RoboDBG
Loading...
Searching...
No Matches
RoboDBG::Debugger Class Reference

Main Debugger class. More...

#include <debugger.h>

Public Member Functions

 Debugger ()
 Constructs a Debugger with default settings.
 Debugger (bool verbose)
 Constructs a Debugger with verbosity control.
int start (std::string exeName)
 Starts a process under debugging.
int start (std::string exeName, const std::vector< std::string > &args)
 Starts a process under debugging with arguments.
int attach (std::string exeName)
 Attaches to a running process by name.
int detach ()
 Detaches from the current debuggee.
int loop ()
 Main debugger message loop.

Protected Member Functions

virtual void onStart (uintptr_t imageBase, uintptr_t entryPoint)
 Called when a new debuggee process is started.
virtual void onEnd (DWORD exitCode, DWORD pid)
 Called when the debuggee exits.
virtual void onAttach ()
 Called after successfully attaching to an already running process.
virtual void onThreadCreate (HANDLE hThread, DWORD threadId, uintptr_t threadBase, uintptr_t startAddress)
 Called when a thread is created in the debuggee.
virtual void onThreadExit (DWORD threadID)
 Called when a thread exits.
virtual bool onDLLLoad (uintptr_t address, std::string dllName, uintptr_t entryPoint)
 Called when a DLL is loaded.
virtual void onDLLUnload (uintptr_t address, std::string dllName)
 Called when a DLL is unloaded.
virtual BreakpointAction onBreakpoint (uintptr_t address, HANDLE hThread)
 Called on software breakpoint (INT3).
virtual BreakpointAction onHardwareBreakpoint (uintptr_t address, HANDLE hThread, DRReg reg)
 Called on hardware breakpoint hit.
virtual void onSinglestep (uintptr_t address, HANDLE hThread)
 Called on single-step exception.
virtual void onDebugString (std::string dbgString)
 Called when OutputDebugString is emitted by the debuggee.
virtual void onAccessViolation (uintptr_t address, uintptr_t faultingAddress, long accessType)
 Called on access violation (AV).
virtual void onRIPError (const RIP_INFO &rip)
 Called on RIP error (native debug port issues).
virtual void onUnknownException (uintptr_t addr, DWORD code)
 Called on unknown exception.
virtual void onUnknownDebugEvent (DWORD code)
 Called on unhandled/unknown debug events.
void actualizeThreadList ()
 Refreshes the internal thread list by querying the target process.
void setBreakpoint (LPVOID address)
 Sets a software INT3 breakpoint at an address.
DRReg isHardwareBreakpointAt (LPVOID address)
 Checks if a hardware breakpoint exists at an address.
void restoreBreakpoint (LPVOID address)
 Restores the original byte at a software breakpoint address.
bool setHardwareBreakpointOnThread (hwBp_t bp)
 Sets a hardware breakpoint for a specific thread.
bool setHardwareBreakpoint (hwBp_t bp)
 Sets a hardware breakpoint for all existing (and future) threads where applicable.
std::vector< hwBp_tgetHardwareBreakpoints ()
 Enumerates current hardware breakpoints.
void enableSingleStep (HANDLE hThread)
 Enables trap flag (single-step) for a thread.
void decrementIP (HANDLE hThread)
 Moves the instruction pointer one instruction backward (post-breakpoint fixup).
bool clearHardwareBreakpoint (DRReg reg)
 Clears a DRx slot across threads.
bool clearHardwareBreakpointOnThread (HANDLE hThread, DRReg reg)
 Clears a DRx slot on a single thread.
hwBp_t getBreakpointByReg (DRReg reg)
 Gets the breakpoint definition bound to a DRx register.
bool writeMemory (LPVOID address, const void *buffer, SIZE_T size)
 Writes raw bytes to target memory.
bool readMemory (LPVOID address, void *buffer, SIZE_T size)
 Reads raw bytes from target memory.
bool changeMemoryProtection (LPVOID baseAddress, SIZE_T regionSize, DWORD newProtect)
 Changes memory protection on a region.
MemoryRegion_t getPageByAddress (LPVOID baseAddress)
 Gets information for the page containing an address.
