10 if (!this->verbose)
return;
12 std::cout <<
"[*] Debugger::onStart\n";
13 std::cout <<
" ImageBase : 0x" << std::hex << imageBase <<
"\n";
14 std::cout <<
" EntryPoint: 0x" << std::hex << entryPoint << std::dec <<
"\n";
18 if (!this->verbose)
return;
20 std::cout <<
"[*] Process exited\n";
21 std::cout <<
" PID : " << pid <<
"\n";
22 std::cout <<
" Exit Code : 0x" << std::hex << exitCode
23 << std::dec <<
" (" << exitCode <<
")\n";
27 if (!this->verbose)
return;
29 std::cout <<
"[*] Debugger::onAttach: Attached\n";
34 std::cout <<
"[*] Breakpoint hit\n";
35 std::cout <<
" Address: 0x" << std::hex << address
36 <<
" Thread: 0x" <<
reinterpret_cast<uintptr_t
>(hThread)
43 if (!this->verbose)
return false;
45 std::cout <<
"[*] DLL Load\n";
46 std::cout <<
" Address : 0x" << std::hex << address <<
"\n";
47 std::cout <<
" DLL Name : " << std::dec << dllName <<
"\n";
48 std::cout <<
" Entry Point: 0x" << std::hex << entryPoint << std::dec <<
"\n";
53 if (!this->verbose)
return;
55 std::cout <<
"[*] Thread created\n";
56 std::cout <<
" TID : " << std::dec << threadId <<
"\n";
57 std::cout <<
" Handle : 0x" << std::hex << reinterpret_cast<uintptr_t>(hThread) <<
"\n";
58 std::cout <<
" TEB/Base : 0x" << std::hex << threadBase <<
"\n";
59 std::cout <<
" StartAddress : 0x" << std::hex << startAddress << std::dec <<
"\n";
63 if (!this->verbose)
return;
65 std::cout <<
"[*] Thread exited\n";
66 std::cout <<
" TID: " << std::dec << threadID <<
"\n";
70 if (!this->verbose)
return;
72 std::cout <<
"[*] DLL Unload\n";
73 std::cout <<
" Address : 0x" << std::hex << address <<
"\n";
74 std::cout <<
" DLL Name: " << std::dec << dllName <<
"\n";
78 if (!this->verbose)
return;
80 std::cout <<
"[*] Single-step\n";
81 std::cout <<
" Address: 0x" << std::hex << address
82 <<
" Thread: 0x" <<
reinterpret_cast<uintptr_t
>(hThread)
87 if (!this->verbose)
return;
89 std::cout <<
"[!] Access violation\n";
90 std::cout <<
" At Address : 0x" << std::hex << address <<
"\n";
91 std::cout <<
" Faulting Addr : 0x" << std::hex << faultingAddress <<
"\n";
92 std::cout <<
" Access Type : " << std::dec << accessType <<
" -> ";
95 case 0: std::cout <<
"Read\n";
break;
96 case 1: std::cout <<
"Write\n";
break;
97 case 8: std::cout <<
"Execute (NX)\n";
break;
98 default: std::cout <<
"Unknown\n";
break;
103 if (!this->verbose)
return;
105 std::cout <<
"[*] Debug string\n";
106 std::cout <<
" \"" << msg <<
"\"\n";
110 if (!this->verbose)
return;
113 std::cout <<
"[*] RIP error\n";
114 std::cout <<
" RIP_INFO@0x" << std::hex << reinterpret_cast<uintptr_t>(&rip) << std::dec <<
"\n";
118 if (!this->verbose)
return;
120 std::cout <<
"[*] Unknown exception\n";
121 std::cout <<
" Code : 0x" << std::hex << code <<
"\n";
122 std::cout <<
" Addr : 0x" << std::hex << addr << std::dec <<
"\n";
126 if (!this->verbose)
return;
128 std::cout <<
"[*] Unknown debug event\n";
129 std::cout <<
" Code: " << std::dec << code <<
"\n";
134 std::cout <<
"[*] Hardware Breakpoint\n";
135 std::cout <<
" Address: 0x" << std::hex << address
136 <<
" Thread: 0x" <<
reinterpret_cast<uintptr_t
>(hThread)
137 <<
" DR: " <<
static_cast<int>(reg)
virtual void onAttach()
Called after successfully attaching to an already running process.
virtual void onAccessViolation(uintptr_t address, uintptr_t faultingAddress, long accessType)
Called on access violation (AV).
virtual void onThreadExit(DWORD threadID)
Called when a thread exits.
virtual void onEnd(DWORD exitCode, DWORD pid)
Called when the debuggee exits.
virtual void onDLLUnload(uintptr_t address, std::string dllName)
Called when a DLL is unloaded.
virtual void onUnknownException(uintptr_t addr, DWORD code)
Called on unknown exception.
virtual void onStart(uintptr_t imageBase, uintptr_t entryPoint)
Called when a new debuggee process is started.
virtual void onThreadCreate(HANDLE hThread, DWORD threadId, uintptr_t threadBase, uintptr_t startAddress)
Called when a thread is created in the debuggee.
virtual void onRIPError(const RIP_INFO &rip)
Called on RIP error (native debug port issues).
virtual bool onDLLLoad(uintptr_t address, std::string dllName, uintptr_t entryPoint)
Called when a DLL is loaded.
virtual BreakpointAction onBreakpoint(uintptr_t address, HANDLE hThread)
Called on software breakpoint (INT3).
virtual void onDebugString(std::string dbgString)
Called when OutputDebugString is emitted by the debuggee.
virtual BreakpointAction onHardwareBreakpoint(uintptr_t address, HANDLE hThread, DRReg reg)
Called on hardware breakpoint hit.
virtual void onUnknownDebugEvent(DWORD code)
Called on unhandled/unknown debug events.
virtual void onSinglestep(uintptr_t address, HANDLE hThread)
Called on single-step exception.
BreakpointAction
Specifies the action to take when a breakpoint is hit.
@ RESTORE
Restore the original instruction at the breakpoint.
DRReg
Hardware debug registers used for breakpoints.