forked from qt-creator/qt-creator
debugger: make Attach to Remote... dialogs better accessible
Change-Id: Ic20897a565c37d45d1521c8934ae0c4759fdef01 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -1115,6 +1115,7 @@ public slots:
|
||||
void maybeEnrichParameters(DebuggerStartParameters *sp);
|
||||
|
||||
void gdbServerStarted(const QString &channel, const QString &sysroot, const QString &localExecutable);
|
||||
void attachedToProcess(const QString &channel, const QString &sysroot, const QString &localExecutable);
|
||||
|
||||
public:
|
||||
DebuggerMainWindow *m_mainWindow;
|
||||
@@ -1672,11 +1673,6 @@ void DebuggerPluginPrivate::attachToRemoteServer()
|
||||
}
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::attachToRemoteProcess()
|
||||
{
|
||||
startRemoteServer();
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::startRemoteServer()
|
||||
{
|
||||
PluginManager *pm = PluginManager::instance();
|
||||
@@ -1689,6 +1685,24 @@ void DebuggerPluginPrivate::startRemoteServer()
|
||||
|
||||
void DebuggerPluginPrivate::gdbServerStarted(const QString &channel,
|
||||
const QString &sysroot, const QString &remoteCommandLine)
|
||||
{
|
||||
Q_UNUSED(remoteCommandLine);
|
||||
Q_UNUSED(sysroot);
|
||||
showStatusMessage(tr("gdbserver is now listening at %1").arg(channel));
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::attachToRemoteProcess()
|
||||
{
|
||||
PluginManager *pm = PluginManager::instance();
|
||||
QTC_ASSERT(pm, return);
|
||||
QObject *rl = pm->getObjectByName(_("RemoteLinuxPlugin"));
|
||||
QTC_ASSERT(rl, return);
|
||||
QMetaObject::invokeMethod(rl, "attachToRemoteProcess", Qt::QueuedConnection);
|
||||
// This will call back attachedtToProcess() below.
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::attachedToProcess(const QString &channel,
|
||||
const QString &sysroot, const QString &remoteCommandLine)
|
||||
{
|
||||
QString binary = remoteCommandLine.section(QLatin1Char(' '), 0, 0);
|
||||
QString localExecutable;
|
||||
@@ -3074,7 +3088,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
||||
connect(act, SIGNAL(triggered()), SLOT(attachToRemoteServer()));
|
||||
|
||||
act = m_startRemoteServerAction = new QAction(this);
|
||||
act->setText(tr("Start Remote Debug Server..."));
|
||||
act->setText(tr("Start Remote Debug Server Attached to Process..."));
|
||||
connect(act, SIGNAL(triggered()), SLOT(startRemoteServer()));
|
||||
|
||||
act = m_attachToRemoteProcessAction = new QAction(this);
|
||||
|
@@ -96,41 +96,20 @@ RemoteLinuxPlugin::~RemoteLinuxPlugin()
|
||||
|
||||
void RemoteLinuxPlugin::extensionsInitialized()
|
||||
{
|
||||
/*
|
||||
using namespace Core;
|
||||
ICore *core = ICore::instance();
|
||||
ActionManager *am = core->actionManager();
|
||||
ActionContainer *mstart =
|
||||
am->actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
|
||||
|
||||
const Context globalcontext(Core::Constants::C_GLOBAL);
|
||||
|
||||
QAction *act = 0;
|
||||
Command *cmd = 0;
|
||||
|
||||
act = new QAction(tr("Start Remote Debug Server..."), 0);
|
||||
cmd = am->registerAction(act, "StartGdbServer", globalcontext);
|
||||
cmd->setDescription(tr("Start Gdbserver"));
|
||||
mstart->addAction(cmd, Debugger::Constants::G_MANUAL_REMOTE);
|
||||
connect(act, SIGNAL(triggered()), SLOT(startGdbServer()));
|
||||
|
||||
act = new QAction(tr("Attach to Running Remote Process..."), 0);
|
||||
cmd = am->registerAction(act, "AttachRemoteProcess", globalcontext);
|
||||
cmd->setDescription(tr("Attach to Remote Process"));
|
||||
mstart->addAction(cmd, Debugger::Constants::G_AUTOMATIC_REMOTE);
|
||||
connect(act, SIGNAL(triggered()), SLOT(startGdbServer()));
|
||||
*/
|
||||
}
|
||||
|
||||
void RemoteLinuxPlugin::startGdbServer()
|
||||
{
|
||||
StartGdbServerDialog dlg;
|
||||
int result = dlg.exec();
|
||||
if (result == QDialog::Rejected)
|
||||
return;
|
||||
dlg.startGdbServer();
|
||||
}
|
||||
|
||||
void RemoteLinuxPlugin::attachToRemoteProcess()
|
||||
{
|
||||
StartGdbServerDialog dlg;
|
||||
dlg.attachToRemoteProcess();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace RemoteLinux
|
||||
|
||||
|
@@ -51,6 +51,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void startGdbServer();
|
||||
void attachToRemoteProcess();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -92,6 +92,7 @@ public:
|
||||
}
|
||||
|
||||
StartGdbServerDialog *q;
|
||||
bool startServerOnly;
|
||||
AbstractRemoteLinuxProcessList *processList;
|
||||
QSortFilterProxyModel proxyModel;
|
||||
|
||||
@@ -110,7 +111,7 @@ public:
|
||||
};
|
||||
|
||||
StartGdbServerDialogPrivate::StartGdbServerDialogPrivate(StartGdbServerDialog *q)
|
||||
: q(q), processList(0)
|
||||
: q(q), startServerOnly(true), processList(0)
|
||||
{
|
||||
settings = ICore::settings();
|
||||
|
||||
@@ -313,13 +314,20 @@ void StartGdbServerDialog::portListReady()
|
||||
|
||||
void StartGdbServerDialog::startGdbServer()
|
||||
{
|
||||
d->startServerOnly = true;
|
||||
if (exec() == QDialog::Rejected)
|
||||
return;
|
||||
LinuxDeviceConfiguration::ConstPtr device = d->currentDevice();
|
||||
d->gatherer.start(SshConnection::create(device->sshParameters()), device);
|
||||
}
|
||||
|
||||
void StartGdbServerDialog::attachToRemoteProcess()
|
||||
{
|
||||
startGdbServer();
|
||||
d->startServerOnly = false;
|
||||
if (exec() == QDialog::Rejected)
|
||||
return;
|
||||
LinuxDeviceConfiguration::ConstPtr device = d->currentDevice();
|
||||
d->gatherer.start(SshConnection::create(device->sshParameters()), device);
|
||||
}
|
||||
|
||||
void StartGdbServerDialog::handleConnectionError()
|
||||
@@ -343,21 +351,17 @@ void StartGdbServerDialog::handleProcessErrorOutput(const QByteArray &ba)
|
||||
logMessage(QString::fromUtf8(ba.trimmed()));
|
||||
// "Attached; pid = 16740"
|
||||
// "Listening on port 10000"
|
||||
int pos = ba.indexOf("Listening on port");
|
||||
if (pos == -1)
|
||||
return;
|
||||
const int port = ba.mid(pos + 18).trimmed().toInt();
|
||||
logMessage(tr("Port %1 is now accessible.").arg(port));
|
||||
foreach (const QByteArray &line, ba.split('\n')) {
|
||||
if (line.startsWith("Listening on port")) {
|
||||
const int port = line.mid(18).trimmed().toInt();
|
||||
reportOpenPort(port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StartGdbServerDialog::reportOpenPort(int port)
|
||||
{
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
QObject *ob = pm->getObjectByName("DebuggerCore");
|
||||
if (!ob)
|
||||
return;
|
||||
|
||||
logMessage(tr("Port %1 is now accessible.").arg(port));
|
||||
LinuxDeviceConfiguration::ConstPtr device = d->currentDevice();
|
||||
QString host = device->sshParameters().host;
|
||||
QString channel;
|
||||
@@ -367,11 +371,17 @@ void StartGdbServerDialog::reportOpenPort(int port)
|
||||
channel = QString::fromLatin1("%1:%2").arg(host).arg(port);
|
||||
logMessage(tr("Server started on %1").arg(channel));
|
||||
|
||||
QMetaObject::invokeMethod(ob, "gdbServerStarted", Qt::QueuedConnection,
|
||||
const char *member = d->startServerOnly ? "gdbServerStarted" : "attachedToProcess";
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
QObject *ob = pm->getObjectByName("DebuggerCore");
|
||||
if (ob) {
|
||||
QMetaObject::invokeMethod(ob, member, Qt::QueuedConnection,
|
||||
Q_ARG(QString, channel),
|
||||
Q_ARG(QString, d->sysrootPathChooser->path()),
|
||||
Q_ARG(QString, d->remoteCommandLine));
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
void StartGdbServerDialog::handleProcessClosed(int status)
|
||||
{
|
||||
|
Reference in New Issue
Block a user