Commit 607e5452 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

S60: Handle TrkNotifyStopped (crash) when running.



Extract error message string from Trk, print proper message
when application crashes in run mode and terminate launcher.
Use same message in Debugger for consistency.
Reviewed-by: default avatarRobert Loehning <robert.loehning@nokia.com>
parent 9ac451ea
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
**************************************************************************/ **************************************************************************/
#include "trkgdbadapter.h" #include "trkgdbadapter.h"
#include "launcher.h"
#include "trkoptions.h" #include "trkoptions.h"
#include "trkoptionspage.h" #include "trkoptionspage.h"
#include "s60debuggerbluetoothstarter.h" #include "s60debuggerbluetoothstarter.h"
...@@ -991,16 +992,18 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result) ...@@ -991,16 +992,18 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
logMessage(logMsg); logMessage(logMsg);
break; break;
} }
case 0x90: { // Notified Stopped case TrkNotifyStopped: { // Notified Stopped
// 90 01 78 6a 40 40 00 00 07 23 00 00 07 24 00 00 // 90 01 78 6a 40 40 00 00 07 23 00 00 07 24 00 00
debugMessage(_("RESET SNAPSHOT (NOTIFY STOPPED)")); debugMessage(_("RESET SNAPSHOT (NOTIFY STOPPED)"));
m_snapshot.reset(); m_snapshot.reset();
const char *data = result.data.data(); QString reason;
const uint addr = extractInt(data); uint addr;
const uint pid = extractInt(data + 4); uint pid;
const uint tid = extractInt(data + 8); uint tid;
logMessage(prefix + _("NOTE: PID %1/TID %2 " trk::Launcher::parseNotifyStopped(result.data, &pid, &tid, &addr, &reason);
"STOPPED at 0x%3").arg(pid).arg(tid).arg(addr, 0, 16)); const QString msg = trk::Launcher::msgStopped(pid, tid, addr, reason);
logMessage(prefix + msg);
m_engine->manager()->showDebuggerOutput(LogMisc, msg);
sendTrkAck(result.token); sendTrkAck(result.token);
if (addr) { if (addr) {
// Todo: Do not send off GdbMessages if a synced gdb // Todo: Do not send off GdbMessages if a synced gdb
...@@ -1019,7 +1022,7 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result) ...@@ -1019,7 +1022,7 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
trkReadRegistersMessage()); trkReadRegistersMessage());
break; break;
} }
case 0x91: { // Notify Exception (obsolete) case TrkNotifyException: { // Notify Exception (obsolete)
debugMessage(_("RESET SNAPSHOT (NOTIFY EXCEPTION)")); debugMessage(_("RESET SNAPSHOT (NOTIFY EXCEPTION)"));
m_snapshot.reset(); m_snapshot.reset();
logMessage(prefix + "NOTE: EXCEPTION " + str); logMessage(prefix + "NOTE: EXCEPTION " + str);
......
...@@ -602,6 +602,8 @@ void S60DeviceRunControlBase::signsisProcessFinished() ...@@ -602,6 +602,8 @@ void S60DeviceRunControlBase::signsisProcessFinished()
connect(m_launcher, SIGNAL(canNotInstall(QString,QString)), this, SLOT(printInstallFailed(QString,QString))); connect(m_launcher, SIGNAL(canNotInstall(QString,QString)), this, SLOT(printInstallFailed(QString,QString)));
connect(m_launcher, SIGNAL(copyProgress(int)), this, SLOT(printCopyProgress(int))); connect(m_launcher, SIGNAL(copyProgress(int)), this, SLOT(printCopyProgress(int)));
connect(m_launcher, SIGNAL(stateChanged(int)), this, SLOT(slotLauncherStateChanged(int))); connect(m_launcher, SIGNAL(stateChanged(int)), this, SLOT(slotLauncherStateChanged(int)));
connect(m_launcher, SIGNAL(processStopped(uint,uint,uint,QString)),
this, SLOT(processStopped(uint,uint,uint,QString)));
//TODO sisx destination and file path user definable //TODO sisx destination and file path user definable
m_launcher->setTrkServerName(m_serialPortName); m_launcher->setTrkServerName(m_serialPortName);
...@@ -688,6 +690,12 @@ void S60DeviceRunControlBase::launcherFinished() ...@@ -688,6 +690,12 @@ void S60DeviceRunControlBase::launcherFinished()
handleLauncherFinished(); handleLauncherFinished();
} }
void S60DeviceRunControlBase::processStopped(uint pc, uint pid, uint tid, const QString& reason)
{
emit addToOutputWindow(this, trk::Launcher::msgStopped(pid, tid, pc, reason));
m_launcher->terminate();
}
QMessageBox *S60DeviceRunControlBase::createTrkWaitingMessageBox(const QString &port, QWidget *parent) QMessageBox *S60DeviceRunControlBase::createTrkWaitingMessageBox(const QString &port, QWidget *parent)
{ {
const QString title = QCoreApplication::translate("Qt4ProjectManager::Internal::S60DeviceRunControlBase", const QString title = QCoreApplication::translate("Qt4ProjectManager::Internal::S60DeviceRunControlBase",
......
...@@ -155,6 +155,7 @@ protected slots: ...@@ -155,6 +155,7 @@ protected slots:
void printApplicationOutput(const QString &output); void printApplicationOutput(const QString &output);
private slots: private slots:
void processStopped(uint pc, uint pid, uint tid, const QString& reason);
void readStandardError(); void readStandardError();
void readStandardOutput(); void readStandardOutput();
void makesisProcessFailed(); void makesisProcessFailed();
......
...@@ -136,6 +136,8 @@ int main(int argc, char *argv[]) ...@@ -136,6 +136,8 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
QObject::connect(launcher.data(), SIGNAL(finished()), &app, SLOT(quit())); QObject::connect(launcher.data(), SIGNAL(finished()), &app, SLOT(quit()));
QObject::connect(launcher.data(), SIGNAL(processStopped(uint,uint,uint,QString)),
launcher.data(), SLOT(terminate()));
// BLuetooth: Open with prompt // BLuetooth: Open with prompt
QString errorMessage; QString errorMessage;
if (bluetooth && !trk::ConsoleBluetoothStarter::startBluetooth(launcher->trkDevice(), if (bluetooth && !trk::ConsoleBluetoothStarter::startBluetooth(launcher->trkDevice(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment