mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-19 08:24:12 +00:00
[llvm-symbolizer] Add -print-address option
Differential Revision: http://reviews.llvm.org/D13518 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250086 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2fef79ea96
commit
e8d28f3d7a
@ -98,6 +98,8 @@ OPTIONS
|
||||
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
|
||||
-----------
|
||||
|
BIN
test/tools/llvm-symbolizer/Inputs/addr.exe
Executable file
BIN
test/tools/llvm-symbolizer/Inputs/addr.exe
Executable file
Binary file not shown.
1
test/tools/llvm-symbolizer/Inputs/addr.inp
Normal file
1
test/tools/llvm-symbolizer/Inputs/addr.inp
Normal file
@ -0,0 +1 @@
|
||||
0x40054d
|
19
test/tools/llvm-symbolizer/sym.test
Normal file
19
test/tools/llvm-symbolizer/sym.test
Normal file
@ -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
|
||||
|
@ -73,6 +73,9 @@ static cl::list<std::string>
|
||||
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 @@ int main(int argc, char **argv) {
|
||||
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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user