llvm.org GIT mirror llvm / 6bd0713
[llvm-symbolizer] Add -print-address option Differential Revision http://reviews.llvm.org/D13518 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250067 91177308-0d34-0410-b5e6-96231b3b80d8 Hemant Kulkarni 4 years ago
4 changed file(s) with 30 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
9797 location, look for the debug info at the .dSYM path provided via the
9898 ``-dsym-hint`` flag. This flag can be used multiple times.
9999
100 .. option:: -print-address
101 Print address before the source code location. Defaults to false.
100102
101103 EXIT STATUS
102104 -----------
0 #Source:
1 ##include
2 #static inline int inc (int *a) {
3 # printf ("%d\n",(*a)++);
4 # return (*a)++;
5 #}
6 #
7 #int main () {
8 # int x = 1;
9 # return inc(&x);
10 #}
11 #Build as : clang -g -O2 addr.c
12
13 RUN: llvm-symbolizer -inlining -print-address -obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck %s
14
15 #CHECK: 0x40054d
16 #CHECK: main
17 #CHECK: {{[/\]+}}tmp{{[/\]+}}x.c:9:0
18
7272 ClDsymHint("dsym-hint", cl::ZeroOrMore,
7373 cl::desc("Path to .dSYM bundles to search for debug info for the "
7474 "object files"));
75 static cl::opt
76 ClPrintAddress("print-address", cl::init(false),
77 cl::desc("Show address before line information"));
7578
7679 static bool parseCommand(bool &IsData, std::string &ModuleName,
7780 uint64_t &ModuleOffset) {
151154 std::string Result =
152155 IsData ? Symbolizer.symbolizeData(ModuleName, ModuleOffset)
153156 : Symbolizer.symbolizeCode(ModuleName, ModuleOffset);
157 if (ClPrintAddress) {
158 outs() << "0x";
159 outs().write_hex(ModuleOffset);
160 outs() << "\n";
161 }
154162 outs() << Result << "\n";
155163 outs().flush();
156164 }