aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4instr_moth.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-30 15:32:27 +0200
committerLars Knoll <lars.knoll@qt.io>2017-09-01 12:30:34 +0000
commit20596907289d50be3a5e1597ba62cefb733e6f19 (patch)
tree47fb30f65337beb0a5926c75b7e95436b6d886f9 /src/qml/compiler/qv4instr_moth.cpp
parent50828bc6ed9112956170a68dffe72431a21fddd9 (diff)
Add dumping of the raw hex values to the bytecode dumper
Change-Id: I1ddc179fb19983d079872bd59a48e83de7af8494 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4instr_moth.cpp')
-rw-r--r--src/qml/compiler/qv4instr_moth.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/qml/compiler/qv4instr_moth.cpp b/src/qml/compiler/qv4instr_moth.cpp
index c51f604500..940c49c83a 100644
--- a/src/qml/compiler/qv4instr_moth.cpp
+++ b/src/qml/compiler/qv4instr_moth.cpp
@@ -55,7 +55,7 @@ int Instr::size(Type type)
static QByteArray alignedNumber(int n) {
QByteArray number = QByteArray::number(n);
- while (number.size() < 12)
+ while (number.size() < 8)
number.prepend(' ');
return number;
}
@@ -63,7 +63,23 @@ static QByteArray alignedNumber(int n) {
static QByteArray alignedLineNumber(int line) {
if (line > 0)
return alignedNumber(static_cast<int>(line));
- return QByteArray(" ");
+ return QByteArray(" ");
+}
+
+static QByteArray rawBytes(const char *data, int n)
+{
+ QByteArray ba;
+ while (n) {
+ uint num = *reinterpret_cast<const uchar *>(data);
+ if (num < 16)
+ ba += '0';
+ ba += QByteArray::number(num, 16) + " ";
+ ++data;
+ --n;
+ }
+ while (ba.size() < 25)
+ ba += ' ';
+ return ba;
}
static QString toString(QV4::ReturnedValue v)
@@ -90,11 +106,11 @@ static QString toString(QV4::ReturnedValue v)
#define MOTH_BEGIN_INSTR(instr) \
{ \
- INSTR_##instr(MOTH_DECODE) \
+ INSTR_##instr(MOTH_DECODE_WITH_BASE) \
QDebug d = qDebug(); \
d.noquote(); \
d.nospace(); \
- d << alignedLineNumber(line) << alignedNumber(codeOffset).constData() << ": " << #instr << " "; \
+ d << alignedLineNumber(line) << alignedNumber(codeOffset).constData() << ": " << rawBytes(base_ptr, code - base_ptr) << #instr << " "; \
#define MOTH_END_INSTR(instr) \
continue; \