Skip to content

gdb ¤

Modules:

  • debug_sym
  • symbol

    Looking up addresses for function names / symbols, and

Classes:

Functions:

  • parse_and_eval

    Same as gdb.parse_and_eval, but only uses global_context if it is

Attributes:

T module-attribute ¤

T = TypeVar('T')

gdb_architecture_name_fixup_list module-attribute ¤

gdb_architecture_name_fixup_list = (
    "x86-64",
    "i386",
    "i8086",
    "aarch64",
    "mips",
    "rs6000",
    "powerpc",
    "sparc",
    "arm",
    "iwmmxt",
    "iwmmxt2",
    "xscale",
    "riscv:rv32",
    "riscv:rv64",
    "riscv",
    "loongarch64",
    "s390:64-bit",
)

gdb_mips_to_arch_attribute_map module-attribute ¤

gdb_mips_to_arch_attribute_map = {
    "mips5": MIPS_ISA_5,
    "micromips": MIPS_ISA_MICRO,
    "isa32": MIPS_ISA_32,
    "isa32r2": MIPS_ISA_32R2,
    "isa32r3": MIPS_ISA_32R3,
    "isa32r5": MIPS_ISA_32R5,
    "isa32r6": MIPS_ISA_32R6,
    "isa64": MIPS_ISA_64,
    "isa64r2": MIPS_ISA_64R2,
    "isa64r3": MIPS_ISA_64R3,
    "isa64r5": MIPS_ISA_64R5,
    "isa64r6": MIPS_ISA_64R6,
}

BPWP_DEFERRED_DELETE module-attribute ¤

BPWP_DEFERRED_DELETE: Set[GDBStopPoint] = set()

BPWP_DEFERRED_ENABLE module-attribute ¤

BPWP_DEFERRED_ENABLE: Set[GDBStopPoint] = set()

BPWP_DEFERRED_DISABLE module-attribute ¤

BPWP_DEFERRED_DISABLE: Set[GDBStopPoint] = set()

EXECUTION_CONTROLLER module-attribute ¤

EXECUTION_CONTROLLER = GDBExecutionController()

GDBRegisters ¤

GDBRegisters(frame: GDBFrame)

Bases: Registers

Methods:

Attributes:

frame instance-attribute ¤

frame = frame

by_name ¤

by_name(name: str) -> Value | None

GDBFrame ¤

GDBFrame(inner: Frame)

Bases: Frame

Methods:

Attributes:

inner instance-attribute ¤

inner = inner

lookup_symbol ¤

lookup_symbol(name: str, *, type: SymbolLookupType = ANY) -> Value | None

evaluate_expression ¤

evaluate_expression(expression: str, lock_scheduler: bool = False) -> Value

regs ¤

regs() -> Registers

reg_write ¤

reg_write(name: str, val: int) -> bool

pc ¤

pc() -> int

sp ¤

sp() -> int

parent ¤

parent() -> Frame | None

child ¤

child() -> Frame | None

sal ¤

sal() -> tuple[str, int] | None

__eq__ ¤

__eq__(rhs: object) -> bool

GDBThread ¤

GDBThread(inner: InferiorThread)

Bases: Thread

Methods:

Attributes:

inner instance-attribute ¤

inner = inner

bottom_frame ¤

bottom_frame() -> Iterator[Frame]

ptid ¤

ptid() -> int | None

index ¤

index() -> int

GDBMemoryMap ¤

GDBMemoryMap(qemu: bool, pages: Sequence[Page])

Bases: MemoryMap

Methods:

Attributes:

qemu instance-attribute ¤

qemu = qemu

pages instance-attribute ¤

pages = pages

is_qemu ¤

is_qemu() -> bool

ranges ¤

ranges() -> Sequence[Page]

BreakpointAdapter ¤

Bases: Breakpoint

Methods:

Attributes:

stop_handler instance-attribute ¤

stop_handler: Callable[[], bool]

stop ¤

stop() -> bool

GDBStopPoint ¤

GDBStopPoint(inner: Breakpoint, proc: GDBProcess)

Bases: StopPoint

Methods:

Attributes:

inner instance-attribute ¤

