BRIDGE: added GuiSetLastException
DBG: dump somewhere when the system breakpoint was hit DBG: set last exception code in GUI GUI: last exception code in settings dialog
This commit is contained in:
parent
a72ba35712
commit
d9fdc0a99a
|
@ -764,6 +764,11 @@ BRIDGE_IMPEXP void GuiAddRecentFile(const char* file)
|
|||
_gui_sendmessage(GUI_ADD_RECENT_FILE, (void*)file, 0);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void GuiSetLastException(unsigned int exception)
|
||||
{
|
||||
_gui_sendmessage(GUI_SET_LAST_EXCEPTION, (void*)(duint)exception, 0);
|
||||
}
|
||||
|
||||
//Main
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
|
|
|
@ -462,7 +462,8 @@ enum GUIMSG
|
|||
GUI_STACK_DUMP_AT, // param1=duint addr, param2=duint csp
|
||||
GUI_UPDATE_DUMP_VIEW, // param1=unused, param2=unused
|
||||
GUI_UPDATE_THREAD_VIEW, // param1=unused, param2=unused
|
||||
GUI_ADD_RECENT_FILE // param1=(const char*)file, param2=unused
|
||||
GUI_ADD_RECENT_FILE, // param1=(const char*)file, param2=unused
|
||||
GUI_SET_LAST_EXCEPTION // param1=unsigned int code, param2=unused
|
||||
};
|
||||
|
||||
//GUI structures
|
||||
|
@ -510,6 +511,7 @@ BRIDGE_IMPEXP void GuiStackDumpAt(duint addr, duint csp);
|
|||
BRIDGE_IMPEXP void GuiUpdateDumpView();
|
||||
BRIDGE_IMPEXP void GuiUpdateThreadView();
|
||||
BRIDGE_IMPEXP void GuiAddRecentFile(const char* file);
|
||||
BRIDGE_IMPEXP void GuiSetLastException(unsigned int exception);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -624,6 +624,8 @@ static void cbSystemBreakpoint(void* ExceptionData)
|
|||
//log message
|
||||
dputs("system breakpoint reached!");
|
||||
bSkipExceptions=false; //we are not skipping first-chance exceptions
|
||||
uint cip=GetContextData(UE_CIP);
|
||||
GuiDumpAt(memfindbaseaddr(fdProcessInfo->hProcess, cip, 0)); //dump somewhere
|
||||
|
||||
//plugin callbacks
|
||||
PLUG_CB_SYSTEMBREAKPOINT callbackInfo;
|
||||
|
@ -633,7 +635,7 @@ static void cbSystemBreakpoint(void* ExceptionData)
|
|||
if(settingboolget("Events", "SystemBreakpoint"))
|
||||
{
|
||||
//update GUI
|
||||
DebugUpdateGui(GetContextData(UE_CIP), true);
|
||||
DebugUpdateGui(cip, true);
|
||||
GuiSetDebugState(paused);
|
||||
//lock
|
||||
lock(WAITID_RUN);
|
||||
|
@ -809,6 +811,8 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
|
|||
{
|
||||
PLUG_CB_EXCEPTION callbackInfo;
|
||||
callbackInfo.Exception=ExceptionData;
|
||||
unsigned int ExceptionCode=ExceptionData->ExceptionRecord.ExceptionCode;
|
||||
GuiSetLastException(ExceptionCode);
|
||||
|
||||
uint addr=(uint)ExceptionData->ExceptionRecord.ExceptionAddress;
|
||||
if(ExceptionData->ExceptionRecord.ExceptionCode==EXCEPTION_BREAKPOINT)
|
||||
|
@ -832,8 +836,6 @@ 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,ExceptionCode);
|
||||
|
|
|
@ -220,6 +220,11 @@ void Bridge::emitAddRecentFile(QString file)
|
|||
emit addRecentFile(file);
|
||||
}
|
||||
|
||||
void Bridge::emitSetLastException(unsigned int exceptionCode)
|
||||
{
|
||||
emit setLastException(exceptionCode);
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
Static Functions
|
||||
************************************************************************************/
|
||||
|
@ -462,6 +467,12 @@ __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* pa
|
|||
}
|
||||
break;
|
||||
|
||||
case GUI_SET_LAST_EXCEPTION:
|
||||
{
|
||||
Bridge::getBridge()->emitSetLastException((unsigned int)(uint_t)param1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
void emitUpdateDump();
|
||||
void emitUpdateThreads();
|
||||
void emitAddRecentFile(QString file);
|
||||
void emitSetLastException(unsigned int exceptionCode);
|
||||
|
||||
//Public variables
|
||||
void* winId;
|
||||
|
@ -101,6 +102,7 @@ signals:
|
|||
void updateDump();
|
||||
void updateThreads();
|
||||
void addRecentFile(QString file);
|
||||
void setLastException(unsigned int exceptionCode);
|
||||
|
||||
private:
|
||||
QMutex mBridgeMutex;
|
||||
|
|
|
@ -129,9 +129,11 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
|
||||
connect(Bridge::getBridge(), SIGNAL(updateWindowTitle(QString)), this, SLOT(updateWindowTitleSlot(QString)));
|
||||
connect(Bridge::getBridge(), SIGNAL(addRecentFile(QString)), this, SLOT(addRecentFile(QString)));
|
||||
connect(Bridge::getBridge(), SIGNAL(setLastException(uint)), this, SLOT(setLastException(uint)));
|
||||
|
||||
//Set default setttings (when not set)
|
||||
SettingsDialog defaultSettings;
|
||||
lastException=0;
|
||||
defaultSettings.SaveSettings();
|
||||
|
||||
const char* errormsg=DbgInit();
|
||||
|
@ -510,6 +512,7 @@ void MainWindow::displayThreadsWidget()
|
|||
void MainWindow::openSettings()
|
||||
{
|
||||
SettingsDialog settings(this);
|
||||
settings.lastException=lastException;
|
||||
settings.exec();
|
||||
}
|
||||
|
||||
|
@ -519,3 +522,8 @@ void MainWindow::addRecentFile(QString file)
|
|||
updateMRUMenu();
|
||||
saveMRUList();
|
||||
}
|
||||
|
||||
void MainWindow::setLastException(unsigned int exceptionCode)
|
||||
{
|
||||
lastException=exceptionCode;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public slots:
|
|||
void displayThreadsWidget();
|
||||
void openSettings();
|
||||
void addRecentFile(QString file);
|
||||
void setLastException(unsigned int exceptionCode);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
@ -81,6 +82,7 @@ private:
|
|||
|
||||
std::vector<QString> mMRUList;
|
||||
unsigned int mMaxMRU;
|
||||
unsigned int lastException;
|
||||
|
||||
void loadMRUList(int maxItems);
|
||||
void saveMRUList();
|
||||
|
|
|
@ -11,11 +11,12 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
|
|||
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
|
||||
setFixedSize(this->size()); //fixed size
|
||||
LoadSettings(); //load settings from file
|
||||
ui->btnAddLast->setEnabled(false);
|
||||
connect(Bridge::getBridge(), SIGNAL(setLastException(uint)), this, SLOT(setLastException(uint)));
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog()
|
||||
{
|
||||
disconnect(Bridge::getBridge(), SIGNAL(setLastException(uint)), this, SLOT(setLastException(uint)));
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -196,6 +197,11 @@ void SettingsDialog::AddRangeToList(RangeStruct range)
|
|||
ui->listExceptions->addItem(QString().sprintf("%.8X-%.8X", settings.exceptionRanges->at(i).start, settings.exceptionRanges->at(i).end));
|
||||
}
|
||||
|
||||
void SettingsDialog::setLastException(unsigned int exceptionCode)
|
||||
{
|
||||
lastException=exceptionCode;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_btnSave_clicked()
|
||||
{
|
||||
SaveSettings();
|
||||
|
@ -343,5 +349,16 @@ void SettingsDialog::on_btnDeleteRange_clicked()
|
|||
|
||||
void SettingsDialog::on_btnAddLast_clicked()
|
||||
{
|
||||
|
||||
QMessageBox msg(QMessageBox::Question, "Question", QString().sprintf("Are you sure you want to add %.8X?", lastException));
|
||||
msg.setWindowIcon(QIcon(":/icons/images/question.png"));
|
||||
msg.setParent(this, Qt::Dialog);
|
||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.setStandardButtons(QMessageBox::No|QMessageBox::Yes);
|
||||
msg.setDefaultButton(QMessageBox::Yes);
|
||||
if(msg.exec()!=QMessageBox::Yes)
|
||||
return;
|
||||
RangeStruct range;
|
||||
range.start=lastException;
|
||||
range.end=lastException;
|
||||
AddRangeToList(range);
|
||||
}
|
||||
|
|
|
@ -17,8 +17,11 @@ public:
|
|||
explicit SettingsDialog(QWidget *parent = 0);
|
||||
~SettingsDialog();
|
||||
void SaveSettings();
|
||||
unsigned int lastException;
|
||||
|
||||
private slots:
|
||||
//Manual slots
|
||||
void setLastException(unsigned int exceptionCode);
|
||||
//General
|
||||
void on_btnSave_clicked();
|
||||
//Event tab
|
||||
|
|
Loading…
Reference in New Issue