summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
diff options
context:
space:
mode:
authorTobias Nätterlund <tobias.naetterlund.qnx@kdab.com>2012-06-29 07:23:13 +0200
committerDaniel Teske <daniel.teske@nokia.com>2012-07-13 15:37:34 +0200
commita7ac2bb559fb717b616548ef3cc6332f1bdd46eb (patch)
tree063c170c5ae35cd769e51aa07a5c2fad8ec78fcc /src/plugins/debugger/gdb/remotegdbserveradapter.cpp
parentcbce4389a540370169a874301450081eb6dbf675 (diff)
downloadqt-creator-a7ac2bb559fb717b616548ef3cc6332f1bdd46eb.tar.gz
New QNX plugin.
This plugin adds support for cross-compiling, deploying, running and debugging on a PlayBook or QNX Neutrino device. Change-Id: I0da7ccee40bd7ce4c0d6bdc6884d48ef23167dac Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Diffstat (limited to 'src/plugins/debugger/gdb/remotegdbserveradapter.cpp')
-rw-r--r--src/plugins/debugger/gdb/remotegdbserveradapter.cpp49
1 files changed, 41 insertions, 8 deletions
diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
index 0f1d3e09ed..fc26e49af6 100644
--- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
+++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
@@ -170,11 +170,17 @@ void GdbRemoteServerEngine::setupInferior()
#else
#define PATHSEP ":"
#endif
- QString fileName;
+ QString executableFileName;
if (!sp.executable.isEmpty()) {
QFileInfo fi(sp.executable);
- fileName = 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 remoteArch = sp.remoteArchitecture.toLatin1();
//const QByteArray gnuTarget = sp.gnuTarget.toLatin1();
@@ -213,14 +219,21 @@ void GdbRemoteServerEngine::setupInferior()
if (debuggerCore()->boolSetting(TargetAsync))
postCommand("set target-async on", CB(handleSetTargetAsync));
- if (fileName.isEmpty()) {
+ if (executableFileName.isEmpty() && symbolFileName.isEmpty()) {
showMessage(tr("No symbol file given."), StatusBar);
callTargetRemote();
return;
}
- postCommand("-file-exec-and-symbols \"" + fileName.toLocal8Bit() + '"',
- CB(handleFileExecAndSymbols));
+ if (!symbolFileName.isEmpty()) {
+ postCommand("-file-symbol-file \""
+ + symbolFileName.toLocal8Bit() + '"',
+ CB(handleFileExecAndSymbols));
+ }
+ if (!executableFileName.isEmpty()) {
+ postCommand("-file-exec-and-symbols \"" + executableFileName.toLocal8Bit() + '"',
+ CB(handleFileExecAndSymbols));
+ }
}
void GdbRemoteServerEngine::handleSetTargetAsync(const GdbResponse &response)
@@ -302,7 +315,7 @@ void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response)
showMessage(_("INFERIOR STARTED"));
showMessage(msgAttachedToStoppedInferior(), StatusBar);
- const qint64 pid = startParameters().attachPID;
+ const qint64 pid = isMasterEngine() ? startParameters().attachPID : masterEngine()->startParameters().attachPID;
if (pid > -1) {
postCommand("attach " + QByteArray::number(pid), CB(handleAttach));
} else {
@@ -342,8 +355,28 @@ void GdbRemoteServerEngine::handleAttach(const GdbResponse &response)
void GdbRemoteServerEngine::runEngine()
{
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
- notifyEngineRunAndInferiorStopOk();
- continueInferiorInternal();
+
+ const QString remoteExecutable = startParameters().remoteExecutable;
+ if (!remoteExecutable.isEmpty()) {
+ postCommand("-exec-run " + remoteExecutable.toLocal8Bit(), GdbEngine::RunRequest, CB(handleExecRun));
+ } else {
+ notifyEngineRunAndInferiorStopOk();
+ continueInferiorInternal();
+ }
+}
+
+void GdbRemoteServerEngine::handleExecRun(const GdbResponse &response)
+{
+ QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
+ if (response.resultClass == GdbResultRunning) {
+ notifyEngineRunAndInferiorRunOk();
+ showMessage(_("INFERIOR STARTED"));
+ showMessage(msgInferiorSetupOk(), StatusBar);
+ } else {
+ QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
+ showMessage(msg);
+ notifyEngineRunFailed();
+ }
}
void GdbRemoteServerEngine::interruptInferior2()