debugger: make more of cdb compilable on non-Windows

This commit is contained in:
hjk
2010-06-14 11:28:34 +02:00
parent effa8a38da
commit 8a26bc5aec
5 changed files with 85 additions and 39 deletions

View File

@@ -206,7 +206,7 @@ bool BreakPoint::add(CIDebugControl* debugControl,
unsigned long *id, unsigned long *id,
quint64 *address) const quint64 *address) const
{ {
IDebugBreakpoint2* ibp = 0; CIDebugBreakpoint* ibp = 0;
if (address) if (address)
*address = 0; *address = 0;
if (id) if (id)
@@ -473,8 +473,8 @@ bool BreakPoint::getBreakPoints(CIDebugControl* debugControl, QList<BreakPoint>
if (!getBreakPointCount(debugControl, &count, errorMessage)) if (!getBreakPointCount(debugControl, &count, errorMessage))
return false; return false;
// retrieve one by one and parse // retrieve one by one and parse
for (ULONG b= 0; b < count; b++) { for (ULONG b = 0; b < count; b++) {
IDebugBreakpoint2 *ibp = 0; CIDebugBreakpoint *ibp = 0;
const HRESULT hr = debugControl->GetBreakpointByIndex2(b, &ibp); const HRESULT hr = debugControl->GetBreakpointByIndex2(b, &ibp);
if (FAILED(hr)) { if (FAILED(hr)) {
*errorMessage = QString::fromLatin1("Cannot retrieve breakpoint %1: %2"). *errorMessage = QString::fromLatin1("Cannot retrieve breakpoint %1: %2").
@@ -495,7 +495,7 @@ static inline QString msgNoBreakPointWithId(unsigned long id, const QString &why
return QString::fromLatin1("Unable to find breakpoint with id %1: %2").arg(id).arg(why); return QString::fromLatin1("Unable to find breakpoint with id %1: %2").arg(id).arg(why);
} }
IDebugBreakpoint2 *BreakPoint::breakPointById(CIDebugControl *ctl, unsigned long id, QString *errorMessage) CIDebugBreakpoint *BreakPoint::breakPointById(CIDebugControl *ctl, unsigned long id, QString *errorMessage)
{ {
CIDebugBreakpoint *ibp = 0; CIDebugBreakpoint *ibp = 0;
const HRESULT hr = ctl->GetBreakpointById2(id, &ibp); const HRESULT hr = ctl->GetBreakpointById2(id, &ibp);

View File

@@ -62,7 +62,7 @@ struct BreakPoint
// Apply parameters (with the exception of type, which is // Apply parameters (with the exception of type, which is
// passed as a parameter to IDebugControl within add(). // passed as a parameter to IDebugControl within add().
bool apply(IDebugBreakpoint2 *ibp, QString *errorMessage) const; bool apply(CIDebugBreakpoint *ibp, QString *errorMessage) const;
// Convenience to add to a IDebugControl4. // Convenience to add to a IDebugControl4.
bool add(CIDebugControl* debugControl, bool add(CIDebugControl* debugControl,
QString *errorMessage, QString *errorMessage,
@@ -70,13 +70,13 @@ struct BreakPoint
quint64 *address = 0) const; quint64 *address = 0) const;
// Retrieve/parse breakpoints from the interfaces // Retrieve/parse breakpoints from the interfaces
bool retrieve(IDebugBreakpoint2 *ibp, QString *errorMessage); bool retrieve(CIDebugBreakpoint *ibp, QString *errorMessage);
bool parseExpression(const QString &expr); bool parseExpression(const QString &expr);
// Retrieve all breakpoints from the engine // Retrieve all breakpoints from the engine
static bool getBreakPointCount(CIDebugControl* debugControl, ULONG *count, QString *errorMessage = 0); static bool getBreakPointCount(CIDebugControl* debugControl, ULONG *count, QString *errorMessage = 0);
static bool getBreakPoints(CIDebugControl* debugControl, QList<BreakPoint> *bps, QString *errorMessage); static bool getBreakPoints(CIDebugControl* debugControl, QList<BreakPoint> *bps, QString *errorMessage);
// Control helpers // Control helpers
static IDebugBreakpoint2 *breakPointById(CIDebugControl *ctl, unsigned long id, QString *errorMessage); static CIDebugBreakpoint *breakPointById(CIDebugControl *ctl, unsigned long id, QString *errorMessage);
static bool removeBreakPointById(CIDebugControl *ctl, unsigned long id, QString *errorMessage); static bool removeBreakPointById(CIDebugControl *ctl, unsigned long id, QString *errorMessage);
static bool setBreakPointEnabledById(CIDebugControl *ctl, unsigned long id, bool enabled, QString *errorMessage); static bool setBreakPointEnabledById(CIDebugControl *ctl, unsigned long id, bool enabled, QString *errorMessage);
static bool setBreakPointThreadById(CIDebugControl *ctl, unsigned long id, int threadId, QString *errorMessage); static bool setBreakPointThreadById(CIDebugControl *ctl, unsigned long id, int threadId, QString *errorMessage);

View File

@@ -41,39 +41,59 @@ FORMS += $$PWD/cdboptionspagewidget.ui
# Compile test on non-Windows platforms # Compile test on non-Windows platforms
isEmpty(CDB_PATH) { isEmpty(CDB_PATH) {
false { false {
HEADERS += \ HEADERS += \
# $$PWD/cdbdebugengine.h \ $$PWD/cdbcom.h \
# $$PWD/cdbdebugengine_p.h \ $$PWD/coreengine.h \
# $$PWD/cdbdebugeventcallback.h \ $$PWD/debugoutputbase.h \
# $$PWD/cdbdebugoutput.h \ $$PWD/debugeventcallbackbase.h \
# $$PWD/cdbsymbolgroupcontext.h \ $$PWD/symbolgroupcontext.h \
# $$PWD/cdbsymbolgroupcontext_tpl.h \ $$PWD/stacktracecontext.h \
# $$PWD/cdbstacktracecontext.h \ $$PWD/breakpoint.h
# $$PWD/cdbbreakpoint.h \
# $$PWD/cdbmodules.h \ HEADERS += \
# $$PWD/cdbassembler.h \ $$PWD/cdbdebugengine.h \
# $$PWD/cdboptions.h \ $$PWD/cdbdebugengine_p.h \
# $$PWD/cdboptionspage.h \ $$PWD/cdbdebugeventcallback.h \
# $$PWD/cdbdumperhelper.h \ $$PWD/cdbdebugoutput.h \
# $$PWD/cdbsymbolpathlisteditor.h \ $$PWD/cdbsymbolgroupcontext.h \
# $$PWD/cdbexceptionutils.h $$PWD/cdbsymbolgroupcontext_tpl.h \
$$PWD/cdbstacktracecontext.h \
$$PWD/cdbbreakpoint.h \
$$PWD/cdbmodules.h \
$$PWD/cdbassembler.h \
$$PWD/cdboptions.h \
$$PWD/cdboptionspage.h \
$$PWD/cdbdumperhelper.h \
$$PWD/cdbsymbolpathlisteditor.h \
$$PWD/cdbexceptionutils.h
SOURCES += \
# $$PWD/coreengine.cpp \
# $$PWD/debugoutputbase.cpp \
# $$PWD/debugeventcallbackbase.cpp \
# $$PWD/symbolgroupcontext.cpp \
# $$PWD/stacktracecontext.cpp \
# $$PWD/breakpoint.cpp
SOURCES += \ SOURCES += \
# $$PWD/cdbdebugengine.cpp \ # $$PWD/cdbdebugengine.cpp \
# $$PWD/cdbdebugeventcallback.cpp \ # $$PWD/cdbdebugeventcallback.cpp \
$$PWD/cdbdebugoutput.cpp \ $$PWD/cdbdebugoutput.cpp \
# $$PWD/cdbsymbolgroupcontext.cpp \ # $$PWD/cdbsymbolgroupcontext.cpp \
# $$PWD/cdbstacktracecontext.cpp \ $$PWD/cdbstacktracecontext.cpp \
# $$PWD/cdbbreakpoint.cpp \ $$PWD/cdbbreakpoint.cpp \
# $$PWD/cdbmodules.cpp \ # $$PWD/cdbmodules.cpp \
# $$PWD/cdbassembler.cpp \ $$PWD/cdbassembler.cpp \
# $$PWD/cdboptions.cpp \ $$PWD/cdboptions.cpp \
# $$PWD/cdboptionspage.cpp \ $$PWD/cdboptionspage.cpp \
# $$PWD/cdbdumperhelper.cpp \ # $$PWD/cdbdumperhelper.cpp \
# $$PWD/cdbsymbolpathlisteditor.cpp \ $$PWD/cdbsymbolpathlisteditor.cpp \
# $$PWD/cdbexceptionutils.cpp # $$PWD/cdbexceptionutils.cpp
FORMS += $$PWD/cdboptionspagewidget.ui FORMS += $$PWD/cdboptionspagewidget.ui
INCLUDEPATH*=$$PWD
DEPENDPATH*=$$PWD
} }
} }

View File

@@ -32,6 +32,9 @@
// Stubs to make it partially compile for test purposes on non-Windows. // Stubs to make it partially compile for test purposes on non-Windows.
// FIXME: Make everything more Windows-like instead of choosing arbitrary
// values to make it compile.
typedef unsigned long ULONG; typedef unsigned long ULONG;
typedef unsigned long long ULONG64; typedef unsigned long long ULONG64;
typedef void *PVOID; typedef void *PVOID;
@@ -40,6 +43,9 @@ typedef void *HANDLE;
typedef int HRESULT; typedef int HRESULT;
typedef int DEBUG_VALUE; typedef int DEBUG_VALUE;
typedef int PDEBUG_BREAKPOINT2; typedef int PDEBUG_BREAKPOINT2;
const int MAX_PATH = 1024;
inline bool FAILED(HRESULT) { return false; }
enum enum
{ {
@@ -58,7 +64,7 @@ enum
#define THIS_ #define THIS_
#define REFIID void * #define REFIID void *
#define THIS_ #define THIS_
#define STDMETHOD(x) void x #define STDMETHOD(x) HRESULT x
#define STDMETHOD_(x, y) x y #define STDMETHOD_(x, y) x y
struct IUnknown struct IUnknown
@@ -72,36 +78,56 @@ struct IDebugOutputCallbacksWide : IUnknown
{ {
}; };
struct CIDebugClient struct CIDebugClient : IUnknown
{ {
}; };
struct CIDebugControl struct CIDebugControl : IUnknown
{ {
}; };
struct CIDebugSystemObjects struct CIDebugSystemObjects : IUnknown
{ {
}; };
struct CIDebugSymbols struct CIDebugSymbols : IUnknown
{ {
}; };
struct CIDebugRegisters struct CIDebugRegisters : IUnknown
{
HRESULT GetNumberRegisters(ULONG *) const { return 0; }
HRESULT GetDescription(ULONG, char *, int, int, int) const { return 0; }
HRESULT GetValues(ULONG, int, int, DEBUG_VALUE *) const { return 0; }
};
struct CIDebugDataSpaces : IUnknown
{ {
}; };
struct CIDebugDataSpaces struct CIDebugSymbolGroup : IUnknown
{ {
}; };
struct CIDebugSymbolGroup struct CIDebugBreakpoint : IUnknown
{ {
}; };
struct CIDebugBreakpoint enum DebugSymbolFlags
{
DEBUG_SYMBOL_IS_LOCAL = 1,
DEBUG_SYMBOL_IS_ARGUMENT = 2,
DEBUG_SYMBOL_READ_ONLY = 4
};
struct DEBUG_SYMBOL_PARAMETERS
{
DebugSymbolFlags Flags;
unsigned long ParentSymbol;
};
struct DEBUG_STACK_FRAME
{ {
}; };
#endif // Q_OS_WINDOWS #endif // Q_OS_WIN

View File

@@ -41,7 +41,7 @@ enum { debug = 0 };
namespace CdbCore { namespace CdbCore {
StackFrame::StackFrame() : StackFrame::StackFrame() :
line(0),address(0) line(0), address(0)
{ {
} }