diff --git a/src/plugins/debugger/attachcoredialog.ui b/src/plugins/debugger/attachcoredialog.ui
index 3b16c637a919178e220db1636b5f5026149f3713..5ebe87de853b89805472d890d2a665b003917676 100644
--- a/src/plugins/debugger/attachcoredialog.ui
+++ b/src/plugins/debugger/attachcoredialog.ui
@@ -1,64 +1,95 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>AttachCoreDialog</class>
- <widget class="QDialog" name="AttachCoreDialog" >
-  <property name="geometry" >
+ <widget class="QDialog" name="AttachCoreDialog">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>561</width>
-    <height>866</height>
+    <width>425</width>
+    <height>127</height>
    </rect>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>Start Debugger</string>
   </property>
-  <layout class="QVBoxLayout" >
-   <property name="spacing" >
+  <layout class="QVBoxLayout">
+   <property name="spacing">
     <number>6</number>
    </property>
-   <property name="margin" >
+   <property name="margin">
     <number>9</number>
    </property>
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout" >
-     <item>
-      <widget class="QLabel" name="pidLabel" >
-       <property name="text" >
-        <string>Attach to Process ID:</string>
+    <layout class="QGridLayout">
+     <property name="margin">
+      <number>0</number>
+     </property>
+     <property name="spacing">
+      <number>6</number>
+     </property>
+     <item row="0" column="0">
+      <widget class="QLabel" name="execLabel">
+       <property name="text">
+        <string>Executable:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="0">
+      <widget class="QLabel" name="coreLabel">
+       <property name="text">
+        <string>Core File:</string>
        </property>
       </widget>
      </item>
-     <item>
-      <widget class="QLineEdit" name="pidLineEdit" />
+     <item row="0" column="1">
+      <widget class="Core::Utils::PathChooser" name="execFileName" native="true"/>
+     </item>
+     <item row="1" column="1">
+      <widget class="Core::Utils::PathChooser" name="coreFileName" native="true"/>
      </item>
     </layout>
    </item>
    <item>
-    <widget class="QTreeView" name="procView" >
-     <property name="editTriggers" >
-      <set>QAbstractItemView::NoEditTriggers</set>
+    <spacer>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
      </property>
-    </widget>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>407</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
    </item>
    <item>
-    <widget class="Line" name="line" >
-     <property name="orientation" >
+    <widget class="Line" name="line">
+     <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
     </widget>
    </item>
    <item>
-    <widget class="QDialogButtonBox" name="buttonBox" >
-     <property name="orientation" >
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
-     <property name="standardButtons" >
+     <property name="standardButtons">
       <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
      </property>
     </widget>
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>Core::Utils::PathChooser</class>
+   <extends>QWidget</extends>
+   <header location="global">utils/pathchooser.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>
diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp
index 0f538d63e606e75abee2ba6ef76b4a6c76a4ca28..4273fe743b29e10d402cfdbf76d45336e6e86cce 100644
--- a/src/plugins/debugger/debuggerdialogs.cpp
+++ b/src/plugins/debugger/debuggerdialogs.cpp
@@ -29,6 +29,11 @@
 
 #include "debuggerdialogs.h"
 
+#include "ui_attachcoredialog.h"
+#include "ui_attachexternaldialog.h"
+#include "ui_attachremotedialog.h"
+#include "ui_startexternaldialog.h"
+
 #include <QtCore/QDebug>
 #include <QtCore/QDir>
 #include <QtCore/QFile>
@@ -54,17 +59,46 @@ using namespace Debugger::Internal;
 ///////////////////////////////////////////////////////////////////////
 
 AttachCoreDialog::AttachCoreDialog(QWidget *parent)
-  : QDialog(parent)
+  : QDialog(parent), m_ui(new Ui::AttachCoreDialog)
 {
-    setupUi(this);
+    m_ui->setupUi(this);
+
+    m_ui->execFileName->setExpectedKind(Core::Utils::PathChooser::File);
+    m_ui->execFileName->setPromptDialogTitle(tr("Select Executable"));
+
+    m_ui->coreFileName->setExpectedKind(Core::Utils::PathChooser::File);
+    m_ui->coreFileName->setPromptDialogTitle(tr("Select Executable"));
+
+    m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
 
-    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
-    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+    connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+}
+
+AttachCoreDialog::~AttachCoreDialog()
+{
+    delete m_ui;
+}
 