std::vector< MemoryRegion_tgetMemoryPages ()
 Enumerates readable/committed pages of the process.
bool changeMemoryProtection (MemoryRegion_t page, DWORD newProtect)
 Changes protection for a specific page descriptor.
std::vector< uintptr_t > searchInMemory (const std::vector< BYTE > &pattern)
 Scans process memory for a byte pattern.
uintptr_t ASLR (LPVOID address)
 Applies the module ASLR slide to an LPVOID.
uintptr_t ASLR (uintptr_t address)
 Applies the module ASLR slide to a uintptr_t.
bool hideDebugger ()
 Attempts to hide the debugger from basic anti-debug checks.
void printIP (HANDLE hThread)
 Prints the current instruction pointer (IP/EIP/RIP) of a thread.
bool getFlag (HANDLE hThread, Flags32 flag)
 Reads a status flag from EFLAGS.
void setFlag (HANDLE hThread, Flags32 flag, bool enabled)
 Sets or clears a status flag in EFLAGS.
int32_t getRegister (HANDLE hThread, Register32 reg)
 Reads a 32-bit general-purpose register.
void setRegister (HANDLE hThread, Register32 reg, int32_t value)
 Writes a 32-bit general-purpose register.
void PrintMemoryPages ()
 Prints a formatted list of memory pages (debug helper).
void setBreakpoint (uintptr_t address)
 Sets a software INT3 breakpoint.
DRReg isHardwareBreakpointAt (uintptr_t address)
 Checks if a hardware breakpoint exists at an address.
MemoryRegion_t getPageByAddress (uintptr_t baseAddress)
 Gets page information for an address.
void restoreBreakpoint (uintptr_t address)
 Restores the original byte at a software breakpoint.
bool setHardwareBreakpointOnThread (HANDLE hThread, LPVOID address, DRReg reg, AccessType type, BreakpointLength len)
 Sets a hardware breakpoint on a specific thread.
bool setHardwareBreakpoint (LPVOID address, DRReg reg, AccessType type, BreakpointLength len)
 Sets a hardware breakpoint process-wide (current/future threads as applicable).
bool setHardwareBreakpoint (int address, DRReg reg, AccessType type, BreakpointLength len)
 Sets a hardware breakpoint using a 32-bit int address (for convenience).
bool changeMemoryProtection (uintptr_t baseAddress, SIZE_T regionSize, DWORD newProtect)
 Changes memory protection on a region (uintptr_t overload).
bool writeMemory (uintptr_t address, const void *buffer, SIZE_T size)
 Writes raw bytes to target memory (uintptr_t overload).
bool readMemory (uintptr_t address, void *buffer, SIZE_T size)
 Reads raw bytes from target memory (uintptr_t overload).
template<typename T>
bool writeMemory (uintptr_t address, const T &value)
 Writes a POD value to target memory (typed helper).
template<typename T>
readMemory (uintptr_t address)
 Reads a POD value from target memory (typed helper).
bool isEqual (LPVOID a, uintptr_t b)
 Compares an LPVOID to a uintptr_t for equality.
HANDLE getProcessHandle ()
 Returns HANDLE of debugged process.

Protected Attributes

uintptr_t baseImageBase = 0x00400000U
 Typical image base (with ASLR).

Detailed Description

Main Debugger class.

Bla

Definition at line 173 of file debugger.h.

Constructor & Destructor Documentation

◆ Debugger()

RoboDBG::Debugger::Debugger ( bool verbose)

Constructs a Debugger with verbosity control.

Parameters
verboseEnable verbose logging if true.

Definition at line 10 of file debugger.cpp.

Member Function Documentation

◆ ASLR() [1/2]

uintptr_t RoboDBG::Debugger::ASLR ( LPVOID address)
protected

Applies the module ASLR slide to an LPVOID.

Parameters
addressUnslid address.
Returns
Slid (runtime) address.

Definition at line 46 of file debugger.cpp.

References baseImageBase.

◆ ASLR() [2/2]

uintptr_t RoboDBG::Debugger::ASLR ( uintptr_t address)
protected

Applies the module ASLR slide to a uintptr_t.

Parameters
addressUnslid address.
Returns
Slid (runtime) address.

