module documentation

Pink's low level wrappers around ptrace(2) internals

Function me No summary
Function resume Restarts the stopped child process.
Function kill Send signal to the tracee
Function singlestep Restarts the stopped child process and arranges it to be stopped after execution of a single instruction.
Function syscall Restarts the stopped child process and arranges it to be stopped after the entry or exit of the next system call.
Function geteventmsg No summary
Function setup Sets the tracing options.
Function sysemu Restarts the stopped child process and arranges it to be stopped after the entry of the next system call which will *not* be executed.
Function sysemu_singlestep Restarts the stopped child process like pinktrace.trace.sysemu() but also singlesteps if not a system call.
Function attach No summary
Function detach Restarts the stopped child as for pinktrace.trace.resume(), but first detaches from the process, undoing the reparenting effect of pinktrace.trace.attach().
Function seize Attach to the process specified in pid, without trapping it or affecting its signal and job control states.
Function interrupt Trap the process without any signal or job control related side effects.
Function listen Listen for ptrace events asynchronously after pink_trace_interrupt()
def me():

Indicates that this process is to be traced by its parent. Any signal (except SIGKILL) delivered to this process will cause it to stop and its parent to be notified via wait(2). Also, all subsequent calls to execve(2) by this process will cause a SIGTRAP to be sent to it, giving the parent a chance to gain control before the new program begins execution.

RaisesOSErrorRaised when the underlying ptrace(2) call fails.@return: True
def resume():

Restarts the stopped child process.

ParameterspidProcess ID
sigIf this is non-zero and not SIGSTOP, it is interpreted as the signal to be delivered to the child; otherwise, no signal is delivered. Thus, for example, the parent can control whether a signal sent to the child is delivered or not. (Optional, defaults to 0)
ReturnsTrue
RaisesValueErrorRaised when the signal number is invalid.
OSErrorRaised when the underlying ptrace(2) call fails.
def kill():
def singlestep():

Restarts the stopped child process and arranges it to be stopped after execution of a single instruction.

ParameterspidProcess ID
sigTreated the same as the signal argument of pinktrace.trace.resume()
RaisesValueErrorRaised when the signal number is invalid.
OSErrorRaised when the underlying ptrace(2) call fails.
See Alsopinktrace.trace.resume
def syscall():

Restarts the stopped child process and arranges it to be stopped after the entry or exit of the next system call.

ParameterspidProcess ID
sigTreated the same as the signal argument of pinktrace.trace.resume()
RaisesValueErrorRaised when the signal number is invalid.
OSErrorRaised when the underlying ptrace(2) call fails.
See Alsopinktrace.trace.resume
def geteventmsg():

Retrieve a message (as an unsigned long) about the trace event that just happened, placing it in the location given by the second argument. For EXIT event this is the child's exit status. For FORK, VFORK, CLONE and VFORK_DONE events this is the process ID of the new process. For SECCOMP event, this is the SECCOMP_RET_DATA portion of the BPF program return value.

@note This function is supported on Linux-2.5.46 and newer. @see pinktrace.system.HAVE_GETEVENTMSG

ParameterspidProcess ID
ReturnsThe event message@rtype: long
RaisesOSErrorRaised when the underlying ptrace(2) call fails.
SystemErrorRaised if the underlying ptrace(2) call is not supported by the host system
def setup():

Sets the tracing options.

@note This function is supported on Linux-2.4.6 and newer. @see pinktrace.system.HAVE_SETUP

ParameterspidProcess ID
optionsBitwise OR'ed pinktrace.trace.OPTION_* flags
RaisesOSErrorRaised when the underlying ptrace(2) call fails.
SystemErrorRaised if the underlying ptrace(2) call is not supported by the host system @return True
def sysemu():

Restarts the stopped child process and arranges it to be stopped after the entry of the next system call which will *not* be executed.

@note This function is supported on Linux-2.6.14 and newer. @see pinktrace.system.HAVE_SYSEMU

ParameterssigTreated the same as the signal argument of pinktrace.trace.resume()
RaisesValueErrorRaised when the signal number is invalid.
OSErrorRaised when the underlying ptrace(2) call fails.
SystemErrorRaised if the underlying ptrace(2) call is not supported by the host system @return True
See Alsopinktrace.trace.resume@param pid: Process ID
def sysemu_singlestep():

Restarts the stopped child process like pinktrace.trace.sysemu() but also singlesteps if not a system call.

@note This function is supported on Linux-2.6.14 and newer. @see pinktrace.system.HAVE_SYSEMU

ParameterssigTreated the same as the signal argument of pinktrace.trace.resume()
RaisesValueErrorRaised when the signal number is invalid.
OSErrorRaised when the underlying ptrace(2) call fails.
SystemErrorRaised if the underlying ptrace(2) call is not supported by the host system @return True
See Alsopinktrace.trace.resume@param pid: Process ID
def attach():

Attaches to the process specified in pid, making it a traced "child" of the calling process; the behaviour of the child is as if it had done a pinktrace.trace.me(). The child is sent a SIGSTOP, but will not necessarily have stopped by the completion of this call; use wait(2) to wait for the child to stop.

ParameterspidProcess ID
RaisesOSErrorRaised when the underlying ptrace(2) call fails.
def detach():

Restarts the stopped child as for pinktrace.trace.resume(), but first detaches from the process, undoing the reparenting effect of pinktrace.trace.attach().

ParameterspidProcess ID
sigTreated the same as the signal argument of pinktrace.trace.resume()
RaisesValueErrorRaised when the signal number is invalid.
OSErrorRaised when the underlying ptrace(2) call fails.
See Alsopinktrace.trace.resume
def seize():

Attach to the process specified in pid, without trapping it or affecting its signal and job control states.

@note This function is supported on Linux-3.4 and newer. @see pinktrace.system.HAVE_SEIZE

ParameterspidProcess ID
optionsBitwise OR'ed pinktrace.trace.OPTION_* flags
RaisesValueErrorRaised when the signal number is invalid.
OSErrorRaised when the underlying ptrace(2) call fails.
SystemErrorRaised if the underlying ptrace(2) call is not supported by the host system @return True
See Alsopinktrace.trace.setup
def interrupt():

Trap the process without any signal or job control related side effects.

@note This function is supported on Linux-3.4 and newer. @see pinktrace.system.HAVE_INTERRUPT

ParameterspidProcess ID
RaisesOSErrorRaised when the underlying ptrace(2) call fails.
SystemErrorRaised if the underlying ptrace(2) call is not supported by the host system @return True
def listen():

Listen for ptrace events asynchronously after pink_trace_interrupt()

@note This function is supported on Linux-3.4 and newer. @see pinktrace.system.HAVE_LISTEN

ParameterspidProcess ID
RaisesOSErrorRaised when the underlying ptrace(2) call fails.
SystemErrorRaised if the underlying ptrace(2) call is not supported by the host system @return True
API Documentation for pinktrace, generated by pydoctor 21.2.2 at 2021-06-02 21:17:39.