[PATCH] D18207: [llvm-objdump] Add '0x' prefix to a target displacement number to accent its hex format
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 16 04:14:51 PDT 2016
atanasyan created this revision.
atanasyan added a reviewer: rafael.
atanasyan added a subscriber: llvm-commits.
atanasyan set the repository for this revision to rL LLVM.
It might be hard to recognize a hexadecimal number without '0x' prefix. Besides that '0x' prefix corresponds to GNU objdump behaviour.
Repository:
rL LLVM
http://reviews.llvm.org/D18207
Files:
test/tools/llvm-objdump/hex-displacement.test
tools/llvm-objdump/llvm-objdump.cpp
Index: tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- tools/llvm-objdump/llvm-objdump.cpp
+++ tools/llvm-objdump/llvm-objdump.cpp
@@ -1142,7 +1142,7 @@
outs() << " <" << TargetName;
uint64_t Disp = Target - TargetAddress;
if (Disp)
- outs() << '+' << utohexstr(Disp);
+ outs() << "+0x" << utohexstr(Disp);
outs() << '>';
}
}
Index: test/tools/llvm-objdump/hex-displacement.test
===================================================================
--- /dev/null
+++ test/tools/llvm-objdump/hex-displacement.test
@@ -0,0 +1,10 @@
+# Check that target displacement has '0x' prefix
+# to accent hex format of the number.
+
+# RUN: llvm-objdump -d %p/Inputs/export.dll.coff-i386 | FileCheck %s
+
+# CHECK: exportfn2:
+# CHECK-NEXT: 10002010: 50 pushl %eax
+# CHECK-NEXT: 10002011: e8 00 00 00 00 calll 0 <exportfn2+0x6>
+# CHECK-NEXT: 10002016: 50 pushl %eax
+# CHECK-NEXT: 10002017: e8 00 00 00 00 calll 0 <exportfn2+0xC>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18207.50815.patch
Type: text/x-patch
Size: 1173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160316/d70cd2bb/attachment.bin>
More information about the llvm-commits
mailing list