Current File : //proc/self/root/usr/local/lib/python3.6/site-packages/ptrace/__pycache__/disasm.cpython-36.pyc
3

�d�	�@sdZy�ddlmZmZyHddlmZer:ddlmZdZnerPddlm	ZdZne
d��d	ZWnXe
k
r�d
ZddlmZer�ddlmZdZner�ddlm	ZdZne
d��YnXddl
mZGdd
�d
e�Zddd�Zddd�Zd	ZWne
efk
�rd
ZYnXdS)z9
Disassembler: only enabled if HAS_DISASSEMBLER is True.
�)�CPU_I386�
CPU_X86_64)�Decode)�Decode64Bits�)�Decode32Bits�zCPU not supportedTF)�PtraceErrorc@s eZdZdZdd�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
        cCsLtr|\|_|_|_|_n.|j|_|j|_t|j�|_d|j|j	f|_dS)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__cCs|jS)N)r)rrrr�__str__5szInstruction.__str__N)�__name__�
__module__�__qualname__�__doc__rrrrrrr
s	r
�ccs$xt||t�D]}t|�VqWdS)zw
        Disassemble the specified byte string, where address is the
        address of the first instruction.
        N)r�
DecodeBitsr
)�coderrrrr�disassemble8srcCs&xt||�D]}|SWtd|��dS)z�
        Disassemble the first instruction of the byte string, where
        address is the address of the instruction.
        zUnable to disassemble %rN)rr	)rrrrrr�disassembleOne@srN)r)r)rZptrace.cpu_inforrZdistorm3rrrZMAX_INSTR_SIZEr�ImportErrorrZptrace.pydistormZptracer	�objectr
rrZHAS_DISASSEMBLER�OSErrorrrrr�<module>s: