1
0
Fork 0

DBG: add expression functions for exception information

This commit is contained in:
Duncan Ogilvie 2019-06-13 13:17:15 +02:00
parent 1e075142a5
commit 0a77a1cb00
3 changed files with 47 additions and 0 deletions

View File

@ -133,6 +133,14 @@ void ExpressionFunctions::Init()
RegisterEasy("arg.get,arg", argget);
RegisterEasy("arg.set", argset);
//Exceptions
RegisterEasy("ex.firstchance", exfirstchance);
RegisterEasy("ex.addr", exaddr);
RegisterEasy("ex.code", excode);
RegisterEasy("ex.flags", exflags);
RegisterEasy("ex.infocount", exinfocount);
RegisterEasy("ex.info", exinfo);
//Undocumented
RegisterEasy("bpgoto", bpgoto);
}

View File

@ -429,4 +429,36 @@ namespace Exprfunc
SetContextDataEx(hActiveThread, UE_CIP, cip);
return cip;
}
duint exfirstchance()
{
return getLastExceptionInfo().dwFirstChance;
}
duint exaddr()
{
return (duint)getLastExceptionInfo().ExceptionRecord.ExceptionAddress;
}
duint excode()
{
return getLastExceptionInfo().ExceptionRecord.ExceptionCode;
}
duint exflags()
{
return getLastExceptionInfo().ExceptionRecord.ExceptionFlags;
}
duint exinfocount()
{
return getLastExceptionInfo().ExceptionRecord.NumberParameters;
}
duint exinfo(duint index)
{
if(index >= 16)
return 0;
return getLastExceptionInfo().ExceptionRecord.ExceptionInformation[index];
}
}

View File

@ -72,4 +72,11 @@ namespace Exprfunc
duint argset(duint index, duint value);
duint bpgoto(duint cip);
duint exfirstchance();
duint exaddr();
duint excode();
duint exflags();
duint exinfocount();
duint exinfo(duint index);
}