[PATCH] D13518: Add -address option to symbolizer
khemant@codeaurora.org via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 12 12:28:39 PDT 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL250086: [llvm-symbolizer] Add -print-address option (authored by khemant).
Changed prior to commit:
http://reviews.llvm.org/D13518?vs=36980&id=37144#toc
Repository:
rL LLVM
http://reviews.llvm.org/D13518
Files:
llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
llvm/trunk/test/tools/llvm-symbolizer/Inputs/addr.exe
llvm/trunk/test/tools/llvm-symbolizer/Inputs/addr.inp
llvm/trunk/test/tools/llvm-symbolizer/sym.test
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
@@ -73,6 +73,9 @@
ClDsymHint("dsym-hint", cl::ZeroOrMore,
cl::desc("Path to .dSYM bundles to search for debug info for the "
"object files"));
+static cl::opt<bool>
+ ClPrintAddress("print-address", cl::init(false),
+ cl::desc("Show address before line information"));
static bool parseCommand(bool &IsData, std::string &ModuleName,
uint64_t &ModuleOffset) {
@@ -152,6 +155,11 @@
std::string Result =
IsData ? Symbolizer.symbolizeData(ModuleName, ModuleOffset)
: Symbolizer.symbolizeCode(ModuleName, ModuleOffset);
+ if (ClPrintAddress) {
+ outs() << "0x";
+ outs().write_hex(ModuleOffset);
+ outs() << "\n";
+ }
outs() << Result << "\n";
outs().flush();
}
Index: llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
===================================================================
--- llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
+++ llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
@@ -98,6 +98,8 @@
location, look for the debug info at the .dSYM path provided via the
``-dsym-hint`` flag. This flag can be used multiple times.
+.. option:: -print-address
+ Print address before the source code location. Defaults to false.
EXIT STATUS
-----------
Index: llvm/trunk/test/tools/llvm-symbolizer/sym.test
===================================================================
--- llvm/trunk/test/tools/llvm-symbolizer/sym.test
+++ llvm/trunk/test/tools/llvm-symbolizer/sym.test
@@ -0,0 +1,19 @@
+#Source:
+##include <stdio.h>
+#static inline int inc (int *a) {
+# printf ("%d\n",(*a)++);
+# return (*a)++;
+#}
+#
+#int main () {
+# int x = 1;
+# return inc(&x);
+#}
+#Build as : clang -g -O2 addr.c
+
+RUN: llvm-symbolizer -inlining -print-address -obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck %s
+
+#CHECK: 0x40054d
+#CHECK: main
+#CHECK: {{[/\]+}}tmp{{[/\]+}}x.c:9:0
+
Index: llvm/trunk/test/tools/llvm-symbolizer/Inputs/addr.inp
===================================================================
--- llvm/trunk/test/tools/llvm-symbolizer/Inputs/addr.inp
+++ llvm/trunk/test/tools/llvm-symbolizer/Inputs/addr.inp
@@ -0,0 +1 @@
+0x40054d
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13518.37144.patch
Type: text/x-patch
Size: 2454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151012/1555ed10/attachment.bin>
More information about the llvm-commits
mailing list