diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index f5328c1158d..efec8c5df79 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -2248,6 +2248,7 @@ class DumperBase(): self.put('addrbase="0x%x",' % addrBase) self.put('addrstep="0x%x",' % innerSize) self.put('arrayencoding="%s",' % enc) + self.put('endian="%s",' % self.packCode) if n > maxNumChild: self.put('childrenelided="%s",' % n) # FIXME: Act on that in frontend n = maxNumChild diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp index c834e209a96..8a5c917391e 100644 --- a/src/plugins/debugger/watchdata.cpp +++ b/src/plugins/debugger/watchdata.cpp @@ -11,6 +11,7 @@ #include "debuggertr.h" #include +#include namespace Debugger::Internal { @@ -208,6 +209,8 @@ QString decodeItemHelper(const double &t) return QString::number(t, 'g', 16); } +enum class Endian { Little, Big }; + class ArrayDataDecoder { public: @@ -219,7 +222,8 @@ public: for (int i = 0, n = int(ba.size() / sizeof(T)); i < n; ++i) { auto child = new WatchItem; child->arrayIndex = i; - child->value = decodeItemHelper(p[i]); + child->value = decodeItemHelper(endian == Endian::Big ? qFromBigEndian(p[i]) + : qFromLittleEndian(p[i])); child->size = childSize; child->type = childType; child->address = addrbase + i * addrstep; @@ -276,6 +280,7 @@ public: DebuggerEncoding encoding; quint64 addrbase; quint64 addrstep; + Endian endian; }; static bool sortByName(const WatchItem *a, const WatchItem *b) @@ -390,6 +395,7 @@ void WatchItem::parseHelper(const GdbMi &input, bool maySort) decoder.childType = input["childtype"].data(); decoder.addrbase = input["addrbase"].toAddress(); decoder.addrstep = input["addrstep"].toAddress(); + decoder.endian = input["endian"].data() == ">" ? Endian::Big : Endian::Little; decoder.encoding = DebuggerEncoding(input["arrayencoding"].data()); decoder.decode(); } else {