diff --git a/src/plugins/debugger/debuggercore.h b/src/plugins/debugger/debuggercore.h index 7ca14e05a8d..883fb7f5e4b 100644 --- a/src/plugins/debugger/debuggercore.h +++ b/src/plugins/debugger/debuggercore.h @@ -52,6 +52,10 @@ namespace Utils { class SavedAction; } +namespace ProjectExplorer { +class RunControl; +} + namespace Debugger { class DebuggerEngine; @@ -122,6 +126,9 @@ public: virtual DebuggerToolTipManager *toolTipManager() const = 0; virtual QSharedPointer globalDebuggerOptions() const = 0; + +public slots: + virtual void attachExternalApplication(ProjectExplorer::RunControl *rc) = 0; }; // This is the only way to access the global object. diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 87ae97d8ee0..e2b61b11537 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -888,6 +888,7 @@ public slots: void attachToRemoteServer(); void attachToProcess(bool startServerOnly); void attachToRunningApplication(); + void attachExternalApplication(ProjectExplorer::RunControl *rc); void attachToQmlPort(); void startRemoteEngine(); void runScheduled(); @@ -1684,6 +1685,18 @@ void DebuggerPluginPrivate::attachToProcess(bool startServerOnly) } } +void DebuggerPluginPrivate::attachExternalApplication(ProjectExplorer::RunControl *rc) +{ + DebuggerStartParameters sp; + fillParameters(&sp); + sp.attachPID = rc->applicationProcessHandle().pid(); + sp.displayName = tr("Process %1").arg(sp.attachPID); + sp.startMode = AttachExternal; + sp.closeMode = DetachAtClose; + sp.toolChainAbi = rc->abi(); + DebuggerRunControlFactory::createAndScheduleRun(sp); +} + void DebuggerPluginPrivate::attachToQmlPort() { DebuggerStartParameters sp; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 7af0a9ced5b..47a61c1eca6 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -5235,7 +5235,9 @@ bool GdbEngine::attemptQuickStart() const void GdbEngine::checkForReleaseBuild() { - QString binary = startParameters().executable; + const QString binary = startParameters().executable; + if (binary.isEmpty()) + return; ElfReader reader(binary); ElfData elfData = reader.readHeaders(); QString error = reader.errorString();