diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp index ee3e9cf0505..e60d12d30c7 100644 --- a/src/plugins/remotelinux/remotelinuxplugin.cpp +++ b/src/plugins/remotelinux/remotelinuxplugin.cpp @@ -97,12 +97,20 @@ void RemoteLinuxPlugin::extensionsInitialized() const Context globalcontext(Core::Constants::C_GLOBAL); - QAction *startGdbServerAction = new QAction(tr("Start Remote Debug Server..."), 0); - Command *cmd = am->registerAction(startGdbServerAction, "StartGdbServer", globalcontext); + QAction *act = 0; + Command *cmd = 0; + + act = new QAction(tr("Start Remote Debug Server..."), 0); + cmd = am->registerAction(act, "StartGdbServer", globalcontext); cmd->setDefaultText(tr("Start Gdbserver")); mstart->addAction(cmd, Debugger::Constants::G_MANUAL_REMOTE); + connect(act, SIGNAL(triggered()), SLOT(startGdbServer())); - connect(startGdbServerAction, SIGNAL(triggered()), SLOT(startGdbServer())); + act = new QAction(tr("Attach to Running Remote Process..."), 0); + cmd = am->registerAction(act, "AttachRemoteProcess", globalcontext); + cmd->setDefaultText(tr("Attach to Remote Process")); + mstart->addAction(cmd, Debugger::Constants::G_AUTOMATIC_REMOTE); + connect(act, SIGNAL(triggered()), SLOT(startGdbServer())); } void RemoteLinuxPlugin::startGdbServer() diff --git a/src/plugins/remotelinux/startgdbserverdialog.cpp b/src/plugins/remotelinux/startgdbserverdialog.cpp index 3de8cbcc47b..377268e1598 100644 --- a/src/plugins/remotelinux/startgdbserverdialog.cpp +++ b/src/plugins/remotelinux/startgdbserverdialog.cpp @@ -39,6 +39,8 @@ #include "remotelinuxusedportsgatherer.h" #include "portlist.h" +#include + #include #include #include @@ -200,6 +202,12 @@ void StartGdbServerDialog::startGdbServer() d->gatherer.start(Utils::SshConnection::create(device->sshParameters()), device); } +void StartGdbServerDialog::attachToRemoteProcess() +{ + LinuxDeviceConfiguration::ConstPtr device = d->currentDevice(); + d->gatherer.start(Utils::SshConnection::create(device->sshParameters()), device); +} + void StartGdbServerDialog::handleConnectionError() { d->ui.textBrowser->append(tr("Connection error: %1") @@ -227,6 +235,13 @@ void StartGdbServerDialog::handleProcessErrorOutput(const QByteArray &ba) int port = ba.mid(pos + 18).trimmed().toInt(); d->ui.textBrowser->append(tr("Port %1 is now accessible.").arg(port)); emit portOpened(port); + ExtensionSystem::PluginManager *pm = + ExtensionSystem::PluginManager::instance(); + QObject *ob = pm->getObjectByName("DebuggerCore"); + qDebug() << "FOUND DEBUGGER CORE: " << ob; + if (ob) + QMetaObject::invokeMethod(ob, "gdbServerStarted", Qt::QueuedConnection, + Q_ARG(int, port)); } } diff --git a/src/plugins/remotelinux/startgdbserverdialog.h b/src/plugins/remotelinux/startgdbserverdialog.h index fe511c57d13..ce176dec2f4 100644 --- a/src/plugins/remotelinux/startgdbserverdialog.h +++ b/src/plugins/remotelinux/startgdbserverdialog.h @@ -52,6 +52,7 @@ public: ~StartGdbServerDialog(); void startGdbServer(); + void attachToRemoteProcess(); signals: void pidSelected(int pid);