TCF TRK: Added support for Console Logging event.

This commit is contained in:
Friedemann Kleint
2010-07-12 16:19:13 +02:00
parent 7986c44dbf
commit b2694a33bb
5 changed files with 56 additions and 2 deletions

View File

@@ -270,6 +270,7 @@ void TcfTrkGdbAdapter::tcftrkEvent(const tcftrk::TcfTrkEvent &e)
switch (e.type()) { switch (e.type()) {
case tcftrk::TcfTrkEvent::LocatorHello: case tcftrk::TcfTrkEvent::LocatorHello:
m_trkDevice->sendLoggingAddListenerCommand(TcfTrkCallback());
startGdb(); // Commands are only accepted after hello startGdb(); // Commands are only accepted after hello
break; break;
case tcftrk::TcfTrkEvent::RunControlModuleLoadSuspended: // A module was loaded case tcftrk::TcfTrkEvent::RunControlModuleLoadSuspended: // A module was loaded
@@ -311,6 +312,9 @@ void TcfTrkGdbAdapter::tcftrkEvent(const tcftrk::TcfTrkEvent &e)
Symbian::RegisterCount); Symbian::RegisterCount);
} }
break; break;
case tcftrk::TcfTrkEvent::LoggingWriteEvent: // TODO: Not tested yet.
showMessage(e.toString(), AppOutput);
break;
default: default:
break; break;
} }

View File

@@ -914,4 +914,15 @@ void TcfTrkDevice::sendRegistersSetCommand(const TcfTrkCallback &callBack,
value, cookie); value, cookie);
} }
static const char outputListenerIDC[] = "org.eclipse.cdt.debug.edc.ui.ProgramOutputConsoleLogger";
void TcfTrkDevice::sendLoggingAddListenerCommand(const TcfTrkCallback &callBack,
const QVariant &cookie)
{
QByteArray data;
JsonInputStream str(data);
str << outputListenerIDC;
sendTcfTrkMessage(MessageWithReply, LoggingService, "addListener", data, callBack, cookie);
}
} // namespace tcftrk } // namespace tcftrk

View File

@@ -249,6 +249,9 @@ public:
unsigned value, unsigned value,
const QVariant &cookie = QVariant()); const QVariant &cookie = QVariant());
void sendLoggingAddListenerCommand(const TcfTrkCallback &callBack,
const QVariant &cookie = QVariant());
static QByteArray parseMemoryGet(const TcfTrkCommandResult &r); static QByteArray parseMemoryGet(const TcfTrkCommandResult &r);
signals: signals:

View File

@@ -36,7 +36,7 @@
// Names matching the enum // Names matching the enum
static const char *serviceNamesC[] = static const char *serviceNamesC[] =
{ "Locator", "RunControl", "Processes", "Memory", "Settings", "Breakpoints", { "Locator", "RunControl", "Processes", "Memory", "Settings", "Breakpoints",
"Registers", "SimpleRegisters", "Registers", "SimpleRegisters", "Logging",
"UnknownService"}; "UnknownService"};
namespace tcftrk { namespace tcftrk {
@@ -401,6 +401,10 @@ TcfTrkEvent *TcfTrkEvent::parseEvent(Services s, const QByteArray &nameBA, const
return new TcfTrkRunControlContextRemovedEvent(ids); return new TcfTrkRunControlContextRemovedEvent(ids);
} }
break; break;
case LoggingService:
if (nameBA == "write" && values.size() >= 2)
return new TcfTrkLoggingWriteEvent(values.at(0).data(), values.at(1).data());
break;
default: default:
break; break;
} }
@@ -419,6 +423,21 @@ QString TcfTrkLocatorHelloEvent::toString() const
return QLatin1String("ServiceHello: ") + m_services.join(QLatin1String(", ")); return QLatin1String("ServiceHello: ") + m_services.join(QLatin1String(", "));
} }
// -------------- Logging event
TcfTrkLoggingWriteEvent::TcfTrkLoggingWriteEvent(const QByteArray &console, const QByteArray &message) :
TcfTrkEvent(LoggingWriteEvent), m_console(console), m_message(message)
{
}
QString TcfTrkLoggingWriteEvent::toString() const
{
QByteArray msgBA = m_console;
msgBA += ": ";
msgBA += m_message;
return QString::fromUtf8(msgBA);
}
// -------------- TcfTrkIdEvent // -------------- TcfTrkIdEvent
TcfTrkIdEvent::TcfTrkIdEvent(Type t, const QByteArray &id) : TcfTrkIdEvent::TcfTrkIdEvent(Type t, const QByteArray &id) :
TcfTrkEvent(t), m_id(id) TcfTrkEvent(t), m_id(id)

View File

@@ -53,6 +53,7 @@ enum Services {
BreakpointsService, BreakpointsService,
RegistersService, RegistersService,
SimpleRegistersService, // non-standard, trk specific SimpleRegistersService, // non-standard, trk specific
LoggingService, // non-standard, trk specific
UnknownService UnknownService
}; // Note: Check string array 'serviceNamesC' of same size when modifying this. }; // Note: Check string array 'serviceNamesC' of same size when modifying this.
@@ -160,7 +161,8 @@ public:
RunControlSuspended, RunControlSuspended,
RunControlBreakpointSuspended, RunControlBreakpointSuspended,
RunControlModuleLoadSuspended, RunControlModuleLoadSuspended,
RunControlResumed RunControlResumed,
LoggingWriteEvent // Non-standard
}; };
virtual ~TcfTrkEvent(); virtual ~TcfTrkEvent();
@@ -189,6 +191,21 @@ private:
QStringList m_services; QStringList m_services;
}; };
// Logging event (non-standard, trk specific)
class SYMBIANUTILS_EXPORT TcfTrkLoggingWriteEvent : public TcfTrkEvent {
public:
explicit TcfTrkLoggingWriteEvent(const QByteArray &console, const QByteArray &message);
QByteArray message() const { return m_message; }
QByteArray console() const { return m_console; }
virtual QString toString() const;
private:
const QByteArray m_console;
const QByteArray m_message;
};
// Base for events that just have one id as parameter // Base for events that just have one id as parameter
// (simple suspend) // (simple suspend)
class SYMBIANUTILS_EXPORT TcfTrkIdEvent : public TcfTrkEvent { class SYMBIANUTILS_EXPORT TcfTrkIdEvent : public TcfTrkEvent {