Definition at line 50 of file debugger.cpp.

References baseImageBase.

◆ attach()

int RoboDBG::Debugger::attach ( std::string exeName)

Attaches to a running process by name.

Parameters
exeNameProcess image name (e.g., "notepad.exe").
Returns
0 on success; non-zero on failure.

Definition at line 55 of file debugger.cpp.

References RoboDBG::Util::findProcessId(), and onAttach().

◆ changeMemoryProtection() [1/3]

bool RoboDBG::Debugger::changeMemoryProtection ( LPVOID baseAddress,
SIZE_T regionSize,
DWORD newProtect )
protected

Changes memory protection on a region.

Parameters
baseAddressRegion base.
regionSizeRegion length in bytes.
newProtectPAGE_* flags.
Returns
true on success; false otherwise.

Definition at line 60 of file debugger.memory.cpp.

Referenced by changeMemoryProtection(), and changeMemoryProtection().

◆ changeMemoryProtection() [2/3]

bool RoboDBG::Debugger::changeMemoryProtection ( MemoryRegion_t page,
DWORD newProtect )
protected

Changes protection for a specific page descriptor.

Parameters
pagePage descriptor from getMemoryPages().
newProtectPAGE_* flags.
Returns
true on success; false otherwise.

Definition at line 56 of file debugger.memory.cpp.

References RoboDBG::MemoryRegion_t::BaseAddress, changeMemoryProtection(), and RoboDBG::MemoryRegion_t::RegionSize.

◆ changeMemoryProtection() [3/3]

bool RoboDBG::Debugger::changeMemoryProtection ( uintptr_t baseAddress,
SIZE_T regionSize,
DWORD newProtect )
inlineprotected

Changes memory protection on a region (uintptr_t overload).

Parameters
baseAddressRegion base.
regionSizeLength in bytes.
newProtectPAGE_* flags.
Returns
true on success; false otherwise.

Definition at line 636 of file debugger.h.

References changeMemoryProtection().

◆ clearHardwareBreakpoint()

bool RoboDBG::Debugger::clearHardwareBreakpoint ( DRReg reg)
protected

Clears a DRx slot across threads.

Parameters
regRegister to clear (DR0–DR3).
Returns
true on success; false otherwise.

Definition at line 178 of file debugger.breakpoints.cpp.

References actualizeThreadList(), and clearHardwareBreakpointOnThread().

Referenced by loop().

◆ clearHardwareBreakpointOnThread()

bool RoboDBG::Debugger::clearHardwareBreakpointOnThread ( HANDLE hThread,
DRReg reg )
protected

Clears a DRx slot on a single thread.

Parameters
hThreadThread handle.
regRegister to clear (DR0–DR3).
Returns
true on success; false otherwise.

Definition at line 127 of file debugger.breakpoints.cpp.

References RoboDBG::hwBp_t::hThread, and RoboDBG::hwBp_t::reg.

Referenced by clearHardwareBreakpoint(), and loop().

◆ decrementIP()

void RoboDBG::Debugger::decrementIP ( HANDLE hThread)
protected

Moves the instruction pointer one instruction backward (post-breakpoint fixup).

Parameters
hThreadThread handle.

Definition at line 158 of file debugger.cpp.

Referenced by loop().

◆ detach()

int RoboDBG::Debugger::detach ( )

Detaches from the current debuggee.

Returns
0 on success; non-zero on failure.

Definition at line 77 of file debugger.cpp.

◆ enableSingleStep()

void RoboDBG::Debugger::enableSingleStep ( HANDLE hThread)
protected

Enables trap flag (single-step) for a thread.

Parameters
hThreadThread handle.

Definition at line 148 of file debugger.cpp.

Referenced by loop().

◆ getBreakpointByReg()

hwBp_t RoboDBG::Debugger::getBreakpointByReg ( DRReg reg)
protected

Gets the breakpoint definition bound to a DRx register.

Parameters
regRegister (DR0–DR3).
Returns
Hardware breakpoint record.

Definition at line 228 of file debugger.breakpoints.cpp.

Referenced by loop().

◆ getFlag()

bool RoboDBG::Debugger::getFlag ( HANDLE hThread,
Flags32 flag )
protected

