[PATCH] D57151: [llvm-symbolizer] Add switch to adjust addresses by fixed offset
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 25 03:49:30 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352195: [llvm-symbolizer] Add switch to adjust addresses by fixed offset (authored by jhenderson, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D57151?vs=183304&id=183512#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57151/new/
https://reviews.llvm.org/D57151
Files:
llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
llvm/trunk/test/tools/llvm-symbolizer/adjust-vma.s
llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
Index: llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
===================================================================
--- llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -134,6 +134,11 @@
static cl::opt<bool> ClVerbose("verbose", cl::init(false),
cl::desc("Print verbose line info"));
+// -adjust-vma
+static cl::opt<unsigned long long>
+ ClAdjustVMA("adjust-vma", cl::init(0), cl::value_desc("offset"),
+ cl::desc("Add specified offset to object file addresses"));
+
static cl::list<std::string> ClInputAddresses(cl::Positional,
cl::desc("<input addresses>..."),
cl::ZeroOrMore);
@@ -201,6 +206,7 @@
StringRef Delimiter = ClPrettyPrint ? ": " : "\n";
outs() << Delimiter;
}
+ ModuleOffset -= ClAdjustVMA;
if (IsData) {
auto ResOrErr = Symbolizer.symbolizeData(ModuleName, ModuleOffset);
Printer << (error(ResOrErr) ? DIGlobal() : ResOrErr.get());
Index: llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
===================================================================
--- llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
+++ llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
@@ -123,6 +123,12 @@
Strip directories when printing the file path.
+.. option:: -adjust-vma=<offset>
+
+ Add the specified offset to object file addresses when performing lookups. This
+ can be used to simplify lookups when the object is not loaded at a dynamically
+ relocated address.
+
EXIT STATUS
-----------
Index: llvm/trunk/test/tools/llvm-symbolizer/adjust-vma.s
===================================================================
--- llvm/trunk/test/tools/llvm-symbolizer/adjust-vma.s
+++ llvm/trunk/test/tools/llvm-symbolizer/adjust-vma.s
@@ -0,0 +1,39 @@
+# REQUIRES: x86-registered-target
+
+.type foo, at function
+.size foo,12
+foo:
+ .space 10
+ nop
+ nop
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -g
+
+# RUN: llvm-symbolizer 0xa 0xb --print-address --obj=%t.o \
+# RUN: | FileCheck %s --check-prefix=NORMAL
+# RUN: llvm-symbolizer 0x10a 0x10b --print-address --adjust-vma 0x100 --obj=%t.o \
+# RUN: | FileCheck %s --check-prefix=ADJUST
+
+# Show that we can handle addresses less than the offset.
+# RUN: llvm-symbolizer 0xa 0xb --print-address --adjust-vma 0xc --obj=%t.o \
+# RUN: | FileCheck %s --check-prefix=OVERFLOW
+
+# NORMAL: 0xa
+# NORMAL-NEXT: foo
+# NORMAL-NEXT: adjust-vma.s:7:0
+# NORMAL-EMPTY:
+# NORMAL-NEXT: 0xb
+# NORMAL-NEXT: foo
+# NORMAL-NEXT: adjust-vma.s:8:0
+
+# ADJUST: 0x10a
+# ADJUST-NEXT: foo
+# ADJUST-NEXT: adjust-vma.s:7:0
+# ADJUST-EMPTY:
+# ADJUST-NEXT: 0x10b
+# ADJUST-NEXT: foo
+# ADJUST-NEXT: adjust-vma.s:8:0
+
+# OVERFLOW: 0xa
+# OVERFLOW-NEXT: ??
+# OVERFLOW-NEXT: ??
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57151.183512.patch
Type: text/x-patch
Size: 2915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190125/d6437482/attachment.bin>
More information about the llvm-commits
mailing list