Skip to content

Commit 0a77a1c

Browse files
committed
DBG: add expression functions for exception information
1 parent 1e07514 commit 0a77a1c

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

src/dbg/expressionfunctions.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ void ExpressionFunctions::Init()
133133
RegisterEasy("arg.get,arg", argget);
134134
RegisterEasy("arg.set", argset);
135135

136+
//Exceptions
137+
RegisterEasy("ex.firstchance", exfirstchance);
138+
RegisterEasy("ex.addr", exaddr);
139+
RegisterEasy("ex.code", excode);
140+
RegisterEasy("ex.flags", exflags);
141+
RegisterEasy("ex.infocount", exinfocount);
142+
RegisterEasy("ex.info", exinfo);
143+
136144
//Undocumented
137145
RegisterEasy("bpgoto", bpgoto);
138146
}

src/dbg/exprfunc.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,4 +429,36 @@ namespace Exprfunc
429429
SetContextDataEx(hActiveThread, UE_CIP, cip);
430430
return cip;
431431
}
432+
433+
duint exfirstchance()
434+
{
435+
return getLastExceptionInfo().dwFirstChance;
436+
}
437+
438+
duint exaddr()
439+
{
440+
return (duint)getLastExceptionInfo().ExceptionRecord.ExceptionAddress;
441+
}
442+
443+
duint excode()
444+
{
445+
return getLastExceptionInfo().ExceptionRecord.ExceptionCode;
446+
}
447+
448+
duint exflags()
449+
{
450+
return getLastExceptionInfo().ExceptionRecord.ExceptionFlags;
451+
}
452+
453+
duint exinfocount()
454+
{
455+
return getLastExceptionInfo().ExceptionRecord.NumberParameters;
456+
}
457+
458+
duint exinfo(duint index)
459+
{
460+
if(index >= 16)
461+
return 0;
462+
return getLastExceptionInfo().ExceptionRecord.ExceptionInformation[index];
463+
}
432464
}

src/dbg/exprfunc.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,11 @@ namespace Exprfunc
7272
duint argset(duint index, duint value);
7373

7474
duint bpgoto(duint cip);
75+
76+
duint exfirstchance();
77+
duint exaddr();
78+
duint excode();
79+
duint exflags();
80+
duint exinfocount();
81+
duint exinfo(duint index);
7582
}

0 commit comments

Comments
 (0)