| Current File : //usr/local/lib/python3.6/site-packages/ptrace/debugger/__pycache__/breakpoint.cpython-36.pyc |
3
�d� � @ s` d dl mZ d dlmZ d dlmZ d dlmZ d dlm Z m
Z
d dl mZ G dd� de�Z
d S )
� )�
formatAddress)�PtraceError)�info)�ref)�CPU_POWERPC�
CPU_WORD_SIZE)�
word2bytesc @ s4 e Zd ZdZddd�Zd
dd�Zdd � Zd
d� ZdS )�
Breakpointzf
Software breakpoint.
Use desinstall() method to remove the breakpoint from the process.
Nc C sx d| _ t|�| _|| _tr t}n|d kr,d}|| _td| � |j||�| _ trZt
d�}nd| }|j||� d| _ d S )NF� z
Install %si �� �T)�
_installedr �process�addressr r �sizer Z readBytes� old_bytesr �
writeBytes)�selfr
r r Z new_bytes� r �C/tmp/pip-build-in2aja_b/python-ptrace/ptrace/debugger/breakpoint.py�__init__ s
zBreakpoint.__init__Fc C s` | j s
dS d| _ 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 r r
Zrunningr r r ZsetInstrPointerZremoveBreakpoint)r Zset_ipr
r r r �
desinstall'