Current File : //usr/local/lib/python3.6/site-packages/ptrace/debugger/__pycache__/breakpoint.cpython-36.pyc
3

�d��@s`ddlmZddlmZddlmZddlmZddlm	Z	m
Z
ddlmZGdd�de�Z
d	S)
�)�
formatAddress)�PtraceError)�info)�ref)�CPU_POWERPC�
CPU_WORD_SIZE)�
word2bytesc@s4eZdZdZddd�Zd
dd�Zdd	�Zd
d�ZdS)�
Breakpointzf
    Software breakpoint.

    Use desinstall() method to remove the breakpoint from the process.
    NcCsxd|_t|�|_||_tr t}n|dkr,d}||_td|�|j||�|_	trZt
d�}nd|}|j||�d|_dS)NF�z
Install %si���T)�
_installedr�process�addressrr�sizerZ	readBytes�	old_bytesr�
writeBytes)�selfr
rrZ	new_bytes�r�C/tmp/pip-build-in2aja_b/python-ptrace/ptrace/debugger/breakpoint.py�__init__s

zBreakpoint.__init__FcCs`|js
dSd|_td|�|j�}|s,dS|jrB|j|j|j�|rR|j|j�|j|�dS)z�
        Remove the breakpoint from the associated process. If set_ip is True,
        restore the instruction pointer to the address of the breakpoint.
        NFz
Desinstall %s)	rrr
ZrunningrrrZsetInstrPointerZremoveBreakpoint)rZset_ipr
rrr�
desinstall'szBreakpoint.desinstallcCs"dt|j�t|j|jd�fS)Nz<Breakpoint %s..%s>r
)rrr)rrrr�__str__9szBreakpoint.__str__cCs(y|jd�Wntk
r"YnXdS)NF)rr)rrrr�__del__>szBreakpoint.__del__)N)F)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr		s


r	N)Zptrace.ctypes_toolsrZptracer�loggingr�weakrefrZptrace.cpu_inforrr�objectr	rrrr�<module>s