forked from qt-creator/qt-creator
Qnx: Partially fix Attach to Running process
Only works for opened, active project, but better than before. Change-Id: Icafe3a9605cea29cd16ed4bd316bf195e78efdb5 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1019,7 +1019,8 @@ void GdbServerPortsGatherer::handlePortListReady()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reportDone();
|
// reportDone();
|
||||||
|
reportStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
// GdbServerRunner
|
// GdbServerRunner
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
|
|
||||||
namespace Constants {
|
namespace Constants {
|
||||||
|
|
||||||
const char QNX_TARGET_KEY[] = "QNX_TARGET";
|
const char QNX_TARGET_KEY[] = "QNX_TARGET";
|
||||||
|
@@ -102,7 +102,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void start() override
|
void start() final
|
||||||
{
|
{
|
||||||
StandardRunnable r = runnable().as<StandardRunnable>();
|
StandardRunnable r = runnable().as<StandardRunnable>();
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
@@ -155,17 +155,13 @@ void QnxDebugSupport::start()
|
|||||||
Target *target = runConfig->target();
|
Target *target = runConfig->target();
|
||||||
Kit *k = target->kit();
|
Kit *k = target->kit();
|
||||||
|
|
||||||
auto inferior = runConfig->runnable().as<StandardRunnable>();
|
|
||||||
inferior.executable = runConfig->remoteExecutableFilePath();
|
|
||||||
inferior.commandLineArguments = runConfig->arguments();
|
|
||||||
|
|
||||||
setStartMode(AttachToRemoteServer);
|
setStartMode(AttachToRemoteServer);
|
||||||
setCloseMode(KillAtClose);
|
setCloseMode(KillAtClose);
|
||||||
setUseCtrlCStub(true);
|
setUseCtrlCStub(true);
|
||||||
setRemoteChannel(m_portsGatherer->gdbServerChannel());
|
setRemoteChannel(m_portsGatherer->gdbServerChannel());
|
||||||
setQmlServer(m_portsGatherer->qmlServer());
|
setQmlServer(m_portsGatherer->qmlServer());
|
||||||
setInferior(inferior);
|
|
||||||
setSolibSearchPath(searchPaths(k));
|
setSolibSearchPath(searchPaths(k));
|
||||||
|
setSymbolFile(runConfig->localExecutableFilePath());
|
||||||
|
|
||||||
DebuggerRunTool::start();
|
DebuggerRunTool::start();
|
||||||
}
|
}
|
||||||
@@ -219,20 +215,11 @@ public:
|
|||||||
private:
|
private:
|
||||||
void start() final
|
void start() final
|
||||||
{
|
{
|
||||||
StandardRunnable r = runnable().as<StandardRunnable>();
|
|
||||||
QStringList arguments;
|
|
||||||
if (m_portsGatherer->useGdbServer()) {
|
|
||||||
Port pdebugPort = m_portsGatherer->gdbServerPort();
|
Port pdebugPort = m_portsGatherer->gdbServerPort();
|
||||||
r.executable = Constants::QNX_DEBUG_EXECUTABLE;
|
|
||||||
arguments.append(pdebugPort.toString());
|
|
||||||
}
|
|
||||||
if (m_portsGatherer->useQmlServer()) {
|
|
||||||
arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices,
|
|
||||||
m_portsGatherer->qmlServerPort()));
|
|
||||||
}
|
|
||||||
arguments.append(QtcProcess::splitArgs(r.commandLineArguments));
|
|
||||||
r.commandLineArguments = QtcProcess::joinArgs(arguments);
|
|
||||||
|
|
||||||
|
StandardRunnable r;
|
||||||
|
r.executable = Constants::QNX_DEBUG_EXECUTABLE;
|
||||||
|
r.commandLineArguments = pdebugPort.toString();
|
||||||
setRunnable(r);
|
setRunnable(r);
|
||||||
|
|
||||||
SimpleTargetRunner::start();
|
SimpleTargetRunner::start();
|
||||||
@@ -250,21 +237,22 @@ QnxAttachDebugSupport::QnxAttachDebugSupport(RunControl *runControl)
|
|||||||
m_portsGatherer->setUseGdbServer(isCppDebugging());
|
m_portsGatherer->setUseGdbServer(isCppDebugging());
|
||||||
m_portsGatherer->setUseQmlServer(isQmlDebugging());
|
m_portsGatherer->setUseQmlServer(isQmlDebugging());
|
||||||
|
|
||||||
|
if (isCppDebugging()) {
|
||||||
m_pdebugRunner = new PDebugRunner(runControl, m_portsGatherer);
|
m_pdebugRunner = new PDebugRunner(runControl, m_portsGatherer);
|
||||||
m_pdebugRunner->addStartDependency(m_portsGatherer);
|
m_pdebugRunner->addStartDependency(m_portsGatherer);
|
||||||
|
|
||||||
addStartDependency(m_pdebugRunner);
|
addStartDependency(m_pdebugRunner);
|
||||||
|
} else {
|
||||||
|
// No pdebug needed for Qml-only debugging.
|
||||||
|
addStartDependency(m_portsGatherer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// connect(m_launcher, &ApplicationLauncher::remoteProcessStarted,
|
void QnxAttachDebugSupport::start()
|
||||||
// this, &QnxAttachDebugSupport::attachToProcess);
|
{
|
||||||
// connect(m_launcher, &ApplicationLauncher::reportError,
|
setRemoteChannel(m_portsGatherer->gdbServerChannel());
|
||||||
// this, &QnxAttachDebugSupport::handleError);
|
setQmlServer(m_portsGatherer->qmlServer());
|
||||||
// connect(m_launcher, &ApplicationLauncher::reportProgress,
|
|
||||||
// this, &QnxAttachDebugSupport::handleProgressReport);
|
DebuggerRunTool::start();
|
||||||
// connect(m_launcher, &ApplicationLauncher::remoteStdout,
|
|
||||||
// this, &QnxAttachDebugSupport::handleRemoteOutput);
|
|
||||||
// connect(m_launcher, &ApplicationLauncher::remoteStderr,
|
|
||||||
// this, &QnxAttachDebugSupport::handleRemoteOutput);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxAttachDebugSupport::showProcessesDialog()
|
void QnxAttachDebugSupport::showProcessesDialog()
|
||||||
@@ -285,73 +273,33 @@ void QnxAttachDebugSupport::showProcessesDialog()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// FIXME: That should be somehow related to the selected kit.
|
// FIXME: That should be somehow related to the selected kit.
|
||||||
auto runConfig = RunConfiguration::startupRunConfiguration();
|
auto startRunConfig = RunConfiguration::startupRunConfiguration();
|
||||||
|
auto runConfig = qobject_cast<QnxRunConfiguration *>(startRunConfig);
|
||||||
if (!runConfig)
|
if (!runConfig)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DeviceProcessItem process = dlg.currentProcess();
|
DeviceProcessItem process = dlg.currentProcess();
|
||||||
const int pid = process.pid;
|
const int pid = process.pid;
|
||||||
|
// QString projectSourceDirectory = dlg.projectSource();
|
||||||
|
QString localExecutable = dlg.localExecutable();
|
||||||
|
if (localExecutable.isEmpty())
|
||||||
|
localExecutable = runConfig->localExecutableFilePath();
|
||||||
|
|
||||||
auto runControl = new RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
auto runControl = new RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
auto debugger = new QnxAttachDebugSupport(runControl);
|
auto debugger = new QnxAttachDebugSupport(runControl);
|
||||||
debugger->setAttachPid(pid);
|
|
||||||
debugger->setSymbolFile(dlg.localExecutable());
|
|
||||||
// QString projectSourceDirectory = dlg.projectSource();
|
|
||||||
|
|
||||||
// auto runConfig = qobject_cast<QnxRunConfiguration *>(runControl()->runConfiguration());
|
|
||||||
// QTC_ASSERT(runConfig, return);
|
|
||||||
// Target *target = runConfig->target();
|
|
||||||
|
|
||||||
// StandardRunnable inferior;
|
|
||||||
// inferior.executable = runConfig->remoteExecutableFilePath();
|
|
||||||
// inferior.executable = m_localExecutablePath;
|
|
||||||
// inferior.commandLineArguments = runConfig->arguments();
|
|
||||||
|
|
||||||
debugger->setStartMode(AttachToRemoteServer);
|
debugger->setStartMode(AttachToRemoteServer);
|
||||||
debugger->setCloseMode(DetachAtClose);
|
debugger->setCloseMode(DetachAtClose);
|
||||||
|
debugger->setNeedFixup(false);
|
||||||
|
debugger->setSymbolFile(localExecutable);
|
||||||
debugger->setUseCtrlCStub(true);
|
debugger->setUseCtrlCStub(true);
|
||||||
// setInferior(inferior);
|
debugger->setAttachPid(pid);
|
||||||
// setRunControlName(tr("Remote: \"%1\" - Process %2").arg(remoteChannel).arg(m_process.pid));
|
// setRunControlName(tr("Remote: \"%1\" - Process %2").arg(remoteChannel).arg(m_process.pid));
|
||||||
debugger->setRunControlName(tr("Remote QNX process %1").arg(pid));
|
debugger->setRunControlName(tr("Remote QNX process %1").arg(pid));
|
||||||
debugger->setSolibSearchPath(searchPaths(kit));
|
debugger->setSolibSearchPath(searchPaths(kit));
|
||||||
|
debugger->setUseContinueInsteadOfRun(true);
|
||||||
|
|
||||||
(void) new QnxAttachDebugSupport(runControl);
|
|
||||||
ProjectExplorerPlugin::startRunControl(runControl);
|
ProjectExplorerPlugin::startRunControl(runControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxAttachDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState state)
|
|
||||||
{
|
|
||||||
if (state == Debugger::DebuggerFinished)
|
|
||||||
stopPDebug();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QnxAttachDebugSupport::handleError(const QString &message)
|
|
||||||
{
|
|
||||||
showMessage(message, Debugger::AppError);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QnxAttachDebugSupport::handleProgressReport(const QString &message)
|
|
||||||
{
|
|
||||||
showMessage(message, Debugger::AppStuff);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QnxAttachDebugSupport::handleRemoteOutput(const QString &output)
|
|
||||||
{
|
|
||||||
showMessage(output, Debugger::AppOutput);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QnxAttachDebugSupport::stopPDebug()
|
|
||||||
{
|
|
||||||
// m_launcher->stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QnxAttachDebugSupport::start()
|
|
||||||
{
|
|
||||||
setRemoteChannel(m_portsGatherer->gdbServerChannel());
|
|
||||||
setQmlServer(m_portsGatherer->qmlServer());
|
|
||||||
|
|
||||||
DebuggerRunTool::start();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qnx
|
} // namespace Qnx
|
||||||
|
@@ -27,8 +27,6 @@
|
|||||||
|
|
||||||
#include <debugger/debuggerruncontrol.h>
|
#include <debugger/debuggerruncontrol.h>
|
||||||
|
|
||||||
#include <utils/port.h>
|
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -57,22 +55,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
void start() final;
|
void start() final;
|
||||||
|
|
||||||
void launchPDebug();
|
|
||||||
void attachToProcess();
|
|
||||||
|
|
||||||
void handleDebuggerStateChanged(Debugger::DebuggerState state);
|
|
||||||
void handleError(const QString &message);
|
|
||||||
void handleProgressReport(const QString &message);
|
|
||||||
void handleRemoteOutput(const QString &output);
|
|
||||||
|
|
||||||
void stopPDebug();
|
|
||||||
|
|
||||||
Debugger::GdbServerPortsGatherer *m_portsGatherer;
|
Debugger::GdbServerPortsGatherer *m_portsGatherer;
|
||||||
ProjectExplorer::SimpleTargetRunner *m_pdebugRunner;
|
ProjectExplorer::SimpleTargetRunner *m_pdebugRunner;
|
||||||
|
|
||||||
Utils::Port m_pdebugPort;
|
|
||||||
QString m_projectSourceDirectory;
|
|
||||||
QString m_localExecutablePath;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -139,8 +139,8 @@ void QnxPlugin::updateDebuggerActions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_attachToQnxApplication->setVisible(false && hasValidQnxKit); // FIXME
|
m_attachToQnxApplication->setVisible(hasValidQnxKit);
|
||||||
m_debugSeparator->setVisible(false && hasValidQnxKit); // FIXME QTCREATORBUG-16608
|
m_debugSeparator->setVisible(hasValidQnxKit);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
Reference in New Issue
Block a user