Execute script automatically on attach or initialize (#1026)
* Use last codepage conveniently * 1. fix bug: "inc" and "dec" commands have no effect. 2. fix bug: "bswap" command cannot execute when not debugging. 3. fix bug: app crash when displaying a variable smaller than 15. 4. new feature: script timeout 5. new feature: execute script when the debuggee initializes at the system breakpoint. * Add settings for initialzation script and HelpOnSymbolicNameUrl * fix
This commit is contained in:
parent
0bdf861461
commit
ec43781a10
|
@ -343,4 +343,6 @@ void dbgfunctionsinit()
|
|||
_dbgfunctions.GetDbgEvents = dbggetdbgevents;
|
||||
_dbgfunctions.MemIsCodePage = MemIsCodePage;
|
||||
_dbgfunctions.AnimateCommand = _dbg_animatecommand;
|
||||
_dbgfunctions.DbgSetDebuggeeInitScript = dbgsetdebuggeeinitscript;
|
||||
_dbgfunctions.DbgGetDebuggeeInitScript = dbggetdebuggeeinitscript;
|
||||
}
|
||||
|
|
|
@ -147,6 +147,8 @@ typedef void (*MODSETPARTY)(duint base, int party);
|
|||
typedef bool(*WATCHISWATCHDOGTRIGGERED)(unsigned int id);
|
||||
typedef bool(*MEMISCODEPAGE)(duint addr, bool refresh);
|
||||
typedef bool(*ANIMATECOMMAND)(const char* command);
|
||||
typedef void(*DBGSETDEBUGGEEINITSCRIPT)(const char* fileName);
|
||||
typedef const char* (*DBGGETDEBUGGEEINITSCRIPT)();
|
||||
|
||||
typedef struct DBGFUNCTIONS_
|
||||
{
|
||||
|
@ -203,6 +205,8 @@ typedef struct DBGFUNCTIONS_
|
|||
WATCHISWATCHDOGTRIGGERED WatchIsWatchdogTriggered;
|
||||
MEMISCODEPAGE MemIsCodePage;
|
||||
ANIMATECOMMAND AnimateCommand;
|
||||
DBGSETDEBUGGEEINITSCRIPT DbgSetDebuggeeInitScript;
|
||||
DBGGETDEBUGGEEINITSCRIPT DbgGetDebuggeeInitScript;
|
||||
} DBGFUNCTIONS;
|
||||
|
||||
#ifdef BUILD_DBG
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "encodemap.h"
|
||||
#include "plugin_loader.h"
|
||||
#include "argument.h"
|
||||
#include "debugger.h"
|
||||
|
||||
/**
|
||||
\brief Directory where program databases are stored (usually in \db). UTF-8 encoding.
|
||||
|
@ -71,6 +72,13 @@ void DbSave(DbLoadSaveType saveType)
|
|||
BridgeFree(text);
|
||||
}
|
||||
|
||||
//save initialization script
|
||||
const char* initscript = dbggetdebuggeeinitscript();
|
||||
if(initscript[0] != 0)
|
||||
{
|
||||
json_object_set_new(root, "initscript", json_string(initscript));
|
||||
}
|
||||
|
||||
//plugin data
|
||||
PLUG_CB_LOADSAVEDB pluginSaveDb;
|
||||
// Some plugins may wish to change this value so that all plugins after his or her plugin will save data into plugin-supplied storage instead of the system's.
|
||||
|
@ -204,6 +212,10 @@ void DbLoad(DbLoadSaveType loadType)
|
|||
const char* text = json_string_value(json_object_get(root, "notes"));
|
||||
GuiSetDebuggeeNotes(text);
|
||||
|
||||
// Initialization script
|
||||
text = json_string_value(json_object_get(root, "initscript"));
|
||||
dbgsetdebuggeeinitscript(text);
|
||||
|
||||
// Plugins
|
||||
JSON pluginRoot = json_object_get(root, "plugins");
|
||||
if(pluginRoot)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "historycontext.h"
|
||||
#include "taskthread.h"
|
||||
#include "animate.h"
|
||||
#include "simplescript.h"
|
||||
|
||||
struct TraceCondition
|
||||
{
|
||||
|
@ -75,6 +76,7 @@ static bool bStopDumpRefreshThread = false;
|
|||
static String lastDebugText;
|
||||
static duint timeWastedDebugging = 0;
|
||||
static EXCEPTION_DEBUG_INFO lastExceptionInfo = { 0 };
|
||||
static char szDebuggeeInitializationScript[MAX_PATH] = "";
|
||||
char szFileName[MAX_PATH] = "";
|
||||
char szSymbolCachePath[MAX_PATH] = "";
|
||||
char sqlitedb[deflen] = "";
|
||||
|
@ -530,21 +532,23 @@ static void printHwBpInfo(const BREAKPOINT & bp)
|
|||
|
||||
static void printMemBpInfo(const BREAKPOINT & bp, const void* ExceptionAddress)
|
||||
{
|
||||
const char* bptype = "";
|
||||
char* bptype;
|
||||
switch(bp.titantype)
|
||||
{
|
||||
case UE_MEMORY_READ:
|
||||
bptype = " (read)";
|
||||
bptype = _strdup(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", " (read)")));
|
||||
break;
|
||||
case UE_MEMORY_WRITE:
|
||||
bptype = " (write)";
|
||||
bptype = _strdup(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", " (write)")));
|
||||
break;
|
||||
case UE_MEMORY_EXECUTE:
|
||||
bptype = " (execute)";
|
||||
bptype = _strdup(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", " (execute)")));
|
||||
break;
|
||||
case UE_MEMORY:
|
||||
bptype = " (read/write/execute)";
|
||||
bptype = _strdup(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", " (read/write/execute)")));
|
||||
break;
|
||||
default:
|
||||
bptype = _strdup("");
|
||||
}
|
||||
auto symbolicname = SymGetSymbolicName(bp.addr);
|
||||
if(symbolicname.length())
|
||||
|
@ -561,6 +565,7 @@ static void printMemBpInfo(const BREAKPOINT & bp, const void* ExceptionAddress)
|
|||
else
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Memory breakpoint%s at %p (%p)!\n"), bptype, bp.addr, ExceptionAddress);
|
||||
}
|
||||
free(bptype);
|
||||
}
|
||||
|
||||
static bool getConditionValue(const char* expression)
|
||||
|
@ -1336,17 +1341,51 @@ static void cbSystemBreakpoint(void* ExceptionData) // TODO: System breakpoint e
|
|||
callbackInfo.reserved = 0;
|
||||
plugincbcall(CB_SYSTEMBREAKPOINT, &callbackInfo);
|
||||
|
||||
lock(WAITID_RUN); // Allow the user to run a script file now
|
||||
if(bIsAttached ? settingboolget("Events", "AttachBreakpoint") : settingboolget("Events", "SystemBreakpoint"))
|
||||
{
|
||||
//lock
|
||||
GuiSetDebugStateAsync(paused);
|
||||
lock(WAITID_RUN);
|
||||
// Plugin callback
|
||||
PLUG_CB_PAUSEDEBUG pauseInfo = { nullptr };
|
||||
plugincbcall(CB_PAUSEDEBUG, &pauseInfo);
|
||||
SetForegroundWindow(GuiGetWindowHandle());
|
||||
wait(WAITID_RUN);
|
||||
char script[MAX_SETTING_SIZE];
|
||||
if(BridgeSettingGet("Engine", "InitializeScript", script)) // Global script file
|
||||
{
|
||||
if(scriptLoadSync(script) == 0)
|
||||
scriptRunSync((void*)0);
|
||||
else
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Error: Cannot load global initialization script."));
|
||||
}
|
||||
if(szDebuggeeInitializationScript[0] != 0)
|
||||
{
|
||||
if(scriptLoadSync(szDebuggeeInitializationScript) == 0)
|
||||
scriptRunSync((void*)0);
|
||||
else
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Error: Cannot load debuggee initialization script."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char script[MAX_SETTING_SIZE];
|
||||
if(BridgeSettingGet("Engine", "InitializeScript", script)) // Global script file
|
||||
{
|
||||
if(scriptLoadSync(script) == 0)
|
||||
scriptRunSync((void*)0);
|
||||
else
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Error: Cannot load global initialization script."));
|
||||
}
|
||||
if(szDebuggeeInitializationScript[0] != 0)
|
||||
{
|
||||
if(scriptLoadSync(szDebuggeeInitializationScript) == 0)
|
||||
scriptRunSync((void*)0);
|
||||
else
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Error: Cannot load debuggee initialization script."));
|
||||
}
|
||||
unlock(WAITID_RUN);
|
||||
}
|
||||
wait(WAITID_RUN);
|
||||
}
|
||||
|
||||
static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
|
||||
|
@ -1356,7 +1395,7 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
|
|||
|
||||
char DLLDebugFileName[deflen] = "";
|
||||
if(!GetFileNameFromHandle(LoadDll->hFile, DLLDebugFileName))
|
||||
strcpy_s(DLLDebugFileName, "??? (GetFileNameFromHandle failed)");
|
||||
strcpy_s(DLLDebugFileName, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "??? (GetFileNameFromHandle failed)")));
|
||||
|
||||
SafeSymLoadModuleExW(fdProcessInfo->hProcess, LoadDll->hFile, StringUtils::Utf8ToUtf16(DLLDebugFileName).c_str(), 0, (DWORD64)base, 0, 0, 0);
|
||||
IMAGEHLP_MODULEW64 modInfo;
|
||||
|
@ -2522,6 +2561,19 @@ static void debugLoopFunction(void* lpParameter, bool attach)
|
|||
isDetachedByUser = false;
|
||||
}
|
||||
|
||||
void dbgsetdebuggeeinitscript(const char* fileName)
|
||||
{
|
||||
if(fileName)
|
||||
strcpy_s(szDebuggeeInitializationScript, fileName);
|
||||
else
|
||||
szDebuggeeInitializationScript[0] = 0;
|
||||
}
|
||||
|
||||
const char* dbggetdebuggeeinitscript()
|
||||
{
|
||||
return szDebuggeeInitializationScript;
|
||||
}
|
||||
|
||||
DWORD WINAPI threadDebugLoop(void* lpParameter)
|
||||
{
|
||||
debugLoopFunction(lpParameter, false);
|
||||
|
|
|
@ -108,6 +108,8 @@ duint dbggetdebuggedbase();
|
|||
duint dbggetdbgevents();
|
||||
bool dbgsettracecondition(String expression, duint maxCount);
|
||||
bool dbgtraceactive();
|
||||
void dbgsetdebuggeeinitscript(const char* fileName);
|
||||
const char* dbggetdebuggeeinitscript();
|
||||
|
||||
void cbStep();
|
||||
void cbRtrStep();
|
||||
|
|
|
@ -183,7 +183,7 @@ static bool scriptcreatelinemap(const char* filename)
|
|||
if(!*cur.u.label || !strcmp(cur.u.label, "\"\"")) //no label text
|
||||
{
|
||||
char message[256] = "";
|
||||
sprintf(message, "Empty label detected on line %d!", i + 1);
|
||||
sprintf(message, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Empty label detected on line %d!")), i + 1);
|
||||
GuiScriptError(0, message);
|
||||
std::vector<LINEMAPENTRY>().swap(linemap);
|
||||
return false;
|
||||
|
@ -192,7 +192,7 @@ static bool scriptcreatelinemap(const char* filename)
|
|||
if(foundlabel) //label defined twice
|
||||
{
|
||||
char message[256] = "";
|
||||
sprintf(message, "Duplicate label \"%s\" detected on lines %d and %d!", cur.u.label, foundlabel, i + 1);
|
||||
sprintf(message, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Duplicate label \"%s\" detected on lines %d and %d!")), cur.u.label, foundlabel, i + 1);
|
||||
GuiScriptError(0, message);
|
||||
std::vector<LINEMAPENTRY>().swap(linemap);
|
||||
return false;
|
||||
|
@ -233,7 +233,7 @@ static bool scriptcreatelinemap(const char* filename)
|
|||
if(!labelline) //invalid branch label
|
||||
{
|
||||
char message[256] = "";
|
||||
sprintf(message, "Invalid branch label \"%s\" detected on line %d!", currentLine.u.branch.branchlabel, i + 1);
|
||||
sprintf(message, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Invalid branch label \"%s\" detected on line %d!")), currentLine.u.branch.branchlabel, i + 1);
|
||||
GuiScriptError(0, message);
|
||||
std::vector<LINEMAPENTRY>().swap(linemap);
|
||||
return false;
|
||||
|
@ -399,7 +399,7 @@ static bool scriptinternalcmd()
|
|||
break;
|
||||
case STATUS_ERROR:
|
||||
bContinue = false;
|
||||
GuiScriptError(scriptIp, "Error executing command!");
|
||||
GuiScriptError(scriptIp, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Error executing command!")));
|
||||
break;
|
||||
case STATUS_EXIT:
|
||||
bContinue = false;
|
||||
|
@ -423,7 +423,7 @@ static bool scriptinternalcmd()
|
|||
return bContinue;
|
||||
}
|
||||
|
||||
static DWORD WINAPI scriptRunThread(void* arg)
|
||||
DWORD WINAPI scriptRunSync(void* arg)
|
||||
{
|
||||
int destline = (int)(duint)arg;
|
||||
if(!destline || destline > (int)linemap.size()) //invalid line
|
||||
|
@ -439,6 +439,9 @@ static DWORD WINAPI scriptRunThread(void* arg)
|
|||
scriptIp--;
|
||||
scriptIp = scriptinternalstep(scriptIp);
|
||||
bool bContinue = true;
|
||||
bool bIgnoreTimeout = settingboolget("Engine", "NoScriptTimeout");
|
||||
unsigned long long kernelTime, userTime;
|
||||
FILETIME creationTime, exitTime; // unused
|
||||
while(bContinue && !bAbort) //run loop
|
||||
{
|
||||
bContinue = scriptinternalcmd();
|
||||
|
@ -451,14 +454,26 @@ static DWORD WINAPI scriptRunThread(void* arg)
|
|||
scriptIp = scriptinternalstep(scriptIp); //this is the next ip
|
||||
if(scriptinternalbpget(scriptIp)) //breakpoint=stop run loop
|
||||
bContinue = false;
|
||||
Sleep(1); //don't fry the processor
|
||||
if(bContinue && !bIgnoreTimeout && GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, reinterpret_cast<LPFILETIME>(&kernelTime), reinterpret_cast<LPFILETIME>(&userTime)) != 0)
|
||||
{
|
||||
if(userTime + kernelTime >= 10 * 10000000) // time out in 10 seconds of CPU time
|
||||
{
|
||||
if(GuiScriptMsgyn(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "The script is too busy. Would you like to terminate it now?"))) != 0)
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Script is terminated by user."));
|
||||
break;
|
||||
}
|
||||
else
|
||||
bIgnoreTimeout = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
bIsRunning = false; //not running anymore
|
||||
GuiScriptSetIp(scriptIp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD WINAPI scriptLoadThread(void* filename)
|
||||
DWORD WINAPI scriptLoadSync(void* filename)
|
||||
{
|
||||
GuiScriptClear();
|
||||
GuiScriptEnableHighlighting(true); //enable default script syntax highlighting
|
||||
|
@ -466,10 +481,10 @@ static DWORD WINAPI scriptLoadThread(void* filename)
|
|||
std::vector<SCRIPTBP>().swap(scriptbplist); //clear breakpoints
|
||||
std::vector<int>().swap(scriptstack); //clear script stack
|
||||
bAbort = false;
|
||||
if(!scriptcreatelinemap((const char*)filename))
|
||||
return 0;
|
||||
if(!scriptcreatelinemap(reinterpret_cast<const char*>(filename)))
|
||||
return 1; // Script load failed
|
||||
int lines = (int)linemap.size();
|
||||
const char** script = (const char**)BridgeAlloc(lines * sizeof(const char*));
|
||||
const char** script = reinterpret_cast<const char**>(BridgeAlloc(lines * sizeof(const char*)));
|
||||
for(int i = 0; i < lines; i++) //add script lines
|
||||
script[i] = linemap.at(i).raw;
|
||||
GuiScriptAdd(lines, script);
|
||||
|
@ -482,7 +497,7 @@ void scriptload(const char* filename)
|
|||
{
|
||||
static char filename_[MAX_PATH] = "";
|
||||
strcpy_s(filename_, filename);
|
||||
CloseHandle(CreateThread(0, 0, scriptLoadThread, filename_, 0, 0));
|
||||
CloseHandle(CreateThread(0, 0, scriptLoadSync, filename_, 0, 0));
|
||||
}
|
||||
|
||||
void scriptunload()
|
||||
|
@ -497,13 +512,13 @@ void scriptrun(int destline)
|
|||
{
|
||||
if(DbgIsDebugging() && dbgisrunning())
|
||||
{
|
||||
GuiScriptError(0, "Debugger must be paused to run a script!");
|
||||
GuiScriptError(0, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Debugger must be paused to run a script!")));
|
||||
return;
|
||||
}
|
||||
if(bIsRunning) //already running
|
||||
return;
|
||||
bIsRunning = true;
|
||||
CloseHandle(CreateThread(0, 0, scriptRunThread, (void*)(duint)destline, 0, 0));
|
||||
CloseHandle(CreateThread(0, 0, scriptRunSync, (void*)(duint)destline, 0, 0));
|
||||
}
|
||||
|
||||
DWORD WINAPI scriptStepThread(void* param)
|
||||
|
@ -636,7 +651,7 @@ CMDRESULT cbScriptMsg(int argc, char* argv[])
|
|||
{
|
||||
if(argc < 2)
|
||||
{
|
||||
dputs("not enough arguments!");
|
||||
dputs(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "not enough arguments!")));
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
GuiScriptMessage(stringformatinline(argv[1]).c_str());
|
||||
|
@ -647,7 +662,7 @@ CMDRESULT cbScriptMsgyn(int argc, char* argv[])
|
|||
{
|
||||
if(argc < 2)
|
||||
{
|
||||
dputs("not enough arguments!");
|
||||
dputs(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "not enough arguments!")));
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
varset("$RESULT", GuiScriptMsgyn(stringformatinline(argv[1]).c_str()), false);
|
||||
|
|
|
@ -36,6 +36,8 @@ SCRIPTLINETYPE scriptgetlinetype(int line);
|
|||
void scriptsetip(int line);
|
||||
void scriptreset();
|
||||
bool scriptgetbranchinfo(int line, SCRIPTBRANCH* info);
|
||||
DWORD WINAPI scriptLoadSync(void* filename); // Load script synchronized
|
||||
DWORD WINAPI scriptRunSync(void* arg);
|
||||
|
||||
//script commands
|
||||
CMDRESULT cbScriptLoad(int argc, char* argv[]);
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "CPUMultiDump.h"
|
||||
#include "CPUStack.h"
|
||||
#include "GotoDialog.h"
|
||||
#include "BrowseDialog.h"
|
||||
#include "main.h"
|
||||
|
||||
QString MainWindow::windowTitle = "";
|
||||
|
@ -329,6 +330,7 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
connect(ui->actionAnimateInto, SIGNAL(triggered()), this, SLOT(animateIntoSlot()));
|
||||
connect(ui->actionAnimateOver, SIGNAL(triggered()), this, SLOT(animateOverSlot()));
|
||||
connect(ui->actionAnimateCommand, SIGNAL(triggered()), this, SLOT(animateCommandSlot()));
|
||||
connect(ui->actionSetInitializationScript, SIGNAL(triggered()), this, SLOT(setInitialzationScript()));
|
||||
|
||||
connect(mCpuWidget->getDisasmWidget(), SIGNAL(updateWindowTitle(QString)), this, SLOT(updateWindowTitleSlot(QString)));
|
||||
connect(mCpuWidget->getDisasmWidget(), SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidget()));
|
||||
|
@ -1676,3 +1678,25 @@ void MainWindow::animateCommandSlot()
|
|||
if(SimpleInputBox(this, tr("Animate command"), "", command, tr("Example: StepInto")))
|
||||
DbgFunctions()->AnimateCommand(command.toUtf8().constData());
|
||||
}
|
||||
|
||||
void MainWindow::setInitialzationScript()
|
||||
{
|
||||
QString global, debuggee;
|
||||
char globalChar[MAX_SETTING_SIZE];
|
||||
if(DbgIsDebugging())
|
||||
{
|
||||
debuggee = QString::fromUtf8(DbgFunctions()->DbgGetDebuggeeInitScript());
|
||||
BrowseDialog browseScript(this, tr("Set Initialzation Script for Debuggee"), tr("Set Initialzation Script for Debuggee"), tr("Script files (*.txt *.scr);;All files (*.*)"), debuggee, false);
|
||||
if(browseScript.exec() == QDialog::Accepted)
|
||||
DbgFunctions()->DbgSetDebuggeeInitScript(browseScript.path.toUtf8().constData());
|
||||
}
|
||||
if(BridgeSettingGet("Engine", "InitializeScript", globalChar))
|
||||
global = QString::fromUtf8(globalChar);
|
||||
else
|
||||
global = QString();
|
||||
BrowseDialog browseScript(this, tr("Set Global Initialzation Script"), tr("Set Global Initialzation Script"), tr("Script files (*.txt *.scr);;All files (*.*)"), global, false);
|
||||
if(browseScript.exec() == QDialog::Accepted)
|
||||
{
|
||||
BridgeSettingSet("Engine", "InitializeScript", browseScript.path.toUtf8().constData());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,6 +135,7 @@ public slots:
|
|||
void updateFavouriteTools();
|
||||
void clickFavouriteTool();
|
||||
void chooseLanguage();
|
||||
void setInitialzationScript();
|
||||
void addFavouriteItem(int type, const QString & name, const QString & description);
|
||||
void setFavouriteItemShortcut(int type, const QString & name, const QString & shortcut);
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@
|
|||
<addaction name="actionShortcuts"/>
|
||||
<addaction name="actionTopmost"/>
|
||||
<addaction name="actionReloadStylesheet"/>
|
||||
<addaction name="actionSetInitializationScript"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuFavourites">
|
||||
<property name="title">
|
||||
|
@ -1022,6 +1023,11 @@
|
|||
<string>Animate command...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSetInitializationScript">
|
||||
<property name="text">
|
||||
<string>Set Initialization Script</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
|
|
@ -57,6 +57,7 @@ void SettingsDialog::LoadSettings()
|
|||
settings.engineUndecorateSymbolNames = true;
|
||||
settings.engineEnableSourceDebugging = true;
|
||||
settings.engineEnableTraceRecordDuringTrace = true;
|
||||
settings.engineNoScriptTimeout = false;
|
||||
settings.exceptionRanges = &realExceptionRanges;
|
||||
settings.disasmArgumentSpaces = false;
|
||||
settings.disasmMemorySpaces = false;
|
||||
|
@ -118,6 +119,7 @@ void SettingsDialog::LoadSettings()
|
|||
GetSettingBool("Engine", "DisableDatabaseCompression", &settings.engineDisableDatabaseCompression);
|
||||
GetSettingBool("Engine", "TraceRecordEnabledDuringTrace", &settings.engineEnableTraceRecordDuringTrace);
|
||||
GetSettingBool("Engine", "SkipInt3Stepping", &settings.engineSkipInt3Stepping);
|
||||
GetSettingBool("Engine", "NoScriptTimeout", &settings.engineNoScriptTimeout);
|
||||
switch(settings.engineCalcType)
|
||||
{
|
||||
case calc_signed:
|
||||
|
@ -146,6 +148,7 @@ void SettingsDialog::LoadSettings()
|
|||
ui->chkDisableDatabaseCompression->setChecked(settings.engineDisableDatabaseCompression);
|
||||
ui->chkTraceRecordEnabledDuringTrace->setChecked(settings.engineEnableTraceRecordDuringTrace);
|
||||
ui->chkSkipInt3Stepping->setChecked(settings.engineSkipInt3Stepping);
|
||||
ui->chkNoScriptTimeout->setChecked(settings.engineNoScriptTimeout);
|
||||
|
||||
//Exceptions tab
|
||||
char exceptionRange[MAX_SETTING_SIZE] = "";
|
||||
|
@ -233,15 +236,17 @@ void SettingsDialog::LoadSettings()
|
|||
}
|
||||
char setting[MAX_SETTING_SIZE] = "";
|
||||
if(BridgeSettingGet("Symbols", "DefaultStore", setting))
|
||||
ui->editSymbolStore->setText(QString(setting));
|
||||
ui->editSymbolStore->setText(QString::fromUtf8(setting));
|
||||
else
|
||||
{
|
||||
QString defaultStore = "http://msdl.microsoft.com/download/symbols";
|
||||
QString defaultStore("http://msdl.microsoft.com/download/symbols");
|
||||
ui->editSymbolStore->setText(defaultStore);
|
||||
BridgeSettingSet("Symbols", "DefaultStore", defaultStore.toUtf8().constData());
|
||||
}
|
||||
if(BridgeSettingGet("Symbols", "CachePath", setting))
|
||||
ui->editSymbolCache->setText(QString(setting));
|
||||
ui->editSymbolCache->setText(QString::fromUtf8(setting));
|
||||
if(BridgeSettingGet("Misc", "HelpOnSymbolicNameUrl", setting))
|
||||
ui->editHelpOnSymbolicNameUrl->setText(QString::fromUtf8(setting));
|
||||
|
||||
bJitOld = settings.miscSetJIT;
|
||||
bJitAutoOld = settings.miscSetJITAuto;
|
||||
|
@ -275,6 +280,7 @@ void SettingsDialog::SaveSettings()
|
|||
BridgeSettingSetUint("Engine", "DisableDatabaseCompression", settings.engineDisableDatabaseCompression);
|
||||
BridgeSettingSetUint("Engine", "TraceRecordEnabledDuringTrace", settings.engineEnableTraceRecordDuringTrace);
|
||||
BridgeSettingSetUint("Engine", "SkipInt3Stepping", settings.engineSkipInt3Stepping);
|
||||
BridgeSettingSetUint("Engine", "NoScriptTimeout", settings.engineNoScriptTimeout);
|
||||
|
||||
//Exceptions tab
|
||||
QString exceptionRange = "";
|
||||
|
@ -305,23 +311,24 @@ void SettingsDialog::SaveSettings()
|
|||
if(bJitOld != settings.miscSetJIT)
|
||||
{
|
||||
if(settings.miscSetJIT)
|
||||
DbgCmdExecDirect("setjit oldsave");
|
||||
DbgCmdExec("setjit oldsave");
|
||||
else
|
||||
DbgCmdExecDirect("setjit restore");
|
||||
DbgCmdExec("setjit restore");
|
||||
}
|
||||
|
||||
if(bJitAutoOld != settings.miscSetJITAuto)
|
||||
{
|
||||
if(!settings.miscSetJITAuto)
|
||||
DbgCmdExecDirect("setjitauto on");
|
||||
DbgCmdExec("setjitauto on");
|
||||
else
|
||||
DbgCmdExecDirect("setjitauto off");
|
||||
DbgCmdExec("setjitauto off");
|
||||
}
|
||||
}
|
||||
if(settings.miscSymbolStore)
|
||||
BridgeSettingSet("Symbols", "DefaultStore", ui->editSymbolStore->text().toUtf8().constData());
|
||||
if(settings.miscSymbolCache)
|
||||
BridgeSettingSet("Symbols", "CachePath", ui->editSymbolCache->text().toUtf8().constData());
|
||||
BridgeSettingSet("Misc", "HelpOnSymbolicNameUrl", ui->editHelpOnSymbolicNameUrl->text().toUtf8().constData());
|
||||
|
||||
BridgeSettingSetUint("Miscellaneous", "LoadSaveTabOrder", settings.miscLoadSaveTabOrder);
|
||||
|
||||
|
@ -477,42 +484,27 @@ void SettingsDialog::on_chkSetJIT_stateChanged(int arg1)
|
|||
|
||||
void SettingsDialog::on_chkDllLoad_stateChanged(int arg1)
|
||||
{
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.eventDllLoad = false;
|
||||
else
|
||||
settings.eventDllLoad = true;
|
||||
settings.eventDllLoad = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkDllUnload_stateChanged(int arg1)
|
||||
{
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.eventDllUnload = false;
|
||||
else
|
||||
settings.eventDllUnload = true;
|
||||
settings.eventDllUnload = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkThreadStart_stateChanged(int arg1)
|
||||
{
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.eventThreadStart = false;
|
||||
else
|
||||
settings.eventThreadStart = true;
|
||||
settings.eventThreadStart = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkThreadEnd_stateChanged(int arg1)
|
||||
{
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.eventThreadEnd = false;
|
||||
else
|
||||
settings.eventThreadEnd = true;
|
||||
settings.eventThreadEnd = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkDebugStrings_stateChanged(int arg1)
|
||||
{
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.eventDebugStrings = false;
|
||||
else
|
||||
settings.eventDebugStrings = true;
|
||||
settings.eventDebugStrings = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_radioUnsigned_clicked()
|
||||
|
@ -617,36 +609,24 @@ void SettingsDialog::on_btnAddLast_clicked()
|
|||
void SettingsDialog::on_chkArgumentSpaces_stateChanged(int arg1)
|
||||
{
|
||||
bTokenizerConfigUpdated = true;
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.disasmArgumentSpaces = false;
|
||||
else
|
||||
settings.disasmArgumentSpaces = true;
|
||||
settings.disasmArgumentSpaces = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkMemorySpaces_stateChanged(int arg1)
|
||||
{
|
||||
bTokenizerConfigUpdated = true;
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.disasmMemorySpaces = false;
|
||||
else
|
||||
settings.disasmMemorySpaces = true;
|
||||
settings.disasmMemorySpaces = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkUppercase_stateChanged(int arg1)
|
||||
{
|
||||
bTokenizerConfigUpdated = true;
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.disasmUppercase = false;
|
||||
else
|
||||
settings.disasmUppercase = true;
|
||||
settings.disasmUppercase = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkOnlyCipAutoComments_stateChanged(int arg1)
|
||||
{
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.disasmOnlyCipAutoComments = false;
|
||||
else
|
||||
settings.disasmOnlyCipAutoComments = true;
|
||||
settings.disasmOnlyCipAutoComments = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkTabBetweenMnemonicAndArguments_stateChanged(int arg1)
|
||||
|
@ -669,28 +649,18 @@ void SettingsDialog::on_editSymbolCache_textEdited(const QString & arg1)
|
|||
|
||||
void SettingsDialog::on_chkSaveLoadTabOrder_stateChanged(int arg1)
|
||||
{
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.miscLoadSaveTabOrder = false;
|
||||
else
|
||||
settings.miscLoadSaveTabOrder = true;
|
||||
|
||||
settings.miscLoadSaveTabOrder = arg1 != Qt::Unchecked;
|
||||
emit chkSaveLoadTabOrderStateChanged((bool)arg1);
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkFpuRegistersLittleEndian_stateChanged(int arg1)
|
||||
{
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.guiFpuRegistersLittleEndian = false;
|
||||
else
|
||||
settings.guiFpuRegistersLittleEndian = true;
|
||||
settings.guiFpuRegistersLittleEndian = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkSaveColumnOrder_stateChanged(int arg1)
|
||||
{
|
||||
if(arg1 == Qt::Unchecked)
|
||||
settings.guiSaveColumnOrder = false;
|
||||
else
|
||||
settings.guiSaveColumnOrder = true;
|
||||
settings.guiSaveColumnOrder = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkNoCloseDialog_toggled(bool checked)
|
||||
|
@ -707,3 +677,8 @@ void SettingsDialog::on_chkPidInHex_clicked(bool checked)
|
|||
{
|
||||
settings.guiPidInHex = checked;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkNoScriptTimeout_stateChanged(int arg1)
|
||||
{
|
||||
settings.engineNoScriptTimeout = arg1 != Qt::Unchecked;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ private slots:
|
|||
void on_chkSaveDatabaseInProgramDirectory_stateChanged(int arg1);
|
||||
void on_chkTraceRecordEnabledDuringTrace_stateChanged(int arg1);
|
||||
void on_chkSkipInt3Stepping_toggled(bool checked);
|
||||
void on_chkNoScriptTimeout_stateChanged(int arg1);
|
||||
//Exception tab
|
||||
void on_btnAddRange_clicked();
|
||||
void on_btnDeleteRange_clicked();
|
||||
|
@ -127,6 +128,7 @@ private:
|
|||
bool engineDisableDatabaseCompression;
|
||||
bool engineEnableTraceRecordDuringTrace;
|
||||
bool engineSkipInt3Stepping;
|
||||
bool engineNoScriptTimeout;
|
||||
//Exception Tab
|
||||
QList<RangeStruct>* exceptionRanges;
|
||||
//Disasm Tab
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>381</width>
|
||||
<height>325</height>
|
||||
<height>420</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -296,6 +296,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkNoScriptTimeout">
|
||||
<property name="text">
|
||||
<string>No Script Timeout Warning</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -487,6 +494,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkSaveLoadTabOrder">
|
||||
<property name="text">
|
||||
<string>Enable Load/Save Tab Order</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
|
@ -581,10 +595,15 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkSaveLoadTabOrder">
|
||||
<property name="text">
|
||||
<string>Enable Load/Save Tab Order</string>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Search Engine URL</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editHelpOnSymbolicNameUrl"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Loading…
Reference in New Issue