diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp
index afa8937073922a7b2be348c03193ce0e6b15a089..55f112a9c0494e14d158f3138e29e5f0b7e88beb 100644
--- a/src/plugins/debugger/debuggerdialogs.cpp
+++ b/src/plugins/debugger/debuggerdialogs.cpp
@@ -378,7 +378,7 @@ bool StartApplicationDialog::run(QWidget *parent, QSettings *settings, DebuggerS
     }
 
     Profile *profile = dialog.d->profileChooser->currentProfile();
-    fillParameters(sp, profile->id());
+    fillParameters(sp, profile);
 
     sp->executable = newParameters.localExecutable;
     sp->displayName = newParameters.displayName();
@@ -495,9 +495,9 @@ int AttachToQmlPortDialog::port() const
     return d->portSpinBox->value();
 }
 
-Id AttachToQmlPortDialog::profileId() const
+Profile *AttachToQmlPortDialog::profile() const
 {
-    return d->profileChooser->currentProfileId();
+    return d->profileChooser->currentProfile();
 }
 
 void AttachToQmlPortDialog::setProfileId(const Id &id)
diff --git a/src/plugins/debugger/debuggerdialogs.h b/src/plugins/debugger/debuggerdialogs.h
index d68e25f00aa95522d068260c231a8fd0724b2ec2..2c25b317b4e468db9fec4a79817cddc40ddae4ed 100644
--- a/src/plugins/debugger/debuggerdialogs.h
+++ b/src/plugins/debugger/debuggerdialogs.h
@@ -44,6 +44,7 @@ class QSettings;
 QT_END_NAMESPACE
 
 namespace Core { class Id; }
+namespace ProjectExplorer { class Profile; }
 
 namespace Debugger {
 class DebuggerStartParameters;
@@ -96,7 +97,7 @@ public:
     int port() const;
     void setPort(const int port);
 
-    Core::Id profileId() const;
+    ProjectExplorer::Profile *profile() const;
     void setProfileId(const Core::Id &id);
 
 private:
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index e02df979c2db1296082396aa87519f002329fc69..cefb55b97618d796ad6cad3fd55f8a1e979c5d0d 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -548,10 +548,10 @@ public:
 //
 ///////////////////////////////////////////////////////////////////////
 
-void fillParameters(DebuggerStartParameters *sp, Id id)
+void fillParameters(DebuggerStartParameters *sp, Profile *profile)
 {
-    Profile *profile = ProfileManager::instance()->find(id);
-    QTC_ASSERT(profile, return);
+    if (!profile)
+        profile = ProfileManager::instance()->defaultProfile();
     sp->sysRoot = SysRootProfileInformation::sysRoot(profile).toString();
     sp->debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString();
 
@@ -1277,8 +1277,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
             return false;
         }
         DebuggerStartParameters sp;
-        Profile *defaultProfile = ProfileManager::instance()->defaultProfile();
-        fillParameters(&sp, defaultProfile ? defaultProfile->id() : Core::Id());
+        fillParameters(&sp, ProfileManager::instance()->defaultProfile());
         qulonglong pid = it->toULongLong();
         if (pid) {
             sp.startMode = AttachExternal;
@@ -1315,8 +1314,10 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
                     sp.displayName = tr("Core file \"%1\"").arg(sp.coreFile);
                     sp.startMessage = tr("Attaching to core file %1.").arg(sp.coreFile);
                 }
-                else if (key == QLatin1String("profile"))
-                    fillParameters(&sp, Id(val));
+                else if (key == QLatin1String("profile")) {
+                    Profile *profile = ProfileManager::instance()->find(Id(val));
+                    fillParameters(&sp, profile);
+                }
             }
         }
         if (sp.startMode == StartExternal) {
@@ -1338,7 +1339,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
             return false;
         }
         DebuggerStartParameters sp;
-        fillParameters(&sp, ProfileManager::instance()->defaultProfile()->id());
+        fillParameters(&sp, 0);
         sp.startMode = AttachCrashedExternal;
         sp.crashParameter = it->section(QLatin1Char(':'), 0, 0);
         sp.attachPID = it->section(QLatin1Char(':'), 1, 1).toULongLong();
