1
0
Fork 0

Show current debug engine in the version string

This commit is contained in:
Duncan Ogilvie 2020-09-20 19:59:59 +02:00
parent 6518994beb
commit 5a0caf0be0
5 changed files with 57 additions and 28 deletions

View File

@ -1097,6 +1097,11 @@ BRIDGE_IMPEXP void DbgGetSymbolInfo(const SYMBOLPTR* symbolptr, SYMBOLINFO* info
_dbg_sendmessage(DBG_GET_SYMBOL_INFO, (void*)symbolptr, info); _dbg_sendmessage(DBG_GET_SYMBOL_INFO, (void*)symbolptr, info);
} }
BRIDGE_IMPEXP DEBUG_ENGINE DbgGetDebugEngine()
{
return (DEBUG_ENGINE)_dbg_sendmessage(DBG_GET_DEBUG_ENGINE, nullptr, nullptr);
}
BRIDGE_IMPEXP const char* GuiTranslateText(const char* Source) BRIDGE_IMPEXP const char* GuiTranslateText(const char* Source)
{ {
EnterCriticalSection(&csTranslate); EnterCriticalSection(&csTranslate);

View File

@ -319,6 +319,7 @@ typedef enum
DBG_ANALYZE_FUNCTION, // param1=BridgeCFGraphList* graph, param2=duint entry DBG_ANALYZE_FUNCTION, // param1=BridgeCFGraphList* graph, param2=duint entry
DBG_MENU_PREPARE, // param1=int hMenu, param2=unused DBG_MENU_PREPARE, // param1=int hMenu, param2=unused
DBG_GET_SYMBOL_INFO, // param1=void* symbol, param2=SYMBOLINFO* info DBG_GET_SYMBOL_INFO, // param1=void* symbol, param2=SYMBOLINFO* info
DBG_GET_DEBUG_ENGINE, // param1=unused, param2-unused
} DBGMSG; } DBGMSG;
typedef enum typedef enum
@ -519,6 +520,13 @@ typedef enum
mod_system mod_system
} MODULEPARTY; } MODULEPARTY;
typedef enum
{
DebugEngineTitanEngine,
DebugEngineGleeBug,
DebugEngineStaticEngine,
} DEBUG_ENGINE;
//Debugger typedefs //Debugger typedefs
typedef MEMORY_SIZE VALUE_SIZE; typedef MEMORY_SIZE VALUE_SIZE;
@ -1046,6 +1054,7 @@ BRIDGE_IMPEXP duint DbgGetTebAddress(DWORD ThreadId);
BRIDGE_IMPEXP bool DbgAnalyzeFunction(duint entry, BridgeCFGraphList* graph); BRIDGE_IMPEXP bool DbgAnalyzeFunction(duint entry, BridgeCFGraphList* graph);
BRIDGE_IMPEXP duint DbgEval(const char* expression, bool* DEFAULT_PARAM(success, nullptr)); BRIDGE_IMPEXP duint DbgEval(const char* expression, bool* DEFAULT_PARAM(success, nullptr));
BRIDGE_IMPEXP void DbgGetSymbolInfo(const SYMBOLPTR* symbolptr, SYMBOLINFO* info); BRIDGE_IMPEXP void DbgGetSymbolInfo(const SYMBOLPTR* symbolptr, SYMBOLINFO* info);
BRIDGE_IMPEXP DEBUG_ENGINE DbgGetDebugEngine();
//Gui defines //Gui defines
typedef enum typedef enum

View File

