Commit 743a83b6 authored by Joerg Bornemann's avatar Joerg Bornemann
Browse files

cdb plugin: fix borked merge

parent f580db95
......@@ -29,7 +29,8 @@
#include "cdbdumperhelper.h"
#include "cdbmodules.h"
#include "cdbdebugengine_p.h"
#include "cdbengine.h"
#include "cdbengine_p.h"
#include "cdbdebugoutput.h"
#include "cdbdebugeventcallback.h"
#include "cdbsymbolgroupcontext.h"
......@@ -99,7 +100,7 @@ namespace Internal {
// the QtCored4.pdb file to be present as we need "qstrdup"
// as dummy symbol. This is ok ATM since dumpers only
// make sense for Qt apps.
static bool debuggeeLoadLibrary(DebuggerManager *manager,
static bool debuggeeLoadLibrary(CdbEngine *cdbEngine,
CdbCore::CoreEngine *engine,
unsigned long threadId,
const QString &moduleName,
......@@ -108,7 +109,8 @@ static bool debuggeeLoadLibrary(DebuggerManager *manager,
if (loadDebug > 1)
qDebug() << Q_FUNC_INFO << moduleName;
// Try to ignore the breakpoints, skip stray startup-complete trap exceptions
QSharedPointer<CdbExceptionLoggerEventCallback> exLogger(new CdbExceptionLoggerEventCallback(LogWarning, true, manager));
QSharedPointer<CdbExceptionLoggerEventCallback>
exLogger(new CdbExceptionLoggerEventCallback(LogWarning, true, cdbEngine));
CdbCore::EventCallbackRedirector eventRedir(engine, exLogger);
Q_UNUSED(eventRedir)
// Make a call to LoadLibraryA. First, reserve memory in debugger
......@@ -196,7 +198,7 @@ public:
virtual void run();
signals:
void logMessage(int channel, const QString &m);
void logMessage(const QString &m, int channel);
void statusMessage(const QString &m, int timeOut);
private:
......@@ -231,10 +233,10 @@ bool CdbDumperInitThread::ensureDumperInitialized(CdbDumperHelper &h, QString *e
QApplication::setOverrideCursor(Qt::BusyCursor);
CdbDumperInitThread thread(h, errorMessage);
connect(&thread, SIGNAL(statusMessage(QString,int)),
h.m_manager, SLOT(showStatusMessage(QString,int)),
h.m_engine, SLOT(showStatusMessage(QString,int)),
Qt::QueuedConnection);
connect(&thread, SIGNAL(logMessage(int,QString)),
h.m_manager, SLOT(showDebuggerOutput(int,QString)),
connect(&thread, SIGNAL(logMessage(QString,int)),
h.m_engine, SLOT(showMessage(QString,int)),
Qt::QueuedConnection);
QEventLoop eventLoop;
connect(&thread, SIGNAL(finished()), &eventLoop, SLOT(quit()), Qt::QueuedConnection);
......@@ -243,14 +245,14 @@ bool CdbDumperInitThread::ensureDumperInitialized(CdbDumperHelper &h, QString *e
eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
QApplication::restoreOverrideCursor();
if (thread.m_ok) {
h.m_manager->showStatusMessage(QCoreApplication::translate("Debugger::Internal::CdbDumperHelper", "Stopped / Custom dumper library initialized."), messageTimeOut);
h.m_manager->showDebuggerOutput(LogMisc, h.m_helper.toString());
h.m_engine->showStatusMessage(QCoreApplication::translate("Debugger::Internal::CdbDumperHelper", "Stopped / Custom dumper library initialized."), messageTimeOut);
h.m_engine->showMessage(h.m_helper.toString());
h.m_state = CdbDumperHelper::Initialized;
} else {
h.m_state = CdbDumperHelper::Disabled; // No message here
*errorMessage = QCoreApplication::translate("Debugger::Internal::CdbDumperHelper", "The custom dumper library could not be initialized: %1").arg(*errorMessage);
h.m_manager->showStatusMessage(*errorMessage, messageTimeOut);
h.m_manager->showQtDumperLibraryWarning(*errorMessage);
h.m_engine->showStatusMessage(*errorMessage, messageTimeOut);
h.m_engine->showQtDumperLibraryWarning(*errorMessage);
}
if (loadDebug)
qDebug() << Q_FUNC_INFO << '\n' << thread.m_ok;
......@@ -269,7 +271,7 @@ void CdbDumperInitThread ::run()
switch (m_helper.initCallLoad(m_errorMessage)) {
case CdbDumperHelper::CallLoadOk:
case CdbDumperHelper::CallLoadAlreadyLoaded:
emit logMessage(LogMisc, msgLoadSucceeded(m_helper.m_library, false));
emit logMessage(msgLoadSucceeded(m_helper.m_library, false), LogMisc);
m_helper.m_state = CdbDumperHelper::Loaded;
break;
case CdbDumperHelper::CallLoadError:
......@@ -277,7 +279,7 @@ void CdbDumperInitThread ::run()
m_ok = false;
return;
case CdbDumperHelper::CallLoadNoQtApp:
emit logMessage(LogMisc, QCoreApplication::translate("Debugger::Internal::CdbDumperHelper", "The debuggee does not appear to be Qt application."));
emit logMessage(QCoreApplication::translate("Debugger::Internal::CdbDumperHelper", "The debuggee does not appear to be Qt application."), LogMisc);
m_helper.m_state = CdbDumperHelper::Disabled; // No message here
m_ok = true;
return;
......@@ -293,13 +295,13 @@ void CdbDumperInitThread ::run()
// ------------------- CdbDumperHelper
CdbDumperHelper::CdbDumperHelper(DebuggerManager *manager,
CdbDumperHelper::CdbDumperHelper(CdbEngine *engine,
CdbCore::CoreEngine *coreEngine) :
m_tryInjectLoad(true),
m_msgDisabled(QLatin1String("Dumpers are disabled")),
m_msgNotInScope(QLatin1String("Data not in scope")),
m_state(NotLoaded),
m_manager(manager),
m_engine(engine),
m_coreEngine(coreEngine),
m_inBufferAddress(0),
m_inBufferSize(0),
......@@ -321,7 +323,7 @@ void CdbDumperHelper::disable()
{
if (loadDebug)
qDebug() << Q_FUNC_INFO;
m_manager->showDebuggerOutput(LogMisc, QCoreApplication::translate("Debugger::Internal::CdbDumperHelper", "Disabling dumpers due to debuggee crash..."));
m_engine->showMessage(QCoreApplication::translate("Debugger::Internal::CdbDumperHelper", "Disabling dumpers due to debuggee crash..."));
m_state = Disabled;
}
......@@ -360,7 +362,7 @@ void CdbDumperHelper::moduleLoadHook(const QString &module, HANDLE debuggeeHandl
// for the thread to finish as this would lock up.
if (m_tryInjectLoad && module.contains(QLatin1String("Qt"), Qt::CaseInsensitive)) {
// Also shows up in the log window.
m_manager->showStatusMessage(msgLoading(m_library, true), messageTimeOut);
m_engine->showMessage(msgLoading(m_library, true), StatusBar, messageTimeOut);
QString errorMessage;
SharedLibraryInjector sh(GetProcessId(debuggeeHandle));
if (sh.remoteInject(m_library, false, &errorMessage)) {
......@@ -368,7 +370,7 @@ void CdbDumperHelper::moduleLoadHook(const QString &module, HANDLE debuggeeHandl
} else {
m_state = InjectLoadFailed;
// Ok, try call loading...
m_manager->showDebuggerOutput(LogMisc, msgLoadFailed(m_library, true, errorMessage));
m_engine->showMessage(msgLoadFailed(m_library, true, errorMessage));
}
}
break;
......@@ -376,7 +378,7 @@ void CdbDumperHelper::moduleLoadHook(const QString &module, HANDLE debuggeeHandl
// check if gdbmacros.dll loaded
if (module.contains(QLatin1String(dumperModuleNameC), Qt::CaseInsensitive)) {
m_state = Loaded;
m_manager->showDebuggerOutput(LogMisc, msgLoadSucceeded(m_library, true));
m_engine->showMessage(msgLoadSucceeded(m_library, true));
}
break;
}
......@@ -398,7 +400,7 @@ CdbDumperHelper::CallLoadResult CdbDumperHelper::initCallLoad(QString *errorMess
if (modules.filter(QLatin1String(qtCoreModuleNameC), Qt::CaseInsensitive).isEmpty())
return CallLoadNoQtApp;
// Try to load
if (!debuggeeLoadLibrary(m_manager, m_coreEngine, m_dumperCallThread, m_library, errorMessage))
if (!debuggeeLoadLibrary(m_engine, m_coreEngine, m_dumperCallThread, m_library, errorMessage))
return CallLoadError;
return CallLoadOk;
}
......@@ -440,9 +442,9 @@ bool CdbDumperHelper::initResolveSymbols(QString *errorMessage)
// There is a 'qDumpInBuffer' in QtCore as well.
if (loadDebug)
qDebug() << Q_FUNC_INFO;
bool rc;
const QString dumperModuleName = QLatin1String(dumperModuleNameC);
QString inBufferSymbol, outBufferSymbol;
bool rc;
if (m_fastSymbolResolution) {
// Symbols in the debugging helpers are never namespaced.
m_dumpObjectSymbol = dumperModuleName + QLatin1String("!qDumpObjectData440");
......@@ -453,7 +455,8 @@ bool CdbDumperHelper::initResolveSymbols(QString *errorMessage)
m_dumpObjectSymbol = QLatin1String("*qDumpObjectData440");
inBufferSymbol = QLatin1String("*qDumpInBuffer");
outBufferSymbol = QLatin1String("*qDumpOutBuffer");
bool rc = resolveSymbol(m_coreEngine->interfaces().debugSymbols, &m_dumpObjectSymbol, errorMessage) == ResolveSymbolOk
rc = resolveSymbol(m_coreEngine->interfaces().debugSymbols, &m_dumpObjectSymbol, errorMessage) == ResolveSymbolOk
&& resolveSymbol(m_coreEngine->interfaces().debugSymbols, dumperModuleName, &inBufferSymbol, errorMessage) == ResolveSymbolOk
&& resolveSymbol(m_coreEngine->interfaces().debugSymbols, dumperModuleName, &outBufferSymbol, errorMessage) == ResolveSymbolOk;
if (!rc)
......@@ -504,7 +507,8 @@ CdbDumperHelper::CallResult
{
*outDataPtr = 0;
// Skip stray startup-complete trap exceptions.
QSharedPointer<CdbExceptionLoggerEventCallback> exLogger(new CdbExceptionLoggerEventCallback(LogWarning, true, m_manager));
QSharedPointer<CdbExceptionLoggerEventCallback> exLogger(new
CdbExceptionLoggerEventCallback(LogWarning, true, m_engine));
CdbCore::EventCallbackRedirector eventRedir(m_coreEngine, exLogger);
Q_UNUSED(eventRedir)
// write input buffer
......@@ -641,7 +645,7 @@ CdbDumperHelper::DumpResult CdbDumperHelper::dumpTypeI(const WatchData &wd, bool
// Ensure types are parsed and known.
if (!CdbDumperInitThread::ensureDumperInitialized(*this, errorMessage)) {
*errorMessage = msgDumpFailed(wd, errorMessage);
m_manager->showDebuggerOutput(LogError, *errorMessage);
m_engine->showMessage(*errorMessage, LogError);
return DumpError;
}
......@@ -658,7 +662,7 @@ CdbDumperHelper::DumpResult CdbDumperHelper::dumpTypeI(const WatchData &wd, bool
const QString message = QCoreApplication::translate("Debugger::Internal::CdbDumperHelper",
"Querying dumpers for '%1'/'%2' (%3)").
arg(QString::fromLatin1(wd.iname), wd.exp, wd.type);
m_manager->showDebuggerOutput(LogMisc, message);
m_engine->showMessage(message);
const DumpExecuteResult der = executeDump(wd, td, dumpChildren, result, errorMessage);
if (der == DumpExecuteOk)
......@@ -670,7 +674,7 @@ CdbDumperHelper::DumpResult CdbDumperHelper::dumpTypeI(const WatchData &wd, bool
}
// log error
*errorMessage = msgDumpFailed(wd, errorMessage);
m_manager->showDebuggerOutput(LogWarning, *errorMessage);
m_engine->showMessage(*errorMessage, LogWarning);
return DumpError;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment