libdebug.architectures package#

Subpackages#

Submodules#

libdebug.architectures.ptrace_hardware_breakpoint_manager module#

class libdebug.architectures.ptrace_hardware_breakpoint_manager.PtraceHardwareBreakpointManager(thread: ThreadContext, peek_user: Callable[[int, int], int], poke_user: Callable[[int, int, int], None])[source]#

Bases: ABC

An architecture-independent interface for managing hardware breakpoints.

thread#

The target thread.

Type:

ThreadContext

peek_user#

A function that reads a number of bytes from the target thread registers.

Type:

callable

poke_user#

A function that writes a number of bytes to the target thread registers.

Type:

callable

breakpoint_count#

The number of hardware breakpoints set.

Type:

int

abstract install_breakpoint(bp: Breakpoint) None[source]#

Installs a hardware breakpoint at the provided location.

abstract remove_breakpoint(bp: Breakpoint) None[source]#

Removes a hardware breakpoint at the provided location.

abstract available_breakpoints() int[source]#

Returns the number of available hardware breakpoint registers.

abstract is_watchpoint_hit() Breakpoint | None[source]#

Checks if a watchpoint has been hit.

Returns:

The watchpoint that has been hit, or None if no watchpoint has been hit.

Return type:

Breakpoint | None

libdebug.architectures.ptrace_hardware_breakpoint_provider module#

libdebug.architectures.ptrace_hardware_breakpoint_provider.ptrace_hardware_breakpoint_manager_provider(thread: ThreadContext, peek_user: Callable[[int, int], int], poke_user: Callable[[int, int, int], None]) PtraceHardwareBreakpointManager[source]#

Returns an instance of the hardware breakpoint manager to be used by the _InternalDebugger class.

libdebug.architectures.ptrace_software_breakpoint_patcher module#

libdebug.architectures.ptrace_software_breakpoint_patcher.software_breakpoint_byte_size() int[source]#

Return the size of a software breakpoint instruction.

libdebug.architectures.register_helper module#

libdebug.architectures.register_helper.register_holder_provider(register_file: object, _: Callable[[], object] | None = None, __: Callable[[object], None] | None = None) RegisterHolder[source]#

Returns an instance of the register holder to be used by the _InternalDebugger class.

libdebug.architectures.stack_unwinding_manager module#

class libdebug.architectures.stack_unwinding_manager.StackUnwindingManager[source]#

Bases: ABC

An architecture-independent interface for stack unwinding.

abstract unwind(target: ThreadContext) list[source]#

Unwind the stack of the target process.

abstract get_return_address(target: ThreadContext) int[source]#

Get the return address of the current function.

libdebug.architectures.stack_unwinding_provider module#

libdebug.architectures.stack_unwinding_provider.stack_unwinding_provider() StackUnwindingManager[source]#

Returns an instance of the stack unwinding provider to be used by the _InternalDebugger class.

libdebug.architectures.syscall_hijacking_manager module#

class libdebug.architectures.syscall_hijacking_manager.SyscallHijackingManager[source]#

Bases: ABC

An architecture-independent interface for syscall hijacking.

abstract create_hijacker(new_syscall: int, **kwargs: int) Callable[[ThreadContext, int], None][source]#

Create a new hijacker for the given syscall.

libdebug.architectures.syscall_hijacking_provider module#

libdebug.architectures.syscall_hijacking_provider.syscall_hijacking_provider() SyscallHijackingManager[source]#

Returns an instance of the syscall hijacking provider to be used by the _InternalDebugger class.

Module contents#