aboutsummaryrefslogtreecommitdiff
path: root/test/aarch64
diff options
context:
space:
mode:
authorJacob Bramley <jacob.bramley@arm.com>2017-06-22 11:47:39 +0100
committerJacob Bramley <jacob.bramley@arm.com>2017-06-26 11:09:02 +0100
commitea6eb28675beac69ad71475524e7d49a8a2f2ce8 (patch)
treecfd88991326861992d08f09eec00090d0e772601 /test/aarch64
parentd817e1ed50e3c8d6bea1714ebc56cdebb076373a (diff)
downloadvixl-ea6eb28675beac69ad71475524e7d49a8a2f2ce8.tar.gz
Print the instruction address when disassembling.
I've found that most of the time that I use --disassemble, I want to know the instruction addresses (especially since our disassembly for things like branches includes calculated addresses). The rest of the time, it's easy to ignore. Change-Id: I4b233da077492786adbe89439e319b13f02b48d9
Diffstat (limited to 'test/aarch64')
-rw-r--r--test/aarch64/test-assembler-aarch64.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/aarch64/test-assembler-aarch64.cc b/test/aarch64/test-assembler-aarch64.cc
index 71e09e14..f365dd25 100644
--- a/test/aarch64/test-assembler-aarch64.cc
+++ b/test/aarch64/test-assembler-aarch64.cc
@@ -255,8 +255,13 @@ namespace aarch64 {
masm.GetBuffer()->GetOffsetAddress<Instruction*>(end_offset); \
while (instruction != end) { \
disassembler_decoder.Decode(instruction); \
- uint32_t encoding = *reinterpret_cast<uint32_t*>(instruction); \
- printf("%08" PRIx32 "\t%s\n", encoding, disasm.GetOutput()); \
+ uint32_t encoding; \
+ memcpy(&encoding, instruction, sizeof(encoding)); \
+ uint64_t address = reinterpret_cast<uintptr_t>(instruction); \
+ printf(" %016" PRIx64 ":\t%08" PRIx32 "\t%s\n", \
+ address, \
+ encoding, \
+ disasm.GetOutput()); \
instruction += kInstructionSize; \
} \
}