-    //connect(procView, SIGNAL(activated(const QModelIndex &)),
-    //    this, SLOT(procSelected(const QModelIndex &)));
+QString AttachCoreDialog::executableFile() const
+{
+    return m_ui->execFileName->path();
 }
 
+void AttachCoreDialog::setExecutableFile(const QString &fileName)
+{
+    m_ui->execFileName->setPath(fileName);
+}
+
+QString AttachCoreDialog::coreFile() const
+{
+    return m_ui->coreFileName->path();
+}
+
+void AttachCoreDialog::setCoreFile(const QString &fileName)
+{
+    m_ui->coreFileName->setPath(fileName);
+}
 
 
 ///////////////////////////////////////////////////////////////////////
@@ -74,23 +108,28 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
 ///////////////////////////////////////////////////////////////////////
 
 AttachExternalDialog::AttachExternalDialog(QWidget *parent)
-  : QDialog(parent)
+  : QDialog(parent), m_ui(new Ui::AttachExternalDialog)
 {
-    setupUi(this);
-    buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
+    m_ui->setupUi(this);
+    m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
     m_model = new QStandardItemModel(this);
 
-    procView->setSortingEnabled(true);
+    m_ui->procView->setSortingEnabled(true);
 
-    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
-    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+    connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
 
-    connect(procView, SIGNAL(activated(const QModelIndex &)),
-        this, SLOT(procSelected(const QModelIndex &)));
+    connect(m_ui->procView, SIGNAL(activated(QModelIndex)),
+        this, SLOT(procSelected(QModelIndex)));
 
     rebuildProcessList();
 }
 
+AttachExternalDialog::~AttachExternalDialog()
+{
+    delete m_ui;
+}
+
 static bool isProcessName(const QString &procname)
 {
     for (int i = 0; i != procname.size(); ++i)
@@ -132,7 +171,7 @@ void AttachExternalDialog::rebuildProcessList()
 {
     QStringList procnames = QDir("/proc/").entryList();
     if (procnames.isEmpty()) {
-        procView->hide();
+        m_ui->procView->hide();
         return;
     }
     
@@ -165,11 +204,11 @@ void AttachExternalDialog::rebuildProcessList()
     //model->setHeaderData(2, Qt::Horizontal, "Parent", Qt::DisplayRole);
     m_model->setHeaderData(2, Qt::Horizontal, "State", Qt::DisplayRole);
 
-    procView->setModel(m_model);
-    procView->expandAll();
-    procView->resizeColumnToContents(0);
-    procView->resizeColumnToContents(1);
-    procView->sortByColumn(1, Qt::AscendingOrder);
+    m_ui->procView->setModel(m_model);
+    m_ui->procView->expandAll();
+    m_ui->procView->resizeColumnToContents(0);
+    m_ui->procView->resizeColumnToContents(1);
+    m_ui->procView->sortByColumn(1, Qt::AscendingOrder);
 }
 
 void AttachExternalDialog::procSelected(const QModelIndex &index0)
@@ -178,13 +217,13 @@ void AttachExternalDialog::procSelected(const QModelIndex &index0)
     QStandardItem *item = m_model->itemFromIndex(index);
     if (!item)
         return;
-    pidLineEdit->setText(item->text());
+    m_ui->pidLineEdit->setText(item->text());
     accept();
 }
 
 int AttachExternalDialog::attachPID() const
 {
-    return pidLineEdit->text().toInt();
+    return m_ui->pidLineEdit->text().toInt();
 }
 
 
@@ -196,31 +235,35 @@ int AttachExternalDialog::attachPID() const
 ///////////////////////////////////////////////////////////////////////
 
 AttachRemoteDialog::AttachRemoteDialog(QWidget *parent, const QString &pid)
-  : QDialog(parent)
+  : QDialog(parent), m_ui(new Ui::AttachRemoteDialog)
 {
-    setupUi(this);
-    buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
+    m_ui->setupUi(this);
+    m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
     m_defaultPID = pid;
     m_model = new QStandardItemModel(this);
 
-    procView->setSortingEnabled(true);
-
-    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
-    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+    m_ui->procView->setSortingEnabled(true);
 
-    connect(procView, SIGNAL(activated(const QModelIndex &)),
-        this, SLOT(procSelected(const QModelIndex &)));
+    connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
 
+    connect(m_ui->procView, SIGNAL(activated(QModelIndex)),
+        this, SLOT(procSelected(QModelIndex)));
 
-    pidLineEdit->setText(m_defaultPID);
+    m_ui->pidLineEdit->setText(m_defaultPID);
     rebuildProcessList();
 }
 
