1
0
Fork 0

GUI: add human readable names to exceptions tab

This commit is contained in:
Matthijs Lavrijsen 2021-01-29 11:34:11 +01:00
parent 93794bf8cf
commit 515c08823e
No known key found for this signature in database
GPG Key ID: D40D1DBE299B83EA
2 changed files with 27 additions and 1 deletions

View File

@ -609,13 +609,38 @@ void SettingsDialog::UpdateExceptionListWidget()
{
qSort(settings.exceptionFilters->begin(), settings.exceptionFilters->end(), ExceptionFilterLess());
ui->listExceptions->clear();
if(exceptionNames.empty() && DbgFunctions()->EnumExceptions)
{
BridgeList<CONSTANTINFO> exceptions;
DbgFunctions()->EnumExceptions(&exceptions);
for(int i = 0; i < exceptions.Count(); i++)
{
exceptionNames.insert({exceptions[i].value, exceptions[i].name});
}
}
for(int i = 0; i < settings.exceptionFilters->size(); i++)
{
const ExceptionFilter & filter = settings.exceptionFilters->at(i);
if(filter.range.start == 0 && filter.range.start == filter.range.end)
ui->listExceptions->addItem(QString("Unknown exceptions"));
else
ui->listExceptions->addItem(QString().asprintf("%.8X-%.8X", filter.range.start, filter.range.end));
{
const bool bSingleItemRange = filter.range.start == filter.range.end;
if(!bSingleItemRange)
{
ui->listExceptions->addItem(QString().asprintf("%.8X-%.8X", filter.range.start, filter.range.end));
}
else
{
auto found = exceptionNames.find(filter.range.start);
if(found == exceptionNames.end())
ui->listExceptions->addItem(QString().asprintf("%.8X", filter.range.start));
else
ui->listExceptions->addItem(QString().asprintf("%.8X\n %s", filter.range.start, found->second));
}
}
}
}

View File

@ -250,6 +250,7 @@ private:
Ui::SettingsDialog* ui;
SettingsStruct settings;
QList<ExceptionFilter> realExceptionFilters;
std::unordered_map<duint, const char*> exceptionNames;
bool bJitOld;
bool bJitAutoOld;
bool bGuiOptionsUpdated;