Commit 7959460f authored by Friedemann Kleint's avatar Friedemann Kleint Committed by unknown
Browse files

Start experimental VS debugger support

parent 2047426b
......@@ -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()
{
}
......@@ -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*);
......
#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
......
......@@ -2,7 +2,7 @@
#define DEBUGGER_CDBDEBUGEVENTCALLBACK_H
#include <windows.h>
#include <dbgeng.h>
#include <inc/dbgeng.h>
namespace Debugger {
namespace Internal {
......
#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
......
......@@ -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
}
}
......@@ -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()
......
......@@ -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;
......
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