From 903a50a6ef90cf4b795acab3648006e577fb0e47 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Thu, 10 Sep 2009 13:59:21 +0200
Subject: [PATCH] debugger: work on trk integration

---
 src/plugins/debugger/debuggermanager.cpp        | 12 ++++++++----
 src/plugins/debugger/symbian/symbianadapter.cpp | 16 +++++++++-------
 src/plugins/debugger/symbian/symbianadapter.h   |  1 +
 src/plugins/debugger/symbian/symbianengine.cpp  |  3 ++-
 tests/manual/trk/trklauncher.pri                |  2 +-
 5 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp
index 9bc178ca946..5222fb8c1ae 100644
--- a/src/plugins/debugger/debuggermanager.cpp
+++ b/src/plugins/debugger/debuggermanager.cpp
@@ -1355,14 +1355,18 @@ void DebuggerManager::modulesDockToggled(bool on)
 
 void DebuggerManager::showDebuggerOutput(int channel, const QString &msg)
 {
-    QTC_ASSERT(m_outputWindow, return);
-    m_outputWindow->showOutput(channel, msg);
+    if (m_outputWindow)
+        m_outputWindow->showOutput(channel, msg);
+    else 
+        qDebug() << "OUTPUT: " << channel << msg;
 }
 
 void DebuggerManager::showDebuggerInput(int channel, const QString &msg)
 {
-    QTC_ASSERT(m_outputWindow, return);
-    m_outputWindow->showInput(channel, msg);
+    if (m_outputWindow)
+        m_outputWindow->showInput(channel, msg);
+    else 
+        qDebug() << "INPUT: " << channel << msg;
 }
 
 
diff --git a/src/plugins/debugger/symbian/symbianadapter.cpp b/src/plugins/debugger/symbian/symbianadapter.cpp
index 9ade25364d7..b13447499f7 100644
--- a/src/plugins/debugger/symbian/symbianadapter.cpp
+++ b/src/plugins/debugger/symbian/symbianadapter.cpp
@@ -191,6 +191,7 @@ void SymbianAdapter::startInferior()
     appendString(&ba, file, TargetByteOrder);
     sendTrkMessage(0x40, TrkCB(handleCreateProcess), ba); // Create Item
     //sendTrkMessage(TRK_WRITE_QUEUE_NOOP_CODE, TrkCB(startGdbServer));
+    emit started();
 }
 
 void SymbianAdapter::logMessage(const QString &msg)
@@ -1292,7 +1293,8 @@ void SymbianAdapter::sendOutput(QObject *sender, const QString &data)
 
 void SymbianAdapter::handleProcError(QProcess::ProcessError error)
 {
-    sendOutput(sender(), QString("Process Error %1").arg(error));
+    sendOutput(sender(),
+        QString("Process Error %1: %2").arg(error).arg(errorString()));
 }
 
 void SymbianAdapter::handleProcFinished(int exitCode, QProcess::ExitStatus exitStatus)
@@ -1511,25 +1513,25 @@ void SymbianAdapter::handleRfcommReadyReadStandardOutput()
 void SymbianAdapter::start(const QString &program, const QStringList &args,
     QIODevice::OpenMode mode)
 {
-    qDebug() << "SYMBIAN START";
+    Q_UNUSED(mode);
+    qDebug() << "SYMBIAN START" << program << args << mode;
     run();
-    //m_gdbProc.start(program, args, mode);
 }
 
 void SymbianAdapter::kill()
 {
-    //m_gdbProc.kill();
+    m_gdbProc.kill();
 }
 
 void SymbianAdapter::terminate()
 {
-    //m_gdbProc.terminate();
+    m_gdbProc.terminate();
 }
 
 bool SymbianAdapter::waitForFinished(int msecs)
 {
-    //return m_gdbProc.waitForFinished(msecs);
-    return true;
+    return m_gdbProc.waitForFinished(msecs);
+    //return true;
 }
 
 QProcess::ProcessState SymbianAdapter::state() const
diff --git a/src/plugins/debugger/symbian/symbianadapter.h b/src/plugins/debugger/symbian/symbianadapter.h
index 79c7860d5c4..da6c0735ab3 100644
--- a/src/plugins/debugger/symbian/symbianadapter.h
+++ b/src/plugins/debugger/symbian/symbianadapter.h
@@ -96,6 +96,7 @@ public slots:
 
 signals:
     void output(const QString &msg);
+    void startSuccessful();
 
 private slots:
     void handleProcError(QProcess::ProcessError error);
diff --git a/src/plugins/debugger/symbian/symbianengine.cpp b/src/plugins/debugger/symbian/symbianengine.cpp
index ef407e2c53f..cb30e78fd9d 100644
--- a/src/plugins/debugger/symbian/symbianengine.cpp
+++ b/src/plugins/debugger/symbian/symbianengine.cpp
@@ -52,9 +52,10 @@ IDebuggerEngine *createSymbianEngine(DebuggerManager *parent,
     Q_UNUSED(opts);
     //opts->push_back(new GdbOptionsPage);
     SymbianAdapter *adapter = new SymbianAdapter;
+    GdbEngine *engine = new GdbEngine(parent, adapter);
     QObject::connect(adapter, SIGNAL(output(QString)),
         parent, SLOT(showDebuggerOutput(QString)));
-    return new GdbEngine(parent, adapter);
+    return engine;
 }
 
 } // namespace Internal
diff --git a/tests/manual/trk/trklauncher.pri b/tests/manual/trk/trklauncher.pri
index 74b37e42e3c..69ed7630410 100644
--- a/tests/manual/trk/trklauncher.pri
+++ b/tests/manual/trk/trklauncher.pri
@@ -1,7 +1,7 @@
 DEFINES += DEBUG_TRK=0
 DEBUGGERHOME = ../../../src/plugins/debugger/symbian
 
-INCLUDEPATH *= $$DEBUGGERHOME
+INCLUDEPATH *= $$PWD $$DEBUGGERHOME
 
 SOURCES += \
     $$DEBUGGERHOME/trkutils.cpp \
-- 
GitLab