Reads a status flag from EFLAGS.

Parameters
hThreadThread handle.
flagFlag to test.
Returns
true if set; false otherwise.

Definition at line 193 of file debugger.registers.cpp.

◆ getHardwareBreakpoints()

std::vector< hwBp_t > RoboDBG::Debugger::getHardwareBreakpoints ( )
protected

Enumerates current hardware breakpoints.

Returns
Vector of active hardware breakpoints.

Definition at line 190 of file debugger.breakpoints.cpp.

◆ getMemoryPages()

std::vector< MemoryRegion_t > RoboDBG::Debugger::getMemoryPages ( )
protected

Enumerates readable/committed pages of the process.

Returns
Vector of memory regions.

Definition at line 78 of file debugger.memory.cpp.

References RoboDBG::MemoryRegion_t::BaseAddress, RoboDBG::MemoryRegion_t::Protect, RoboDBG::MemoryRegion_t::RegionSize, RoboDBG::MemoryRegion_t::State, and RoboDBG::MemoryRegion_t::Type.

Referenced by searchInMemory().

◆ getPageByAddress() [1/2]

MemoryRegion_t RoboDBG::Debugger::getPageByAddress ( LPVOID baseAddress)
protected

Gets information for the page containing an address.

Parameters
baseAddressAddress inside the page.
Returns
Memory region descriptor.

Definition at line 24 of file debugger.memory.cpp.

Referenced by getPageByAddress().

◆ getPageByAddress() [2/2]

MemoryRegion_t RoboDBG::Debugger::getPageByAddress ( uintptr_t baseAddress)
inlineprotected

Gets page information for an address.

Parameters
baseAddressAddress inside the page.
Returns
Memory region descriptor.

Definition at line 577 of file debugger.h.

References getPageByAddress().

◆ getProcessHandle()

HANDLE RoboDBG::Debugger::getProcessHandle ( )
inlineprotected

Returns HANDLE of debugged process.

Returns
HANDLE

Definition at line 709 of file debugger.h.

◆ getRegister()

int32_t RoboDBG::Debugger::getRegister ( HANDLE hThread,
Register32 reg )
protected

Reads a 32-bit general-purpose register.

Parameters
hThreadThread handle.
regRegister selector.
Returns
Register value.

Definition at line 74 of file debugger.registers.cpp.

◆ hideDebugger()

bool RoboDBG::Debugger::hideDebugger ( )
protected

Attempts to hide the debugger from basic anti-debug checks.

Returns
true if hiding steps were applied; false otherwise.

Definition at line 14 of file debugger.cpp.

◆ isEqual()

bool RoboDBG::Debugger::isEqual ( LPVOID a,
uintptr_t b )
inlineprotected

Compares an LPVOID to a uintptr_t for equality.

Parameters
aLeft operand (LPVOID).
bRight operand (uintptr_t).
Returns
true if equal; false otherwise.

Definition at line 701 of file debugger.h.

◆ isHardwareBreakpointAt() [1/2]

DRReg RoboDBG::Debugger::isHardwareBreakpointAt ( LPVOID address)
protected

Checks if a hardware breakpoint exists at an address.

Parameters
addressAddress to probe.
Returns
DR register if present; DRReg::NOP otherwise.

Definition at line 264 of file debugger.breakpoints.cpp.

Referenced by isHardwareBreakpointAt(), and loop().

◆ isHardwareBreakpointAt() [2/2]

DRReg RoboDBG::Debugger::isHardwareBreakpointAt ( uintptr_t address)
inlineprotected

Checks if a hardware breakpoint exists at an address.

Parameters
addressAddress to probe.
Returns
DR register if present; DRReg::NOP otherwise.

Definition at line 568 of file debugger.h.

References isHardwareBreakpointAt().

◆ loop()

◆ onAccessViolation()

void RoboDBG::Debugger::onAccessViolation ( uintptr_t address,
uintptr_t faultingAddress,
long accessType )
protectedvirtual

Called on access violation (AV).

Parameters
addressFaulting instruction address.
faultingAddressMemory address being accessed.
accessTypeAccess type (read/write/execute).

Definition at line 86 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onBreakpoint()

