From bb146f4da0cac390815b740c61827e7746419437 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 9 Feb 2009 13:07:38 +0100 Subject: [PATCH] Fixes: cdbdebugger: some cosmetics --- ...msvcdebugengine.cpp => cdbdebugengine.cpp} | 94 +++++++++---------- .../{msvcdebugengine.h => cdbdebugengine.h} | 27 +++--- ...callback.cpp => cdbdebugeventcallback.cpp} | 32 ++----- ...ventcallback.h => cdbdebugeventcallback.h} | 13 ++- ...msvcdebugoutput.cpp => cdbdebugoutput.cpp} | 20 ++-- .../{msvcdebugoutput.h => cdbdebugoutput.h} | 14 +-- src/plugins/debugger/debugger.pro | 22 +++-- 7 files changed, 105 insertions(+), 117 deletions(-) rename src/plugins/debugger/{msvcdebugengine.cpp => cdbdebugengine.cpp} (85%) rename src/plugins/debugger/{msvcdebugengine.h => cdbdebugengine.h} (82%) rename src/plugins/debugger/{msvcdebugeventcallback.cpp => cdbdebugeventcallback.cpp} (89%) rename src/plugins/debugger/{msvcdebugeventcallback.h => cdbdebugeventcallback.h} (89%) rename src/plugins/debugger/{msvcdebugoutput.cpp => cdbdebugoutput.cpp} (76%) rename src/plugins/debugger/{msvcdebugoutput.h => cdbdebugoutput.h} (67%) diff --git a/src/plugins/debugger/msvcdebugengine.cpp b/src/plugins/debugger/cdbdebugengine.cpp similarity index 85% rename from src/plugins/debugger/msvcdebugengine.cpp rename to src/plugins/debugger/cdbdebugengine.cpp index e2216644405..c7555af17c8 100644 --- a/src/plugins/debugger/msvcdebugengine.cpp +++ b/src/plugins/debugger/cdbdebugengine.cpp @@ -1,4 +1,4 @@ -#include "msvcdebugengine.h" +#include "cdbdebugengine.h" #include "assert.h" #include "debuggermanager.h" @@ -16,8 +16,8 @@ using namespace Debugger; using namespace Debugger::Internal; -MSVCDebugEngine::MSVCDebugEngine(DebuggerManager *parent) -: IDebuggerEngine(parent), +CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent) + : IDebuggerEngine(parent), m_hDebuggeeProcess(0), m_hDebuggeeThread(0), //m_hDebuggeeImage(0), @@ -50,7 +50,7 @@ MSVCDebugEngine::MSVCDebugEngine(DebuggerManager *parent) } } -MSVCDebugEngine::~MSVCDebugEngine() +CdbDebugEngine::~CdbDebugEngine() { if (m_pDebugClient) m_pDebugClient->Release(); @@ -64,13 +64,13 @@ MSVCDebugEngine::~MSVCDebugEngine() m_pDebugRegisters->Release(); } -void MSVCDebugEngine::startWatchTimer() +void CdbDebugEngine::startWatchTimer() { if (m_watchTimer == -1) m_watchTimer = startTimer(0); } -void MSVCDebugEngine::killWatchTimer() +void CdbDebugEngine::killWatchTimer() { if (m_watchTimer != -1) { killTimer(m_watchTimer); @@ -78,16 +78,16 @@ void MSVCDebugEngine::killWatchTimer() } } -void MSVCDebugEngine::shutdown() +void CdbDebugEngine::shutdown() { exitDebugger(); } -void MSVCDebugEngine::setToolTipExpression(const QPoint &pos, const QString &exp) +void CdbDebugEngine::setToolTipExpression(const QPoint &pos, const QString &exp) { } -bool MSVCDebugEngine::startDebugger() +bool CdbDebugEngine::startDebugger() { q->showStatusMessage("Starting Debugger", -1); @@ -110,7 +110,7 @@ bool MSVCDebugEngine::startDebugger() //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) { - qWarning("MSVCDebugEngine: attach to process not yet implemented!"); + qWarning("CdbDebugEngine: attach to process not yet implemented!"); } else { hr = m_pDebugClient->CreateProcess2Wide(NULL, const_cast(filename.utf16()), @@ -130,19 +130,19 @@ bool MSVCDebugEngine::startDebugger() return true; } -void MSVCDebugEngine::exitDebugger() +void CdbDebugEngine::exitDebugger() { m_pDebugClient->TerminateCurrentProcess(); killWatchTimer(); } -void MSVCDebugEngine::updateWatchModel() +void CdbDebugEngine::updateWatchModel() { } -void MSVCDebugEngine::stepExec() +void CdbDebugEngine::stepExec() { - //qDebug() << "MSVCDebugEngine::stepExec()"; + //qDebug() << "CdbDebugEngine::stepExec()"; //m_pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, "p", 0); HRESULT hr; hr = m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_INTO); @@ -150,9 +150,9 @@ void MSVCDebugEngine::stepExec() startWatchTimer(); } -void MSVCDebugEngine::stepOutExec() +void CdbDebugEngine::stepOutExec() { - //qDebug() << "MSVCDebugEngine::stepOutExec()"; + //qDebug() << "CdbDebugEngine::stepOutExec()"; StackHandler* sh = qq->stackHandler(); const int idx = sh->currentIndex() + 1; QList stackframes = sh->frames(); @@ -191,26 +191,26 @@ void MSVCDebugEngine::stepOutExec() continueInferior(); } -void MSVCDebugEngine::nextExec() +void CdbDebugEngine::nextExec() { - //qDebug() << "MSVCDebugEngine::nextExec()"; + //qDebug() << "CdbDebugEngine::nextExec()"; HRESULT hr; hr = m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_OVER); startWatchTimer(); } -void MSVCDebugEngine::stepIExec() +void CdbDebugEngine::stepIExec() { - qWarning("MSVCDebugEngine::stepIExec() not implemented"); + qWarning("CdbDebugEngine::stepIExec() not implemented"); } -void MSVCDebugEngine::nextIExec() +void CdbDebugEngine::nextIExec() { m_pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, "p", 0); startWatchTimer(); } -void MSVCDebugEngine::continueInferior() +void CdbDebugEngine::continueInferior() { killWatchTimer(); q->resetLocation(); @@ -224,12 +224,12 @@ void MSVCDebugEngine::continueInferior() qq->notifyInferiorRunning(); } -void MSVCDebugEngine::runInferior() +void CdbDebugEngine::runInferior() { continueInferior(); } -void MSVCDebugEngine::interruptInferior() +void CdbDebugEngine::interruptInferior() { //TODO: better use IDebugControl::SetInterrupt? if (!m_hDebuggeeProcess) @@ -241,27 +241,27 @@ void MSVCDebugEngine::interruptInferior() qq->notifyInferiorStopped(); } -void MSVCDebugEngine::runToLineExec(const QString &fileName, int lineNumber) +void CdbDebugEngine::runToLineExec(const QString &fileName, int lineNumber) { } -void MSVCDebugEngine::runToFunctionExec(const QString &functionName) +void CdbDebugEngine::runToFunctionExec(const QString &functionName) { } -void MSVCDebugEngine::jumpToLineExec(const QString &fileName, int lineNumber) +void CdbDebugEngine::jumpToLineExec(const QString &fileName, int lineNumber) { } -void MSVCDebugEngine::assignValueInDebugger(const QString &expr, const QString &value) +void CdbDebugEngine::assignValueInDebugger(const QString &expr, const QString &value) { } -void MSVCDebugEngine::executeDebuggerCommand(const QString &/*command*/) +void CdbDebugEngine::executeDebuggerCommand(const QString &/*command*/) { } -void MSVCDebugEngine::activateFrame(int frameIndex) +void CdbDebugEngine::activateFrame(int frameIndex) { if (q->status() != DebuggerInferiorStopped) return; @@ -287,7 +287,7 @@ void MSVCDebugEngine::activateFrame(int frameIndex) qDebug() << "FULL NAME NOT USABLE: " << frame.file; } -void MSVCDebugEngine::selectThread(int index) +void CdbDebugEngine::selectThread(int index) { //reset location arrow q->resetLocation(); @@ -298,7 +298,7 @@ void MSVCDebugEngine::selectThread(int index) updateStackTrace(); } -void MSVCDebugEngine::attemptBreakpointSynchronization() +void CdbDebugEngine::attemptBreakpointSynchronization() { BreakHandler *handler = qq->breakHandler(); //qDebug() << "attemptBreakpointSynchronization"; @@ -333,35 +333,35 @@ void MSVCDebugEngine::attemptBreakpointSynchronization() } } -void MSVCDebugEngine::loadSessionData() +void CdbDebugEngine::loadSessionData() { } -void MSVCDebugEngine::saveSessionData() +void CdbDebugEngine::saveSessionData() { } -void MSVCDebugEngine::reloadDisassembler() +void CdbDebugEngine::reloadDisassembler() { } -void MSVCDebugEngine::reloadModules() +void CdbDebugEngine::reloadModules() { } -void MSVCDebugEngine::loadSymbols(const QString &moduleName) +void CdbDebugEngine::loadSymbols(const QString &moduleName) { } -void MSVCDebugEngine::loadAllSymbols() +void CdbDebugEngine::loadAllSymbols() { } -void MSVCDebugEngine::reloadRegisters() +void CdbDebugEngine::reloadRegisters() { } -void MSVCDebugEngine::timerEvent(QTimerEvent* te) +void CdbDebugEngine::timerEvent(QTimerEvent* te) { if (te->timerId() != m_watchTimer) return; @@ -391,7 +391,7 @@ void MSVCDebugEngine::timerEvent(QTimerEvent* te) } } -void MSVCDebugEngine::handleDebugEvent() +void CdbDebugEngine::handleDebugEvent() { if (m_bIgnoreNextDebugEvent) { startWatchTimer(); @@ -414,7 +414,7 @@ void MSVCDebugEngine::handleDebugEvent() //} } -void MSVCDebugEngine::updateThreadList() +void CdbDebugEngine::updateThreadList() { ThreadsHandler* th = qq->threadsHandler(); QList threads; @@ -435,7 +435,7 @@ void MSVCDebugEngine::updateThreadList() th->setThreads(threads); } -void MSVCDebugEngine::updateStackTrace() +void CdbDebugEngine::updateStackTrace() { //qDebug() << "updateStackTrace()"; HRESULT hr; @@ -503,17 +503,17 @@ void MSVCDebugEngine::updateStackTrace() //m_pDebugControl->OutputStackTrace(DEBUG_OUTCTL_THIS_CLIENT, frames, numFramesFilled, DEBUG_STACK_SOURCE_LINE); } -void MSVCDebugEngine::handleDebugOutput(const char* szOutputString) +void CdbDebugEngine::handleDebugOutput(const char* szOutputString) { qq->showApplicationOutput("app-dbgoutput", QString::fromLocal8Bit(szOutputString)); } -void MSVCDebugEngine::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP) +void CdbDebugEngine::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP) { - qDebug() << "MSVCDebugEngine::handleBreakpointEvent()"; + qDebug() << "CdbDebugEngine::handleBreakpointEvent()"; } IDebuggerEngine *createWinEngine(DebuggerManager *parent) { - return new MSVCDebugEngine(parent); + return new CdbDebugEngine(parent); } diff --git a/src/plugins/debugger/msvcdebugengine.h b/src/plugins/debugger/cdbdebugengine.h similarity index 82% rename from src/plugins/debugger/msvcdebugengine.h rename to src/plugins/debugger/cdbdebugengine.h index 3a358e30462..c78b6585ae3 100644 --- a/src/plugins/debugger/msvcdebugengine.h +++ b/src/plugins/debugger/cdbdebugengine.h @@ -1,9 +1,10 @@ -#ifndef __MSVCDEBUGENGINE_H__ -#define __MSVCDEBUGENGINE_H__ +#ifndef DEBUGGER_CDBENGINE_H +#define DEBUGGER_CDBENGINE_H #include "idebuggerengine.h" -#include "msvcdebugeventcallback.h" -#include "msvcdebugoutput.h" +#include "cdbdebugeventcallback.h" +#include "cdbdebugoutput.h" + #include namespace Debugger { @@ -12,12 +13,12 @@ namespace Internal { class DebuggerManager; class IDebuggerManagerAccessForEngines; -class MSVCDebugEngine : public IDebuggerEngine +class CdbDebugEngine : public IDebuggerEngine { Q_OBJECT public: - MSVCDebugEngine(DebuggerManager *parent); - ~MSVCDebugEngine(); + CdbDebugEngine(DebuggerManager *parent); + ~CdbDebugEngine(); virtual void shutdown(); virtual void setToolTipExpression(const QPoint &pos, const QString &exp); @@ -63,7 +64,7 @@ protected: private: void startWatchTimer(); void killWatchTimer(); - bool isDebuggeeRunning() { return m_watchTimer != -1; } + bool isDebuggeeRunning() const { return m_watchTimer != -1; } void handleDebugEvent(); void updateThreadList(); void updateStackTrace(); @@ -82,17 +83,17 @@ private: IDebugSystemObjects4* m_pDebugSystemObjects; IDebugSymbols3* m_pDebugSymbols; IDebugRegisters2* m_pDebugRegisters; - MSVCDebugEventCallback m_debugEventCallBack; - MSVCDebugOutput m_debugOutputCallBack; + CdbDebugEventCallback m_debugEventCallBack; + CdbDebugOutput m_debugOutputCallBack; DebuggerManager *q; IDebuggerManagerAccessForEngines *qq; - friend class MSVCDebugEventCallback; - friend class MSVCDebugOutput; + friend class CdbDebugEventCallback; + friend class CdbDebugOutput; }; } // namespace Internal } // namespace Debugger -#endif +#endif // DEBUGGER_CDBENGINE_H diff --git a/src/plugins/debugger/msvcdebugeventcallback.cpp b/src/plugins/debugger/cdbdebugeventcallback.cpp similarity index 89% rename from src/plugins/debugger/msvcdebugeventcallback.cpp rename to src/plugins/debugger/cdbdebugeventcallback.cpp index 9ef74e63ef7..22614c00b1d 100644 --- a/src/plugins/debugger/msvcdebugeventcallback.cpp +++ b/src/plugins/debugger/cdbdebugeventcallback.cpp @@ -1,18 +1,16 @@ -#include "msvcdebugeventcallback.h" -#include "msvcdebugengine.h" +#include "cdbdebugeventcallback.h" +#include "cdbcdebugengine.h" #include "debuggermanager.h" -#include +#include namespace Debugger { namespace Internal { -STDMETHODIMP -MSVCDebugEventCallback::QueryInterface( +STDMETHODIMP MSVCDebugEventCallback::QueryInterface( THIS_ IN REFIID InterfaceId, - OUT PVOID* Interface - ) + OUT PVOID* Interface) { *Interface = NULL; @@ -29,30 +27,21 @@ MSVCDebugEventCallback::QueryInterface( } } -STDMETHODIMP_(ULONG) -MSVCDebugEventCallback::AddRef( - THIS - ) +STDMETHODIMP_(ULONG) MSVCDebugEventCallback::AddRef(THIS) { // This class is designed to be static so // there's no true refcount. return 1; } -STDMETHODIMP_(ULONG) -MSVCDebugEventCallback::Release( - THIS - ) +STDMETHODIMP_(ULONG) MSVCDebugEventCallback::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 MSVCDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask) { *mask = DEBUG_EVENT_CREATE_PROCESS | DEBUG_EVENT_EXIT_PROCESS //| DEBUG_EVENT_CREATE_THREAD | DEBUG_EVENT_EXIT_THREAD @@ -62,10 +51,7 @@ STDMETHODIMP MSVCDebugEventCallback::GetInterestMask( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::Breakpoint( - THIS_ - __in PDEBUG_BREAKPOINT Bp - ) +STDMETHODIMP MSVCDebugEventCallback::Breakpoint(THIS_ __in PDEBUG_BREAKPOINT Bp) { qDebug() << "MSVCDebugEventCallback::Breakpoint"; m_pEngine->handleBreakpointEvent(Bp); diff --git a/src/plugins/debugger/msvcdebugeventcallback.h b/src/plugins/debugger/cdbdebugeventcallback.h similarity index 89% rename from src/plugins/debugger/msvcdebugeventcallback.h rename to src/plugins/debugger/cdbdebugeventcallback.h index fa5633ca791..c28ee87e48f 100644 --- a/src/plugins/debugger/msvcdebugeventcallback.h +++ b/src/plugins/debugger/cdbdebugeventcallback.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef DEBUGGER_CDBDEBUGEVENTCALLBACK_H +#define DEBUGGER_CDBDEBUGEVENTCALLBACK_H #include #include @@ -6,12 +7,12 @@ namespace Debugger { namespace Internal { -class MSVCDebugEngine; +class CdbDebugEngine; -class MSVCDebugEventCallback : public IDebugEventCallbacks +class CdbDebugEventCallback : public IDebugEventCallbacks { public: - MSVCDebugEventCallback(MSVCDebugEngine* dbg) + CdbDebugEventCallback(CdbDebugEngine* dbg) : m_pEngine(dbg) {} @@ -124,8 +125,10 @@ public: ); private: - MSVCDebugEngine* m_pEngine; + CdbDebugEngine* m_pEngine; }; } // namespace Internal } // namespace Debugger + +#endif // DEBUGGER_CDBDEBUGEVENTCALLBACK_H diff --git a/src/plugins/debugger/msvcdebugoutput.cpp b/src/plugins/debugger/cdbdebugoutput.cpp similarity index 76% rename from src/plugins/debugger/msvcdebugoutput.cpp rename to src/plugins/debugger/cdbdebugoutput.cpp index 4f121fb52fd..135e78c28d5 100644 --- a/src/plugins/debugger/msvcdebugoutput.cpp +++ b/src/plugins/debugger/cdbdebugoutput.cpp @@ -1,14 +1,13 @@ #include #include -#include "msvcdebugoutput.h" -#include "msvcdebugengine.h" +#include "cdbdebugoutput.h" +#include "cdbdebugengine.h" namespace Debugger { namespace Internal { -STDMETHODIMP -MSVCDebugOutput::QueryInterface( +STDMETHODIMP MSVCDebugOutput::QueryInterface( THIS_ IN REFIID InterfaceId, OUT PVOID* Interface @@ -29,28 +28,21 @@ MSVCDebugOutput::QueryInterface( } } -STDMETHODIMP_(ULONG) -MSVCDebugOutput::AddRef( - THIS - ) +STDMETHODIMP_(ULONG) MSVCDebugOutput::AddRef(THIS) { // This class is designed to be static so // there's no true refcount. return 1; } -STDMETHODIMP_(ULONG) -MSVCDebugOutput::Release( - THIS - ) +STDMETHODIMP_(ULONG) MSVCDebugOutput::Release(THIS) { // This class is designed to be static so // there's no true refcount. return 0; } -STDMETHODIMP -MSVCDebugOutput::Output( +STDMETHODIMP MSVCDebugOutput::Output( THIS_ IN ULONG mask, IN PCSTR text diff --git a/src/plugins/debugger/msvcdebugoutput.h b/src/plugins/debugger/cdbdebugoutput.h similarity index 67% rename from src/plugins/debugger/msvcdebugoutput.h rename to src/plugins/debugger/cdbdebugoutput.h index f0e1f32d79f..273c8afcf10 100644 --- a/src/plugins/debugger/msvcdebugoutput.h +++ b/src/plugins/debugger/cdbdebugoutput.h @@ -1,15 +1,15 @@ -#ifndef __MSVCDEBUGOUTPUT_H__ -#define __MSVCDEBUGOUTPUT_H__ +#ifndef DEBUGGER_CDBOUTPUT_H +#define DEBUGGER_CDBOUTPUT_H namespace Debugger { namespace Internal { -class MSVCDebugEngine; +class CdbDebugEngine; -class MSVCDebugOutput : public IDebugOutputCallbacks +class CdbDebugOutput : public IDebugOutputCallbacks { public: - MSVCDebugOutput(MSVCDebugEngine* engine) + CdbDebugOutput(CdbDebugEngine* engine) : m_pEngine(engine) {} @@ -34,10 +34,10 @@ public: ); private: - MSVCDebugEngine* m_pEngine; + CdbDebugEngine* m_pEngine; }; } // namespace Internal } // namespace Debugger -#endif // #ifndef __MSVCDEBUGOUTPUT_H__ +#endif // DEBUGGER_CDBOUTPUT_H diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index b2498747161..b3fd6257e1f 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -84,13 +84,19 @@ HEADERS += $$PWD/modeltest.h DEFINES += USE_MODEL_TEST=1 } -false { - HEADERS += msvcdebugengine.h \ - msvcdebugeventcallback.h \ - msvcdebugoutput.h - SOURCES += msvcdebugengine.cpp \ - msvcdebugeventcallback.cpp \ - msvcdebugoutput.cpp - LIBS += dbgeng.lib +win32 { + +HEADERS += \ + cdbdebugengine.h \ + cdbdebugeventcallback.h \ + cdbdebugoutput.h + +SOURCES += \ + cdbdebugengine.cpp \ + cdbdebugeventcallback.cpp \ + cdbdebugoutput.cpp + +LIBS += dbgeng.lib + }