libdebug.interfaces package#
Submodules#
libdebug.interfaces.debugging_interface module#
- class libdebug.interfaces.debugging_interface.DebuggingInterface[source]#
Bases:
ABC
The interface used by _InternalDebugger to communicate with the available debugging backends, such as ptrace or gdb.
- abstract attach(pid: int) None [source]#
Attaches to the specified process.
- Parameters:
pid (int) – the pid of the process to attach to.
- abstract step(thread: ThreadContext) None [source]#
Executes a single instruction of the specified thread.
- Parameters:
thread (ThreadContext) – The thread to step.
- abstract step_until(thread: ThreadContext, address: int, max_steps: int) None [source]#
Executes instructions of the specified thread until the specified address is reached.
- Parameters:
thread (ThreadContext) – The thread to step.
address (int) – The address to reach.
max_steps (int) – The maximum number of steps to execute.
- abstract finish(thread: ThreadContext, heuristic: str) None [source]#
Continues execution until the current function returns or the process stops.
The command requires a heuristic to determine the end of the function. The available heuristics are: - backtrace: The debugger will place a breakpoint on the saved return address found on the stack and continue execution on all threads. - step-mode: The debugger will step on the specified thread until the current function returns. This will be slower.
- Parameters:
thread (ThreadContext) – The thread to finish.
heuristic (str, optional) – The heuristic to use. Defaults to “backtrace”.
- abstract set_breakpoint(bp: Breakpoint) None [source]#
Sets a breakpoint at the specified address.
- Parameters:
bp (Breakpoint) – The breakpoint to set.
- abstract unset_breakpoint(bp: Breakpoint) None [source]#
Restores the original instruction flow at the specified address.
- Parameters:
bp (Breakpoint) – The breakpoint to restore.
- abstract set_syscall_hook(hook: SyscallHook) None [source]#
Sets a syscall hook.
- Parameters:
hook (SyscallHook) – The syscall hook to set.
- abstract unset_syscall_hook(hook: SyscallHook) None [source]#
Unsets a syscall hook.
- Parameters:
hook (SyscallHook) – The syscall hook to unset.
- abstract set_signal_hook(hook: SignalHook) None [source]#
Sets a signal hook.
- Parameters:
hook (SignalHook) – The signal hook to set.
- abstract unset_signal_hook(hook: SignalHook) None [source]#
Unsets a signal hook.
- Parameters:
hook (SignalHook) – The signal hook to unset.
libdebug.interfaces.interface_helper module#
- libdebug.interfaces.interface_helper.provide_debugging_interface(interface: AvailableInterfaces = AvailableInterfaces.PTRACE) DebuggingInterface [source]#
Returns an instance of the debugging interface to be used by the _InternalDebugger class.