+AttachRemoteDialog::~AttachRemoteDialog()
+{
+    delete m_ui;
+}
+
 void AttachRemoteDialog::rebuildProcessList()
 {
     QStringList procnames = QDir("/proc/").entryList();
     if (procnames.isEmpty()) {
-        procView->hide();
+        m_ui->procView->hide();
         return;
     }
     
@@ -253,10 +296,10 @@ void AttachRemoteDialog::rebuildProcessList()
     //model->setHeaderData(2, Qt::Horizontal, "Parent", Qt::DisplayRole);
     m_model->setHeaderData(2, Qt::Horizontal, "State", Qt::DisplayRole);
 
-    procView->setModel(m_model);
-    procView->expandAll();
-    procView->resizeColumnToContents(0);
-    procView->resizeColumnToContents(1);
+    m_ui->procView->setModel(m_model);
+    m_ui->procView->expandAll();
+    m_ui->procView->resizeColumnToContents(0);
+    m_ui->procView->resizeColumnToContents(1);
 }
 
 void AttachRemoteDialog::procSelected(const QModelIndex &index0)
@@ -265,13 +308,13 @@ void AttachRemoteDialog::procSelected(const QModelIndex &index0)
     QStandardItem *item = m_model->itemFromIndex(index);
     if (!item)
         return;
-    pidLineEdit->setText(item->text());
+    m_ui->pidLineEdit->setText(item->text());
     accept();
 }
 
 int AttachRemoteDialog::attachPID() const
 {
-    return pidLineEdit->text().toInt();
+    return m_ui->pidLineEdit->text().toInt();
 }
 
 
@@ -284,40 +327,45 @@ int AttachRemoteDialog::attachPID() const
 
 
 StartExternalDialog::StartExternalDialog(QWidget *parent)
-  : QDialog(parent)
+  : QDialog(parent), m_ui(new Ui::StartExternalDialog)
 {
-    setupUi(this);
-    execFile->setExpectedKind(Core::Utils::PathChooser::File);
-    execFile->setPromptDialogTitle(tr("Select Executable"));
-    buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
+    m_ui->setupUi(this);
+    m_ui->execFile->setExpectedKind(Core::Utils::PathChooser::File);
+    m_ui->execFile->setPromptDialogTitle(tr("Select Executable"));
+    m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
 
     //execLabel->setHidden(false);
     //execEdit->setHidden(false);
     //browseButton->setHidden(false);
 
-    execLabel->setText(tr("Executable:"));
-    argLabel->setText(tr("Arguments:"));
+    m_ui->execLabel->setText(tr("Executable:"));
+    m_ui->argLabel->setText(tr("Arguments:"));
 
-    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
-    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+    connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+}
+
+StartExternalDialog::~StartExternalDialog()
+{
+    delete m_ui;
 }
 
 void StartExternalDialog::setExecutableFile(const QString &str)
 {
-    execFile->setPath(str);
+    m_ui->execFile->setPath(str);
 }
 
 void StartExternalDialog::setExecutableArguments(const QString &str)
 {
-    argsEdit->setText(str);
+    m_ui->argsEdit->setText(str);
 }
 
 QString StartExternalDialog::executableFile() const
 {
-    return execFile->path();
+    return m_ui->execFile->path();
 }
 
 QString StartExternalDialog::executableArguments() const
 {
-    return argsEdit->text();
+    return m_ui->argsEdit->text();
 }
diff --git a/src/plugins/debugger/debuggerdialogs.h b/src/plugins/debugger/debuggerdialogs.h
index 0bb07242ae05db38b6327c777ac8e67e03950103..c80c8f39de19005f3b6f1da4476cd1542fd22a3c 100644
--- a/src/plugins/debugger/debuggerdialogs.h
+++ b/src/plugins/debugger/debuggerdialogs.h
@@ -30,39 +30,53 @@
 #ifndef DEBUGGER_DIALOGS_H
 #define DEBUGGER_DIALOGS_H
 
-#include "ui_attachcoredialog.h"
-#include "ui_attachexternaldialog.h"
-#include "ui_attachremotedialog.h"
-#include "ui_startexternaldialog.h"
+#include <QtGui/QDialog>
 
 QT_BEGIN_NAMESPACE
+
+class QModelIndex;
 class QStandardItemModel;
