Commit b2694a33 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

TCF TRK: Added support for Console Logging event.

parent 7986c44d
......@@ -270,6 +270,7 @@ void TcfTrkGdbAdapter::tcftrkEvent(const tcftrk::TcfTrkEvent &e)
switch (e.type()) {
case tcftrk::TcfTrkEvent::LocatorHello:
m_trkDevice->sendLoggingAddListenerCommand(TcfTrkCallback());
startGdb(); // Commands are only accepted after hello
break;
case tcftrk::TcfTrkEvent::RunControlModuleLoadSuspended: // A module was loaded
......@@ -311,6 +312,9 @@ void TcfTrkGdbAdapter::tcftrkEvent(const tcftrk::TcfTrkEvent &e)
Symbian::RegisterCount);
}
break;
case tcftrk::TcfTrkEvent::LoggingWriteEvent: // TODO: Not tested yet.
showMessage(e.toString(), AppOutput);
break;
default:
break;
}
......
......@@ -914,4 +914,15 @@ void TcfTrkDevice::sendRegistersSetCommand(const TcfTrkCallback &callBack,
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
......@@ -249,6 +249,9 @@ public:
unsigned value,
const QVariant &cookie = QVariant());
void sendLoggingAddListenerCommand(const TcfTrkCallback &callBack,
const QVariant &cookie = QVariant());
static QByteArray parseMemoryGet(const TcfTrkCommandResult &r);
signals:
......
......@@ -36,7 +36,7 @@
// Names matching the enum
static const char *serviceNamesC[] =
{ "Locator", "RunControl", "Processes", "Memory", "Settings", "Breakpoints",
"Registers", "SimpleRegisters",
"Registers", "SimpleRegisters", "Logging",
"UnknownService"};
namespace tcftrk {
......@@ -401,6 +401,10 @@ TcfTrkEvent *TcfTrkEvent::parseEvent(Services s, const QByteArray &nameBA, const
return new TcfTrkRunControlContextRemovedEvent(ids);
}
break;
case LoggingService:
if (nameBA == "write" && values.size() >= 2)
return new TcfTrkLoggingWriteEvent(values.at(0).data(), values.at(1).data());
break;
default:
break;
}
......@@ -419,6 +423,21 @@ QString TcfTrkLocatorHelloEvent::toString() const
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(Type t, const QByteArray &id) :
TcfTrkEvent(t), m_id(id)
......
......@@ -53,6 +53,7 @@ enum Services {
BreakpointsService,
RegistersService,
SimpleRegistersService, // non-standard, trk specific
LoggingService, // non-standard, trk specific
UnknownService
}; // Note: Check string array 'serviceNamesC' of same size when modifying this.
......@@ -160,7 +161,8 @@ public:
RunControlSuspended,
RunControlBreakpointSuspended,
RunControlModuleLoadSuspended,
RunControlResumed
RunControlResumed,
LoggingWriteEvent // Non-standard
};
virtual ~TcfTrkEvent();
......@@ -189,6 +191,21 @@ private:
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
// (simple suspend)
class SYMBIANUTILS_EXPORT TcfTrkIdEvent : public TcfTrkEvent {
......
Supports Markdown
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