From 7959460ffb7b5aa3931bc4493e7871e972a514a2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <qtc-committer@nokia.com> Date: Fri, 20 Feb 2009 14:56:36 +0100 Subject: [PATCH] Start experimental VS debugger support --- src/plugins/debugger/cdbdebugengine.cpp | 37 ++++++++++++++----- src/plugins/debugger/cdbdebugengine.h | 10 +++-- .../debugger/cdbdebugeventcallback.cpp | 36 +++++++++--------- src/plugins/debugger/cdbdebugeventcallback.h | 2 +- src/plugins/debugger/cdbdebugoutput.cpp | 10 ++--- src/plugins/debugger/debugger.pro | 19 ++++++++-- src/plugins/debugger/debuggermanager.cpp | 7 +++- src/plugins/debugger/debuggermanager.h | 7 ++-- 8 files changed, 83 insertions(+), 45 deletions(-) diff --git a/src/plugins/debugger/cdbdebugengine.cpp b/src/plugins/debugger/cdbdebugengine.cpp index f7e8c6cb560..486ac253cc3 100644 --- a/src/plugins/debugger/cdbdebugengine.cpp +++ b/src/plugins/debugger/cdbdebugengine.cpp @@ -11,12 +11,11 @@ #include <QFileInfo> #define DBGHELP_TRANSLATE_TCHAR -#include <Dbghelp.h> +#include <inc/Dbghelp.h> using namespace Debugger; using namespace Debugger::Internal; - CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent) : IDebuggerEngine(parent), m_hDebuggeeProcess(0), @@ -84,7 +83,7 @@ void CdbDebugEngine::shutdown() exitDebugger(); } -void CdbDebugEngine::setToolTipExpression(const QPoint &pos, const QString &exp) +void CdbDebugEngine::setToolTipExpression(const QPoint & /*pos*/, const QString & /*exp*/) { } @@ -110,7 +109,7 @@ bool CdbDebugEngine::startDebugger() m_pDebugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS); //m_pDebugSymbols->AddSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS | SYMOPT_NO_IMAGE_SEARCH); - if (q->startMode() == q->attachExternal) { + if (q->startMode() == DebuggerManager::AttachExternal) { qWarning("CdbDebugEngine: attach to process not yet implemented!"); } else { hr = m_pDebugClient->CreateProcess2Wide(NULL, @@ -225,11 +224,6 @@ void CdbDebugEngine::continueInferior() qq->notifyInferiorRunning(); } -void CdbDebugEngine::runInferior() -{ - continueInferior(); -} - void CdbDebugEngine::interruptInferior() { //TODO: better use IDebugControl::SetInterrupt? @@ -244,18 +238,25 @@ void CdbDebugEngine::interruptInferior() void CdbDebugEngine::runToLineExec(const QString &fileName, int lineNumber) { + Q_UNUSED(fileName) + Q_UNUSED(lineNumber) } void CdbDebugEngine::runToFunctionExec(const QString &functionName) { + Q_UNUSED(functionName) } void CdbDebugEngine::jumpToLineExec(const QString &fileName, int lineNumber) { + Q_UNUSED(fileName) + Q_UNUSED(lineNumber) } void CdbDebugEngine::assignValueInDebugger(const QString &expr, const QString &value) { + Q_UNUSED(expr) + Q_UNUSED(value) } void CdbDebugEngine::executeDebuggerCommand(const QString &/*command*/) @@ -352,6 +353,7 @@ void CdbDebugEngine::reloadModules() void CdbDebugEngine::loadSymbols(const QString &moduleName) { + Q_UNUSED(moduleName) } void CdbDebugEngine::loadAllSymbols() @@ -506,11 +508,12 @@ void CdbDebugEngine::updateStackTrace() void CdbDebugEngine::handleDebugOutput(const char* szOutputString) { - qq->showApplicationOutput("app-dbgoutput", QString::fromLocal8Bit(szOutputString)); + qq->showApplicationOutput(QString::fromLocal8Bit(szOutputString)); } void CdbDebugEngine::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP) { + Q_UNUSED(pBP) qDebug() << "CdbDebugEngine::handleBreakpointEvent()"; } @@ -518,3 +521,17 @@ IDebuggerEngine *createWinEngine(DebuggerManager *parent) { return new CdbDebugEngine(parent); } + +void CdbDebugEngine::setDebugDumpers(bool on) +{ + Q_UNUSED(on) +} + +void CdbDebugEngine::setUseCustomDumpers(bool on) +{ + Q_UNUSED(on) +} + +void CdbDebugEngine::reloadSourceFiles() +{ +} diff --git a/src/plugins/debugger/cdbdebugengine.h b/src/plugins/debugger/cdbdebugengine.h index c78b6585ae3..bea545596de 100644 --- a/src/plugins/debugger/cdbdebugengine.h +++ b/src/plugins/debugger/cdbdebugengine.h @@ -5,8 +5,6 @@ #include "cdbdebugeventcallback.h" #include "cdbdebugoutput.h" -#include <windows.h> - namespace Debugger { namespace Internal { @@ -32,8 +30,7 @@ public: virtual void stepIExec(); virtual void nextIExec(); - virtual void continueInferior(); - virtual void runInferior(); + virtual void continueInferior(); virtual void interruptInferior(); virtual void runToLineExec(const QString &fileName, int lineNumber); @@ -58,6 +55,11 @@ public: virtual void reloadRegisters(); + virtual void setDebugDumpers(bool on); + virtual void setUseCustomDumpers(bool on); + + virtual void reloadSourceFiles(); + protected: void timerEvent(QTimerEvent*); diff --git a/src/plugins/debugger/cdbdebugeventcallback.cpp b/src/plugins/debugger/cdbdebugeventcallback.cpp index b9d01198b39..893b8d9ab55 100644 --- a/src/plugins/debugger/cdbdebugeventcallback.cpp +++ b/src/plugins/debugger/cdbdebugeventcallback.cpp @@ -1,5 +1,5 @@ #include "cdbdebugeventcallback.h" -#include "cdbcdebugengine.h" +#include "cdbdebugengine.h" #include "debuggermanager.h" #include <QtCore/QDebug> @@ -7,7 +7,7 @@ namespace Debugger { namespace Internal { -STDMETHODIMP MSVCDebugEventCallback::QueryInterface( +STDMETHODIMP CdbDebugEventCallback::QueryInterface( THIS_ IN REFIID InterfaceId, OUT PVOID* Interface) @@ -27,21 +27,21 @@ STDMETHODIMP MSVCDebugEventCallback::QueryInterface( } } -STDMETHODIMP_(ULONG) MSVCDebugEventCallback::AddRef(THIS) +STDMETHODIMP_(ULONG) CdbDebugEventCallback::AddRef(THIS) { // This class is designed to be static so // there's no true refcount. return 1; } -STDMETHODIMP_(ULONG) MSVCDebugEventCallback::Release(THIS) +STDMETHODIMP_(ULONG) CdbDebugEventCallback::Release(THIS) { // This class is designed to be static so // there's no true refcount. return 0; } -STDMETHODIMP MSVCDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask) +STDMETHODIMP CdbDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask) { *mask = DEBUG_EVENT_CREATE_PROCESS | DEBUG_EVENT_EXIT_PROCESS //| DEBUG_EVENT_CREATE_THREAD | DEBUG_EVENT_EXIT_THREAD @@ -51,14 +51,14 @@ STDMETHODIMP MSVCDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask) return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::Breakpoint(THIS_ __in PDEBUG_BREAKPOINT Bp) +STDMETHODIMP CdbDebugEventCallback::Breakpoint(THIS_ __in PDEBUG_BREAKPOINT Bp) { qDebug() << "MSVCDebugEventCallback::Breakpoint"; m_pEngine->handleBreakpointEvent(Bp); return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::Exception( +STDMETHODIMP CdbDebugEventCallback::Exception( THIS_ __in PEXCEPTION_RECORD64 Exception, __in ULONG FirstChance @@ -68,7 +68,7 @@ STDMETHODIMP MSVCDebugEventCallback::Exception( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::CreateThread( +STDMETHODIMP CdbDebugEventCallback::CreateThread( THIS_ __in ULONG64 Handle, __in ULONG64 DataOffset, @@ -82,7 +82,7 @@ STDMETHODIMP MSVCDebugEventCallback::CreateThread( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::ExitThread( +STDMETHODIMP CdbDebugEventCallback::ExitThread( THIS_ __in ULONG ExitCode ) @@ -90,7 +90,7 @@ STDMETHODIMP MSVCDebugEventCallback::ExitThread( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::CreateProcess( +STDMETHODIMP CdbDebugEventCallback::CreateProcess( THIS_ __in ULONG64 ImageFileHandle, __in ULONG64 Handle, @@ -120,7 +120,7 @@ STDMETHODIMP MSVCDebugEventCallback::CreateProcess( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::ExitProcess( +STDMETHODIMP CdbDebugEventCallback::ExitProcess( THIS_ __in ULONG ExitCode ) @@ -132,7 +132,7 @@ STDMETHODIMP MSVCDebugEventCallback::ExitProcess( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::LoadModule( +STDMETHODIMP CdbDebugEventCallback::LoadModule( THIS_ __in ULONG64 ImageFileHandle, __in ULONG64 BaseOffset, @@ -146,7 +146,7 @@ STDMETHODIMP MSVCDebugEventCallback::LoadModule( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::UnloadModule( +STDMETHODIMP CdbDebugEventCallback::UnloadModule( THIS_ __in_opt PCSTR ImageBaseName, __in ULONG64 BaseOffset @@ -155,7 +155,7 @@ STDMETHODIMP MSVCDebugEventCallback::UnloadModule( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::SystemError( +STDMETHODIMP CdbDebugEventCallback::SystemError( THIS_ __in ULONG Error, __in ULONG Level @@ -164,7 +164,7 @@ STDMETHODIMP MSVCDebugEventCallback::SystemError( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::SessionStatus( +STDMETHODIMP CdbDebugEventCallback::SessionStatus( THIS_ __in ULONG Status ) @@ -172,7 +172,7 @@ STDMETHODIMP MSVCDebugEventCallback::SessionStatus( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::ChangeDebuggeeState( +STDMETHODIMP CdbDebugEventCallback::ChangeDebuggeeState( THIS_ __in ULONG Flags, __in ULONG64 Argument @@ -181,7 +181,7 @@ STDMETHODIMP MSVCDebugEventCallback::ChangeDebuggeeState( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::ChangeEngineState( +STDMETHODIMP CdbDebugEventCallback::ChangeEngineState( THIS_ __in ULONG Flags, __in ULONG64 Argument @@ -190,7 +190,7 @@ STDMETHODIMP MSVCDebugEventCallback::ChangeEngineState( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::ChangeSymbolState( +STDMETHODIMP CdbDebugEventCallback::ChangeSymbolState( THIS_ __in ULONG Flags, __in ULONG64 Argument diff --git a/src/plugins/debugger/cdbdebugeventcallback.h b/src/plugins/debugger/cdbdebugeventcallback.h index c28ee87e48f..f9fa3e11c32 100644 --- a/src/plugins/debugger/cdbdebugeventcallback.h +++ b/src/plugins/debugger/cdbdebugeventcallback.h @@ -2,7 +2,7 @@ #define DEBUGGER_CDBDEBUGEVENTCALLBACK_H #include <windows.h> -#include <dbgeng.h> +#include <inc/dbgeng.h> namespace Debugger { namespace Internal { diff --git a/src/plugins/debugger/cdbdebugoutput.cpp b/src/plugins/debugger/cdbdebugoutput.cpp index 135e78c28d5..94bc33cd254 100644 --- a/src/plugins/debugger/cdbdebugoutput.cpp +++ b/src/plugins/debugger/cdbdebugoutput.cpp @@ -1,5 +1,5 @@ #include <windows.h> -#include <dbgeng.h> +#include <inc/dbgeng.h> #include "cdbdebugoutput.h" #include "cdbdebugengine.h" @@ -7,7 +7,7 @@ namespace Debugger { namespace Internal { -STDMETHODIMP MSVCDebugOutput::QueryInterface( +STDMETHODIMP CdbDebugOutput::QueryInterface( THIS_ IN REFIID InterfaceId, OUT PVOID* Interface @@ -28,21 +28,21 @@ STDMETHODIMP MSVCDebugOutput::QueryInterface( } } -STDMETHODIMP_(ULONG) MSVCDebugOutput::AddRef(THIS) +STDMETHODIMP_(ULONG) CdbDebugOutput::AddRef(THIS) { // This class is designed to be static so // there's no true refcount. return 1; } -STDMETHODIMP_(ULONG) MSVCDebugOutput::Release(THIS) +STDMETHODIMP_(ULONG) CdbDebugOutput::Release(THIS) { // This class is designed to be static so // there's no true refcount. return 0; } -STDMETHODIMP MSVCDebugOutput::Output( +STDMETHODIMP CdbDebugOutput::Output( THIS_ IN ULONG mask, IN PCSTR text diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index 0d1b11e1888..fe5a0ce428d 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -85,7 +85,20 @@ HEADERS += $$PWD/modeltest.h DEFINES += USE_MODEL_TEST=1 } -false { +win32 { +# ---- Detect Debugging Tools For Windows + +CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows/sdk" + +exists ($$CDB_PATH) { +message("Experimental: Adding support for $$CDB_PATH") + +DEFINES+=CDB_ENABLED + +CDB_PLATFORM=i386 + +INCLUDEPATH+=$$CDB_PATH +CDB_LIBPATH=$$CDB_PATH/lib/$$CDB_PLATFORM HEADERS += \ cdbdebugengine.h \ @@ -97,7 +110,7 @@ SOURCES += \ cdbdebugeventcallback.cpp \ cdbdebugoutput.cpp -LIBS += dbgeng.lib +LIBS += -L$$CDB_LIBPATH Dbghelp.lib dbgeng.lib } - +} diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 0bc4b47c5c3..89bb091bf59 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -132,7 +132,12 @@ static IDebuggerEngine *winEngine = 0; static IDebuggerEngine *scriptEngine = 0; extern IDebuggerEngine *createGdbEngine(DebuggerManager *parent); -extern IDebuggerEngine *createWinEngine(DebuggerManager *) { return 0; } +extern IDebuggerEngine *createWinEngine(DebuggerManager *) +#ifdef CDB_ENABLED +; +#else +{ return 0; } +#endif extern IDebuggerEngine *createScriptEngine(DebuggerManager *parent); DebuggerManager::DebuggerManager() diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 18d5475e728..0c7ae0e0bd0 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -110,7 +110,7 @@ enum DebuggerStatus class IDebuggerEngine; class GdbEngine; class ScriptEngine; -class WinEngine; +class CdbDebugEngine; // The construct below is not nice but enforces a bit of order. The // DebuggerManager interfaces a lots of thing: The DebuggerPlugin, @@ -131,10 +131,11 @@ public: private: // This is the part of the interface that's exclusively seen by the - // debugger engines. + // debugger enginesfriend class GdbEngine;. friend class GdbEngine; + friend class CdbDebugEngine; + friend class CdbDebugEventCallback; friend class ScriptEngine; - friend class WinEngine; // called from the engines after successful startup virtual void notifyInferiorStopRequested() = 0; -- GitLab