| Current File : //proc/self/root/usr/local/lib/python3.6/site-packages/ptrace/__pycache__/disasm.cpython-36.pyc |
3
�d� � @ s d Z y�ddlmZmZ yHddlmZ er:ddlmZ dZnerPddlm Z dZne
d��d ZW nX e
k
r� d
ZddlmZ er�ddlmZ dZner�ddlm Z dZne
d��Y nX ddl
mZ G dd
� d
e�Zddd�Zddd�Zd ZW n e
efk
�r d
ZY nX dS )z9
Disassembler: only enabled if HAS_DISASSEMBLER is True.
� )�CPU_I386�
CPU_X86_64)�Decode)�Decode64Bits� )�Decode32Bits� zCPU not supportedTF)�PtraceErrorc @ s e Zd ZdZdd� Zdd� ZdS )�Instructiona�
A CPU instruction.
Attributes:
- address (int): address of the instruction
- size (int): size of the instruction in bytes
- mnemonic (str): name of the instruction
- operands (str): string describing the operands
- hexa (str): bytes of the instruction as an hexadecimal string
- text (str): string representing the whole instruction
c C sL t r|\| _| _| _| _n.|j| _|j| _t|j�| _d|j|j f | _d S )Nz%s %s)
�DISTORM3�address�size�textZhexa�offset�strZinstructionHexZmnemonicZoperands)�self�instr� r �6/tmp/pip-build-in2aja_b/python-ptrace/ptrace/disasm.py�__init__, s zInstruction.__init__c C s | j S )N)r )r r r r �__str__5 s zInstruction.__str__N)�__name__�
__module__�__qualname__�__doc__r r r r r r r
s r
� c c s$ xt || t�D ]}t|�V qW dS )zw
Disassemble the specified byte string, where address is the
address of the first instruction.
N)r �
DecodeBitsr
)�coder r r r r �disassemble8 s r c C s&