+
+namespace Ui {
+class AttachCoreDialog;
+class AttachExternalDialog;
+class AttachRemoteDialog;
+class StartExternalDialog;
+} // namespace Ui
+
 QT_END_NAMESPACE
 
 
 namespace Debugger {
 namespace Internal {
 
-class AttachCoreDialog : public QDialog, Ui::AttachCoreDialog
+class AttachCoreDialog : public QDialog
 {
     Q_OBJECT
 
 public:
     explicit AttachCoreDialog(QWidget *parent);
+    ~AttachCoreDialog();
 
     void setExecutableFile(const QString &executable);
     void setCoreFile(const QString &core);
 
     QString executableFile() const;
     QString coreFile() const;
+
+private:
+    Ui::AttachCoreDialog *m_ui;
 };
 
-class AttachExternalDialog : public QDialog, Ui::AttachExternalDialog
+
+class AttachExternalDialog : public QDialog
 {
     Q_OBJECT
 
 public:
     explicit AttachExternalDialog(QWidget *parent);
+    ~AttachExternalDialog();
+
     int attachPID() const;
 
 private slots:
@@ -70,16 +84,19 @@ private slots:
     void procSelected(const QModelIndex &);
 
 private:
+    Ui::AttachExternalDialog *m_ui;
     QStandardItemModel *m_model;
 };
 
 
-class AttachRemoteDialog : public QDialog, Ui::AttachRemoteDialog
+class AttachRemoteDialog : public QDialog
 {
     Q_OBJECT
 
 public:
     explicit AttachRemoteDialog(QWidget *parent, const QString &pid);
+    ~AttachRemoteDialog();
+
     int attachPID() const;
 
 private slots:
@@ -87,23 +104,28 @@ private slots:
     void procSelected(const QModelIndex &);
 
 private:
+    Ui::AttachRemoteDialog *m_ui;
     QString m_defaultPID;
     QStandardItemModel *m_model;
 };
 
 
-class StartExternalDialog : public QDialog, Ui::StartExternalDialog
+class StartExternalDialog : public QDialog
 {
     Q_OBJECT
 
 public:
     explicit StartExternalDialog(QWidget *parent);
+    ~StartExternalDialog();
 
     void setExecutableFile(const QString &executable);
     void setExecutableArguments(const QString &args);
 
     QString executableFile() const;
     QString executableArguments() const;
+
+private:
+    Ui::StartExternalDialog *m_ui;
 };
 
 } // namespace Debugger
diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp
index 19f9826f61f3324db0fe0854c51ed867b67b0fbc..8c3ccffd703672df64749c3dff6ee321cfb68c6c 100644
--- a/src/plugins/debugger/debuggermanager.cpp
+++ b/src/plugins/debugger/debuggermanager.cpp
@@ -779,7 +779,7 @@ void DebuggerManager::attachCore()
         emit debuggingFinished();
 }
 
-bool DebuggerManager::startNewDebugger(StartMode mode)
+bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
 {
     m_startMode = mode;
     // FIXME: Clean up
@@ -838,19 +838,20 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
             m_attachedPID = 0;
         }
     } else if (startMode() == AttachCore) {
-        StartExternalDialog dlg(mainWindow());
+        AttachCoreDialog dlg(mainWindow());
         dlg.setExecutableFile(
             configValue(QLatin1String("LastExternalExecutableFile")).toString());
-        dlg.setExecutableArguments(
-            configValue(QLatin1String("LastExternalExecutableArguments")).toString());
+        dlg.setCoreFile(
+            configValue(QLatin1String("LastExternalCoreFile")).toString());
         if (dlg.exec() != QDialog::Accepted)
             return false;
         setConfigValue(QLatin1String("LastExternalExecutableFile"),
             dlg.executableFile());
-        setConfigValue(QLatin1String("LastExternalExecutableArguments"),
-            dlg.executableArguments());
+        setConfigValue(QLatin1String("LastExternalCoreFile"),
+            dlg.coreFile());
         m_executable = dlg.executableFile();
-        m_processArgs = dlg.executableArguments().split(' ');
+        m_coreFile = dlg.coreFile();
+        m_processArgs.clear();
         m_workingDir = QString();
         m_attachedPID = -1;
     }
diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h
index 4964d7b87e027b23cd841094f2562a1b9d33a8fa..9594092cbf1f7f2706aa7942015cc67d6374c52e 100644
--- a/src/plugins/debugger/debuggermanager.h
+++ b/src/plugins/debugger/debuggermanager.h
@@ -102,6 +102,14 @@ enum DebuggerStatus
     DebuggerInferiorStopped,          // Debuggee stopped
 };
 
