forked from qt-creator/qt-creator
QNX: Fix debugging on QNX >6.5
The previous approach when debugging on pure QNX 6.5 no longer works with QNX version >6.5. Use proper way with "set nto-executable" and "run" instead. Change-Id: I00961236b416c42a0c81e29ea087de5ddd3a5f00 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -122,7 +122,6 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &sp)
|
|||||||
<< " attachPID=" << sp.attachPID
|
<< " attachPID=" << sp.attachPID
|
||||||
<< " useTerminal=" << sp.useTerminal
|
<< " useTerminal=" << sp.useTerminal
|
||||||
<< " remoteChannel=" << sp.remoteChannel
|
<< " remoteChannel=" << sp.remoteChannel
|
||||||
<< " symbolFileName=" << sp.symbolFileName
|
|
||||||
<< " serverStartScript=" << sp.serverStartScript
|
<< " serverStartScript=" << sp.serverStartScript
|
||||||
<< " abi=" << sp.toolChainAbi.toString() << '\n';
|
<< " abi=" << sp.toolChainAbi.toString() << '\n';
|
||||||
return str;
|
return str;
|
||||||
|
|||||||
@@ -2598,7 +2598,6 @@ static QString formatStartParameters(DebuggerStartParameters &sp)
|
|||||||
}
|
}
|
||||||
str << "Sysroot: " << sp.sysRoot << '\n';
|
str << "Sysroot: " << sp.sysRoot << '\n';
|
||||||
str << "Debug Source Location: " << sp.debugSourceLocation.join(QLatin1String(":")) << '\n';
|
str << "Debug Source Location: " << sp.debugSourceLocation.join(QLatin1String(":")) << '\n';
|
||||||
str << "Symbol file: " << sp.symbolFileName << '\n';
|
|
||||||
str << "Dumper libraries: " << QDir::toNativeSeparators(sp.dumperLibrary);
|
str << "Dumper libraries: " << QDir::toNativeSeparators(sp.dumperLibrary);
|
||||||
foreach (const QString &dl, sp.dumperLibraryLocations)
|
foreach (const QString &dl, sp.dumperLibraryLocations)
|
||||||
str << ' ' << QDir::toNativeSeparators(dl);
|
str << ' ' << QDir::toNativeSeparators(dl);
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ public:
|
|||||||
|
|
||||||
// Used by remote debugging.
|
// Used by remote debugging.
|
||||||
QString remoteChannel;
|
QString remoteChannel;
|
||||||
QString symbolFileName;
|
|
||||||
QString serverStartScript;
|
QString serverStartScript;
|
||||||
QString debugInfoLocation; // Gdb "set-debug-file-directory".
|
QString debugInfoLocation; // Gdb "set-debug-file-directory".
|
||||||
QStringList debugSourceLocation; // Gdb "directory"
|
QStringList debugSourceLocation; // Gdb "directory"
|
||||||
|
|||||||
@@ -179,11 +179,6 @@ void GdbRemoteServerEngine::setupInferior()
|
|||||||
QFileInfo fi(sp.executable);
|
QFileInfo fi(sp.executable);
|
||||||
executableFileName = fi.absoluteFilePath();
|
executableFileName = fi.absoluteFilePath();
|
||||||
}
|
}
|
||||||
QString symbolFileName;
|
|
||||||
if (!sp.symbolFileName.isEmpty()) {
|
|
||||||
QFileInfo fi(sp.symbolFileName);
|
|
||||||
symbolFileName = fi.absoluteFilePath();
|
|
||||||
}
|
|
||||||
|
|
||||||
//const QByteArray sysroot = sp.sysroot.toLocal8Bit();
|
//const QByteArray sysroot = sp.sysroot.toLocal8Bit();
|
||||||
//const QByteArray remoteArch = sp.remoteArchitecture.toLatin1();
|
//const QByteArray remoteArch = sp.remoteArchitecture.toLatin1();
|
||||||
@@ -221,17 +216,12 @@ void GdbRemoteServerEngine::setupInferior()
|
|||||||
if (debuggerCore()->boolSetting(TargetAsync))
|
if (debuggerCore()->boolSetting(TargetAsync))
|
||||||
postCommand("set target-async on", CB(handleSetTargetAsync));
|
postCommand("set target-async on", CB(handleSetTargetAsync));
|
||||||
|
|
||||||
if (executableFileName.isEmpty() && symbolFileName.isEmpty()) {
|
if (executableFileName.isEmpty()) {
|
||||||
showMessage(tr("No symbol file given."), StatusBar);
|
showMessage(tr("No symbol file given."), StatusBar);
|
||||||
callTargetRemote();
|
callTargetRemote();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!symbolFileName.isEmpty()) {
|
|
||||||
postCommand("-file-symbol-file \""
|
|
||||||
+ symbolFileName.toLocal8Bit() + '"',
|
|
||||||
CB(handleFileExecAndSymbols));
|
|
||||||
}
|
|
||||||
if (!executableFileName.isEmpty()) {
|
if (!executableFileName.isEmpty()) {
|
||||||
postCommand("-file-exec-and-symbols \"" + executableFileName.toLocal8Bit() + '"',
|
postCommand("-file-exec-and-symbols \"" + executableFileName.toLocal8Bit() + '"',
|
||||||
CB(handleFileExecAndSymbols));
|
CB(handleFileExecAndSymbols));
|
||||||
@@ -360,8 +350,11 @@ void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response)
|
|||||||
showMessage(msgAttachedToStoppedInferior(), StatusBar);
|
showMessage(msgAttachedToStoppedInferior(), StatusBar);
|
||||||
|
|
||||||
const qint64 pid = isMasterEngine() ? startParameters().attachPID : masterEngine()->startParameters().attachPID;
|
const qint64 pid = isMasterEngine() ? startParameters().attachPID : masterEngine()->startParameters().attachPID;
|
||||||
|
const QString remoteExecutable = isMasterEngine() ? startParameters().remoteExecutable : masterEngine()->startParameters().remoteExecutable;
|
||||||
if (pid > -1)
|
if (pid > -1)
|
||||||
postCommand("attach " + QByteArray::number(pid), CB(handleAttach));
|
postCommand("attach " + QByteArray::number(pid), CB(handleAttach));
|
||||||
|
else if (!remoteExecutable.isEmpty())
|
||||||
|
postCommand("set nto-executable " + remoteExecutable.toLatin1(), CB(handleSetNtoExecutable));
|
||||||
else
|
else
|
||||||
handleInferiorPrepared();
|
handleInferiorPrepared();
|
||||||
} else {
|
} 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()
|
void GdbRemoteServerEngine::runEngine()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
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()) {
|
if (!remoteExecutable.isEmpty()) {
|
||||||
// Cannot use -exec-run for QNX gdb 7.4 as it does not support path parameter for the MI call
|
postCommand("-exec-run", GdbEngine::RunRequest, CB(handleExecRun));
|
||||||
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));
|
|
||||||
} else {
|
} else {
|
||||||
notifyEngineRunAndInferiorStopOk();
|
notifyEngineRunAndInferiorStopOk();
|
||||||
continueInferiorInternal();
|
continueInferiorInternal();
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ private:
|
|||||||
void handleTargetExtendedAttach(const GdbResponse &response);
|
void handleTargetExtendedAttach(const GdbResponse &response);
|
||||||
void handleTargetQnx(const GdbResponse &response);
|
void handleTargetQnx(const GdbResponse &response);
|
||||||
void handleAttach(const GdbResponse &response);
|
void handleAttach(const GdbResponse &response);
|
||||||
|
void handleSetNtoExecutable(const GdbResponse &response);
|
||||||
void handleInterruptInferior(const GdbResponse &response);
|
void handleInterruptInferior(const GdbResponse &response);
|
||||||
void handleExecRun(const GdbResponse &response);
|
void handleExecRun(const GdbResponse &response);
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,11 @@ void QnxDebugSupport::handleRemoteProcessFinished(bool success)
|
|||||||
|
|
||||||
void QnxDebugSupport::handleDebuggingFinished()
|
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();
|
setFinished();
|
||||||
|
killInferiorProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QnxDebugSupport::executable() const
|
QString QnxDebugSupport::executable() const
|
||||||
@@ -134,6 +138,11 @@ QString QnxDebugSupport::executable() const
|
|||||||
return m_useCppDebugger? QLatin1String(Constants::QNX_DEBUG_EXECUTABLE) : QnxAbstractRunSupport::executable();
|
return m_useCppDebugger? QLatin1String(Constants::QNX_DEBUG_EXECUTABLE) : QnxAbstractRunSupport::executable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QnxDebugSupport::killInferiorProcess()
|
||||||
|
{
|
||||||
|
device()->signalOperation()->killProcess(QnxAbstractRunSupport::executable());
|
||||||
|
}
|
||||||
|
|
||||||
void QnxDebugSupport::handleProgressReport(const QString &progressOutput)
|
void QnxDebugSupport::handleProgressReport(const QString &progressOutput)
|
||||||
{
|
{
|
||||||
if (m_engine)
|
if (m_engine)
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ private:
|
|||||||
|
|
||||||
QString executable() const;
|
QString executable() const;
|
||||||
|
|
||||||
|
void killInferiorProcess();
|
||||||
|
|
||||||
Debugger::DebuggerEngine *m_engine;
|
Debugger::DebuggerEngine *m_engine;
|
||||||
int m_pdebugPort;
|
int m_pdebugPort;
|
||||||
int m_qmlPort;
|
int m_qmlPort;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ static DebuggerStartParameters createDebuggerStartParameters(const QnxRunConfigu
|
|||||||
if (ToolChain *tc = ToolChainKitInformation::toolChain(k))
|
if (ToolChain *tc = ToolChainKitInformation::toolChain(k))
|
||||||
params.toolChainAbi = tc->targetAbi();
|
params.toolChainAbi = tc->targetAbi();
|
||||||
|
|
||||||
params.symbolFileName = runConfig->localExecutableFilePath();
|
params.executable = runConfig->localExecutableFilePath();
|
||||||
params.remoteExecutable = runConfig->remoteExecutableFilePath();
|
params.remoteExecutable = runConfig->remoteExecutableFilePath();
|
||||||
params.remoteChannel = device->sshParameters().host + QLatin1String(":-1");
|
params.remoteChannel = device->sshParameters().host + QLatin1String(":-1");
|
||||||
params.displayName = runConfig->displayName();
|
params.displayName = runConfig->displayName();
|
||||||
|
|||||||
Reference in New Issue
Block a user