@ -876,6 +876,7 @@ extern "C" DLL_EXPORT duint _dbg_sendmessage(DBGMSG type, void* param1, void* pa
case DBG_WIN_EVENT_GLOBAL: case DBG_WIN_EVENT_GLOBAL:
case DBG_RELEASE_ENCODE_TYPE_BUFFER: case DBG_RELEASE_ENCODE_TYPE_BUFFER:
case DBG_GET_TIME_WASTED_COUNTER: case DBG_GET_TIME_WASTED_COUNTER:
case DBG_GET_DEBUG_ENGINE:
break; break;
//the rest is unsafe -> throw an exception when people try to call them //the rest is unsafe -> throw an exception when people try to call them
default: default:
@ -1485,6 +1486,25 @@ extern "C" DLL_EXPORT duint _dbg_sendmessage(DBGMSG type, void* param1, void* pa
((const SymbolInfoGui*)symbolptr->symbol)->convertToGuiSymbol(symbolptr->modbase, (SYMBOLINFO*)param2); ((const SymbolInfoGui*)symbolptr->symbol)->convertToGuiSymbol(symbolptr->modbase, (SYMBOLINFO*)param2);
} }
break; break;
case DBG_GET_DEBUG_ENGINE:
{
static auto debugEngine = []
{
duint setting = DebugEngineTitanEngine;
if(!BridgeSettingGetUint("Engine", "DebugEngine", &setting))
{
auto msg = String(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "GleeBug is now available for beta testing, would you like to enable it? Some bugs can be expected, but generally things are looking stable!\n\nYou can change this setting in the Settings dialog.")));
auto title = String(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "New debug engine available!")));
if(MessageBoxW(GuiGetWindowHandle(), StringUtils::Utf8ToUtf16(msg).c_str(), StringUtils::Utf8ToUtf16(title).c_str(), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES)
setting = DebugEngineGleeBug;
BridgeSettingSetUint("Engine", "DebugEngine", setting);
}
return (DEBUG_ENGINE)setting;
}();
return debugEngine;
}
break;
} }
return 0; return 0;
} }

View File

@ -624,39 +624,18 @@ static FARPROC WINAPI delayHook(unsigned dliNotify, PDelayLoadInfo pdli)
{ {
if(dliNotify == dliNotePreLoadLibrary && _stricmp(pdli->szDll, "TitanEngine.dll") == 0) if(dliNotify == dliNotePreLoadLibrary && _stricmp(pdli->szDll, "TitanEngine.dll") == 0)
{ {
enum DebugEngine : duint
{
TitanEngine,
GleeBug,
StaticEngine,
};
static DebugEngine debugEngine = []
{
duint setting = TitanEngine;
if(!BridgeSettingGetUint("Engine", "DebugEngine", &setting))
{
auto msg = String(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "GleeBug is now available for beta testing, would you like to enable it? Some bugs can be expected, but generally things are looking stable!\n\nYou can change this setting in the Settings dialog.")));
auto title = String(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "New debug engine available!")));
if(MessageBoxW(GuiGetWindowHandle(), StringUtils::Utf8ToUtf16(msg).c_str(), StringUtils::Utf8ToUtf16(title).c_str(), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES)
setting = GleeBug;
BridgeSettingSetUint("Engine", "DebugEngine", setting);
}
return (DebugEngine)setting;
}();
String fullPath = szProgramDir; String fullPath = szProgramDir;
fullPath += '\\'; fullPath += '\\';
switch(debugEngine) switch(DbgGetDebugEngine())
{ {
case GleeBug: case DebugEngineGleeBug:
fullPath += "GleeBug\\TitanEngine.dll"; fullPath += "GleeBug\\TitanEngine.dll";
break; break;
case StaticEngine: case DebugEngineStaticEngine:
fullPath += "StaticEngine\\TitanEngine.dll"; fullPath += "StaticEngine\\TitanEngine.dll";
break; break;
case TitanEngine: case DebugEngineTitanEngine:
default: default:
return 0; return 0;
} }

View File

@ -61,9 +61,25 @@ MainWindow::MainWindow(QWidget* parent)
ui->setupUi(this); ui->setupUi(this);
// Build information // Build information
QAction* buildInfo = new QAction(ToDateString(GetCompileDate()), this); {
const char* debugEngine = []
{
switch(DbgGetDebugEngine())
{
case DebugEngineTitanEngine:
return "TitanEngine";
case DebugEngineGleeBug:
return "GleeBug";
case DebugEngineStaticEngine:
return "StaticEngine";
}
return "";
}();
QAction* buildInfo = new QAction(tr("%1 (%2)").arg(ToDateString(GetCompileDate())).arg(debugEngine), this);
buildInfo->setEnabled(false); buildInfo->setEnabled(false);
ui->menuBar->addAction(buildInfo); ui->menuBar->addAction(buildInfo);
}
// Setup bridge signals // Setup bridge signals
connect(Bridge::getBridge(), SIGNAL(updateWindowTitle(QString)), this, SLOT(updateWindowTitleSlot(QString))); connect(Bridge::getBridge(), SIGNAL(updateWindowTitle(QString)), this, SLOT(updateWindowTitleSlot(QString)));