+enum DebuggerStartMode
+{
+    StartInternal,                    // Start current start project's binary
+    StartExternal,                    // Start binary found in file system
+    AttachExternal,                   // Attach to running process
+    AttachCore                        // Attach to a core file
+};
+
 class IDebuggerEngine;
 class GdbEngine;
 class ScriptEngine;
@@ -215,11 +223,10 @@ public:
     QLabel *statusLabel() const { return m_statusLabel; }
     DebuggerSettings *settings() { return &m_settings; }
 
-    enum StartMode { StartInternal, StartExternal, AttachExternal, AttachCore };
     enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger };
 
 public slots:
-    bool startNewDebugger(StartMode mode);
+    bool startNewDebugger(DebuggerStartMode mode);
     void exitDebugger(); 
 
     void setSimpleDockWidgetArrangement();
@@ -354,7 +361,7 @@ public:
     // one of the interfaces
     QAbstractItemModel *threadsModel();
     int status() const { return m_status; }
-    StartMode startMode() const { return m_startMode; }
+    DebuggerStartMode startMode() const { return m_startMode; }
 
 signals:
     void debuggingFinished();
@@ -377,6 +384,7 @@ signals:
 public:
     // FIXME: make private
     QString m_executable;
+    QString m_coreFile;
     QStringList m_environment;
     QString m_workingDir;
     QString m_buildDir;
@@ -394,7 +402,7 @@ private:
     void toggleBreakpoint(const QString &fileName, int lineNumber);
     void setToolTipExpression(const QPoint &pos, const QString &exp0);
 
-    StartMode m_startMode;
+    DebuggerStartMode m_startMode;
     DebuggerType m_debuggerType;
 
     /// Views
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 47571bdcf47157857373b4bf2c61d709dab37b99..af9ee22c5d94eeae72c26760e7b54004242c0579 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -94,6 +94,7 @@ namespace Constants {
 
 const char * const STARTEXTERNAL        = "Debugger.StartExternal";
 const char * const ATTACHEXTERNAL       = "Debugger.AttachExternal";
+const char * const ATTACHCORE           = "Debugger.AttachCore";
 
 const char * const RUN_TO_LINE          = "Debugger.RunToLine";
 const char * const RUN_TO_FUNCTION      = "Debugger.RunToFunction";
@@ -446,6 +447,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
     cmd = am->registerAction(m_manager->m_attachExternalAction,
         Constants::ATTACHEXTERNAL, globalcontext);
     mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
+
+    cmd = am->registerAction(m_manager->m_attachCoreAction,
+        Constants::ATTACHCORE, globalcontext);
+    mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
 #endif
 
     cmd = am->registerAction(m_manager->m_continueAction,
diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp
index de5d4ba227dc7a697889edb2ec1bbe1f86cfd46f..3cc74138f408a9919f178e166e9688259cb44804 100644
--- a/src/plugins/debugger/debuggerrunner.cpp
+++ b/src/plugins/debugger/debuggerrunner.cpp
@@ -135,7 +135,7 @@ void DebuggerRunControl::start()
     //<daniel> andre: + "\qtc-gdbmacros\"
 
     //emit addToOutputWindow(this, tr("Debugging %1").arg(m_executable));
-    if (m_manager->startNewDebugger(DebuggerManager::StartInternal))
+    if (m_manager->startNewDebugger(StartInternal))
         emit started();
     else
         debuggingFinished();
diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp
index 1628de7155de26abe9a999f233350aabbaf4856b..7d1a82768782c3c073a2079c41577e314fc4d2ee 100644
--- a/src/plugins/debugger/gdbengine.cpp
+++ b/src/plugins/debugger/gdbengine.cpp
@@ -53,6 +53,7 @@
 #include <QtCore/QTimer>
 
 #include <QtGui/QAction>
+#include <QtGui/QApplication>
 #include <QtGui/QLabel>
 #include <QtGui/QMainWindow>
 #include <QtGui/QMessageBox>
@@ -114,6 +115,7 @@ enum GdbCommandType
     GdbQueryDataDumper1,
     GdbQueryDataDumper2,
     GdbTemporaryContinue,
+    GdbTargetCore,
 
     BreakCondition = 200,
     BreakEnablePending,
@@ -913,6 +915,14 @@ void GdbEngine::executeDebuggerCommand(const QString &command)
     m_gdbProc.write(cmd.command.toLatin1() + "\r\n");
 }
 
+void GdbEngine::handleTargetCore(const GdbResultRecord &record)
+{
+    Q_UNUSED(record);
+    reloadModules();
+    reloadSourceFiles();
+    qq->notifyInferiorStopped();
+}
+
 void GdbEngine::handleQueryPwd(const GdbResultRecord &record)
 {
     // FIXME: remove this special case as soon as 'pwd'
@@ -1461,7 +1471,7 @@ void GdbEngine::exitDebugger()
                 qDebug() << "STATUS ON EXITDEBUGGER: " << q->status());
             interruptInferior();
         }
