Load required dependency lib "dbghelp.dll" manually.

This commit is contained in:
Friedemann Kleint
2009-04-17 10:13:41 +02:00
parent 7456e4e514
commit e76943ebb5
2 changed files with 32 additions and 10 deletions

View File

@@ -65,6 +65,7 @@
#define DBGHELP_TRANSLATE_TCHAR #define DBGHELP_TRANSLATE_TCHAR
#include <inc/Dbghelp.h> #include <inc/Dbghelp.h>
static const char *dbgHelpDllC = "dbghelp";
static const char *dbgEngineDllC = "dbgeng"; static const char *dbgEngineDllC = "dbgeng";
static const char *debugCreateFuncC = "DebugCreate"; static const char *debugCreateFuncC = "DebugCreate";
@@ -116,6 +117,12 @@ QString msgComFailed(const char *func, HRESULT hr)
static const char *msgNoStackTraceC = "Internal error: no stack trace present."; static const char *msgNoStackTraceC = "Internal error: no stack trace present.";
static inline QString msgLibLoadFailed(const QString &lib, const QString &why)
{
return CdbDebugEngine::tr("Unable to load the debugger engine library '%1': %2").
arg(lib, why);
}
// ----- Engine helpers // ----- Engine helpers
static inline ULONG getInterruptTimeOutSecs(IDebugControl4 *ctl) static inline ULONG getInterruptTimeOutSecs(IDebugControl4 *ctl)
@@ -143,19 +150,31 @@ DebuggerEngineLibrary::DebuggerEngineLibrary() :
{ {
} }
// Build a lib name as "Path\x.dll"
static inline QString libPath(const QString &libName, const QString &path = QString())
{
QString rc = path;
if (!rc.isEmpty())
rc += QDir::separator();
rc += libName;
rc += QLatin1String(".dll");
return rc;
}
bool DebuggerEngineLibrary::init(const QString &path, QString *errorMessage) bool DebuggerEngineLibrary::init(const QString &path, QString *errorMessage)
{ {
// Load from path // Load the dependent help lib first
QString dllPath = path; const QString helpLibPath = libPath(QLatin1String(dbgHelpDllC), path);
if (!dllPath.isEmpty()) QLibrary helpLib(helpLibPath, 0);
dllPath += QDir::separator(); if (!helpLib.isLoaded() && !helpLib.load()) {
dllPath += QLatin1String(dbgEngineDllC); *errorMessage = msgLibLoadFailed(helpLibPath, helpLib.errorString());
return false;
QLibrary lib(dllPath, 0); }
// Load dbgeng lib
const QString engineLibPath = libPath(QLatin1String(dbgEngineDllC), path);
QLibrary lib(engineLibPath, 0);
if (!lib.isLoaded() && !lib.load()) { if (!lib.isLoaded() && !lib.load()) {
*errorMessage = CdbDebugEngine::tr("Unable to load the debugger engine library '%1': %2"). *errorMessage = msgLibLoadFailed(engineLibPath, lib.errorString());
arg(QLatin1String(dbgEngineDllC), lib.errorString());
return false; return false;
} }
// Locate symbols // Locate symbols

View File

@@ -18,6 +18,9 @@
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QGroupBox" name="cdbOptionsGroupBox"> <widget class="QGroupBox" name="cdbOptionsGroupBox">
<property name="toolTip">
<string>These options take effect at the next start of Qt Creator.</string>
</property>
<property name="title"> <property name="title">
<string>CDB</string> <string>CDB</string>
</property> </property>