blob: 9d6571d5c4c2a954c6dfb7b4adcad347670d4b2c [file] [log] [blame]
Alexey Samsonov2bc10122013-03-01 07:58:27 +00001llvm-symbolizer - convert addresses into source code locations
2==============================================================
3
4SYNOPSIS
5--------
6
7:program:`llvm-symbolizer` [options]
8
9DESCRIPTION
10-----------
11
12:program:`llvm-symbolizer` reads object file names and addresses from standard
Alexey Samsonov60e59e22013-12-24 19:33:22 +000013input and prints corresponding source code locations to standard output.
14If object file is specified in command line, :program:`llvm-symbolizer` reads
15only addresses from standard input. This
Alexey Samsonov2bc10122013-03-01 07:58:27 +000016program uses debug info sections and symbol table in the object files.
17
18EXAMPLE
19--------
20
21.. code-block:: console
22
23 $ cat addr.txt
24 a.out 0x4004f4
25 /tmp/b.out 0x400528
26 /tmp/c.so 0x710
Alexey Samsonov2ca65362013-06-28 08:15:40 +000027 /tmp/mach_universal_binary:i386 0x1f84
28 /tmp/mach_universal_binary:x86_64 0x100000f24
Alexey Samsonov2bc10122013-03-01 07:58:27 +000029 $ llvm-symbolizer < addr.txt
30 main
31 /tmp/a.cc:4
32
33 f(int, int)
34 /tmp/b.cc:11
35
36 h_inlined_into_g
37 /tmp/header.h:2
38 g_inlined_into_f
39 /tmp/header.h:7
40 f_inlined_into_main
41 /tmp/source.cc:3
42 main
43 /tmp/source.cc:8
44
Alexey Samsonov2ca65362013-06-28 08:15:40 +000045 _main
46 /tmp/source_i386.cc:8
47
48 _main
49 /tmp/source_x86_64.cc:8
Alexey Samsonov60e59e22013-12-24 19:33:22 +000050 $ cat addr2.txt
51 0x4004f4
52 0x401000
53 $ llvm-symbolizer -obj=a.out < addr2.txt
54 main
55 /tmp/a.cc:4
56
57 foo(int)
58 /tmp/a.cc:12
Alexey Samsonov2ca65362013-06-28 08:15:40 +000059
Alexey Samsonov2bc10122013-03-01 07:58:27 +000060OPTIONS
61-------
62
Alexey Samsonov60e59e22013-12-24 19:33:22 +000063.. option:: -obj
Alexey Samsonovcd014722014-05-17 00:07:48 +000064
Alexey Samsonov60e59e22013-12-24 19:33:22 +000065 Path to object file to be symbolized.
66
Alexey Samsonovcd014722014-05-17 00:07:48 +000067.. option:: -functions=[none|short|linkage]
Alexey Samsonov2bc10122013-03-01 07:58:27 +000068
Alexey Samsonovcd014722014-05-17 00:07:48 +000069 Specify the way function names are printed (omit function name,
70 print short function name, or print full linkage name, respectively).
71 Defaults to ``linkage``.
Alexey Samsonov2bc10122013-03-01 07:58:27 +000072
73.. option:: -use-symbol-table
74
75 Prefer function names stored in symbol table to function names
76 in debug info sections. Defaults to true.
77
78.. option:: -demangle
79
80 Print demangled function names. Defaults to true.
81
82.. option:: -inlining
83
84 If a source code location is in an inlined function, prints all the
85 inlnied frames. Defaults to true.
86
Alexey Samsonov2ca65362013-06-28 08:15:40 +000087.. option:: -default-arch
88
89 If a binary contains object files for multiple architectures (e.g. it is a
90 Mach-O universal binary), symbolize the object file for a given architecture.
91 You can also specify architecture by writing ``binary_name:arch_name`` in the
92 input (see example above). If architecture is not specified in either way,
93 address will not be symbolized. Defaults to empty string.
94
Alexander Potapenko7aaf5142014-10-17 00:50:19 +000095.. option:: -dsym-hint=<path/to/file.dSYM>
96
97 (Darwin-only flag). If the debug info for a binary isn't present in the default
98 location, look for the debug info at the .dSYM path provided via the
99 ``-dsym-hint`` flag. This flag can be used multiple times.
100
Hemant Kulkarni80f82fb2015-10-12 19:26:44 +0000101.. option:: -print-address
102 Print address before the source code location. Defaults to false.
Alexander Potapenko7aaf5142014-10-17 00:50:19 +0000103
Alexey Samsonov2bc10122013-03-01 07:58:27 +0000104EXIT STATUS
105-----------
106
107:program:`llvm-symbolizer` returns 0. Other exit codes imply internal program error.