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

�d�
�@s6dZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZeZeZee�dkrbeZeZn8ddlmZmZee�dks�t�ee�dks�t�eZeZdZer�eZneZdZeje�ZdZdZdZeeefZej Z dZ!dZ"dZ#d	Z$d
Z%dZ&Gdd
�d
e	�Z'Gdd�de	�Z(eeeeeeee�fe _)efdd�Z*dS)z�
:[diStorm64 1.7.27}:
Copyright RageStorm (C) 2007, Gil Dabah

diStorm is licensed under the BSD license.
http://ragestorm.net/distorm/
---
Python binding of diStorm64 library written by Victor Stinner
�)�cdll�c_long�c_ulong�c_int�c_uint�c_char�POINTER�	Structure�	addressof�byref�c_void_p�create_string_buffer�sizeof�cast�)�
c_longlong�c_ulonglongTzlibdistorm64.so����d�<c@s(eZdZdefdeeffZdd�ZdS)�_WString�pos�pcCs|jS)N)r)�self�r�9/tmp/pip-build-in2aja_b/python-ptrace/ptrace/pydistorm.py�__str__8sz_WString.__str__N)�__name__�
__module__�__qualname__rr�
MAX_TEXT_SIZE�_fields_rrrrrr2src@s6eZdZdefdefdefdefdeffZdd�ZdS)	�_DecodedInst�mnemonic�operandsZinstructionHex�size�offsetcCsd|j|jfS)Nz%s %s)r%r&)rrrrrFsz_DecodedInst.__str__N)rr r!rr�_OffsetTyper#rrrrrr$=s
r$c
	cst|t�std��t|t�s0tdt|�jf��|tkr@td��t|�}t	�}tt
t�t�}t
|�}t|�}x�|�rt|||||tt|��}|tkr�td��|j}|tkr�|r�t��|s�Pd}	t|tt��}
x(t|�D]}|
|}|	|j7}	|Vq�W||	7}||	7}||	8}qpWdS)z@
    Errors: TypeError, IndexError, MemoryError, ValueError
    z codeOffset have to be an integerzcode have to be a bytes, not %szHDecoding-type must be either Decode16Bits, Decode32Bits or Decode64Bits.zInvalid argumentrN)�
isinstance�int�	TypeError�bytes�typer�DECODERS�
IndexErrorr
rrr$�MAX_INSTRUCTIONS�lenr
�internal_decoder�DECRES_INPUTERR�
ValueError�value�DECRES_MEMORYERR�MemoryErrorrr�ranger')
Z
codeOffset�code�dtZcode_bufferZdecodedInstructionsCount�resultZcodeLen�res�countr'Zinstr_array�indexZinstrrrr�DecodeNs@



r@N)+�__doc__�ctypesrrrrrrrr	r
rrr
rrZint32_tZuint32_tZint64_tZuint64_trr�AssertionErrorZSUPPORT_64BIT_OFFSETr)ZLIB_FILENAME�LoadLibraryZdistormZDecode16BitsZDecode32BitsZDecode64Bitsr/r3ZDECRES_NONEZDECRES_SUCCESSr7r4r1r"rr$�argtypesr@rrrr�<module>	sB@