summaryrefslogtreecommitdiff
path: root/tools/runonphone/symbianutils/tcftrkmessage.h
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-07-08 13:40:29 +0200
committerShane Kearns <shane.kearns@accenture.com>2010-07-08 13:40:29 +0200
commit627d62c17b29cf5a99252aeff965b4f848d4d171 (patch)
treecd855b8dffcb48a40a776598da491090f55d33a7 /tools/runonphone/symbianutils/tcftrkmessage.h
parent4f8ec542b123399574d2e509fa99f4bd66a34e25 (diff)
downloadqt4-tools-627d62c17b29cf5a99252aeff965b4f848d4d171.tar.gz
Merge tools/runonphone/symbianutils from qtcreator src/shared/symbianutils
commit bca434a706c6eb28fe713ea10c857c35e3835f62 Author: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Wed Jul 7 14:00:54 2010 +0200 Trk/Launcher: Add infrastructure for reporting crashes. currently used for runonphone only. Initial-patch-by: Shane Kearns <shane.kearns@accenture.com> commit 9bb67101c5daa42f879f2fcf884277c5fd23bed4 Author: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Mon Jul 5 17:14:45 2010 +0200 Trk[TCF]: Proper exit handling commit 52b33a7503866654077b572c1f8005dfc19ed5a6 Author: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Wed Jun 30 17:14:57 2010 +0200 Debugger[Trk]: Prepare thread handling. Store threads and cache registers per thread in Snapshot. As Trk does not generate Thread creation/deletion events. try to add threads on the fly if a stop in a new thread id is reported. Remove them in continue. Continue all threads in classic Trk. Pass on state (crash reason) to ThreadData and model. Factor out common code of both adapters to Snapshot/Symbian classes. commit 66e01e881d7cb865338a6a7949f9a085883387c9 Author: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Mon Jun 28 16:32:53 2010 +0200 Debugger[TCF-Trk]: Send RemoveExecutables command. commit beba423a16fd0e6e836cd8c26ca30e5167ca56db Author: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Fri Jun 25 15:06:30 2010 +0200 Debugger[Trk]: Added TCF experimental adapter. Added adapter to work with TCF over WLAN. Factor out common code for Symbian from TrkAdapter. Improve message logging in TrkGdbAdapter, some cleanup. Added new TcfTrkGdbAdapter based on TcfTrkDevice in symbianutils based on JSON, using QTcpSocket. To be started via special @tcf@ argument. Rubber-stamped-by: hjk create mode 100644 src/shared/symbianutils/json.cpp create mode 100644 src/shared/symbianutils/json.h create mode 100644 src/shared/symbianutils/tcftrkdevice.cpp create mode 100644 src/shared/symbianutils/tcftrkdevice.h create mode 100644 src/shared/symbianutils/tcftrkmessage.cpp create mode 100644 src/shared/symbianutils/tcftrkmessage.h commit 5d5f647f3d9b7a28c605af41a23819b7a24a5814 Author: Tobias Hunger <tobias.hunger@nokia.com> Date: Thu Jun 10 13:12:12 2010 +0200 Fix preprocessor directives * The standard says all preprocessor directives have to start at column 0. commit 6972715a397e8e9a495191a459dcf6db4b75f7a7 Author: Robert Loehning <robert.loehning@nokia.com> Date: Mon Jun 7 14:58:24 2010 +0200 Symbian/trk: Fixed handling of partial frames Initial-patch-by: Shane Kearns <shane.kearns@accenture.com> commit a47e06eec946dd2dbb986e614a3c292b91182b95 Author: Robert Loehning <robert.loehning@nokia.com> Date: Mon Jun 7 14:47:40 2010 +0200 Symbian/trk: Don't try to dereference references commit b6ee94fb5ff652ba22b272a064c2be541b4bcf56 Author: Robert Loehning <robert.loehning@nokia.com> Date: Mon Jun 7 11:50:38 2010 +0200 Symbian/Trk: Don't try to download a file without respective flag set. Task-number: QTCREATORBUG-1567 Reviewed-by: Friedemann Kleint
Diffstat (limited to 'tools/runonphone/symbianutils/tcftrkmessage.h')
-rw-r--r--tools/runonphone/symbianutils/tcftrkmessage.h284
1 files changed, 284 insertions, 0 deletions
diff --git a/tools/runonphone/symbianutils/tcftrkmessage.h b/tools/runonphone/symbianutils/tcftrkmessage.h
new file mode 100644
index 0000000000..8b073c8ab4
--- /dev/null
+++ b/tools/runonphone/symbianutils/tcftrkmessage.h
@@ -0,0 +1,284 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef TRCFTRKMESSAGE_H
+#define TRCFTRKMESSAGE_H
+
+#include "symbianutils_global.h"
+
+#include <QtCore/QStringList>
+#include <QtCore/QVector>
+
+QT_BEGIN_NAMESPACE
+class QTextStream;
+QT_END_NAMESPACE
+
+namespace tcftrk {
+
+class JsonValue;
+class JsonInputStream;
+
+enum Services {
+ LocatorService,
+ RunControlService,
+ ProcessesService,
+ MemoryService,
+ SettingsService, // non-standard, trk specific
+ BreakpointsService,
+ RegistersService,
+ SimpleRegistersService, // non-standard, trk specific
+ UnknownService
+}; // Note: Check string array 'serviceNamesC' of same size when modifying this.
+
+// Modes of RunControl/'Resume' (see EDF documentation).
+// As of 24.6.2010, RM_RESUME, RM_STEP_OVER, RM_STEP_INTO,
+// RM_STEP_OVER_RANGE, RM_STEP_INTO_RANGE are supported with
+// RANG_START/RANGE_END parameters.
+enum RunControlResumeMode {
+ RM_RESUME = 0,
+ RM_STEP_OVER = 1, RM_STEP_INTO = 2,
+ RM_STEP_OVER_LINE = 3, RM_STEP_INTO_LINE = 4,
+ RM_STEP_OUT = 5, RM_REVERSE_RESUME = 6,
+ RM_REVERSE_STEP_OVER = 7, RM_REVERSE_STEP_INTO = 8,
+ RM_REVERSE_STEP_OVER_LINE = 9, RM_REVERSE_STEP_INTO_LINE = 10,
+ RM_REVERSE_STEP_OUT = 11, RM_STEP_OVER_RANGE = 12,
+ RM_STEP_INTO_RANGE = 13, RM_REVERSE_STEP_OVER_RANGE = 14,
+ RM_REVERSE_STEP_INTO_RANGE = 15
+};
+
+SYMBIANUTILS_EXPORT const char *serviceName(Services s);
+SYMBIANUTILS_EXPORT Services serviceFromName(const char *);
+
+// Debug helpers
+SYMBIANUTILS_EXPORT QString formatData(const QByteArray &a);
+SYMBIANUTILS_EXPORT QString joinByteArrays(const QVector<QByteArray> &a, char sep = ',');
+
+// Context used in 'RunControl contextAdded' events and in reply
+// to 'Processes start'. Could be thread or process.
+struct SYMBIANUTILS_EXPORT RunControlContext {
+ enum Flags {
+ Container = 0x1, HasState = 0x2, CanSuspend = 0x4,
+ CanTerminate = 0x8
+ };
+ enum Type { Process, Thread };
+
+ RunControlContext();
+ Type type() const;
+ unsigned processId() const;
+ unsigned threadId() const;
+
+ void clear();
+ bool parse(const JsonValue &v);
+ void format(QTextStream &str) const;
+ QString toString() const;
+
+ // Helper for converting the TCF ids ("p12" or "p12.t34")
+ static Type typeFromTcfId(const QByteArray &id);
+ static unsigned processIdFromTcdfId(const QByteArray &id);
+ static unsigned threadIdFromTcdfId(const QByteArray &id);
+ static QByteArray tcfId(unsigned processId, unsigned threadId = 0);
+
+ unsigned flags;
+ unsigned resumeFlags;
+ QByteArray id; // "p434.t699"
+ QByteArray osid; // Non-standard: Process or thread id
+ QByteArray parentId; // Parent process id of a thread.
+};
+
+// Module load information occuring with 'RunControl contextSuspended' events
+struct SYMBIANUTILS_EXPORT ModuleLoadEventInfo {
+ ModuleLoadEventInfo();
+ void clear();
+ bool parse(const JsonValue &v);
+ void format(QTextStream &str) const;
+
+ QByteArray name;
+ QByteArray file;
+ bool loaded;
+ quint64 codeAddress;
+ quint64 dataAddress;
+ bool requireResume;
+};
+
+// Breakpoint as supported by TcfTrk source June 2010
+// TODO: Add watchpoints,etc once they are implemented
+struct SYMBIANUTILS_EXPORT Breakpoint {
+ enum Type { Software, Hardware, Auto };
+
+ explicit Breakpoint(quint64 loc = 0);
+ void setContextId(unsigned processId, unsigned threadId = 0);
+ QString toString() const;
+
+ static QByteArray idFromLocation(quint64 loc); // Automagically determine from location
+
+ Type type;
+ bool enabled;
+ int ignoreCount;
+ QVector<QByteArray> contextIds; // Process or thread ids.
+ QByteArray id; // Id of the breakpoint;
+ quint64 location;
+ unsigned size;
+ bool thumb;
+};
+
+SYMBIANUTILS_EXPORT JsonInputStream &operator<<(JsonInputStream &str, const Breakpoint &b);
+
+// Event hierarchy
+class SYMBIANUTILS_EXPORT TcfTrkEvent {
+ Q_DISABLE_COPY(TcfTrkEvent)
+public:
+ enum Type { None,
+ LocatorHello,
+ RunControlContextAdded,
+ RunControlContextRemoved,
+ RunControlSuspended,
+ RunControlBreakpointSuspended,
+ RunControlModuleLoadSuspended,
+ RunControlResumed
+ };
+
+ virtual ~TcfTrkEvent();
+
+ Type type() const;
+ virtual QString toString() const;
+
+ static TcfTrkEvent *parseEvent(Services s, const QByteArray &name, const QVector<JsonValue> &val);
+
+protected:
+ explicit TcfTrkEvent(Type type = None);
+
+private:
+ const Type m_type;
+};
+
+// ServiceHello
+class SYMBIANUTILS_EXPORT TcfTrkLocatorHelloEvent : public TcfTrkEvent {
+public:
+ explicit TcfTrkLocatorHelloEvent(const QStringList &);
+
+ const QStringList &services() { return m_services; }
+ virtual QString toString() const;
+
+private:
+ QStringList m_services;
+};
+
+// Base for events that just have one id as parameter
+// (simple suspend)
+class SYMBIANUTILS_EXPORT TcfTrkIdEvent : public TcfTrkEvent {
+protected:
+ explicit TcfTrkIdEvent(Type t, const QByteArray &id);
+public:
+ QByteArray id() const { return m_id; }
+ QString idString() const { return QString::fromUtf8(m_id); }
+
+private:
+ const QByteArray m_id;
+};
+
+// Base for events that just have some ids as parameter
+// (context removed)
+class SYMBIANUTILS_EXPORT TcfTrkIdsEvent : public TcfTrkEvent {
+protected:
+ explicit TcfTrkIdsEvent(Type t, const QVector<QByteArray> &ids);
+
+public:
+ QVector<QByteArray> ids() const { return m_ids; }
+ QString joinedIdString(const char sep = ',') const;
+
+private:
+ const QVector<QByteArray> m_ids;
+};
+
+// RunControlContextAdded
+class SYMBIANUTILS_EXPORT TcfTrkRunControlContextAddedEvent : public TcfTrkEvent {
+public:
+ typedef QVector<RunControlContext> RunControlContexts;
+
+ explicit TcfTrkRunControlContextAddedEvent(const RunControlContexts &c);
+
+ const RunControlContexts &contexts() const { return m_contexts; }
+ virtual QString toString() const;
+
+ static TcfTrkRunControlContextAddedEvent *parseEvent(const QVector<JsonValue> &val);
+
+private:
+ const RunControlContexts m_contexts;
+};
+
+// RunControlContextRemoved
+class SYMBIANUTILS_EXPORT TcfTrkRunControlContextRemovedEvent : public TcfTrkIdsEvent {
+public:
+ explicit TcfTrkRunControlContextRemovedEvent(const QVector<QByteArray> &id);
+ virtual QString toString() const;
+};
+
+// Simple RunControlContextSuspended (process/thread)
+class SYMBIANUTILS_EXPORT TcfTrkRunControlContextSuspendedEvent : public TcfTrkIdEvent {
+public:
+ enum Reason { BreakPoint, ModuleLoad, Crash, Other } ;
+
+ explicit TcfTrkRunControlContextSuspendedEvent(const QByteArray &id,
+ const QByteArray &reason,
+ quint64 pc = 0);
+ virtual QString toString() const;
+
+ quint64 pc() const { return m_pc; }
+ QByteArray reasonID() const { return m_reason; }
+ Reason reason() const;
+
+protected:
+ explicit TcfTrkRunControlContextSuspendedEvent(Type t,
+ const QByteArray &id,
+ const QByteArray &reason,
+ quint64 pc = 0);
+ void format(QTextStream &str) const;
+
+private:
+ const quint64 m_pc;
+ const QByteArray m_reason;
+};
+
+// RunControlContextSuspended due to module load
+class SYMBIANUTILS_EXPORT TcfTrkRunControlModuleLoadContextSuspendedEvent : public TcfTrkRunControlContextSuspendedEvent {
+public:
+ explicit TcfTrkRunControlModuleLoadContextSuspendedEvent(const QByteArray &id,
+ const QByteArray &reason,
+ quint64 pc,
+ const ModuleLoadEventInfo &mi);
+
+ virtual QString toString() const;
+ const ModuleLoadEventInfo &info() const { return m_mi; }
+
+private:
+ const ModuleLoadEventInfo m_mi;
+};
+
+} // namespace tcftrk
+#endif // TRCFTRKMESSAGE_H