forked from qt-creator/qt-creator
debugger: more message channeling
This commit is contained in:
@@ -328,7 +328,7 @@ void CdbDebugEnginePrivate::checkVersion()
|
||||
}
|
||||
// Compare
|
||||
const double minVersion = 6.11;
|
||||
manager()->showDebuggerOutput(LogMisc, CdbDebugEngine::tr("Version: %1").arg(version));
|
||||
showMessage(CdbDebugEngine::tr("Version: %1").arg(version));
|
||||
if (version.toDouble() < minVersion) {
|
||||
const QString msg = CdbDebugEngine::tr(
|
||||
"<html>The installed version of the <i>Debugging Tools for Windows</i> (%1) "
|
||||
@@ -410,7 +410,7 @@ void CdbDebugEngine::startDebugger()
|
||||
// Options
|
||||
QString errorMessage;
|
||||
if (!m_d->setBreakOnThrow(theDebuggerBoolSetting(BreakOnThrow), &errorMessage))
|
||||
manager()->showDebuggerOutput(LogWarning, errorMessage);
|
||||
showMessage(errorMessage, LogWarning);
|
||||
m_d->setVerboseSymbolLoading(m_d->m_options->verboseSymbolLoading);
|
||||
// Figure out dumper. @TODO: same in gdb...
|
||||
const QString dumperLibName = QDir::toNativeSeparators(manager()->qtDumperLibraryName());
|
||||
@@ -532,7 +532,7 @@ void CdbDebugEnginePrivate::processCreatedAttached(ULONG64 processHandle, ULONG6
|
||||
|
||||
void CdbDebugEngine::processTerminated(unsigned long exitCode)
|
||||
{
|
||||
manager()->showDebuggerOutput(LogMisc, tr("The process exited with exit code %1.").arg(exitCode));
|
||||
showMessage(tr("The process exited with exit code %1.").arg(exitCode));
|
||||
if (state() != InferiorStopping)
|
||||
setState(InferiorStopping, Q_FUNC_INFO, __LINE__);
|
||||
setState(InferiorStopped, Q_FUNC_INFO, __LINE__);
|
||||
@@ -612,7 +612,7 @@ void CdbDebugEnginePrivate::endDebugging(EndDebuggingMode em)
|
||||
// Need a stopped debuggee to act
|
||||
if (!endInferior(action, &errorMessage)) {
|
||||
errorMessage = QString::fromLatin1("Unable to detach from/end the debuggee: %1").arg(errorMessage);
|
||||
manager()->showDebuggerOutput(LogError, errorMessage);
|
||||
showMessage(errorMessage, LogError);
|
||||
}
|
||||
errorMessage.clear();
|
||||
}
|
||||
@@ -623,7 +623,7 @@ void CdbDebugEnginePrivate::endDebugging(EndDebuggingMode em)
|
||||
m_engine->setState(DebuggerNotReady, Q_FUNC_INFO, __LINE__);
|
||||
if (!endedCleanly) {
|
||||
errorMessage = QString::fromLatin1("There were errors trying to end debugging:\n%1").arg(errorMessage);
|
||||
manager()->showDebuggerOutput(LogError, errorMessage);
|
||||
showMessage(errorMessage, LogError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -713,7 +713,7 @@ bool CdbDebugEnginePrivate::executeContinueCommand(const QString &command)
|
||||
clearForRun();
|
||||
updateCodeLevel(); // Step by instruction
|
||||
m_engine->setState(InferiorRunningRequested, Q_FUNC_INFO, __LINE__);
|
||||
manager()->showDebuggerOutput(LogMisc, CdbDebugEngine::tr("Continuing with '%1'...").arg(command));
|
||||
showMessage(CdbDebugEngine::tr("Continuing with '%1'...").arg(command));
|
||||
QString errorMessage;
|
||||
const bool success = executeDebuggerCommand(command, &errorMessage);
|
||||
if (success) {
|
||||
@@ -795,7 +795,7 @@ bool CdbDebugEngine::step(unsigned long executionStatus)
|
||||
str << "gu";
|
||||
break;
|
||||
}
|
||||
manager()->showDebuggerOutput(tr("Stepping %1").arg(command));
|
||||
showMessage(tr("Stepping %1").arg(command));
|
||||
const HRESULT hr = m_d->interfaces().debugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, command.toLatin1().constData(), DEBUG_EXECUTE_ECHO);
|
||||
success = SUCCEEDED(hr);
|
||||
if (!success)
|
||||
@@ -931,7 +931,7 @@ void CdbDebugEngine::slotBreakAttachToCrashed()
|
||||
// Force a break when attaching to crashed process (if Creator was not spawned
|
||||
// from handler).
|
||||
if (state() != InferiorStopped) {
|
||||
manager()->showDebuggerOutput(LogMisc, QLatin1String("Forcing break..."));
|
||||
showMessage(QLatin1String("Forcing break..."));
|
||||
m_d->m_dumper->disable();
|
||||
interruptInferior();
|
||||
}
|
||||
@@ -952,7 +952,7 @@ void CdbDebugEngine::interruptInferior()
|
||||
|
||||
void CdbDebugEngine::executeRunToLine(const QString &fileName, int lineNumber)
|
||||
{
|
||||
manager()->showDebuggerOutput(LogMisc, tr("Running up to %1:%2...").arg(fileName).arg(lineNumber));
|
||||
showMessage(tr("Running up to %1:%2...").arg(fileName).arg(lineNumber));
|
||||
QString errorMessage;
|
||||
CdbCore::BreakPoint tempBreakPoint;
|
||||
tempBreakPoint.fileName = fileName;
|
||||
@@ -966,7 +966,7 @@ void CdbDebugEngine::executeRunToLine(const QString &fileName, int lineNumber)
|
||||
|
||||
void CdbDebugEngine::executeRunToFunction(const QString &functionName)
|
||||
{
|
||||
manager()->showDebuggerOutput(LogMisc, tr("Running up to function '%1()'...").arg(functionName));
|
||||
showMessage(tr("Running up to function '%1()'...").arg(functionName));
|
||||
QString errorMessage;
|
||||
CdbCore::BreakPoint tempBreakPoint;
|
||||
tempBreakPoint.funcName = functionName;
|
||||
@@ -1277,10 +1277,10 @@ void CdbDebugEngine::slotConsoleStubTerminated()
|
||||
exitDebugger();
|
||||
}
|
||||
|
||||
void CdbDebugEngine::warning(const QString &w)
|
||||
void CdbDebugEngine::warning(const QString &msg)
|
||||
{
|
||||
manager()->showDebuggerOutput(LogWarning, w);
|
||||
qWarning("%s\n", qPrintable(w));
|
||||
showMessage(msg, LogWarning);
|
||||
qWarning("%s\n", qPrintable(msg));
|
||||
}
|
||||
|
||||
void CdbDebugEnginePrivate::notifyException(long code, bool fatal, const QString &message)
|
||||
@@ -1296,7 +1296,7 @@ void CdbDebugEnginePrivate::notifyException(long code, bool fatal, const QString
|
||||
break;
|
||||
case EXCEPTION_BREAKPOINT:
|
||||
if (m_ignoreInitialBreakPoint && !m_inferiorStartupComplete && m_breakEventMode == BreakEventHandle) {
|
||||
manager()->showDebuggerOutput(LogMisc, CdbDebugEngine::tr("Ignoring initial breakpoint..."));
|
||||
showMessage(CdbDebugEngine::tr("Ignoring initial breakpoint..."));
|
||||
m_breakEventMode = BreakEventIgnoreOnce;
|
||||
}
|
||||
break;
|
||||
@@ -1356,7 +1356,7 @@ void CdbDebugEnginePrivate::handleDebugEvent()
|
||||
const QString msg = m_interrupted ?
|
||||
CdbDebugEngine::tr("Interrupted in thread %1, current thread: %2").arg(m_interruptArticifialThreadId).arg(m_currentThreadId) :
|
||||
CdbDebugEngine::tr("Stopped, current thread: %1").arg(m_currentThreadId);
|
||||
manager()->showDebuggerOutput(LogMisc, msg);
|
||||
showMessage(msg);
|
||||
const int threadIndex = threadIndexById(threadsHandler, m_currentThreadId);
|
||||
if (threadIndex != -1)
|
||||
threadsHandler->setCurrentThread(threadIndex);
|
||||
|
@@ -79,8 +79,8 @@ STDMETHODIMP CdbDebugEventCallback::Exception(
|
||||
const bool fatal = isFatalException(Exception->ExceptionCode);
|
||||
if (debugCDB)
|
||||
qDebug() << Q_FUNC_INFO << "\nex=" << Exception->ExceptionCode << " fatal=" << fatal << msg;
|
||||
m_pEngine->manager()->showApplicationOutput(msg, true);
|
||||
m_pEngine->manager()->showDebuggerOutput(LogMisc, msg);
|
||||
m_pEngine->showMessage(msg, AppError);
|
||||
m_pEngine->showMessage(msg, LogMisc);
|
||||
m_pEngine->m_d->notifyException(Exception->ExceptionCode, fatal, msg);
|
||||
return S_OK;
|
||||
}
|
||||
@@ -207,11 +207,10 @@ STDMETHODIMP CdbDebugEventCallback::SystemError(
|
||||
|
||||
// -----------ExceptionLoggerEventCallback
|
||||
CdbExceptionLoggerEventCallback::CdbExceptionLoggerEventCallback(int logChannel,
|
||||
bool skipNonFatalExceptions,
|
||||
DebuggerManager *manager) :
|
||||
bool skipNonFatalExceptions, CdbDebugEngine *engine) :
|
||||
m_logChannel(logChannel),
|
||||
m_skipNonFatalExceptions(skipNonFatalExceptions),
|
||||
m_manager(manager)
|
||||
m_engine(engine)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -228,15 +227,15 @@ STDMETHODIMP CdbExceptionLoggerEventCallback::Exception(
|
||||
)
|
||||
{
|
||||
const bool recordException = !m_skipNonFatalExceptions || isFatalException(Exception->ExceptionCode);
|
||||
QString message;
|
||||
formatException(Exception, QTextStream(&message));
|
||||
QString msg;
|
||||
formatException(Exception, QTextStream(&msg));
|
||||
if (recordException) {
|
||||
m_exceptionCodes.push_back(Exception->ExceptionCode);
|
||||
m_exceptionMessages.push_back(message);
|
||||
m_exceptionMessages.push_back(msg);
|
||||
}
|
||||
if (debugCDB)
|
||||
qDebug() << Q_FUNC_INFO << '\n' << message;
|
||||
m_manager->showDebuggerOutput(m_logChannel, message);
|
||||
qDebug() << Q_FUNC_INFO << '\n' << msg;
|
||||
m_engine->showMessage(msg, m_logChannel);
|
||||
if (recordException)
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
return S_OK;
|
||||
|
@@ -35,8 +35,6 @@
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
namespace Debugger {
|
||||
class DebuggerManager;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class CdbDebugEngine;
|
||||
@@ -129,7 +127,7 @@ class CdbExceptionLoggerEventCallback : public CdbCore::DebugEventCallbackBase
|
||||
public:
|
||||
CdbExceptionLoggerEventCallback(int logChannel,
|
||||
bool skipNonFatalExceptions,
|
||||
DebuggerManager *access);
|
||||
CdbDebugEngine *engine);
|
||||
|
||||
STDMETHOD(GetInterestMask)(
|
||||
THIS_
|
||||
@@ -149,7 +147,7 @@ public:
|
||||
private:
|
||||
const int m_logChannel;
|
||||
const bool m_skipNonFatalExceptions;
|
||||
DebuggerManager *m_manager;
|
||||
CdbDebugEngine *m_engine;
|
||||
QList<ULONG> m_exceptionCodes;
|
||||
QStringList m_exceptionMessages;
|
||||
};
|
||||
|
@@ -99,7 +99,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(CdbDebugEngine *manager,
|
||||
CdbCore::CoreEngine *engine,
|
||||
unsigned long threadId,
|
||||
const QString &moduleName,
|
||||
@@ -231,10 +231,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)),
|
||||
h.m_engine, SLOT(showMessage(int,QString)),
|
||||
Qt::QueuedConnection);
|
||||
QEventLoop eventLoop;
|
||||
connect(&thread, SIGNAL(finished()), &eventLoop, SLOT(quit()), Qt::QueuedConnection);
|
||||
@@ -243,14 +243,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;
|
||||
@@ -293,13 +293,13 @@ void CdbDumperInitThread ::run()
|
||||
|
||||
// ------------------- CdbDumperHelper
|
||||
|
||||
CdbDumperHelper::CdbDumperHelper(DebuggerManager *manager,
|
||||
CdbDumperHelper::CdbDumperHelper(CdbDebugEngine *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),
|
||||
@@ -320,7 +320,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;
|
||||
}
|
||||
|
||||
@@ -359,7 +359,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)) {
|
||||
@@ -367,7 +367,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;
|
||||
@@ -375,7 +375,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;
|
||||
}
|
||||
@@ -397,7 +397,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;
|
||||
}
|
||||
@@ -493,7 +493,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
|
||||
@@ -630,7 +631,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;
|
||||
}
|
||||
|
||||
@@ -647,7 +648,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)
|
||||
@@ -659,7 +660,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;
|
||||
}
|
||||
|
||||
|
@@ -85,7 +85,7 @@ public:
|
||||
Initialized, // List of types, etc. retrieved
|
||||
};
|
||||
|
||||
explicit CdbDumperHelper(DebuggerManager *manager,
|
||||
explicit CdbDumperHelper(CdbDebugEngine *engine,
|
||||
CdbCore::CoreEngine *coreEngine);
|
||||
~CdbDumperHelper();
|
||||
|
||||
@@ -139,7 +139,7 @@ private:
|
||||
const QString m_msgDisabled;
|
||||
const QString m_msgNotInScope;
|
||||
State m_state;
|
||||
DebuggerManager *m_manager;
|
||||
CdbDebugEngine *m_engine;
|
||||
CdbCore::CoreEngine *m_coreEngine;
|
||||
|
||||
QString m_library;
|
||||
|
Reference in New Issue
Block a user