Commit 90470771 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger: Export DebuggerManager and DebuggerStartParameters.

For device debugging. Move both from namespace
Debugger::Internal to Debugger, export them, give
DebuggerManager a static instance().
parent 4dbfc183
......@@ -36,11 +36,11 @@
#include <QtCore/QAbstractItemModel>
namespace Debugger {
class DebuggerManager;
namespace Internal {
class BreakpointMarker;
class BreakHandler;
class DebuggerManager;
//////////////////////////////////////////////////////////////////
//
......
......@@ -368,7 +368,7 @@ bool CdbDebugEnginePrivate::init(QString *errorMessage)
return true;
}
IDebuggerEngine *CdbDebugEngine::create(DebuggerManager *manager,
IDebuggerEngine *CdbDebugEngine::create(Debugger::DebuggerManager *manager,
const QSharedPointer<CdbOptions> &options,
QString *errorMessage)
{
......
......@@ -36,9 +36,10 @@
#include <QtCore/QSharedPointer>
namespace Debugger {
class DebuggerManager;
namespace Internal {
class DebuggerManager;
class DisassemblerViewAgent;
class CdbDebugEventCallback;
class CdbDebugOutput;
......
......@@ -42,9 +42,10 @@
#include <QtCore/QMap>
namespace Debugger {
class DebuggerManager;
namespace Internal {
class DebuggerManager;
class WatchHandler;
class CdbStackFrameContext;
class CdbStackTraceContext;
......
......@@ -35,8 +35,10 @@
#include <QtCore/QStringList>
namespace Debugger {
namespace Internal {
class DebuggerManager;
namespace Internal {
class CdbDebugEngine;
// Base class for event callbacks that takes care
......
......@@ -37,10 +37,10 @@
#include <QtCore/QMap>
namespace Debugger {
namespace Internal {
class DebuggerManager;
namespace Internal {
struct CdbComInterfaces;
class DebuggerManager;
/* For code clarity, all the stuff related to custom dumpers goes here.
* "Custom dumper" is a library compiled against the current
......
......@@ -4,14 +4,12 @@ TARGET = Debugger
# DEFINES += QT_USE_FAST_OPERATOR_PLUS
# DEFINES += QT_USE_FAST_CONCATENATION
# CONFIG += single
include(../../qtcreatorplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/cpptools/cpptools.pri)
include(../../plugins/find/find.pri)
include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/texteditor/texteditor.pri)
include(../../libs/cplusplus/cplusplus.pri)
include(../../libs/utils/utils.pri)
include(debugger_dependencies.pri)
DEFINES += DEBUGGER_LIBRARY
INCLUDEPATH += $$PWD/../../libs/utils
QT += gui \
network \
......@@ -23,6 +21,7 @@ HEADERS += breakhandler.h \
debuggerconstants.h \
debuggerdialogs.h \
debuggermanager.h \
debugger_global.h \
debuggeroutputwindow.h \
debuggerplugin.h \
debuggerrunner.h \
......
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/cpptools/cpptools.pri)
include(../../plugins/find/find.pri)
include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/texteditor/texteditor.pri)
include(../../libs/cplusplus/cplusplus.pri)
include(../../libs/utils/utils.pri)
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef DEBUGGERGLOBAL_H
#define DEBUGGERGLOBAL_H
#include <QtCore/QtGlobal>
#if defined(DEBUGGER_LIBRARY)
# define DEBUGGER_EXPORT Q_DECL_EXPORT
#else
# define DEBUGGER_EXPORT Q_DECL_IMPORT
#endif
#endif // DEBUGGERGLOBAL_H
......@@ -42,9 +42,9 @@
namespace Debugger {
class DebuggerManager;
namespace Internal {
class DebuggerManager;
struct DisassemblerViewAgentPrivate;
class MemoryViewAgent : public QObject
......
......@@ -60,8 +60,6 @@ namespace Internal {
}
} // namespace Constants
namespace Internal {
enum DebuggerState
{
DebuggerNotReady, // Debugger not started
......@@ -118,7 +116,6 @@ enum LogChannel
LogMisc
};
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGERCONSTANTS_H
......
......@@ -155,8 +155,9 @@ IDebuggerEngine *createWinEngine(DebuggerManager *, bool /* cmdLineEnabled */, Q
{ return 0; }
#endif
} // namespace Internal
QDebug operator<<(QDebug str, const DebuggerStartParameters &p)
DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &p)
{
QDebug nospace = str.nospace();
const QString sep = QString(QLatin1Char(','));
......@@ -173,6 +174,7 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &p)
}
using namespace Constants;
using namespace Debugger::Internal;
static const QString tooltipIName = "tooltip";
......@@ -244,15 +246,17 @@ void DebuggerStartParameters::clear()
//
///////////////////////////////////////////////////////////////////////
static IDebuggerEngine *gdbEngine = 0;
static IDebuggerEngine *scriptEngine = 0;
static IDebuggerEngine *tcfEngine = 0;
static IDebuggerEngine *winEngine = 0;
static Debugger::Internal::IDebuggerEngine *gdbEngine = 0;
static Debugger::Internal::IDebuggerEngine *scriptEngine = 0;
static Debugger::Internal::IDebuggerEngine *tcfEngine = 0;
static Debugger::Internal::IDebuggerEngine *winEngine = 0;
struct DebuggerManagerPrivate {
DebuggerManagerPrivate();
static DebuggerManager *instance;
// FIXME: Remove engine-specific state
DebuggerStartParametersPtr m_startParameters;
qint64 m_inferiorPid;
......@@ -295,6 +299,8 @@ struct DebuggerManagerPrivate {
DebuggerState m_state;
};
DebuggerManager *DebuggerManagerPrivate::instance = 0;
DebuggerManagerPrivate::DebuggerManagerPrivate() :
m_startParameters(new DebuggerStartParameters),
m_inferiorPid(0)
......@@ -303,6 +309,7 @@ DebuggerManagerPrivate::DebuggerManagerPrivate() :
DebuggerManager::DebuggerManager() : d(new DebuggerManagerPrivate)
{
DebuggerManagerPrivate::instance = this;
init();
}
......@@ -314,9 +321,15 @@ DebuggerManager::~DebuggerManager()
doDelete(tcfEngine);
doDelete(winEngine);
#undef doDelete
DebuggerManagerPrivate::instance = 0;
delete d;
}
DebuggerManager *DebuggerManager::instance()
{
return DebuggerManagerPrivate::instance;
}
void DebuggerManager::init()
{
d->m_state = DebuggerState(-1);
......@@ -337,7 +350,6 @@ void DebuggerManager::init()
d->m_threadsWindow = new ThreadsWindow;
d->m_localsWindow = new WatchWindow(WatchWindow::LocalsType, this);
d->m_watchersWindow = new WatchWindow(WatchWindow::WatchersType, this);
//d->m_tooltipWindow = new WatchWindow(WatchWindow::TooltipType, this);
d->m_statusTimer = new QTimer(this);
d->m_mainWindow = new Core::Utils::FancyMainWindow;
......@@ -430,10 +442,10 @@ void DebuggerManager::init()
// Tooltip
//QTreeView *tooltipView = qobject_cast<QTreeView *>(d->m_tooltipWindow);
//tooltipView->setModel(d->m_watchHandler->model(TooltipsWatch));
//qRegisterMetaType<WatchData>("Debugger::Internal::WatchData");
//qRegisterMetaType<WatchData>("WatchData");
qRegisterMetaType<WatchData>("WatchData");
connect(d->m_watchHandler, SIGNAL(watchDataUpdateNeeded(WatchData)),
this, SLOT(updateWatchData(WatchData)));
connect(d->m_watchHandler, SIGNAL(watchDataUpdateNeeded(Debugger::Internal::WatchData)),
this, SLOT(updateWatchData(Debugger::Internal::WatchData)));
d->m_actions.continueAction = new QAction(tr("Continue"), this);
d->m_actions.continueAction->setIcon(QIcon(":/debugger/images/debugger_continue_small.png"));
......@@ -822,7 +834,7 @@ void DebuggerManager::setToolTipExpression(const QPoint &mousePos, TextEditor::I
d->m_engine->setToolTipExpression(mousePos, editor, cursorPos);
}
void DebuggerManager::updateWatchData(const WatchData &data)
void DebuggerManager::updateWatchData(const Debugger::Internal::WatchData &data)
{
if (d->m_engine)
d->m_engine->updateWatchData(data);
......@@ -1323,7 +1335,7 @@ void DebuggerManager::resetLocation()
emit resetLocationRequested();
}
void DebuggerManager::gotoLocation(const StackFrame &frame, bool setMarker)
void DebuggerManager::gotoLocation(const Debugger::Internal::StackFrame &frame, bool setMarker)
{
// connected to the plugin
emit gotoLocationRequested(frame, setMarker);
......@@ -1697,6 +1709,5 @@ void DebuggerManager::runTest(const QString &fileName)
//startNewDebugger(StartInternal);
}
} // namespace Internal
} // namespace Debugger
......@@ -30,6 +30,7 @@
#ifndef DEBUGGER_DEBUGGERMANAGER_H
#define DEBUGGER_DEBUGGERMANAGER_H
#include "debugger_global.h"
#include "debuggerconstants.h"
#include <QtCore/QObject>
......@@ -81,8 +82,17 @@ class ScriptEngine;
class CdbDebugEngine;
struct CdbDebugEnginePrivate;
struct DebuggerManagerActions;
class DebuggerPlugin;
class CdbDebugEventCallback;
class CdbDumperHelper;
class CdbExceptionLoggerEventCallback;
class GdbEngine;
class TcfEngine;
class CdbDebugEngine;
struct CdbDebugEnginePrivate;
} // namespace Internal
class DebuggerStartParameters
class DEBUGGER_EXPORT DebuggerStartParameters
{
public:
DebuggerStartParameters();
......@@ -109,7 +119,8 @@ public:
};
typedef QSharedPointer<DebuggerStartParameters> DebuggerStartParametersPtr;
QDebug operator<<(QDebug str, const DebuggerStartParameters &);
DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &);
// Flags for initialization
enum DebuggerEngineTypeFlags
......@@ -132,7 +143,7 @@ QDebug operator<<(QDebug d, DebuggerState state);
struct DebuggerManagerPrivate;
class DebuggerManager : public QObject
class DEBUGGER_EXPORT DebuggerManager : public QObject
{
Q_OBJECT
......@@ -140,28 +151,30 @@ public:
DebuggerManager();
~DebuggerManager();
friend class IDebuggerEngine;
friend class DebuggerPlugin;
friend class CdbDebugEventCallback;
friend class CdbDumperHelper;
friend class CdbExceptionLoggerEventCallback;
friend class GdbEngine;
friend class ScriptEngine;
friend class TcfEngine;
friend class CdbDebugEngine;
friend struct CdbDebugEnginePrivate;
friend class Internal::IDebuggerEngine;
friend class Internal::DebuggerPlugin;
friend class Internal::CdbDebugEventCallback;
friend class Internal::CdbDumperHelper;
friend class Internal::CdbExceptionLoggerEventCallback;
friend class Internal::GdbEngine;
friend class Internal::ScriptEngine;
friend class Internal::TcfEngine;
friend class Internal::CdbDebugEngine;
friend struct Internal::CdbDebugEnginePrivate;
QList<Core::IOptionsPage*> initializeEngines(unsigned enabledTypeFlags);
Core::Utils::FancyMainWindow *mainWindow() const;
QLabel *statusLabel() const;
IDebuggerEngine *currentEngine() const;
Internal::IDebuggerEngine *currentEngine() const;
DebuggerStartParametersPtr startParameters() const;
qint64 inferiorPid() const;
void showMessageBox(int icon, const QString &title, const QString &text);
static DebuggerManager *instance();
public slots:
void startNewDebugger(const DebuggerStartParametersPtr &sp);
void exitDebugger();
......@@ -171,7 +184,7 @@ public slots:
void setBusyCursor(bool on);
void queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **ed);
void gotoLocation(const StackFrame &frame, bool setLocationMarker);
void gotoLocation(const Debugger::Internal::StackFrame &frame, bool setLocationMarker);
void fileOpen(const QString &file);
void resetLocation();
......@@ -194,7 +207,7 @@ public slots:
void detachDebugger();
void addToWatchWindow();
void updateWatchData(const WatchData &data);
void updateWatchData(const Debugger::Internal::WatchData &data);
void sessionLoaded();
void aboutToUnloadSession();
......@@ -237,15 +250,15 @@ private slots:
void startFailed();
private:
ModulesHandler *modulesHandler() const;
BreakHandler *breakHandler() const;
RegisterHandler *registerHandler() const;
StackHandler *stackHandler() const;
ThreadsHandler *threadsHandler() const;
WatchHandler *watchHandler() const;
SourceFilesWindow *sourceFileWindow() const;
Internal::ModulesHandler *modulesHandler() const;
Internal::BreakHandler *breakHandler() const;
Internal::RegisterHandler *registerHandler() const;
Internal::StackHandler *stackHandler() const;
Internal::ThreadsHandler *threadsHandler() const;
Internal::WatchHandler *watchHandler() const;
Internal::SourceFilesWindow *sourceFileWindow() const;
QWidget *threadsWindow() const;
DebuggerManagerActions debuggerManagerActions() const;
Internal::DebuggerManagerActions debuggerManagerActions() const;
void notifyInferiorStopped();
void notifyInferiorRunning();
......@@ -274,7 +287,7 @@ private:
public:
// stuff in this block should be made private by moving it to
// one of the interfaces
QList<Symbol> moduleSymbols(const QString &moduleName);
QList<Internal::Symbol> moduleSymbols(const QString &moduleName);
signals:
void debuggingFinished();
......@@ -283,7 +296,7 @@ signals:
void debugModeRequested();
void previousModeRequested();
void statusMessageRequested(const QString &msg, int timeout); // -1 for 'forever'
void gotoLocationRequested(const StackFrame &frame, bool setLocationMarker);
void gotoLocationRequested(const Debugger::Internal::StackFrame &frame, bool setLocationMarker);
void resetLocationRequested();
void currentTextEditorRequested(QString *fileName, int *lineNumber, QObject **ob);
void sessionValueRequested(const QString &name, QVariant *value);
......@@ -301,14 +314,13 @@ private:
void toggleBreakpoint(const QString &fileName, int lineNumber);
void toggleBreakpointEnabled(const QString &fileName, int lineNumber);
BreakpointData *findBreakpoint(const QString &fileName, int lineNumber);
Internal::BreakpointData *findBreakpoint(const QString &fileName, int lineNumber);
void setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, int cursorPos);
DebuggerManagerPrivate *d;
};
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_DEBUGGERMANAGER_H
......@@ -55,6 +55,7 @@ using namespace Find;
#endif // GDBDEBUGGERLEAN
using namespace Debugger;
using namespace Debugger::Internal;
static QChar charForChannel(int channel)
......
......@@ -887,8 +887,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
connect(m_manager, SIGNAL(resetLocationRequested()),
this, SLOT(resetLocation()));
connect(m_manager, SIGNAL(gotoLocationRequested(StackFrame,bool)),
this, SLOT(gotoLocation(StackFrame,bool)));
connect(m_manager, SIGNAL(gotoLocationRequested(Debugger::Internal::StackFrame,bool)),
this, SLOT(gotoLocation(Debugger::Internal::StackFrame,bool)));
connect(m_manager, SIGNAL(stateChanged(int)),
this, SLOT(handleStateChanged(int)));
connect(m_manager, SIGNAL(previousModeRequested()),
......@@ -1090,7 +1090,7 @@ void DebuggerPlugin::resetLocation()
m_locationMark = 0;
}
void DebuggerPlugin::gotoLocation(const StackFrame &frame, bool setMarker)
void DebuggerPlugin::gotoLocation(const Debugger::Internal::StackFrame &frame, bool setMarker)
{
if (theDebuggerBoolSetting(StepByInstruction) || !frame.isUsable()) {
if (!m_disassemblerViewAgent)
......
......@@ -55,10 +55,11 @@ class BaseTextMark;
}
namespace Debugger {
class DebuggerManager;
namespace Internal {
class BreakpointData;
class DebuggerManager;
class DebuggerRunControlFactory;
class DebugMode;
class DisassemblerViewAgent;
......@@ -96,7 +97,7 @@ private slots:
int lineNumber, QMenu *menu);
void resetLocation();
void gotoLocation(const StackFrame &frame, bool setMarker);
void gotoLocation(const Debugger::Internal::StackFrame &frame, bool setMarker);
void breakpointSetRemoveMarginActionTriggered();
void breakpointEnableDisableMarginActionTriggered();
......
......@@ -40,9 +40,9 @@ class LocalApplicationRunConfiguration;
}
namespace Debugger {
namespace Internal {
class DebuggerManager;
namespace Internal {
class StartData;
typedef QSharedPointer<ProjectExplorer::RunConfiguration>
......
......@@ -55,11 +55,10 @@ class QMainWindow;
QT_END_NAMESPACE
namespace Debugger {
class DebuggerManager;
namespace Internal {
class AbstractGdbAdapter;
class DebuggerManager;
class IDebuggerManagerAccessForEngines;
class GdbResponse;
class GdbMi;
......
......@@ -50,22 +50,23 @@ class IOptionsPage;
}
namespace Debugger {
class DebuggerManager;
class DebuggerStartParameters;
namespace Internal {
class DebuggerStartParameters;
class DebuggerManager;
class DisassemblerViewAgent;
class MemoryViewAgent;
struct StackFrame;
class Symbol;
class WatchData;
typedef QSharedPointer<DebuggerStartParameters> DebuggerStartParametersPtr;
class IDebuggerEngine : public QObject
{
Q_OBJECT
public:
typedef QSharedPointer<DebuggerStartParameters> DebuggerStartParametersPtr;
IDebuggerEngine(DebuggerManager *manager, QObject *parent = 0)
: QObject(parent), m_manager(manager)
{}
......
......@@ -33,10 +33,10 @@
#include <QTreeView>
namespace Debugger {
namespace Internal {
class DebuggerManager;
namespace Internal {
class ModulesWindow : public QTreeView
{
Q_OBJECT
......
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