BreakpointAction RoboDBG::Debugger::onBreakpoint ( uintptr_t address,
HANDLE hThread )
protectedvirtual

Called on software breakpoint (INT3).

Parameters
addressAddress of the breakpoint.
hThreadCurrent thread handle.
Returns
Action to take (break, restore, single-step).

Definition at line 32 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onDebugString()

void RoboDBG::Debugger::onDebugString ( std::string dbgString)
protectedvirtual

Called when OutputDebugString is emitted by the debuggee.

Parameters
dbgStringThe debug string payload.

Definition at line 102 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onDLLLoad()

bool RoboDBG::Debugger::onDLLLoad ( uintptr_t address,
std::string dllName,
uintptr_t entryPoint )
protectedvirtual

Called when a DLL is loaded.

Parameters
addressBase address of the module.
dllNameFile name of the DLL.
entryPointModule entry point.
Returns
true to continue; false to break into the debugger.

Definition at line 42 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onDLLUnload()

void RoboDBG::Debugger::onDLLUnload ( uintptr_t address,
std::string dllName )
protectedvirtual

Called when a DLL is unloaded.

Parameters
addressBase address prior to unload.
dllNameFile name of the DLL.

Definition at line 69 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onEnd()

void RoboDBG::Debugger::onEnd ( DWORD exitCode,
DWORD pid )
protectedvirtual

Called when the debuggee exits.

Parameters
exitCodeProcess exit code.
pidProcess ID.

Definition at line 17 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onHardwareBreakpoint()

BreakpointAction RoboDBG::Debugger::onHardwareBreakpoint ( uintptr_t address,
HANDLE hThread,
DRReg reg )
protectedvirtual

Called on hardware breakpoint hit.

Parameters
addressAddress being watched.
hThreadCurrent thread handle.
regDebug register that fired.
Returns
Action to take (break, restore, single-step).

Definition at line 132 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onRIPError()

void RoboDBG::Debugger::onRIPError ( const RIP_INFO & rip)
protectedvirtual

Called on RIP error (native debug port issues).

Parameters
ripRIP_INFO structure with details.

Definition at line 109 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onSinglestep()

void RoboDBG::Debugger::onSinglestep ( uintptr_t address,
HANDLE hThread )
protectedvirtual

Called on single-step exception.

Parameters
addressCurrent instruction pointer.
hThreadCurrent thread handle.

Definition at line 77 of file debugger.callbacks.cpp.

◆ onStart()

void RoboDBG::Debugger::onStart ( uintptr_t imageBase,
uintptr_t entryPoint )
protectedvirtual

Called when a new debuggee process is started.

Parameters
imageBaseBase address of the main image.
entryPointEntry point address of the process.

Definition at line 9 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onThreadCreate()

void RoboDBG::Debugger::onThreadCreate ( HANDLE hThread,
DWORD threadId,
uintptr_t threadBase,
uintptr_t startAddress )
protectedvirtual

Called when a thread is created in the debuggee.

Parameters
hThreadThread handle.
threadIdThread ID.
threadBaseThread base address.
startAddressThread start address (initial IP).

Definition at line 52 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onThreadExit()

void RoboDBG::Debugger::onThreadExit ( DWORD threadID)
protectedvirtual

Called when a thread exits.

Parameters
threadIDExiting thread ID.

Definition at line 62 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onUnknownDebugEvent()

void RoboDBG::Debugger::onUnknownDebugEvent ( DWORD code)
protectedvirtual

Called on unhandled/unknown debug events.

Parameters
codeEvent code.

Definition at line 125 of file debugger.callbacks.cpp.

Referenced by loop().

◆ onUnknownException()

void RoboDBG::Debugger::onUnknownException ( uintptr_t addr,
DWORD code )
protectedvirtual

Called on unknown exception.

Parameters
addrFaulting address.
codeException code.

Definition at line 117 of file debugger.callbacks.cpp.

Referenced by loop().

◆ printIP()

void RoboDBG::Debugger::printIP ( HANDLE hThread)
protected

Prints the current instruction pointer (IP/EIP/RIP) of a thread.

Parameters
hThreadThread handle.

Definition at line 180 of file debugger.cpp.

◆ readMemory() [1/3]

