Added private header for engine

This commit is contained in:
Friedemann Kleint
2009-02-20 17:07:00 +01:00
committed by Friedemann Kleint
parent c5d600b1d6
commit fe4a3f354d
9 changed files with 368 additions and 97 deletions

View File

@@ -17,6 +17,7 @@ CDB_LIBPATH=$$CDB_PATH/lib/$$CDB_PLATFORM
HEADERS += \ HEADERS += \
$$PWD/cdbdebugengine.h \ $$PWD/cdbdebugengine.h \
$$PWD/cdbdebugengine_p.h \
$$PWD/cdbdebugeventcallback.h \ $$PWD/cdbdebugeventcallback.h \
$$PWD/cdbdebugoutput.h $$PWD/cdbdebugoutput.h

View File

@@ -1,4 +1,38 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "cdbdebugengine.h" #include "cdbdebugengine.h"
#include "cdbdebugengine_p.h"
#include "debuggermanager.h" #include "debuggermanager.h"
#include "breakhandler.h" #include "breakhandler.h"
@@ -16,15 +50,14 @@
using namespace Debugger; using namespace Debugger;
using namespace Debugger::Internal; using namespace Debugger::Internal;
CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent) CdbDebugEnginePrivate::CdbDebugEnginePrivate(DebuggerManager *parent, CdbDebugEngine* engine) :
: IDebuggerEngine(parent),
m_hDebuggeeProcess(0), m_hDebuggeeProcess(0),
m_hDebuggeeThread(0), m_hDebuggeeThread(0),
//m_hDebuggeeImage(0),
m_bIgnoreNextDebugEvent(false), m_bIgnoreNextDebugEvent(false),
m_watchTimer(-1), m_watchTimer(-1),
m_debugEventCallBack(this), m_debugEventCallBack(engine),
m_debugOutputCallBack(this) m_debugOutputCallBack(engine),
m_engine(engine)
{ {
q = parent; q = parent;
qq = parent->engineInterface(); qq = parent->engineInterface();
@@ -50,7 +83,7 @@ CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent)
} }
} }
CdbDebugEngine::~CdbDebugEngine() CdbDebugEnginePrivate::~CdbDebugEnginePrivate()
{ {
if (m_pDebugClient) if (m_pDebugClient)
m_pDebugClient->Release(); m_pDebugClient->Release();
@@ -64,17 +97,29 @@ CdbDebugEngine::~CdbDebugEngine()
m_pDebugRegisters->Release(); m_pDebugRegisters->Release();
} }
CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent)
: IDebuggerEngine(parent),
m_d(new CdbDebugEnginePrivate(parent, this))
{
}
CdbDebugEngine::~CdbDebugEngine()
{
delete m_d;
}
void CdbDebugEngine::startWatchTimer() void CdbDebugEngine::startWatchTimer()
{ {
if (m_watchTimer == -1) if (m_d->m_watchTimer == -1)
m_watchTimer = startTimer(0); m_d->m_watchTimer = startTimer(0);
} }
void CdbDebugEngine::killWatchTimer() void CdbDebugEngine::killWatchTimer()
{ {
if (m_watchTimer != -1) { if (m_d->m_watchTimer != -1) {
killTimer(m_watchTimer); killTimer(m_d->m_watchTimer);
m_watchTimer = -1; m_d->m_watchTimer = -1;
} }
} }
@@ -89,7 +134,7 @@ void CdbDebugEngine::setToolTipExpression(const QPoint & /*pos*/, const QString
bool CdbDebugEngine::startDebugger() bool CdbDebugEngine::startDebugger()
{ {
q->showStatusMessage("Starting Debugger", -1); m_d->q->showStatusMessage("Starting Debugger", -1);
//if (!q->m_workingDir.isEmpty()) //if (!q->m_workingDir.isEmpty())
// m_gdbProc.setWorkingDirectory(q->m_workingDir); // m_gdbProc.setWorkingDirectory(q->m_workingDir);
@@ -102,17 +147,17 @@ bool CdbDebugEngine::startDebugger()
HRESULT hr; HRESULT hr;
QString filename(q->m_executable); QString filename(m_d->q->m_executable);
QFileInfo fi(filename); QFileInfo fi(filename);
m_pDebugSymbols->AppendImagePathWide(fi.absolutePath().replace('/','\\').utf16()); m_d->m_pDebugSymbols->AppendImagePathWide(fi.absolutePath().replace('/','\\').utf16());
//m_pDebugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS); //m_pDebugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS);
m_pDebugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS); m_d->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); //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() == DebuggerManager::AttachExternal) { if (m_d->q->startMode() == DebuggerManager::AttachExternal) {
qWarning("CdbDebugEngine: attach to process not yet implemented!"); qWarning("CdbDebugEngine: attach to process not yet implemented!");
} else { } else {
hr = m_pDebugClient->CreateProcess2Wide(NULL, hr = m_d->m_pDebugClient->CreateProcess2Wide(NULL,
const_cast<PWSTR>(filename.utf16()), const_cast<PWSTR>(filename.utf16()),
&dbgopts, &dbgopts,
sizeof(dbgopts), sizeof(dbgopts),
@@ -120,19 +165,19 @@ bool CdbDebugEngine::startDebugger()
NULL); // TODO: think about setting the environment NULL); // TODO: think about setting the environment
if (FAILED(hr)) { if (FAILED(hr)) {
//qWarning("CreateProcess2Wide failed"); //qWarning("CreateProcess2Wide failed");
qq->notifyInferiorExited(); m_d->qq->notifyInferiorExited();
return false; return false;
} }
} }
q->showStatusMessage(tr("Debugger Running"), -1); m_d->q->showStatusMessage(tr("Debugger Running"), -1);
startWatchTimer(); startWatchTimer();
return true; return true;
} }
void CdbDebugEngine::exitDebugger() void CdbDebugEngine::exitDebugger()
{ {
m_pDebugClient->TerminateCurrentProcess(); m_d->m_pDebugClient->TerminateCurrentProcess();
killWatchTimer(); killWatchTimer();
} }
@@ -145,15 +190,15 @@ void CdbDebugEngine::stepExec()
//qDebug() << "CdbDebugEngine::stepExec()"; //qDebug() << "CdbDebugEngine::stepExec()";
//m_pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, "p", 0); //m_pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, "p", 0);
HRESULT hr; HRESULT hr;
hr = m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_INTO); hr = m_d->m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_INTO);
m_bIgnoreNextDebugEvent = true; m_d->m_bIgnoreNextDebugEvent = true;
startWatchTimer(); startWatchTimer();
} }
void CdbDebugEngine::stepOutExec() void CdbDebugEngine::stepOutExec()
{ {
//qDebug() << "CdbDebugEngine::stepOutExec()"; //qDebug() << "CdbDebugEngine::stepOutExec()";
StackHandler* sh = qq->stackHandler(); StackHandler* sh = m_d->qq->stackHandler();
const int idx = sh->currentIndex() + 1; const int idx = sh->currentIndex() + 1;
QList<StackFrame> stackframes = sh->frames(); QList<StackFrame> stackframes = sh->frames();
if (idx < 0 || idx >= stackframes.size()) { if (idx < 0 || idx >= stackframes.size()) {
@@ -170,7 +215,7 @@ void CdbDebugEngine::stepOutExec()
} }
IDebugBreakpoint2* pBP; IDebugBreakpoint2* pBP;
HRESULT hr = m_pDebugControl->AddBreakpoint2(DEBUG_BREAKPOINT_CODE, DEBUG_ANY_ID, &pBP); HRESULT hr = m_d->m_pDebugControl->AddBreakpoint2(DEBUG_BREAKPOINT_CODE, DEBUG_ANY_ID, &pBP);
if (FAILED(hr) || !pBP) { if (FAILED(hr) || !pBP) {
qWarning("stepOutExec: cannot create temporary breakpoint"); qWarning("stepOutExec: cannot create temporary breakpoint");
return; return;
@@ -195,7 +240,7 @@ void CdbDebugEngine::nextExec()
{ {
//qDebug() << "CdbDebugEngine::nextExec()"; //qDebug() << "CdbDebugEngine::nextExec()";
HRESULT hr; HRESULT hr;
hr = m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_OVER); hr = m_d->m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_OVER);
startWatchTimer(); startWatchTimer();
} }
@@ -206,34 +251,34 @@ void CdbDebugEngine::stepIExec()
void CdbDebugEngine::nextIExec() void CdbDebugEngine::nextIExec()
{ {
m_pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, "p", 0); m_d->m_pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, "p", 0);
startWatchTimer(); startWatchTimer();
} }
void CdbDebugEngine::continueInferior() void CdbDebugEngine::continueInferior()
{ {
killWatchTimer(); killWatchTimer();
q->resetLocation(); m_d->q->resetLocation();
ULONG executionStatus; ULONG executionStatus;
HRESULT hr = m_pDebugControl->GetExecutionStatus(&executionStatus); HRESULT hr = m_d->m_pDebugControl->GetExecutionStatus(&executionStatus);
if (SUCCEEDED(hr) && executionStatus != DEBUG_STATUS_GO) if (SUCCEEDED(hr) && executionStatus != DEBUG_STATUS_GO)
m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_GO); m_d->m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_GO);
startWatchTimer(); startWatchTimer();
qq->notifyInferiorRunning(); m_d->qq->notifyInferiorRunning();
} }
void CdbDebugEngine::interruptInferior() void CdbDebugEngine::interruptInferior()
{ {
//TODO: better use IDebugControl::SetInterrupt? //TODO: better use IDebugControl::SetInterrupt?
if (!m_hDebuggeeProcess) if (!m_d->m_hDebuggeeProcess)
return; return;
if (!DebugBreakProcess(m_hDebuggeeProcess)) { if (!DebugBreakProcess(m_d->m_hDebuggeeProcess)) {
qWarning("DebugBreakProcess failed."); qWarning("DebugBreakProcess failed.");
return; return;
} }
qq->notifyInferiorStopped(); m_d->qq->notifyInferiorStopped();
} }
void CdbDebugEngine::runToLineExec(const QString &fileName, int lineNumber) void CdbDebugEngine::runToLineExec(const QString &fileName, int lineNumber)
@@ -265,11 +310,11 @@ void CdbDebugEngine::executeDebuggerCommand(const QString &/*command*/)
void CdbDebugEngine::activateFrame(int frameIndex) void CdbDebugEngine::activateFrame(int frameIndex)
{ {
if (q->status() != DebuggerInferiorStopped) if (m_d->q->status() != DebuggerInferiorStopped)
return; return;
StackHandler *stackHandler = qq->stackHandler(); StackHandler *stackHandler = m_d->qq->stackHandler();
int oldIndex = stackHandler->currentIndex(); const int oldIndex = stackHandler->currentIndex();
//qDebug() << "ACTIVATE FRAME: " << frameIndex << oldIndex //qDebug() << "ACTIVATE FRAME: " << frameIndex << oldIndex
// << stackHandler->currentIndex(); // << stackHandler->currentIndex();
@@ -282,9 +327,9 @@ void CdbDebugEngine::activateFrame(int frameIndex)
const StackFrame &frame = stackHandler->currentFrame(); const StackFrame &frame = stackHandler->currentFrame();
bool usable = !frame.file.isEmpty() && QFileInfo(frame.file).isReadable(); const bool usable = !frame.file.isEmpty() && QFileInfo(frame.file).isReadable();
if (usable) if (usable)
q->gotoLocation(frame.file, frame.line, true); m_d->q->gotoLocation(frame.file, frame.line, true);
else else
qDebug() << "FULL NAME NOT USABLE: " << frame.file; qDebug() << "FULL NAME NOT USABLE: " << frame.file;
} }
@@ -292,23 +337,23 @@ void CdbDebugEngine::activateFrame(int frameIndex)
void CdbDebugEngine::selectThread(int index) void CdbDebugEngine::selectThread(int index)
{ {
//reset location arrow //reset location arrow
q->resetLocation(); m_d->q->resetLocation();
ThreadsHandler *threadsHandler = qq->threadsHandler(); ThreadsHandler *threadsHandler = m_d->qq->threadsHandler();
threadsHandler->setCurrentThread(index); threadsHandler->setCurrentThread(index);
m_currentThreadId = index; m_d->m_currentThreadId = index;
updateStackTrace(); m_d->updateStackTrace();
} }
void CdbDebugEngine::attemptBreakpointSynchronization() void CdbDebugEngine::attemptBreakpointSynchronization()
{ {
BreakHandler *handler = qq->breakHandler(); BreakHandler *handler = m_d->qq->breakHandler();
//qDebug() << "attemptBreakpointSynchronization"; //qDebug() << "attemptBreakpointSynchronization";
for (int i=0; i < handler->size(); ++i) { for (int i=0; i < handler->size(); ++i) {
BreakpointData* breakpoint = handler->at(i); BreakpointData* breakpoint = handler->at(i);
if (breakpoint->pending) { if (breakpoint->pending) {
IDebugBreakpoint2* pBP = 0; IDebugBreakpoint2* pBP = 0;
HRESULT hr = m_pDebugControl->AddBreakpoint2(DEBUG_BREAKPOINT_CODE, DEBUG_ANY_ID, &pBP); HRESULT hr = m_d->m_pDebugControl->AddBreakpoint2(DEBUG_BREAKPOINT_CODE, DEBUG_ANY_ID, &pBP);
if (FAILED(hr) || !pBP) { if (FAILED(hr) || !pBP) {
qWarning("m_pDebugControl->AddBreakpoint2 failed"); qWarning("m_pDebugControl->AddBreakpoint2 failed");
continue; continue;
@@ -366,22 +411,22 @@ void CdbDebugEngine::reloadRegisters()
void CdbDebugEngine::timerEvent(QTimerEvent* te) void CdbDebugEngine::timerEvent(QTimerEvent* te)
{ {
if (te->timerId() != m_watchTimer) if (te->timerId() != m_d->m_watchTimer)
return; return;
HRESULT hr; HRESULT hr;
hr = m_pDebugControl->WaitForEvent(0, 1); hr = m_d->m_pDebugControl->WaitForEvent(0, 1);
switch (hr) { switch (hr) {
case S_OK: case S_OK:
//qDebug() << "WaitForEvent S_OK"; //qDebug() << "WaitForEvent S_OK";
killWatchTimer(); killWatchTimer();
handleDebugEvent(); m_d->handleDebugEvent();
break; break;
case S_FALSE: case S_FALSE:
//qDebug() << "S_FALSE"; //qDebug() << "S_FALSE";
break; break;
case E_PENDING: case E_PENDING:
qDebug() << "S_PENDING"; qDebug() << "E_PENDING";
break; break;
case E_UNEXPECTED: case E_UNEXPECTED:
killWatchTimer(); killWatchTimer();
@@ -389,15 +434,13 @@ void CdbDebugEngine::timerEvent(QTimerEvent* te)
case E_FAIL: case E_FAIL:
qDebug() << "E_FAIL"; qDebug() << "E_FAIL";
break; break;
//default:
// qDebug() << "asser welljuh, schuddnt heppn";
} }
} }
void CdbDebugEngine::handleDebugEvent() void CdbDebugEnginePrivate::handleDebugEvent()
{ {
if (m_bIgnoreNextDebugEvent) { if (m_bIgnoreNextDebugEvent) {
startWatchTimer(); m_engine->startWatchTimer();
m_bIgnoreNextDebugEvent = false; m_bIgnoreNextDebugEvent = false;
} else { } else {
qq->notifyInferiorStopped(); qq->notifyInferiorStopped();
@@ -417,7 +460,7 @@ void CdbDebugEngine::handleDebugEvent()
//} //}
} }
void CdbDebugEngine::updateThreadList() void CdbDebugEnginePrivate::updateThreadList()
{ {
ThreadsHandler* th = qq->threadsHandler(); ThreadsHandler* th = qq->threadsHandler();
QList<ThreadData> threads; QList<ThreadData> threads;
@@ -438,11 +481,10 @@ void CdbDebugEngine::updateThreadList()
th->setThreads(threads); th->setThreads(threads);
} }
void CdbDebugEngine::updateStackTrace() void CdbDebugEnginePrivate::updateStackTrace()
{ {
//qDebug() << "updateStackTrace()"; //qDebug() << "updateStackTrace()";
HRESULT hr; HRESULT hr = m_pDebugSystemObjects->SetCurrentThreadId(m_currentThreadId);
hr = m_pDebugSystemObjects->SetCurrentThreadId(m_currentThreadId);
//ULONG64 frameOffset, instructionOffset, stackOffset; //ULONG64 frameOffset, instructionOffset, stackOffset;
//if (FAILED(m_pDebugRegisters->GetFrameOffset2(DEBUG_REGSRC_DEBUGGEE, &frameOffset)) || //if (FAILED(m_pDebugRegisters->GetFrameOffset2(DEBUG_REGSRC_DEBUGGEE, &frameOffset)) ||
@@ -506,12 +548,12 @@ void CdbDebugEngine::updateStackTrace()
//m_pDebugControl->OutputStackTrace(DEBUG_OUTCTL_THIS_CLIENT, frames, numFramesFilled, DEBUG_STACK_SOURCE_LINE); //m_pDebugControl->OutputStackTrace(DEBUG_OUTCTL_THIS_CLIENT, frames, numFramesFilled, DEBUG_STACK_SOURCE_LINE);
} }
void CdbDebugEngine::handleDebugOutput(const char* szOutputString) void CdbDebugEnginePrivate::handleDebugOutput(const char* szOutputString)
{ {
qq->showApplicationOutput(QString::fromLocal8Bit(szOutputString)); qq->showApplicationOutput(QString::fromLocal8Bit(szOutputString));
} }
void CdbDebugEngine::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP) void CdbDebugEnginePrivate::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP)
{ {
Q_UNUSED(pBP) Q_UNUSED(pBP)
qDebug() << "CdbDebugEngine::handleBreakpointEvent()"; qDebug() << "CdbDebugEngine::handleBreakpointEvent()";

View File

@@ -1,15 +1,48 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef DEBUGGER_CDBENGINE_H #ifndef DEBUGGER_CDBENGINE_H
#define DEBUGGER_CDBENGINE_H #define DEBUGGER_CDBENGINE_H
#include "idebuggerengine.h" #include "idebuggerengine.h"
#include "cdbdebugeventcallback.h"
#include "cdbdebugoutput.h"
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
class DebuggerManager; class DebuggerManager;
class IDebuggerManagerAccessForEngines; class CdbDebugEventCallback;
class CdbDebugOutput;
struct CdbDebugEnginePrivate;
class CdbDebugEngine : public IDebuggerEngine class CdbDebugEngine : public IDebuggerEngine
{ {
@@ -66,31 +99,10 @@ protected:
private: private:
void startWatchTimer(); void startWatchTimer();
void killWatchTimer(); void killWatchTimer();
bool isDebuggeeRunning() const { return m_watchTimer != -1; }
void handleDebugEvent();
void updateThreadList();
void updateStackTrace();
void handleDebugOutput(const char* szOutputString);
void handleBreakpointEvent(PDEBUG_BREAKPOINT pBP);
private: CdbDebugEnginePrivate *m_d;
HANDLE m_hDebuggeeProcess;
HANDLE m_hDebuggeeThread;
int m_currentThreadId;
bool m_bIgnoreNextDebugEvent;
int m_watchTimer;
IDebugClient5* m_pDebugClient;
IDebugControl4* m_pDebugControl;
IDebugSystemObjects4* m_pDebugSystemObjects;
IDebugSymbols3* m_pDebugSymbols;
IDebugRegisters2* m_pDebugRegisters;
CdbDebugEventCallback m_debugEventCallBack;
CdbDebugOutput m_debugOutputCallBack;
DebuggerManager *q;
IDebuggerManagerAccessForEngines *qq;
friend struct CdbDebugEnginePrivate;
friend class CdbDebugEventCallback; friend class CdbDebugEventCallback;
friend class CdbDebugOutput; friend class CdbDebugOutput;
}; };

View File

@@ -0,0 +1,81 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef DEBUGGER_CDBENGINEPRIVATE_H
#define DEBUGGER_CDBENGINEPRIVATE_H
#include "cdbdebugengine.h"
#include "cdbdebugeventcallback.h"
#include "cdbdebugoutput.h"
namespace Debugger {
namespace Internal {
class DebuggerManager;
class IDebuggerManagerAccessForEngines;
struct CdbDebugEnginePrivate
{
explicit CdbDebugEnginePrivate(DebuggerManager *parent, CdbDebugEngine* engine);
~CdbDebugEnginePrivate();
bool isDebuggeeRunning() const { return m_watchTimer != -1; }
void handleDebugEvent();
void updateThreadList();
void updateStackTrace();
void handleDebugOutput(const char* szOutputString);
void handleBreakpointEvent(PDEBUG_BREAKPOINT pBP);
HANDLE m_hDebuggeeProcess;
HANDLE m_hDebuggeeThread;
int m_currentThreadId;
bool m_bIgnoreNextDebugEvent;
int m_watchTimer;
IDebugClient5* m_pDebugClient;
IDebugControl4* m_pDebugControl;
IDebugSystemObjects4* m_pDebugSystemObjects;
IDebugSymbols3* m_pDebugSymbols;
IDebugRegisters2* m_pDebugRegisters;
CdbDebugEventCallback m_debugEventCallBack;
CdbDebugOutput m_debugOutputCallBack;
CdbDebugEngine* m_engine;
DebuggerManager *q;
IDebuggerManagerAccessForEngines *qq;
};
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_CDBENGINEPRIVATE_H

View File

@@ -1,5 +1,39 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "cdbdebugeventcallback.h" #include "cdbdebugeventcallback.h"
#include "cdbdebugengine.h" #include "cdbdebugengine.h"
#include "cdbdebugengine_p.h"
#include "debuggermanager.h" #include "debuggermanager.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -54,7 +88,7 @@ STDMETHODIMP CdbDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask)
STDMETHODIMP CdbDebugEventCallback::Breakpoint(THIS_ __in PDEBUG_BREAKPOINT Bp) STDMETHODIMP CdbDebugEventCallback::Breakpoint(THIS_ __in PDEBUG_BREAKPOINT Bp)
{ {
qDebug() << "MSVCDebugEventCallback::Breakpoint"; qDebug() << "MSVCDebugEventCallback::Breakpoint";
m_pEngine->handleBreakpointEvent(Bp); m_pEngine->m_d->handleBreakpointEvent(Bp);
return S_OK; return S_OK;
} }
@@ -105,16 +139,16 @@ STDMETHODIMP CdbDebugEventCallback::CreateProcess(
__in ULONG64 StartOffset __in ULONG64 StartOffset
) )
{ {
m_pEngine->m_hDebuggeeProcess = (HANDLE)Handle; m_pEngine->m_d->m_hDebuggeeProcess = (HANDLE)Handle;
m_pEngine->m_hDebuggeeThread = (HANDLE)InitialThreadHandle; m_pEngine->m_d->m_hDebuggeeThread = (HANDLE)InitialThreadHandle;
//m_pEngine->qq->notifyStartupFinished(); //m_pEngine->qq->notifyStartupFinished();
m_pEngine->qq->notifyInferiorRunning(); m_pEngine->m_d->qq->notifyInferiorRunning();
ULONG currentThreadId; ULONG currentThreadId;
if (SUCCEEDED(m_pEngine->m_pDebugSystemObjects->GetThreadIdByHandle(InitialThreadHandle, &currentThreadId))) if (SUCCEEDED(m_pEngine->m_d->m_pDebugSystemObjects->GetThreadIdByHandle(InitialThreadHandle, &currentThreadId)))
m_pEngine->m_currentThreadId = currentThreadId; m_pEngine->m_d->m_currentThreadId = currentThreadId;
else else
m_pEngine->m_currentThreadId = 0; m_pEngine->m_d->m_currentThreadId = 0;
m_pEngine->attemptBreakpointSynchronization(); m_pEngine->attemptBreakpointSynchronization();
return S_OK; return S_OK;
@@ -126,9 +160,9 @@ STDMETHODIMP CdbDebugEventCallback::ExitProcess(
) )
{ {
UNREFERENCED_PARAMETER(ExitCode); UNREFERENCED_PARAMETER(ExitCode);
m_pEngine->m_hDebuggeeProcess = 0; m_pEngine->m_d->m_hDebuggeeProcess = 0;
m_pEngine->m_hDebuggeeThread = 0; m_pEngine->m_d->m_hDebuggeeThread = 0;
m_pEngine->qq->notifyInferiorExited(); m_pEngine->m_d->qq->notifyInferiorExited();
return S_OK; return S_OK;
} }

View File

@@ -1,3 +1,36 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef DEBUGGER_CDBDEBUGEVENTCALLBACK_H #ifndef DEBUGGER_CDBDEBUGEVENTCALLBACK_H
#define DEBUGGER_CDBDEBUGEVENTCALLBACK_H #define DEBUGGER_CDBDEBUGEVENTCALLBACK_H

View File

@@ -1,8 +1,42 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include <windows.h> #include <windows.h>
#include <inc/dbgeng.h> #include <inc/dbgeng.h>
#include "cdbdebugoutput.h" #include "cdbdebugoutput.h"
#include "cdbdebugengine.h" #include "cdbdebugengine.h"
#include "cdbdebugengine_p.h"
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -49,7 +83,7 @@ STDMETHODIMP CdbDebugOutput::Output(
) )
{ {
UNREFERENCED_PARAMETER(mask); UNREFERENCED_PARAMETER(mask);
m_pEngine->handleDebugOutput(text); m_pEngine->m_d->handleDebugOutput(text);
return S_OK; return S_OK;
} }

View File

@@ -1,3 +1,36 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef DEBUGGER_CDBOUTPUT_H #ifndef DEBUGGER_CDBOUTPUT_H
#define DEBUGGER_CDBOUTPUT_H #define DEBUGGER_CDBOUTPUT_H

View File

@@ -106,11 +106,11 @@ enum DebuggerStatus
DebuggerInferiorStopped, // Debuggee stopped DebuggerInferiorStopped, // Debuggee stopped
}; };
class IDebuggerEngine; class IDebuggerEngine;
class GdbEngine; class GdbEngine;
class ScriptEngine; class ScriptEngine;
class CdbDebugEngine; class CdbDebugEngine;
struct CdbDebugEnginePrivate;
// The construct below is not nice but enforces a bit of order. The // The construct below is not nice but enforces a bit of order. The
// DebuggerManager interfaces a lots of thing: The DebuggerPlugin, // DebuggerManager interfaces a lots of thing: The DebuggerPlugin,
@@ -131,11 +131,12 @@ public:
private: private:
// This is the part of the interface that's exclusively seen by the // This is the part of the interface that's exclusively seen by the
// debugger enginesfriend class GdbEngine;. // debugger engines
friend class GdbEngine; friend class GdbEngine;
friend class CdbDebugEngine; friend class CdbDebugEngine;
friend class CdbDebugEventCallback; friend class CdbDebugEventCallback;
friend class ScriptEngine; friend class ScriptEngine;
friend struct CdbDebugEnginePrivate;
// called from the engines after successful startup // called from the engines after successful startup
virtual void notifyInferiorStopRequested() = 0; virtual void notifyInferiorStopRequested() = 0;