@@ -1471,12 +1472,12 @@ void DebuggerPluginPrivate::attachCore()
     setConfigValue(_("LastExternalExecutableFile"), dlg.localExecutableFile());
     setConfigValue(_("LastLocalCoreFile"), dlg.localCoreFile());
     setConfigValue(_("LastRemoteCoreFile"), dlg.remoteCoreFile());
-    setConfigValue(_("LastExternalProfile"), dlg.profileId().toString());
+    setConfigValue(_("LastExternalProfile"), dlg.profile()->id().toString());
     setConfigValue(_("LastExternalStartScript"), dlg.overrideStartScript());
 
     DebuggerStartParameters sp;
     QString display = dlg.isLocal() ? dlg.localCoreFile() : dlg.remoteCoreFile();
-    fillParameters(&sp, dlg.profileId());
+    fillParameters(&sp, dlg.profile());
     sp.masterEngineType = GdbEngineType;
     sp.executable = dlg.localExecutableFile();
     sp.coreFile = dlg.localCoreFile();
@@ -1517,7 +1518,7 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
     RemoteCdbMatcher matcher;
     Profile *profile = ProfileManager::instance()->find(&matcher);
     QTC_ASSERT(profile, return);
-    fillParameters(&sp, profile->id());
+    fillParameters(&sp, profile);
     sp.startMode = AttachToRemoteServer;
     sp.closeMode = KillAtClose;
     StartRemoteCdbDialog dlg(mainWindow());
@@ -1586,7 +1587,7 @@ void DebuggerPluginPrivate::attachToProcess(bool startServerOnly)
 
     if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
         DebuggerStartParameters sp;
-        fillParameters(&sp, profile->id());
+        fillParameters(&sp, profile);
         sp.attachPID = process.pid;
         sp.displayName = tr("Process %1").arg(process.pid);
         sp.executable = process.exe;
@@ -1627,9 +1628,9 @@ void DebuggerPluginPrivate::attachToQmlPort()
 
     setConfigValue(_("LastQmlServerAddress"), dlg.host());
     setConfigValue(_("LastQmlServerPort"), dlg.port());
-    setConfigValue(_("LastProfile"), dlg.profileId().toString());
+    setConfigValue(_("LastProfile"), dlg.profile()->id().toString());
 
-    fillParameters(&sp, dlg.profileId());
+    fillParameters(&sp, dlg.profile());
     sp.qmlServerAddress = dlg.host();
     sp.qmlServerPort = dlg.port();
 
@@ -3370,12 +3371,12 @@ static Target *activeTarget()
     return project->activeTarget();
 }
 
-static Id currentProfileId()
+static Profile *currentProfile()
 {
     Target *t = activeTarget();
     if (!t || !t->isEnabled())
         return 0;
-    return activeTarget()->profile()->id();
+    return activeTarget()->profile();
 }
 
 static LocalApplicationRunConfiguration *activeLocalRunConfiguration()
@@ -3423,7 +3424,7 @@ void DebuggerPluginPrivate::testPythonDumpers1()
 void DebuggerPluginPrivate::testPythonDumpers2()
 {
     DebuggerStartParameters sp;
-    fillParameters(&sp, currentProfileId());
+    fillParameters(&sp, currentProfile());
     sp.executable = activeLocalRunConfiguration()->executable();
     testRunProject(sp, TestCallBack(this, "testPythonDumpers3"));
 }
