[llvm] r351356 - [llvm-readobj] Set correct offset when dumping hex section output.
Sid Manning via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 16 08:17:19 PST 2019
Author: sidneym
Date: Wed Jan 16 08:17:19 2019
New Revision: 351356
URL: http://llvm.org/viewvc/llvm-project?rev=351356&view=rev
Log:
[llvm-readobj] Set correct offset when dumping hex section output.
Differential Revision: https://reviews.llvm.org/D56369
Added:
llvm/trunk/test/tools/llvm-readobj/hexdump.test
Modified:
llvm/trunk/tools/llvm-readobj/ObjDumper.cpp
Added: llvm/trunk/test/tools/llvm-readobj/hexdump.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/hexdump.test?rev=351356&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/hexdump.test (added)
+++ llvm/trunk/test/tools/llvm-readobj/hexdump.test Wed Jan 16 08:17:19 2019
@@ -0,0 +1,5 @@
+// Check dumping of the hexadecimal bytes of a section.
+RUN: llvm-readobj -x .text %p/../../Object/Inputs/hello-world.elf-x86-64 | FileCheck %s
+
+CHECK: Hex dump of section '.text':
+CHECK-NEXT: {{^}}0x00400460
Modified: llvm/trunk/tools/llvm-readobj/ObjDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ObjDumper.cpp?rev=351356&r1=351355&r2=351356&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ObjDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ObjDumper.cpp Wed Jan 16 08:17:19 2019
@@ -117,7 +117,8 @@ void ObjDumper::printSectionAsHex(const
uint8_t i;
uint8_t k;
- W.startLine() << format_hex(SecPtr - SecContent, 10);
+ W.startLine() << format_hex(Section.getAddress() + (SecPtr - SecContent),
+ 10);
W.startLine() << ' ';
for (i = 0; TmpSecPtr < SecEnd && i < 4; ++i) {
for (k = 0; TmpSecPtr < SecEnd && k < 4; k++, TmpSecPtr++) {
More information about the llvm-commits
mailing list