inner: Breakpoint = inner

proc instance-attribute ¤

proc: GDBProcess = proc

inner_stop instance-attribute ¤

inner_stop: Callable[[], bool] | None = None

set_enabled ¤

set_enabled(enabled: bool) -> None

remove ¤

remove() -> None

__enter__ ¤

__enter__() -> StopPoint

__exit__ ¤

__exit__(exc_type, exc_value, traceback) -> None

Automatic breakpoint removal.

GDBProcess ¤

GDBProcess(inner: Inferior)

Bases: Process

Methods:

Attributes:

inner instance-attribute ¤

inner = inner

in_bpwp_stop_handler instance-attribute ¤

in_bpwp_stop_handler: bool = False

threads ¤

threads() -> list[Thread]

pid ¤

pid() -> int | None

alive ¤

alive() -> bool

stopped_with_signal ¤

stopped_with_signal() -> bool

evaluate_expression ¤

evaluate_expression(expression: str) -> Value

vmmap ¤

vmmap() -> MemoryMap

read_memory ¤

read_memory(address: int, size: int, partial: bool = False) -> bytearray

write_memory ¤

write_memory(address: int, data: bytearray, partial: bool = False) -> int

find_in_memory ¤

find_in_memory(
    pattern: bytearray,
    start: int,
    size: int,
    align: int,
    max_matches: int = -1,
    step: int = -1,
) -> Generator[int, None, None]

is_remote ¤

is_remote() -> bool

send_remote ¤

send_remote(packet: str) -> bytes

send_monitor ¤

send_monitor(cmd: str) -> str

download_remote_file ¤

download_remote_file(remote_path: str, local_path: str) -> None

create_value ¤

create_value(value: int, type: Type | None = None) -> Value

symbol_name_at_address ¤

symbol_name_at_address(address: int) -> str | None

lookup_symbol ¤

lookup_symbol(
    name: str,
    *,
    prefer_static: bool = False,
    type: SymbolLookupType = ANY,
    objfile_endswith: str | None = None,
) -> Value | None

types_with_name ¤

types_with_name(name: str) -> Sequence[Type]

arch ¤

arch() -> ArchDefinition

break_at ¤

break_at(
    location: BreakpointLocation | WatchpointLocation,
    stop_handler: Callable[[StopPoint], bool] | None = None,
    internal: bool = False,
) -> StopPoint

is_linux ¤

is_linux() -> bool

disasm ¤

disasm(address: int) -> DisassembledInstruction | None

module_section_locations ¤

module_section_locations() -> list[tuple[int, int, str, str]]

main_module_name ¤

main_module_name() -> str | None

main_module_entry ¤

main_module_entry() -> int | None

is_dynamically_linked ¤

is_dynamically_linked() -> bool

dispatch_execution_controller ¤

dispatch_execution_controller(
    procedure: Callable[[ExecutionController], Coroutine[Any, Any, None]],
)

GDBExecutionController ¤

Bases: ExecutionController

Methods:

single_step async ¤

single_step()

cont async ¤

cont(until: StopPoint)

GDBCommand ¤

GDBCommand(
    debugger: GDB,
    name: str,
    handler: Callable[[Debugger, str, bool], None],
    doc: str | None,
)

Bases: Command

Methods:

Attributes:

debugger instance-attribute ¤

debugger = debugger

handler instance-attribute ¤

handler = handler

__doc__ instance-attribute ¤

__doc__ = doc

invoke ¤

invoke(args: str, from_tty: bool) -> None

GDBCommandHandle ¤

GDBCommandHandle(command: Command)

Bases: CommandHandle

Methods:

Attributes:

command instance-attribute ¤

command = command

remove ¤

remove() -> None

GDBType ¤

GDBType(inner: Type)

Bases: Type

Methods:

Attributes:

CODE_MAPPING class-attribute instance-attribute ¤

CODE_MAPPING = {
    TYPE_CODE_BOOL: BOOL,
    TYPE_CODE_INT: INT,
    TYPE_CODE_UNION: UNION,
    TYPE_CODE_STRUCT: STRUCT,
    TYPE_CODE_ENUM: ENUM,
    TYPE_CODE_TYPEDEF: TYPEDEF,
    TYPE_CODE_PTR: POINTER,
    TYPE_CODE_ARRAY: ARRAY,
    TYPE_CODE_FUNC: FUNC,
    TYPE_CODE_METHOD: FUNC,
}

