DBG: show some exception names when an exception occurs
This commit is contained in:
parent
9ade0e3933
commit
1249b04510
|
@ -34,6 +34,7 @@ static bool bSkipExceptions=false;
|
|||
static bool bBreakOnNextDll=false;
|
||||
static int ecount=0;
|
||||
static std::vector<ExceptionRange> ignoredExceptionRange;
|
||||
static std::map<unsigned int, const char*> exceptionNames;
|
||||
|
||||
//Superglobal variables
|
||||
char sqlitedb[deflen]="";
|
||||
|
@ -44,6 +45,67 @@ static void cbStep();
|
|||
static void cbSystemBreakpoint(void* ExceptionData);
|
||||
static void cbUserBreakpoint();
|
||||
|
||||
void dbginit()
|
||||
{
|
||||
exceptionNames.insert(std::make_pair(0x40000005, "STATUS_SEGMENT_NOTIFICATION"));
|
||||
exceptionNames.insert(std::make_pair(0x4000001C, "STATUS_WX86_UNSIMULATE"));
|
||||
exceptionNames.insert(std::make_pair(0x4000001D, "STATUS_WX86_CONTINUE"));
|
||||
exceptionNames.insert(std::make_pair(0x4000001E, "STATUS_WX86_SINGLE_STEP"));
|
||||
exceptionNames.insert(std::make_pair(0x4000001F, "STATUS_WX86_BREAKPOINT"));
|
||||
exceptionNames.insert(std::make_pair(0x40000020, "STATUS_WX86_EXCEPTION_CONTINUE"));
|
||||
exceptionNames.insert(std::make_pair(0x40000021, "STATUS_WX86_EXCEPTION_LASTCHANCE"));
|
||||
exceptionNames.insert(std::make_pair(0x40000022, "STATUS_WX86_EXCEPTION_CHAIN"));
|
||||
exceptionNames.insert(std::make_pair(0x40000028, "STATUS_WX86_CREATEWX86TIB"));
|
||||
exceptionNames.insert(std::make_pair(0x40010003, "DBG_TERMINATE_THREAD"));
|
||||
exceptionNames.insert(std::make_pair(0x40010004, "DBG_TERMINATE_PROCESS"));
|
||||
exceptionNames.insert(std::make_pair(0x40010005, "DBG_CONTROL_C"));
|
||||
exceptionNames.insert(std::make_pair(0x40010006, "DBG_PRINTEXCEPTION_C"));
|
||||
exceptionNames.insert(std::make_pair(0x40010007, "DBG_RIPEXCEPTION"));
|
||||
exceptionNames.insert(std::make_pair(0x40010008, "DBG_CONTROL_BREAK"));
|
||||
exceptionNames.insert(std::make_pair(0x40010009, "DBG_COMMAND_EXCEPTION"));
|
||||
exceptionNames.insert(std::make_pair(0x80000001, "EXCEPTION_GUARD_PAGE"));
|
||||
exceptionNames.insert(std::make_pair(0x80000002, "EXCEPTION_DATATYPE_MISALIGNMENT"));
|
||||
exceptionNames.insert(std::make_pair(0x80000003, "EXCEPTION_BREAKPOINT"));
|
||||
exceptionNames.insert(std::make_pair(0x80000004, "EXCEPTION_SINGLE_STEP"));
|
||||
exceptionNames.insert(std::make_pair(0x80000026, "STATUS_LONGJUMP"));
|
||||
exceptionNames.insert(std::make_pair(0x80000029, "STATUS_UNWIND_CONSOLIDATE"));
|
||||
exceptionNames.insert(std::make_pair(0x80010001, "DBG_EXCEPTION_NOT_HANDLED"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000005, "EXCEPTION_ACCESS_VIOLATION"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000006, "EXCEPTION_IN_PAGE_ERROR"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000008, "EXCEPTION_INVALID_HANDLE"));
|
||||
exceptionNames.insert(std::make_pair(0xC000000D, "STATUS_INVALID_PARAMETER"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000017, "STATUS_NO_MEMORY"));
|
||||
exceptionNames.insert(std::make_pair(0xC000001D, "EXCEPTION_ILLEGAL_INSTRUCTION"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000025, "EXCEPTION_NONCONTINUABLE_EXCEPTION"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000026, "EXCEPTION_INVALID_DISPOSITION"));
|
||||
exceptionNames.insert(std::make_pair(0xC000008C, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"));
|
||||
exceptionNames.insert(std::make_pair(0xC000008D, "EXCEPTION_FLT_DENORMAL_OPERAND"));
|
||||
exceptionNames.insert(std::make_pair(0xC000008E, "EXCEPTION_FLT_DIVIDE_BY_ZERO"));
|
||||
exceptionNames.insert(std::make_pair(0xC000008F, "EXCEPTION_FLT_INEXACT_RESULT"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000090, "EXCEPTION_FLT_INVALID_OPERATION"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000091, "EXCEPTION_FLT_OVERFLOW"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000092, "EXCEPTION_FLT_STACK_CHECK"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000093, "EXCEPTION_FLT_UNDERFLOW"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000094, "EXCEPTION_INT_DIVIDE_BY_ZERO"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000095, "EXCEPTION_INT_OVERFLOW"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000096, "EXCEPTION_PRIV_INSTRUCTION"));
|
||||
exceptionNames.insert(std::make_pair(0xC00000FD, "EXCEPTION_STACK_OVERFLOW"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000135, "STATUS_DLL_NOT_FOUND"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000138, "STATUS_ORDINAL_NOT_FOUND"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000139, "STATUS_ENTRYPOINT_NOT_FOUND"));
|
||||
exceptionNames.insert(std::make_pair(0xC000013A, "STATUS_CONTROL_C_EXIT"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000142, "STATUS_DLL_INIT_FAILED"));
|
||||
exceptionNames.insert(std::make_pair(0xC000014A, "STATUS_ILLEGAL_FLOAT_CONTEXT"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000194, "EXCEPTION_POSSIBLE_DEADLOCK"));
|
||||
exceptionNames.insert(std::make_pair(0xC00002B4, "STATUS_FLOAT_MULTIPLE_FAULTS"));
|
||||
exceptionNames.insert(std::make_pair(0xC00002B5, "STATUS_FLOAT_MULTIPLE_TRAPS"));
|
||||
exceptionNames.insert(std::make_pair(0xC00002C5, "STATUS_DATATYPE_MISALIGNMENT_ERROR"));
|
||||
exceptionNames.insert(std::make_pair(0xC00002C9, "STATUS_REG_NAT_CONSUMPTION"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000409, "STATUS_STACK_BUFFER_OVERRUN"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000417, "STATUS_INVALID_CRUNTIME_PARAMETER"));
|
||||
exceptionNames.insert(std::make_pair(0xC0000420, "STATUS_ASSERTION_FAILURE"));
|
||||
}
|
||||
|
||||
void dbgdisablebpx()
|
||||
{
|
||||
std::vector<BREAKPOINT> list;
|
||||
|
@ -957,17 +1019,25 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char* exceptionName = 0;
|
||||
if(exceptionNames.count(ExceptionCode))
|
||||
exceptionName = exceptionNames[ExceptionCode];
|
||||
if(ExceptionData->dwFirstChance) //first chance exception
|
||||
{
|
||||
dprintf("first chance exception on "fhex" (%.8X)!\n", addr,ExceptionCode);
|
||||
if(exceptionName)
|
||||
dprintf("first chance exception on "fhex" (%.8X, %s)!\n", addr, ExceptionCode, exceptionName);
|
||||
else
|
||||
dprintf("first chance exception on "fhex" (%.8X)!\n", addr, ExceptionCode);
|
||||
SetNextDbgContinueStatus(DBG_EXCEPTION_NOT_HANDLED);
|
||||
if(bSkipExceptions || dbgisignoredexception(ExceptionCode))
|
||||
return;
|
||||
}
|
||||
else //lock the exception
|
||||
{
|
||||
dprintf("last chance exception on "fhex" (%.8X)!\n", addr, ExceptionCode);
|
||||
if(exceptionName)
|
||||
dprintf("last chance exception on "fhex" (%.8X, %s)!\n", addr, ExceptionCode, exceptionName);
|
||||
else
|
||||
dprintf("last chance exception on "fhex" (%.8X)!\n", addr, ExceptionCode);
|
||||
SetNextDbgContinueStatus(DBG_CONTINUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef struct _THREADNAME_INFO
|
|||
#pragma pack(pop)
|
||||
|
||||
//functions
|
||||
void dbginit();
|
||||
void dbgdisablebpx();
|
||||
void dbgenablebpx();
|
||||
bool dbgisrunning();
|
||||
|
|
|
@ -230,6 +230,7 @@ static void efree_json(void* ptr)
|
|||
|
||||
extern "C" DLL_EXPORT const char* _dbg_dbginit()
|
||||
{
|
||||
dbginit();
|
||||
dbgfunctionsinit();
|
||||
json_set_alloc_funcs(emalloc_json, efree_json);
|
||||
char dir[deflen]="";
|
||||
|
|
Loading…
Reference in New Issue