bool RoboDBG::Debugger::readMemory ( LPVOID address,
void * buffer,
SIZE_T size )
protected

Reads raw bytes from target memory.

Parameters
addressSource address in target.
bufferDestination buffer.
sizeNumber of bytes to read.
Returns
true on success; false otherwise.

Definition at line 15 of file debugger.memory.cpp.

Referenced by readMemory().

◆ readMemory() [2/3]

template<typename T>
T RoboDBG::Debugger::readMemory ( uintptr_t address)
inlineprotected

Reads a POD value from target memory (typed helper).

Template Parameters
TTrivially copyable type.
Parameters
addressSource runtime address.
Returns
Read value; default-initialized T on failure.

Definition at line 686 of file debugger.h.

◆ readMemory() [3/3]

bool RoboDBG::Debugger::readMemory ( uintptr_t address,
void * buffer,
SIZE_T size )
inlineprotected

Reads raw bytes from target memory (uintptr_t overload).

Parameters
addressSource runtime address.
bufferDestination buffer.
sizeNumber of bytes to read.
Returns
true on success; false otherwise.

Definition at line 658 of file debugger.h.

References readMemory().

◆ restoreBreakpoint() [1/2]

void RoboDBG::Debugger::restoreBreakpoint ( LPVOID address)
protected

Restores the original byte at a software breakpoint address.

Parameters
addressBreakpoint address to restore.

Definition at line 281 of file debugger.breakpoints.cpp.

Referenced by loop(), and restoreBreakpoint().

◆ restoreBreakpoint() [2/2]

void RoboDBG::Debugger::restoreBreakpoint ( uintptr_t address)
inlineprotected

Restores the original byte at a software breakpoint.

Parameters
addressBreakpoint address.

Definition at line 585 of file debugger.h.

References restoreBreakpoint().

◆ searchInMemory()

std::vector< uintptr_t > RoboDBG::Debugger::searchInMemory ( const std::vector< BYTE > & pattern)
protected

Scans process memory for a byte pattern.

Parameters
patternByte sequence to match.
Returns
Vector of matched start addresses.

Definition at line 108 of file debugger.memory.cpp.

References getMemoryPages().

◆ setBreakpoint() [1/2]

void RoboDBG::Debugger::setBreakpoint ( LPVOID address)
protected

Sets a software INT3 breakpoint at an address.

Parameters
addressTarget address in the debuggee.

Definition at line 5 of file debugger.breakpoints.cpp.

Referenced by loop(), and setBreakpoint().

◆ setBreakpoint() [2/2]

void RoboDBG::Debugger::setBreakpoint ( uintptr_t address)
inlineprotected

Sets a software INT3 breakpoint.

Parameters
addressTarget runtime address.

Definition at line 559 of file debugger.h.

References setBreakpoint().

◆ setFlag()

void RoboDBG::Debugger::setFlag ( HANDLE hThread,
Flags32 flag,
bool enabled )
protected

Sets or clears a status flag in EFLAGS.

Parameters
hThreadThread handle.
flagFlag to mutate.
enabledtrue to set; false to clear.

Definition at line 169 of file debugger.registers.cpp.

◆ setHardwareBreakpoint() [1/3]

bool RoboDBG::Debugger::setHardwareBreakpoint ( hwBp_t bp)
protected

Sets a hardware breakpoint for all existing (and future) threads where applicable.

Parameters
bpHardware breakpoint configuration (process-wide intent).
Returns
true on success; false otherwise.

Definition at line 82 of file debugger.breakpoints.cpp.

References actualizeThreadList(), RoboDBG::hwBp_t::hThread, RoboDBG::hwBp_t::len, RoboDBG::hwBp_t::reg, setHardwareBreakpointOnThread(), and RoboDBG::hwBp_t::type.

Referenced by loop(), setHardwareBreakpoint(), and setHardwareBreakpoint().

◆ setHardwareBreakpoint() [2/3]

bool RoboDBG::Debugger::setHardwareBreakpoint ( int address,
DRReg reg,
AccessType type,
BreakpointLength len )
inlineprotected

Sets a hardware breakpoint using a 32-bit int address (for convenience).

