I wonder how do you send the debugger a singlestepping exception. Added only two functions

This commit is contained in:
strongbit 2015-03-25 13:26:21 +00:00
parent 6197f91790
commit a1847472ba
3 changed files with 35 additions and 1 deletions

View File

@ -38,7 +38,17 @@ namespace GleeBug
void Debugger::exceptionEvent(EXCEPTION_DEBUG_INFO* exceptionInfo) void Debugger::exceptionEvent(EXCEPTION_DEBUG_INFO* exceptionInfo)
{ {
switch (exceptionInfo->ExceptionRecord.ExceptionCode){
case EXCEPTION_SINGLE_STEP:
cbException_single_spep(&exceptionInfo->ExceptionRecord);
break;
case EXCEPTION_BREAKPOINT:
cbExcpetion_breakpoint(&exceptionInfo->ExceptionRecord);
break;
default:
cbExceptionEvent(exceptionInfo); cbExceptionEvent(exceptionInfo);
break;
}
} }
void Debugger::debugStringEvent(OUTPUT_DEBUG_STRING_INFO* debugString) void Debugger::debugStringEvent(OUTPUT_DEBUG_STRING_INFO* debugString)

View File

@ -94,6 +94,18 @@ namespace GleeBug
*/ */
virtual void cbExceptionEvent(const EXCEPTION_DEBUG_INFO* exceptionInfo) {}; virtual void cbExceptionEvent(const EXCEPTION_DEBUG_INFO* exceptionInfo) {};
/*
single step event
these will execute instead of cbExceptionEvent.
*/
virtual void cbException_single_spep(EXCEPTION_RECORD* except_inf) {};
/*
breakpoint event
Will also execute instead of cbExceptionEvent.
*/
virtual void cbExcpetion_breakpoint(EXCEPTION_RECORD* except_inf) {};
/** /**
\brief Debug string debug event callback. Provide an implementation to use this callback. \brief Debug string debug event callback. Provide an implementation to use this callback.
\param debugString Information about the debug string. \param debugString Information about the debug string.
@ -117,6 +129,8 @@ namespace GleeBug
virtual void debugStringEvent(OUTPUT_DEBUG_STRING_INFO* debugString); virtual void debugStringEvent(OUTPUT_DEBUG_STRING_INFO* debugString);
virtual void ripEvent(RIP_INFO* rip); virtual void ripEvent(RIP_INFO* rip);
ProcessInfo _mainProcess; ProcessInfo _mainProcess;
DWORD _continueStatus; DWORD _continueStatus;
bool _breakDebugger; bool _breakDebugger;

View File

@ -21,6 +21,16 @@ protected:
printf("Thread %d created with entry 0x%p\n", _debugEvent.dwThreadId, createThread->lpStartAddress); printf("Thread %d created with entry 0x%p\n", _debugEvent.dwThreadId, createThread->lpStartAddress);
}; };
virtual void cbException_single_spep(EXCEPTION_RECORD* except_inf)
{
printf("a single step occurred at location 0x%X", except_inf->ExceptionAddress);
};
virtual void cbExcpetion_breakpoint(EXCEPTION_RECORD* except_inf)
{
printf("a breakpoint occurred at location 0x%X", except_inf->ExceptionAddress);
};
virtual void cbExitThreadEvent(const EXIT_THREAD_DEBUG_INFO* exitThread) virtual void cbExitThreadEvent(const EXIT_THREAD_DEBUG_INFO* exitThread)
{ {
printf("Thread %d terminated with exit code 0x%08X\n", _debugEvent.dwThreadId, exitThread->dwExitCode); printf("Thread %d terminated with exit code 0x%08X\n", _debugEvent.dwThreadId, exitThread->dwExitCode);