Debugger: Set inferior device when attaching to running application

The device is needed to properly interrupt the inferior with cdb.

Change-Id: I96f3a7393770be9821d8edd7123c458399d4494a
Task-nnumber: QTCREATORBUG-19253
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
David Schulz
2017-11-13 11:11:43 +01:00
parent 078ced511d
commit d2784c6805
4 changed files with 11 additions and 1 deletions

View File

@@ -881,7 +881,10 @@ void CdbEngine::doInterruptInferior(SpecialStopMode sm)
QTC_ASSERT(!m_signalOperation, notifyInferiorStopFailed(); return;);
if (DebuggerRunTool *rt = runTool()) {
if (IDevice::ConstPtr device = rt->device())
IDevice::ConstPtr device = rt->device();
if (!device)
device = runParameters().inferior.device;
if (device)
m_signalOperation = device->signalOperation();
}
m_specialStopMode = sm;

View File

@@ -2088,6 +2088,7 @@ RunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit,
debugger->setAttachPid(ProcessHandle(process.pid));
debugger->setRunControlName(tr("Process %1").arg(process.pid));
debugger->setInferiorExecutable(process.exe);
debugger->setInferiorDevice(device);
debugger->setStartMode(AttachExternal);
debugger->setCloseMode(DetachAtClose);
debugger->setContinueAfterAttach(contAfterAttach);

View File

@@ -436,6 +436,11 @@ void DebuggerRunTool::setInferiorEnvironment(const Utils::Environment &env)
m_runParameters.inferior.environment = env;
}
void DebuggerRunTool::setInferiorDevice(IDevice::ConstPtr device)
{
m_runParameters.inferior.device = device;
}
void DebuggerRunTool::setRunControlName(const QString &name)
{
m_runParameters.displayName = name;

View File

@@ -84,6 +84,7 @@ public:
void setInferior(const ProjectExplorer::Runnable &runnable);
void setInferiorExecutable(const QString &executable);
void setInferiorEnvironment(const Utils::Environment &env); // Used by GammaRay plugin
void setInferiorDevice(ProjectExplorer::IDevice::ConstPtr device); // Used by cdbengine
void setRunControlName(const QString &name);
void setStartMessage(const QString &msg);
void appendInferiorCommandLineArgument(const QString &arg);