class
Cradare2::DSL::Debugger
- Cradare2::DSL::Debugger
- Reference
- Object
Overview
High-level debugger DSL for controlling execution, breakpoints, registers, memory maps, and crash reports.
Defined in:
cradare2/dsl/debugger.crConstructors
Instance Method Summary
-
#allocate_memory(size : Int32, address : Address | Nil = nil) : self
Allocates a memory region of the given size in the debugged process (dm
). -
#analyze_registers(regs : Model::Registers | Nil = nil) : Cradare2::Analysis::RegisterAnalysis
Performs deep structural analysis on current CPU registers and memory boundaries.
-
#attach(pid : Int32) : self
Attaches to a running process by PID.
-
#attachable_processes : Array(Model::ProcessInfo)
Returns a list of attachable / running system processes (dplj).
-
#backtrace : Array(Model::StackFrame)
Returns the call stack / backtrace frames (dbtj).
-
#backtrace_symbols : Array(String)
Returns list of demangled backtrace function symbols.
-
#base_address_of(module_name : String) : UInt64 | Nil
Returns the base load address of a specific loaded module by name (e.g.
-
#breakpoint(target : Address) : self
Sets a software breakpoint at the given address or symbol (db).
-
#breakpoint_at?(target : Address) : Bool
Checks whether a breakpoint is active at the specified address.
-
#breakpoint_at_source(file : String, line : Int32) : self
Sets a breakpoint at a source code file and line number.
-
#breakpoints : Array(Model::Breakpoint)
Returns list of active breakpoints as typed models.
-
#classify_memory(address : UInt64) : Cradare2::Analysis::ClassifiedAddress
Classifies an arbitrary pointer against the debugged process memory maps.
-
#clear_breakpoints : self
Removes all breakpoints and watchpoints (db-*).
-
#conditional_breakpoint(target : Address, condition : String) : self
Sets a software breakpoint with an associated condition expression.
-
#continue : self
Continues execution of the debugged process (dc).
-
#continue_back : self
Continues execution back / reverse continue until hitting a breakpoint (dcb).
-
#continue_until(address : Address) : self
Continues execution until reaching the specified target address (dcu).
-
#continue_until_call : self
Continues execution until the next call instruction (dcc).
-
#continue_until_ret : self
Continues execution until returning from the current function (dcr).
-
#continue_until_syscall : self
Continues execution until the next system call (dcs).
-
#crash_report(regs : Model::Registers | Nil = nil, bt : Array(Model::StackFrame) | Nil = nil) : String
Generates a detailed, demangled native crash diagnostic report.
-
#current_thread : Model::Thread | Nil
Returns the currently selected thread in the debugger.
-
#current_thread_id : Int32 | Nil
Returns the currently active thread ID (dpt.).
-
#deallocate_memory(target : Address) : self
Deallocates a memory region at the given address in the debugged process (dm-
). -
#detach : self
Detaches from current process.
-
#diagnose_crash(regs : Model::Registers | Nil = nil, bt : Array(Model::StackFrame) | Nil = nil) : Model::CrashDiagnosis
Generates a structured crash diagnosis with root-cause pattern analysis and remediation steps.
-
#diff_registers(baseline : Model::Registers) : Hash(String, Tuple(UInt64, UInt64))
Compares current CPU registers against a baseline Registers snapshot.
-
#disable_all_breakpoints : self
Disables all breakpoints in the session (dbd*).
-
#disable_breakpoint(target : Address) : self
Disables a breakpoint at the specified target without deleting it (dbd).
-
#dump_memory_region(path : String) : self
Dumps a debug memory region to a file on disk (dmd).
-
#enable_all_breakpoints : self
Enables all breakpoints in the session (dbe*).
-
#enable_breakpoint(target : Address) : self
Enables a breakpoint at the specified target (dbe).
-
#executable_path : String
Returns the path to the executable of the debugged process (dpe).
-
#find_breakpoint(target : Address) : Model::Breakpoint | Nil
Finds an active breakpoint located at the specified address.
-
#find_stale_vtables(registers_to_scan : Array(String) = ["rcx", "rdi", "rsi", "rbx"], vtable_offset : Int32 = 0) : Array(NamedTuple(register: String, object_address: UInt64, vtable: UInt64, reason: String))
Scans standard object registers (e.g.
-
#finish : self
Alias for step_out.
-
#hardware_breakpoint(target : Address) : self
Sets a hardware execution breakpoint at the given address or symbol (dbH).
-
#hardware_breakpoints : Array(Model::Breakpoint)
Returns only hardware breakpoints.
-
#hw_breakpoint(target : Address) : self
Alias for hardware_breakpoint.
-
#kill : self
Sends SIGKILL or terminates the debugged process.
-
#logpoint(target : Address, command : String) : self
Alias for tracepoint.
-
#maps : Array(Model::MemoryMap)
Returns the loaded memory maps / regions (dmj).
-
#memory_classifier : Cradare2::Analysis::MemoryClassifier
Returns a memory classifier configured with the currently loaded memory maps.
-
#module_at(address : Address) : Model::ModuleInfo | Nil
Returns the loaded binary module containing the specified address, or nil if unmapped.
-
#modules : Array(Model::ModuleInfo)
Returns loaded PE/ELF/Mach-O binary modules in the debugged process (dmmj, with fallback to grouped dmj).
-
#name_breakpoint(target : Address, name : String) : self
Assigns a descriptive name or label to a breakpoint (dbn
@ ). -
#pid : Int32 | Nil
Returns current process ID if debugging.
-
#protect_memory(target : Address, size : Int32, perms : String) : self
Changes memory page protection permissions at target address (dmp
). -
#register(name : String) : UInt64
Reads a single register value by name.
-
#registers : Model::Registers
Returns current CPU registers as a strongly typed
Registersmodel. -
#remove_breakpoint(target : Address) : self
Removes a breakpoint or watchpoint at the given address or symbol (db-).
-
#remove_watchpoint(target : Address) : self
Alias for remove_breakpoint to explicitly remove a watchpoint.
-
#restore_registers : self
Pops / restores register states from the previous snapshot (drs-).
-
#running? : Bool
Checks if the debugged process is currently active/attached.
-
#select_thread(tid : Int32) : self
Attaches or switches focus to a specific thread ID (dpt=
). -
#set_breakpoint_command(target : Address, command : String) : self
Sets a command to execute when hitting a breakpoint (dbc).
-
#set_breakpoint_condition(target : Address, condition : String) : self
Sets an expression condition on a breakpoint (dbx
@ ). -
#set_register(name : String, value : UInt64) : self
Sets a register to a specific value (e.g.
-
#snapshot_registers : self
Pushes / takes a snapshot of current register states (drs+).
-
#software_breakpoints : Array(Model::Breakpoint)
Returns only software execution breakpoints.
-
#stack_words(count : Int32 = 8) : Array(UInt64)
Reads
count64-bit words directly from the current Stack Pointer (SP). -
#stale_vtable?(address : UInt64) : Bool
Checks if an address represents a stale vtable pointer (pointing outside all currently mapped modules).
-
#status : String
Returns debugger execution status text.
-
#step(count : Int32 = 1) : self
Steps one or more machine instructions (ds).
-
#step_back : self
Steps back one machine instruction in reversible debugging (dsb).
-
#step_out : self
Steps until exiting current stack frame / function finish (dsf).
-
#step_over(count : Int32 = 1) : self
Steps over calls or compound instructions (dso).
-
#step_source(lines : Int32 = 1) : self
Steps one or more high-level source lines (dsl).
-
#step_until(address : Address) : self
Continues execution until reaching the specified target address (dsu).
-
#telescope : Array(Model::TelescopeEntry)
Inspects telescoping pointer references for all registers (drrj).
-
#threads : Array(Model::Thread)
Returns active threads in the process (dptj).
-
#toggle_breakpoint(target : Address) : self
Toggles a breakpoint at the target address (dbs).
-
#tracepoint(target : Address, command : String) : self
Sets a tracepoint / logpoint that executes a command upon hit and immediately continues execution without stopping (dbC).
-
#watchpoint(target : Address, access : Symbol = :rw) : self
Sets a memory watchpoint on read ('r'), write ('w'), or read/write ('rw') access (dbw).
-
#watchpoints : Array(Model::Breakpoint)
Returns only memory watchpoints.
Constructor Detail
Instance Method Detail
Allocates a memory region of the given size in the debugged process (dm
Performs deep structural analysis on current CPU registers and memory boundaries.
Returns a list of attachable / running system processes (dplj).
Returns the base load address of a specific loaded module by name (e.g. "game.dll" or "godot.exe").
Sets a software breakpoint at the given address or symbol (db).
Checks whether a breakpoint is active at the specified address.
Sets a breakpoint at a source code file and line number.
If mapped in Crystal/DWARF line metadata, resolves the target address; otherwise falls back to dbl file:line.
Classifies an arbitrary pointer against the debugged process memory maps.
Sets a software breakpoint with an associated condition expression.
Continues execution back / reverse continue until hitting a breakpoint (dcb).
Continues execution until reaching the specified target address (dcu).
Continues execution until returning from the current function (dcr).
Generates a detailed, demangled native crash diagnostic report. Includes crash instruction pointer, active function, faulting memory region, registers dump, and demangled call stack.
Deallocates a memory region at the given address in the debugged process (dm-
Generates a structured crash diagnosis with root-cause pattern analysis and remediation steps.
Compares current CPU registers against a baseline Registers snapshot.
Disables a breakpoint at the specified target without deleting it (dbd).
Enables a breakpoint at the specified target (dbe).
Finds an active breakpoint located at the specified address.
Scans standard object registers (e.g. RCX, RDI, RSI, RBX) to detect objects holding stale vtable pointers pointing outside currently mapped module boundaries (frequent during dynamic plugin / GDExtension hot reloading).
Sets a hardware execution breakpoint at the given address or symbol (dbH).
Returns a memory classifier configured with the currently loaded memory maps.
Returns the loaded binary module containing the specified address, or nil if unmapped.
Returns loaded PE/ELF/Mach-O binary modules in the debugged process (dmmj, with fallback to grouped dmj).
Assigns a descriptive name or label to a breakpoint (dbn
Changes memory page protection permissions at target address (dmp
Returns current CPU registers as a strongly typed Registers model.
Removes a breakpoint or watchpoint at the given address or symbol (db-).
Alias for remove_breakpoint to explicitly remove a watchpoint.
Sets a command to execute when hitting a breakpoint (dbc).
Sets an expression condition on a breakpoint (dbx
Sets a register to a specific value (e.g. set_register("rax", 0x1234)).
Reads count 64-bit words directly from the current Stack Pointer (SP).
Checks if an address represents a stale vtable pointer (pointing outside all currently mapped modules).
Steps over calls or compound instructions (dso).
Steps one or more high-level source lines (dsl).
Continues execution until reaching the specified target address (dsu).
Inspects telescoping pointer references for all registers (drrj).
Toggles a breakpoint at the target address (dbs).
Sets a tracepoint / logpoint that executes a command upon hit and immediately continues execution without stopping (dbC).
Sets a memory watchpoint on read ('r'), write ('w'), or read/write ('rw') access (dbw).