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,14 +609,39 @@ void SettingsDialog::UpdateExceptionListWidget()
{ {
qSort(settings.exceptionFilters->begin(), settings.exceptionFilters->end(), ExceptionFilterLess()); qSort(settings.exceptionFilters->begin(), settings.exceptionFilters->end(), ExceptionFilterLess());
ui->listExceptions->clear(); 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++) for(int i = 0; i < settings.exceptionFilters->size(); i++)
{ {
const ExceptionFilter & filter = settings.exceptionFilters->at(i); const ExceptionFilter & filter = settings.exceptionFilters->at(i);
if(filter.range.start == 0 && filter.range.start == filter.range.end) if(filter.range.start == 0 && filter.range.start == filter.range.end)
ui->listExceptions->addItem(QString("Unknown exceptions")); ui->listExceptions->addItem(QString("Unknown exceptions"));
else else
{
const bool bSingleItemRange = filter.range.start == filter.range.end;
if(!bSingleItemRange)
{
ui->listExceptions->addItem(QString().asprintf("%.8X-%.8X", filter.range.start, filter.range.end)); 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));
}
}
}
} }
void SettingsDialog::setLastException(unsigned int exceptionCode) void SettingsDialog::setLastException(unsigned int exceptionCode)

View File

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