@@ -3455,7 +3456,7 @@ void DebuggerPluginPrivate::testStateMachine1()
 void DebuggerPluginPrivate::testStateMachine2()
 {
     DebuggerStartParameters sp;
-    fillParameters(&sp, currentProfileId());
+    fillParameters(&sp, currentProfile());
     sp.executable = activeLocalRunConfiguration()->executable();
     sp.testCase = TestNoBoundsOfCurrentFunction;
     testRunProject(sp, TestCallBack(this, "testStateMachine3"));
diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp
index 329bfecf9d291c13560b848eb07477c4ee366afa..e32359c7cc8f13916629dad24cabed9c00f15541 100644
--- a/src/plugins/debugger/debuggerrunner.cpp
+++ b/src/plugins/debugger/debuggerrunner.cpp
@@ -486,7 +486,7 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
 
     Target *target = runConfiguration->target();
     Profile *profile = target ? target->profile() : ProfileManager::instance()->defaultProfile();
-    fillParameters(&sp, profile ? profile->id() : Core::Id());
+    fillParameters(&sp, profile);
     sp.environment = rc->environment();
     sp.workingDirectory = rc->workingDirectory();
 
diff --git a/src/plugins/debugger/debuggerstartparameters.h b/src/plugins/debugger/debuggerstartparameters.h
index dbda1c62f995d06f1406395af0285d0363992918..457e0bf272b2a1ff4e4c02e508b80e0626810b29 100644
--- a/src/plugins/debugger/debuggerstartparameters.h
+++ b/src/plugins/debugger/debuggerstartparameters.h
@@ -38,6 +38,7 @@
 #include <ssh/sshconnection.h>
 #include <utils/environment.h>
 #include <projectexplorer/abi.h>
+#include <projectexplorer/profile.h>
 #include <projectexplorer/projectexplorerconstants.h>
 
 #include <QMetaType>
@@ -148,7 +149,7 @@ public:
 
 namespace Internal {
 
-void fillParameters(DebuggerStartParameters *sp, Core::Id id);
+void fillParameters(DebuggerStartParameters *sp, ProjectExplorer::Profile *profile);
 
 } // namespace Internal
 } // namespace Debugger
diff --git a/src/plugins/debugger/gdb/startgdbserverdialog.cpp b/src/plugins/debugger/gdb/startgdbserverdialog.cpp
index 2ee4370ef5dd1e0fa1c6a69f1bfd9e8a72f3da29..86537385eb9661e51bf00158a1cc59acb343fede 100644
--- a/src/plugins/debugger/gdb/startgdbserverdialog.cpp
+++ b/src/plugins/debugger/gdb/startgdbserverdialog.cpp
@@ -207,7 +207,7 @@ void GdbServerStarter::attach(int port)
     }
 
     DebuggerStartParameters sp;
-    fillParameters(&sp, d->profile->id());
+    fillParameters(&sp, d->profile);
     sp.masterEngineType = GdbEngineType;
     sp.connParams.port = port;
     sp.displayName = tr("Remote: \"%1:%2\"").arg(sp.connParams.host).arg(port);
diff --git a/src/plugins/debugger/loadcoredialog.cpp b/src/plugins/debugger/loadcoredialog.cpp
index 257c141519fe73bbbeea1d3def5cfa94ae98903a..2d9378d94fa57a2c7bae7636b9d6f3964bf75c04 100644
--- a/src/plugins/debugger/loadcoredialog.cpp
+++ b/src/plugins/debugger/loadcoredialog.cpp
@@ -385,9 +385,9 @@ void AttachCoreDialog::setProfileId(const Core::Id &id)
     changed();
 }
 
-Core::Id AttachCoreDialog::profileId() const
+Profile *AttachCoreDialog::profile() const
 {
-    return d->profileChooser->currentProfileId();
+    return d->profileChooser->currentProfile();
 }
 
 QString AttachCoreDialog::overrideStartScript() const
diff --git a/src/plugins/debugger/loadcoredialog.h b/src/plugins/debugger/loadcoredialog.h
index 8bc5460da33e3ca3fa1b7d630c7bbbe5e93984d2..34cc05bc0193904dce1804b494120e08e0ee1491 100644
--- a/src/plugins/debugger/loadcoredialog.h
+++ b/src/plugins/debugger/loadcoredialog.h
@@ -34,6 +34,7 @@
 #include <QDialog>
 
 namespace Core { class Id; }
+namespace ProjectExplorer { class Profile; }
 
 namespace Debugger {
 namespace Internal {
@@ -55,7 +56,7 @@ public:
     bool isLocal() const;
 
     // For persistance.
-    Core::Id profileId() const;
+    ProjectExplorer::Profile *profile() const;
     void setLocalExecutableFile(const QString &executable);
     void setLocalCoreFile(const QString &core);
     void setRemoteCoreFile(const QString &core);