-        if (q->startMode() == DebuggerManager::AttachExternal)
+        if (q->startMode() == AttachExternal)
             sendCommand("detach");
         else
             sendCommand("kill");
@@ -1494,9 +1504,6 @@ bool GdbEngine::startDebugger()
 {
     QStringList gdbArgs;
 
-    QFileInfo fi(q->m_executable);
-    QString fileName = '"' + fi.absoluteFilePath() + '"';
-
     if (m_gdbProc.state() != QProcess::NotRunning) {
         debugMessage("GDB IS ALREADY RUNNING!");
         return false;
@@ -1516,8 +1523,8 @@ bool GdbEngine::startDebugger()
     } else {
         if (!m_outputCollector.listen()) {
             QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"),
-                                  tr("Cannot set up communication with child process: %1")
-                                  .arg(m_outputCollector.errorString()));
+                tr("Cannot set up communication with child process: %1")
+                    .arg(m_outputCollector.errorString()));
             return false;
         }
         gdbArgs.prepend(QLatin1String("--tty=") + m_outputCollector.serverName());
@@ -1625,10 +1632,20 @@ bool GdbEngine::startDebugger()
         }
     }
 
-    if (q->startMode() == DebuggerManager::AttachExternal) {
+    if (q->startMode() == AttachExternal) {
         sendCommand("attach " + QString::number(q->m_attachedPID), GdbAttached);
-    } else if (!q->m_useTerminal) {
-        // StartInternal or StartExternal
+    } else if (q->startMode() == AttachCore) {
+        QFileInfo fi(q->m_executable);
+        QString fileName = '"' + fi.absoluteFilePath() + '"';
+        QFileInfo fi2(q->m_coreFile);
+        QString coreName = '"' + fi.absoluteFilePath() + '"';
+        sendCommand("-file-exec-and-symbols " + fileName);
+        sendCommand("target core" + coreName, GdbTargetCore);
+    } else if (q->m_useTerminal) {
+        // nothing needed, stub takes care
+    } else if (q->startMode() == StartInternal || q->startMode() == StartExternal) {
+        QFileInfo fi(q->m_executable);
+        QString fileName = '"' + fi.absoluteFilePath() + '"';
         sendCommand("-file-exec-and-symbols " + fileName, GdbFileExecAndSymbols);
         //sendCommand("file " + fileName, GdbFileExecAndSymbols);
         #ifdef Q_OS_MAC
@@ -1649,7 +1666,7 @@ bool GdbEngine::startDebugger()
     }
 
     // set all to "pending"
-    if (q->startMode() == DebuggerManager::AttachExternal)
+    if (q->startMode() == AttachExternal || q->startMode() == AttachCore)
         qq->breakHandler()->removeAllBreakpoints();
     else
         qq->breakHandler()->setAllPending();
diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h
index 79def1362e5c36e0c68d318fa594695b77421b13..661b8198accbd81a6ca3e61ff4ad95fb746e91c8 100644
--- a/src/plugins/debugger/gdbengine.h
+++ b/src/plugins/debugger/gdbengine.h
@@ -197,6 +197,7 @@ private:
     void handleShowVersion(const GdbResultRecord &response);
     void handleQueryPwd(const GdbResultRecord &response);
     void handleQuerySources(const GdbResultRecord &response);
+    void handleTargetCore(const GdbResultRecord &response);
     void debugMessage(const QString &msg);
 
     OutputCollector m_outputCollector;
diff --git a/src/plugins/debugger/scriptengine.cpp b/src/plugins/debugger/scriptengine.cpp
index 03d8bd8f4bad413e4cd569347d46e492cdba62d8..cf9e4827a725bef784bd25dd57378f5d6807df61 100644
--- a/src/plugins/debugger/scriptengine.cpp
+++ b/src/plugins/debugger/scriptengine.cpp
@@ -48,6 +48,7 @@
 #include <QtCore/QTimer>
 
 #include <QtGui/QAction>
+#include <QtGui/QApplication>
 #include <QtGui/QToolTip>
 
 #include <QtScript/QScriptContext>