1
0
Fork 0

DBG: added ignored exception list functiosn

GUI: fixed a bug in the SettingsDialog with ignored exceptions
This commit is contained in:
Mr. eXoDia 2014-03-21 23:55:59 +01:00
parent dce8ddcac7
commit bd284a385b
4 changed files with 59 additions and 5 deletions

View File

@ -657,6 +657,25 @@ extern "C" DLL_EXPORT uint _dbg_sendmessage(DBGMSG type, void* param1, void* par
break;
}
}
char exceptionRange[MAX_SETTING_SIZE]="";
if(BridgeSettingGet("Exceptions", "IgnoreRange", exceptionRange))
{
dbgclearignoredexceptions();
char* entry=strtok(exceptionRange, ",");
while(entry)
{
unsigned long start;
unsigned long end;
if(sscanf(entry, "%08X-%08X", &start, &end)==2 && start<=end)
{
ExceptionRange range;
range.start=start;
range.end=end;
dbgaddignoredexception(range);
}
entry=strtok(0, ",");
}
}
}
break;
}

View File

@ -28,6 +28,7 @@ static bool bScyllaLoaded=false;
static bool bIsAttached=false;
static bool bSkipExceptions=false;
static int ecount=0;
static std::vector<ExceptionRange> ignoredExceptionRange;
//Superglobal variables
char sqlitedb[deflen]="";
@ -72,6 +73,28 @@ void dbgsetskipexceptions(bool skip)
bSkipExceptions=skip;
}
void dbgclearignoredexceptions()
{
std::vector<ExceptionRange>().swap(ignoredExceptionRange);
}
void dbgaddignoredexception(ExceptionRange range)
{
ignoredExceptionRange.push_back(range);
}
bool dbgisignoredexception(unsigned int exception)
{
for(unsigned int i=0; i<ignoredExceptionRange.size(); i++)
{
unsigned int curStart=ignoredExceptionRange.at(i).start;
unsigned int curEnd=ignoredExceptionRange.at(i).end;
if(exception>=curStart && exception<=curEnd)
return true;
}
return false;
}
void DebugUpdateGui(uint disasm_addr, bool stack)
{
uint cip=GetContextData(UE_CIP);
@ -767,16 +790,18 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
SetContextData(UE_CIP, (uint)ExceptionData->ExceptionRecord.ExceptionAddress);
}
unsigned int ExceptionCode=ExceptionData->ExceptionRecord.ExceptionCode;
if(ExceptionData->dwFirstChance) //first chance exception
{
dprintf("first chance exception on "fhex" (%.8X)!\n", addr, ExceptionData->ExceptionRecord.ExceptionCode);
dprintf("first chance exception on "fhex" (%.8X)!\n", addr,ExceptionCode);
SetNextDbgContinueStatus(DBG_EXCEPTION_NOT_HANDLED);
if(bSkipExceptions)
if(bSkipExceptions || dbgisignoredexception(ExceptionCode))
return;
}
else //lock the exception
{
dprintf("last chance exception on "fhex" (%.8X)!\n", addr, ExceptionData->ExceptionRecord.ExceptionCode);
dprintf("last chance exception on "fhex" (%.8X)!\n", addr, ExceptionCode);
SetNextDbgContinueStatus(DBG_CONTINUE);
}

View File

@ -14,12 +14,21 @@ struct INIT_STRUCT
char* currentfolder;
};
struct ExceptionRange
{
unsigned int start;
unsigned int end;
};
//functions
void dbgdisablebpx();
void dbgenablebpx();
bool dbgisrunning();
void DebugUpdateGui(uint disasm_addr, bool stack);
void dbgsetskipexceptions(bool skip);
void dbgclearignoredexceptions();
void dbgaddignoredexception(ExceptionRange range);
bool dbgisignoredexception(unsigned int exception);
//callbacks
CMDRESULT cbDebugInit(int argc, char* argv[]);
CMDRESULT cbStopDebug(int argc, char* argv[]);

View File

@ -123,7 +123,7 @@ void SettingsDialog::LoadSettings()
{
unsigned long start;
unsigned long end;
if(sscanf(ranges.at(i).toUtf8().constData(), "%.8X-%.8X", &start, &end)==2 && start<end)
if(sscanf(ranges.at(i).toUtf8().constData(), "%08X-%08X", &start, &end)==2 && start<=end)
{
RangeStruct newRange;
newRange.start=start;
@ -159,6 +159,8 @@ void SettingsDialog::SaveSettings()
exceptionRange.chop(1); //remove last comma
if(exceptionRange.size())
BridgeSettingSet("Exceptions", "IgnoreRange", exceptionRange.toUtf8().constData());
DbgSettingsUpdated();
}
void SettingsDialog::AddRangeToList(RangeStruct range)
@ -297,7 +299,6 @@ void SettingsDialog::on_radioUd2_clicked()
void SettingsDialog::on_btnSave_clicked()
{
SaveSettings();
DbgSettingsUpdated();
}