Commit da36d051 authored by Friedemann Kleint's avatar Friedemann Kleint

Debugger: Fix debugging external executables/attaching to pid.

... by creating a default run configuration.
parent c1ddd714
......@@ -1221,6 +1221,9 @@ void DebuggerPlugin::startExternalApplication()
m_manager->breakByFunctionMain();
QSharedPointer<RunConfiguration> rc = activeRunConfiguration();
if (rc.isNull())
rc = DebuggerRunner::createDefaultRunConfiguration(sp->executable);
if (RunControl *runControl = m_debuggerRunner
->run(rc, ProjectExplorer::Constants::DEBUGMODE, sp, StartExternal))
runControl->start();
......@@ -1244,6 +1247,8 @@ void DebuggerPlugin::attachExternalApplication(qint64 pid, const QString &crashP
sp->crashParameter = crashParameter;
const DebuggerStartMode dsm = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal;
QSharedPointer<RunConfiguration> rc = activeRunConfiguration();
if (rc.isNull())
rc = DebuggerRunner::createDefaultRunConfiguration();
if (RunControl *runControl = m_debuggerRunner
->run(rc, ProjectExplorer::Constants::DEBUGMODE, sp, dsm))
runControl->start();
......
......@@ -50,6 +50,34 @@ using ProjectExplorer::RunConfiguration;
using ProjectExplorer::RunControl;
using ProjectExplorer::ApplicationRunConfiguration;
// A default run configuration for external executables or attaching to
// running processes by id.
class DefaultApplicationRunConfiguration : public ProjectExplorer::ApplicationRunConfiguration
{
public:
explicit DefaultApplicationRunConfiguration(const QString &executable = QString());
virtual QString executable() const { return m_executable; }
virtual RunMode runMode() const { return Gui; }
virtual QString workingDirectory() const { return QString(); }
virtual QStringList commandLineArguments() const { return QStringList(); }
virtual ProjectExplorer::Environment environment() const
{ return ProjectExplorer::Environment(); }
virtual QString dumperLibrary() const { return QString(); }
virtual QStringList dumperLibraryLocations() const { return QStringList(); }
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const
{ return ProjectExplorer::ToolChain::UNKNOWN; }
virtual QWidget *configurationWidget() { return 0; }
private:
const QString m_executable;
};
DefaultApplicationRunConfiguration::DefaultApplicationRunConfiguration(const QString &executable) :
ProjectExplorer::ApplicationRunConfiguration(0),
m_executable(executable)
{
}
////////////////////////////////////////////////////////////////////////
//
......@@ -73,6 +101,11 @@ QString DebuggerRunner::displayName() const
return tr("Debug");
}
RunConfigurationPtr DebuggerRunner::createDefaultRunConfiguration(const QString &executable)
{
return RunConfigurationPtr(new DefaultApplicationRunConfiguration(executable));
}
RunControl *DebuggerRunner::run(RunConfigurationPtr runConfiguration,
const QString &mode,
const QSharedPointer<DebuggerStartParameters> &sp,
......
......@@ -70,6 +70,8 @@ public:
const QSharedPointer<DebuggerStartParameters> &sp,
DebuggerStartMode startMode);
static RunConfigurationPtr createDefaultRunConfiguration(const QString &executable = QString());
private:
QSharedPointer<DebuggerStartParameters> m_startParameters;
DebuggerManager *m_manager;
......
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