diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index b473866ac05..ab3828f4776 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -122,7 +122,6 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &sp) << " attachPID=" << sp.attachPID << " useTerminal=" << sp.useTerminal << " remoteChannel=" << sp.remoteChannel - << " symbolFileName=" << sp.symbolFileName << " serverStartScript=" << sp.serverStartScript << " abi=" << sp.toolChainAbi.toString() << '\n'; return str; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 67953afcfca..cc42f45a3f7 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2598,7 +2598,6 @@ static QString formatStartParameters(DebuggerStartParameters &sp) } str << "Sysroot: " << sp.sysRoot << '\n'; str << "Debug Source Location: " << sp.debugSourceLocation.join(QLatin1String(":")) << '\n'; - str << "Symbol file: " << sp.symbolFileName << '\n'; str << "Dumper libraries: " << QDir::toNativeSeparators(sp.dumperLibrary); foreach (const QString &dl, sp.dumperLibraryLocations) str << ' ' << QDir::toNativeSeparators(dl); diff --git a/src/plugins/debugger/debuggerstartparameters.h b/src/plugins/debugger/debuggerstartparameters.h index a1b3c0de343..3443152039a 100644 --- a/src/plugins/debugger/debuggerstartparameters.h +++ b/src/plugins/debugger/debuggerstartparameters.h @@ -115,7 +115,6 @@ public: // Used by remote debugging. QString remoteChannel; - QString symbolFileName; QString serverStartScript; QString debugInfoLocation; // Gdb "set-debug-file-directory". QStringList debugSourceLocation; // Gdb "directory" diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index d15e5d0568d..a32387a5774 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -179,11 +179,6 @@ void GdbRemoteServerEngine::setupInferior() QFileInfo fi(sp.executable); executableFileName = fi.absoluteFilePath(); } - QString symbolFileName; - if (!sp.symbolFileName.isEmpty()) { - QFileInfo fi(sp.symbolFileName); - symbolFileName = fi.absoluteFilePath(); - } //const QByteArray sysroot = sp.sysroot.toLocal8Bit(); //const QByteArray remoteArch = sp.remoteArchitecture.toLatin1(); @@ -221,17 +216,12 @@ void GdbRemoteServerEngine::setupInferior() if (debuggerCore()->boolSetting(TargetAsync)) postCommand("set target-async on", CB(handleSetTargetAsync)); - if (executableFileName.isEmpty() && symbolFileName.isEmpty()) { + if (executableFileName.isEmpty()) { showMessage(tr("No symbol file given."), StatusBar); callTargetRemote(); return; } - if (!symbolFileName.isEmpty()) { - postCommand("-file-symbol-file \"" - + symbolFileName.toLocal8Bit() + '"', - CB(handleFileExecAndSymbols)); - } if (!executableFileName.isEmpty()) { postCommand("-file-exec-and-symbols \"" + executableFileName.toLocal8Bit() + '"', CB(handleFileExecAndSymbols)); @@ -360,8 +350,11 @@ void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response) showMessage(msgAttachedToStoppedInferior(), StatusBar); const qint64 pid = isMasterEngine() ? startParameters().attachPID : masterEngine()->startParameters().attachPID; + const QString remoteExecutable = isMasterEngine() ? startParameters().remoteExecutable : masterEngine()->startParameters().remoteExecutable; if (pid > -1) postCommand("attach " + QByteArray::number(pid), CB(handleAttach)); + else if (!remoteExecutable.isEmpty()) + postCommand("set nto-executable " + remoteExecutable.toLatin1(), CB(handleSetNtoExecutable)); else handleInferiorPrepared(); } else { @@ -395,21 +388,32 @@ void GdbRemoteServerEngine::handleAttach(const GdbResponse &response) } } +void GdbRemoteServerEngine::handleSetNtoExecutable(const GdbResponse &response) +{ + QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); + switch (response.resultClass) { + case GdbResultDone: + case GdbResultRunning: { + showMessage(_("EXECUTABLE SET")); + showMessage(msgAttachedToStoppedInferior(), StatusBar); + handleInferiorPrepared(); + break; + } + case GdbResultError: + default: + QString msg = QString::fromLocal8Bit(response.data["msg"].data()); + notifyInferiorSetupFailed(msg); + } + +} + void GdbRemoteServerEngine::runEngine() { QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); - const QString remoteExecutable = startParameters().remoteExecutable; + const QString remoteExecutable = startParameters().remoteExecutable; // This is only set for pure QNX if (!remoteExecutable.isEmpty()) { - // Cannot use -exec-run for QNX gdb 7.4 as it does not support path parameter for the MI call - const bool useRun = m_isQnxGdb && m_gdbVersion > 70300; - QByteArray command = useRun ? "run" : "-exec-run"; - command += " " + remoteExecutable.toLocal8Bit(); - - const QByteArray arguments = isMasterEngine() ? startParameters().processArgs.toLocal8Bit() : masterEngine()->startParameters().processArgs.toLocal8Bit(); - command += " " + arguments; - - postCommand(command, GdbEngine::RunRequest, CB(handleExecRun)); + postCommand("-exec-run", GdbEngine::RunRequest, CB(handleExecRun)); } else { notifyEngineRunAndInferiorStopOk(); continueInferiorInternal(); diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.h b/src/plugins/debugger/gdb/remotegdbserveradapter.h index 27c6a2509ca..38545764854 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.h +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.h @@ -88,6 +88,7 @@ private: void handleTargetExtendedAttach(const GdbResponse &response); void handleTargetQnx(const GdbResponse &response); void handleAttach(const GdbResponse &response); + void handleSetNtoExecutable(const GdbResponse &response); void handleInterruptInferior(const GdbResponse &response); void handleExecRun(const GdbResponse &response); diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index df1a7c16e78..3c36e00f914 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -126,7 +126,11 @@ void QnxDebugSupport::handleRemoteProcessFinished(bool success) void QnxDebugSupport::handleDebuggingFinished() { + // setFinished() will kill "pdebug", but we also have to kill + // the inferior process, as invoking "kill" in gdb doesn't work + // on QNX gdb setFinished(); + killInferiorProcess(); } QString QnxDebugSupport::executable() const @@ -134,6 +138,11 @@ QString QnxDebugSupport::executable() const return m_useCppDebugger? QLatin1String(Constants::QNX_DEBUG_EXECUTABLE) : QnxAbstractRunSupport::executable(); } +void QnxDebugSupport::killInferiorProcess() +{ + device()->signalOperation()->killProcess(QnxAbstractRunSupport::executable()); +} + void QnxDebugSupport::handleProgressReport(const QString &progressOutput) { if (m_engine) diff --git a/src/plugins/qnx/qnxdebugsupport.h b/src/plugins/qnx/qnxdebugsupport.h index 42535bb3149..fa5a9dde265 100644 --- a/src/plugins/qnx/qnxdebugsupport.h +++ b/src/plugins/qnx/qnxdebugsupport.h @@ -65,6 +65,8 @@ private: QString executable() const; + void killInferiorProcess(); + Debugger::DebuggerEngine *m_engine; int m_pdebugPort; int m_qmlPort; diff --git a/src/plugins/qnx/qnxruncontrolfactory.cpp b/src/plugins/qnx/qnxruncontrolfactory.cpp index 9ecb3dd431d..4d965bdc571 100644 --- a/src/plugins/qnx/qnxruncontrolfactory.cpp +++ b/src/plugins/qnx/qnxruncontrolfactory.cpp @@ -81,7 +81,7 @@ static DebuggerStartParameters createDebuggerStartParameters(const QnxRunConfigu if (ToolChain *tc = ToolChainKitInformation::toolChain(k)) params.toolChainAbi = tc->targetAbi(); - params.symbolFileName = runConfig->localExecutableFilePath(); + params.executable = runConfig->localExecutableFilePath(); params.remoteExecutable = runConfig->remoteExecutableFilePath(); params.remoteChannel = device->sshParameters().host + QLatin1String(":-1"); params.displayName = runConfig->displayName();