Parameters
addressWatched address (32-bit).
regDR slot (DR0–DR3).
typeAccess type.
lenOperand length.
Returns
true on success; false otherwise.

Definition at line 624 of file debugger.h.

References setHardwareBreakpoint().

◆ setHardwareBreakpoint() [3/3]

bool RoboDBG::Debugger::setHardwareBreakpoint ( LPVOID address,
DRReg reg,
AccessType type,
BreakpointLength len )
inlineprotected

Sets a hardware breakpoint process-wide (current/future threads as applicable).

Parameters
addressWatched address.
regDR slot (DR0–DR3).
typeAccess type.
lenOperand length.
Returns
true on success; false otherwise.

Definition at line 611 of file debugger.h.

References setHardwareBreakpoint().

◆ setHardwareBreakpointOnThread() [1/2]

bool RoboDBG::Debugger::setHardwareBreakpointOnThread ( HANDLE hThread,
LPVOID address,
DRReg reg,
AccessType type,
BreakpointLength len )
inlineprotected

Sets a hardware breakpoint on a specific thread.

Parameters
hThreadTarget thread.
addressWatched address.
regDR slot (DR0–DR3).
typeAccess type.
lenOperand length.
Returns
true on success; false otherwise.

Definition at line 598 of file debugger.h.

References setHardwareBreakpointOnThread().

◆ setHardwareBreakpointOnThread() [2/2]

bool RoboDBG::Debugger::setHardwareBreakpointOnThread ( hwBp_t bp)
protected

Sets a hardware breakpoint for a specific thread.

Parameters
bpHardware breakpoint configuration (per-thread).
Returns
true on success; false otherwise.

Definition at line 22 of file debugger.breakpoints.cpp.

References RoboDBG::hwBp_t::address, RoboDBG::hwBp_t::hThread, RoboDBG::hwBp_t::len, RoboDBG::hwBp_t::reg, and RoboDBG::hwBp_t::type.

Referenced by setHardwareBreakpoint(), and setHardwareBreakpointOnThread().

◆ setRegister()

void RoboDBG::Debugger::setRegister ( HANDLE hThread,
Register32 reg,
int32_t value )
protected

Writes a 32-bit general-purpose register.

Parameters
hThreadThread handle.
regRegister selector.
valueNew value.

Definition at line 98 of file debugger.registers.cpp.

◆ start() [1/2]

int RoboDBG::Debugger::start ( std::string exeName)

Starts a process under debugging.

Parameters
exeNamePath to the executable.
Returns
0 on success; non-zero on failure.

Definition at line 87 of file debugger.cpp.

◆ start() [2/2]

int RoboDBG::Debugger::start ( std::string exeName,
const std::vector< std::string > & args )

Starts a process under debugging with arguments.

Parameters
exeNamePath to the executable.
argsfor the debugged application.
Returns
0 on success; non-zero on failure.

Definition at line 111 of file debugger.cpp.

◆ writeMemory() [1/3]

bool RoboDBG::Debugger::writeMemory ( LPVOID address,
const void * buffer,
SIZE_T size )
protected

Writes raw bytes to target memory.

Parameters
addressDestination address in target.
bufferSource buffer.
sizeNumber of bytes to write.
Returns
true on success; false otherwise.

Definition at line 5 of file debugger.memory.cpp.

Referenced by writeMemory().

◆ writeMemory() [2/3]

template<typename T>
bool RoboDBG::Debugger::writeMemory ( uintptr_t address,
const T & value )
inlineprotected

Writes a POD value to target memory (typed helper).

Template Parameters
TTrivially copyable type.
Parameters
addressDestination runtime address.
valueValue to write.
Returns
true on success; false otherwise.

Definition at line 670 of file debugger.h.

◆ writeMemory() [3/3]

bool RoboDBG::Debugger::writeMemory ( uintptr_t address,
const void * buffer,
SIZE_T size )
inlineprotected

Writes raw bytes to target memory (uintptr_t overload).

Parameters
addressDestination runtime address.
bufferSource buffer.
sizeNumber of bytes to write.
Returns
true on success; false otherwise.

Definition at line 647 of file debugger.h.

References writeMemory().


The documentation for this class was generated from the following files: