Debugger: Do not create a new terminal when attaching

... to a running application that already has one.

Task-number: QTCREATORBUG-19302
Change-Id: Id83f840408c26f3db85dbe30dadac9949ce6b660
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2017-11-16 12:29:25 +01:00
parent ac1ce65a38
commit c1d3e22511
3 changed files with 5 additions and 4 deletions

View File

@@ -2103,7 +2103,7 @@ void DebuggerPlugin::attachExternalApplication(RunControl *rc)
ProcessHandle pid = rc->applicationProcessHandle(); ProcessHandle pid = rc->applicationProcessHandle();
RunConfiguration *runConfig = rc->runConfiguration(); RunConfiguration *runConfig = rc->runConfiguration();
auto runControl = new RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE); auto runControl = new RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto debugger = new DebuggerRunTool(runControl, guessKitFromAbis({rc->abi()})); auto debugger = new DebuggerRunTool(runControl, guessKitFromAbis({rc->abi()}), false);
debugger->setAttachPid(pid); debugger->setAttachPid(pid);
debugger->setRunControlName(tr("Process %1").arg(pid.pid())); debugger->setRunControlName(tr("Process %1").arg(pid.pid()));
debugger->setStartMode(AttachExternal); debugger->setStartMode(AttachExternal);

View File

@@ -794,7 +794,7 @@ Internal::TerminalRunner *DebuggerRunTool::terminalRunner() const
return d->terminalRunner; return d->terminalRunner;
} }
DebuggerRunTool::DebuggerRunTool(RunControl *runControl, Kit *kit) DebuggerRunTool::DebuggerRunTool(RunControl *runControl, Kit *kit, bool allowTerminal)
: RunWorker(runControl), d(new DebuggerRunToolPrivate) : RunWorker(runControl), d(new DebuggerRunToolPrivate)
{ {
setDisplayName("DebuggerRunTool"); setDisplayName("DebuggerRunTool");
@@ -838,7 +838,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, Kit *kit)
// Normalize to work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch'...) // Normalize to work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch'...)
m_runParameters.inferior.workingDirectory = m_runParameters.inferior.workingDirectory =
FileUtils::normalizePathName(m_runParameters.inferior.workingDirectory); FileUtils::normalizePathName(m_runParameters.inferior.workingDirectory);
setUseTerminal(m_runParameters.inferior.runMode == ApplicationLauncher::Console); setUseTerminal(allowTerminal && m_runParameters.inferior.runMode == ApplicationLauncher::Console);
} }
const QByteArray envBinary = qgetenv("QTC_DEBUGGER_PATH"); const QByteArray envBinary = qgetenv("QTC_DEBUGGER_PATH");

View File

@@ -47,7 +47,8 @@ class DEBUGGER_EXPORT DebuggerRunTool : public ProjectExplorer::RunWorker
public: public:
explicit DebuggerRunTool(ProjectExplorer::RunControl *runControl, explicit DebuggerRunTool(ProjectExplorer::RunControl *runControl,
ProjectExplorer::Kit *kit = nullptr); ProjectExplorer::Kit *kit = nullptr,
bool allowTerminal = true);
~DebuggerRunTool(); ~DebuggerRunTool();
Internal::DebuggerEngine *engine() const { return m_engine; } Internal::DebuggerEngine *engine() const { return m_engine; }