diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h
index d02800625caccd13ed2dcc4ec5b8b2ab1bd4792e..0e5fbbbfb116dc0919d98390bac04490ad075824 100644
--- a/src/plugins/debugger/breakhandler.h
+++ b/src/plugins/debugger/breakhandler.h
@@ -36,11 +36,11 @@
 #include <QtCore/QAbstractItemModel>
 
 namespace Debugger {
+class DebuggerManager;
 namespace Internal {
 
 class BreakpointMarker;
 class BreakHandler;
-class DebuggerManager;
 
 //////////////////////////////////////////////////////////////////
 //
diff --git a/src/plugins/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp
index 69d3ff147955141bbc949af592de09280d509333..2d1915fe03f7237ca89ca0c693effbc791574dc9 100644
--- a/src/plugins/debugger/cdb/cdbdebugengine.cpp
+++ b/src/plugins/debugger/cdb/cdbdebugengine.cpp
@@ -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)
 {
diff --git a/src/plugins/debugger/cdb/cdbdebugengine.h b/src/plugins/debugger/cdb/cdbdebugengine.h
index 18b660416520f01f54ffbf6d9cecba4aa65a4733..cbd52105cbde5d14193e453c6defecd04e4e9719 100644
--- a/src/plugins/debugger/cdb/cdbdebugengine.h
+++ b/src/plugins/debugger/cdb/cdbdebugengine.h
@@ -36,9 +36,10 @@
 #include <QtCore/QSharedPointer>
 
 namespace Debugger {
+class DebuggerManager;
+
 namespace Internal {
 
-class DebuggerManager;
 class DisassemblerViewAgent;
 class CdbDebugEventCallback;
 class CdbDebugOutput;
diff --git a/src/plugins/debugger/cdb/cdbdebugengine_p.h b/src/plugins/debugger/cdb/cdbdebugengine_p.h
index 9cf9f8661b0b3ddb6037ae5ab8218ce014322d56..55c1d9717bc8095213e648d8e0895b8c2336305e 100644
--- a/src/plugins/debugger/cdb/cdbdebugengine_p.h
+++ b/src/plugins/debugger/cdb/cdbdebugengine_p.h
@@ -42,9 +42,10 @@
 #include <QtCore/QMap>
 
 namespace Debugger {
+class DebuggerManager;
+
 namespace Internal {
 
-class DebuggerManager;
 class WatchHandler;
 class CdbStackFrameContext;
 class CdbStackTraceContext;
diff --git a/src/plugins/debugger/cdb/cdbdebugeventcallback.h b/src/plugins/debugger/cdb/cdbdebugeventcallback.h
index 81f5226ddadfa59a60059b70fd2225b36da732e7..b9de88e1745650a667a22c2ba794aae4f1f69937 100644
--- a/src/plugins/debugger/cdb/cdbdebugeventcallback.h
+++ b/src/plugins/debugger/cdb/cdbdebugeventcallback.h
@@ -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
diff --git a/src/plugins/debugger/cdb/cdbdumperhelper.h b/src/plugins/debugger/cdb/cdbdumperhelper.h
index a1fc4a3be49383ffd20f498a5fcfa4744d5ace74..eaa7a1db7b2b38e39ce7129aa2baf68e43317190 100644
--- a/src/plugins/debugger/cdb/cdbdumperhelper.h
+++ b/src/plugins/debugger/cdb/cdbdumperhelper.h
@@ -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
diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro
index bbaba1b70cdf03567ff9b6db3c8a1399c95ee227..55d30c36cc3a42324ae0c83661a281b19c3e0d54 100644
--- a/src/plugins/debugger/debugger.pro
+++ b/src/plugins/debugger/debugger.pro
@@ -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 \
diff --git a/src/plugins/debugger/debugger_dependencies.pri b/src/plugins/debugger/debugger_dependencies.pri
new file mode 100644
index 0000000000000000000000000000000000000000..2701df45bab5a994eafca663a9513b1307dc1721
--- /dev/null
+++ b/src/plugins/debugger/debugger_dependencies.pri
@@ -0,0 +1,7 @@
+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)
diff --git a/src/plugins/debugger/debugger_global.h b/src/plugins/debugger/debugger_global.h
new file mode 100644
index 0000000000000000000000000000000000000000..f01fd3aa070619107ad2d848aa10739e45af72fe
--- /dev/null
+++ b/src/plugins/debugger/debugger_global.h
@@ -0,0 +1,41 @@
+/**************************************************************************
+**
+** 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
diff --git a/src/plugins/debugger/debuggeragents.h b/src/plugins/debugger/debuggeragents.h
index 7e52f96fae9e2d98d54b00cd1fe48ebb7eee2301..ba993b0efdfc3d17f27c3c9a674424f33c70438d 100644
--- a/src/plugins/debugger/debuggeragents.h
+++ b/src/plugins/debugger/debuggeragents.h
@@ -42,9 +42,9 @@
 
 
 namespace Debugger {
+class DebuggerManager;
 namespace Internal {
 
-class DebuggerManager;
 struct DisassemblerViewAgentPrivate;
 
 class MemoryViewAgent : public QObject
diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h
index 59bc87faa24b228ada7930a0964dc14851843a64..2367ce402e5e6bd5bfddf2767e6cc826673c1cca 100644
--- a/src/plugins/debugger/debuggerconstants.h
+++ b/src/plugins/debugger/debuggerconstants.h
@@ -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
diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp
index 4259020f8a3698d97dfdaad8c4ef2ec3350558ee..1666bd7445112db03c8f59a7276fa86f5a6aaadd 100644
--- a/src/plugins/debugger/debuggermanager.cpp
+++ b/src/plugins/debugger/debuggermanager.cpp
@@ -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
 
diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h
index b8f52cb249dc1a3884a76aeb90b3b9f0cf692244..6b3fde9732323222dfbf0125adc1c963629c9ffc 100644
--- a/src/plugins/debugger/debuggermanager.h
+++ b/src/plugins/debugger/debuggermanager.h
@@ -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
diff --git a/src/plugins/debugger/debuggeroutputwindow.cpp b/src/plugins/debugger/debuggeroutputwindow.cpp
index 54e1b1b141f7871e4e595df1afe5d2f60a1d3faf..b248c95b1b5bccc417ff0182c53e481921a0d1a3 100644
--- a/src/plugins/debugger/debuggeroutputwindow.cpp
+++ b/src/plugins/debugger/debuggeroutputwindow.cpp
@@ -55,6 +55,7 @@ using namespace Find;
 
 #endif // GDBDEBUGGERLEAN
 
+using namespace Debugger;
 using namespace Debugger::Internal;
 
 static QChar charForChannel(int channel)
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 3618688d10073c186d55df9b701bdaa2a7903339..03eebb88ba916edc2fc22cb24ef418007fb25672 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -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)
diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h
index a0777d7f284d7d52313cd8c33f7e837d9934b38c..2eecc874adc4ba6fef02e9c1670fb5eb0b473f5e 100644
--- a/src/plugins/debugger/debuggerplugin.h
+++ b/src/plugins/debugger/debuggerplugin.h
@@ -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();
diff --git a/src/plugins/debugger/debuggerrunner.h b/src/plugins/debugger/debuggerrunner.h
index dcb996afe8306f1887cbb0b62a6a30b55325c698..196d7ee123b7415d7d90ccea6162221d34cf42bd 100644
--- a/src/plugins/debugger/debuggerrunner.h
+++ b/src/plugins/debugger/debuggerrunner.h
@@ -40,9 +40,9 @@ class LocalApplicationRunConfiguration;
 }
 
 namespace Debugger {
-namespace Internal {
-
 class DebuggerManager;
+
+namespace Internal {
 class StartData;
 
 typedef QSharedPointer<ProjectExplorer::RunConfiguration>
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index 5e59c049d7dfcc388b5b2c35819a88340015065e..6bfc7444fb04b812f6b0e9fcddffd89d0570fbc9 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -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;
 
diff --git a/src/plugins/debugger/idebuggerengine.h b/src/plugins/debugger/idebuggerengine.h
index d204dc5f6faf919b94f2ad60bbbc018c1505a0ef..db990fa9389b98feb7a311b3eaf3a948104c12b6 100644
--- a/src/plugins/debugger/idebuggerengine.h
+++ b/src/plugins/debugger/idebuggerengine.h
@@ -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)
     {}
diff --git a/src/plugins/debugger/moduleswindow.h b/src/plugins/debugger/moduleswindow.h
index 3c8505076f8d115ed934452ad5cc1284614ca226..4114cddf5ca8aba497b4d2138aa2306e373b965a 100644
--- a/src/plugins/debugger/moduleswindow.h
+++ b/src/plugins/debugger/moduleswindow.h
@@ -33,10 +33,10 @@
 #include <QTreeView>
 
 namespace Debugger {
-namespace Internal {
-
 class DebuggerManager;
 
+namespace Internal {
+
 class ModulesWindow : public QTreeView
 {
     Q_OBJECT
diff --git a/src/plugins/debugger/registerwindow.h b/src/plugins/debugger/registerwindow.h
index f29283f3b5422e378ffebeb5e8ad9fac87185f1a..394a1ca3c916078c816ea1b42cfdc8f110f2dbe4 100644
--- a/src/plugins/debugger/registerwindow.h
+++ b/src/plugins/debugger/registerwindow.h
@@ -30,13 +30,12 @@
 #ifndef DEBUGGER_REGISTERWINDOW_H
 #define DEBUGGER_REGISTERWINDOW_H
 
-#include <QTreeView>
+#include <QtGui/QTreeView>
 
 namespace Debugger {
-namespace Internal {
-
 class DebuggerManager;
 
+namespace Internal {
 class RegisterWindow : public QTreeView
 {
     Q_OBJECT
diff --git a/src/plugins/debugger/stackwindow.h b/src/plugins/debugger/stackwindow.h
index 2703735420ee045a046b3981b192da4c10a87a30..52390bcc342b89639c3693083f7add52f8c05fc2 100644
--- a/src/plugins/debugger/stackwindow.h
+++ b/src/plugins/debugger/stackwindow.h
@@ -39,9 +39,9 @@ class QModelIndex;
 QT_END_NAMESPACE
 
 namespace Debugger {
-namespace Internal {
-
 class DebuggerManager;
+
+namespace Internal {
 class DisassemblerViewAgent;
     
 class StackWindow : public QTreeView
diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h
index 8f6590484b92f33fc46b0576599114ea68ae4546..285f004d8f017afb05fee790b5756384a1a2e1a6 100644
--- a/src/plugins/debugger/watchhandler.h
+++ b/src/plugins/debugger/watchhandler.h
@@ -262,7 +262,7 @@ public:
     static QString watcherEditPlaceHolder();
 
 signals:
-    void watchDataUpdateNeeded(const WatchData &data);
+    void watchDataUpdateNeeded(const Debugger::Internal::WatchData &data);
     void sessionValueRequested(const QString &name, QVariant *value);
     void setSessionValueRequested(const QString &name, const QVariant &value);
 
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index edb3c9bbaf8aadd2cb2515116e7bffd207a6445a..707126fa197c6e7bedba3dd8972199399e6051c9 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -33,6 +33,7 @@
 #include "debuggeractions.h"
 #include "debuggeragents.h"
 #include "debuggerdialogs.h"
+#include "debuggermanager.h"
 
 #include <utils/qtcassert.h>
 
@@ -50,6 +51,7 @@
 #include <QtGui/QMenu>
 #include <QtGui/QResizeEvent>
 
+using namespace Debugger;
 using namespace Debugger::Internal;
 
 /////////////////////////////////////////////////////////////////////
diff --git a/src/plugins/debugger/watchwindow.h b/src/plugins/debugger/watchwindow.h
index 582ffdcd6fab1fb5e5d0d33462c466f6f469caee..3e497e6895ef1ce3e4add742e9505d30a7cdc2f5 100644
--- a/src/plugins/debugger/watchwindow.h
+++ b/src/plugins/debugger/watchwindow.h
@@ -33,6 +33,8 @@
 #include <QtGui/QTreeView>
 
 namespace Debugger {
+class DebuggerManager;
+
 namespace Internal {
 
 /////////////////////////////////////////////////////////////////////
@@ -41,8 +43,6 @@ namespace Internal {
 //
 /////////////////////////////////////////////////////////////////////
 
-class DebuggerManager;
-
 class WatchWindow : public QTreeView
 {
     Q_OBJECT