inner instance-attribute ¤

inner = inner

name_identifier property ¤

name_identifier: str | None

name_to_human_readable property ¤

name_to_human_readable: str

sizeof property ¤

sizeof: int

alignof property ¤

alignof: int

code property ¤

code: TypeCode

__eq__ ¤

__eq__(rhs: object) -> bool

func_arguments ¤

func_arguments() -> list[Type] | None

fields ¤

fields() -> list[TypeField]

has_field ¤

has_field(name: str) -> bool

array ¤

array(count: int) -> Type

pointer ¤

pointer() -> Type

strip_typedefs ¤

strip_typedefs() -> Type

target ¤

target() -> Type

keys ¤

keys() -> list[str]

offsetof ¤

offsetof(field_name: str) -> int | None

enum_member ¤

enum_member(field_name: str) -> int | None

Retrieve the integer value of an enum member.

It returns: - integer value, when found field - returns None, If the field does not exist

GDBValue ¤

GDBValue(inner: Value)

Bases: Value

Methods:

Attributes:

inner instance-attribute ¤

inner = inner

address property ¤

address: Value | None

is_optimized_out property ¤

is_optimized_out: bool

type property ¤

type: Type

dereference ¤

dereference() -> Value

string ¤

string() -> str

value_to_human_readable ¤

value_to_human_readable() -> str

fetch_lazy ¤

fetch_lazy() -> None

__int__ ¤

__int__() -> int

cast ¤

cast(type: Type | Any) -> Value

__add__ ¤

__add__(rhs: int) -> Value

__sub__ ¤

__sub__(rhs: int) -> Value

__getitem__ ¤

__getitem__(key: str | int) -> Value

__len__ ¤

__len__()

GDB ¤

Bases: Debugger

Methods:

Attributes:

pre_ctx_lines property ¤

pre_ctx_lines: int

setup ¤

setup()

add_command ¤

add_command(
    name: str, handler: Callable[[Debugger, str, bool], None], doc: str | None
) -> CommandHandle

history ¤

history(last: int = 10) -> list[tuple[int, str]]

lex_args ¤

lex_args(command_line: str) -> list[str]

selected_thread ¤

selected_thread() -> Thread | None

selected_frame ¤

selected_frame() -> Frame | None

commands ¤

commands()

selected_inferior ¤

selected_inferior() -> Process | None

is_gdblib_available ¤

is_gdblib_available()

has_event_type ¤

has_event_type(ty: EventType) -> bool

event_handler ¤

event_handler(
    ty: EventType,
) -> Callable[[Callable[..., T]], Callable[..., T]]

suspend_events ¤

suspend_events(ty: EventType) -> None

resume_events ¤

resume_events(ty: EventType) -> None

set_sysroot ¤

set_sysroot(sysroot: str) -> bool

supports_breakpoint_creation_during_stop_handler ¤

supports_breakpoint_creation_during_stop_handler() -> bool

breakpoint_locations ¤

breakpoint_locations() -> list[BreakpointLocation]

name ¤

name() -> DebuggerType

x86_disassembly_flavor ¤

x86_disassembly_flavor() -> Literal['att', 'intel']

string_limit ¤

string_limit() -> int

addrsz ¤

addrsz(address: Any) -> str

get_cmd_window_size ¤

get_cmd_window_size() -> tuple[int | None, int | None]

Get the size of the command window.

GDB keeps these parameters up to date with the actual window size of the command output. This is the full terminal size in CLI mode or the size of the cmd window in TUI mode.

When the window size is set to be unlimited (0), the parameter is None.

set_python_diagnostics ¤

set_python_diagnostics(enabled: bool) -> None

parse_and_eval ¤

parse_and_eval(expression: str, global_context: bool) -> Value

Same as gdb.parse_and_eval, but only uses global_context if it is supported by the current version of GDB.

global_context was introduced in GDB 14.