blob: b794f56246ff01098710f7d04015511a8ac382d6 [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.
Mike Aizatsky54a7c692016-01-07 23:57:41 +000014If object file is specified in command line, :program:`llvm-symbolizer`
15processes only addresses from standard input, the rest is output verbatim.
16This program uses debug info sections and symbol table in the object files.
Alexey Samsonov2bc10122013-03-01 07:58:27 +000017
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
Hemant Kulkarnibdce12a2015-11-11 20:41:43 +000059 $cat addr.txt
60 0x40054d
61 $llvm-symbolizer -inlining -print-address -pretty-print -obj=addr.exe < addr.txt
62 0x40054d: inc at /tmp/x.c:3:3
63 (inlined by) main at /tmp/x.c:9:0
64 $llvm-symbolizer -inlining -pretty-print -obj=addr.exe < addr.txt
65 inc at /tmp/x.c:3:3
66 (inlined by) main at /tmp/x.c:9:0
Alexey Samsonov2ca65362013-06-28 08:15:40 +000067
Alexey Samsonov2bc10122013-03-01 07:58:27 +000068OPTIONS
69-------
70
Dmitry Venikov37c1e2e2019-01-11 11:51:52 +000071.. option:: -obj, -exe, -e
Alexey Samsonovcd014722014-05-17 00:07:48 +000072
Alexey Samsonov60e59e22013-12-24 19:33:22 +000073 Path to object file to be symbolized.
74
James Henderson25ce5962019-01-23 17:27:48 +000075.. option:: -functions[=<none|short|linkage>], -f
Alexey Samsonov2bc10122013-03-01 07:58:27 +000076
Alexey Samsonovcd014722014-05-17 00:07:48 +000077 Specify the way function names are printed (omit function name,
78 print short function name, or print full linkage name, respectively).
79 Defaults to ``linkage``.
Alexey Samsonov2bc10122013-03-01 07:58:27 +000080
81.. option:: -use-symbol-table
82
83 Prefer function names stored in symbol table to function names
84 in debug info sections. Defaults to true.
85
Dmitry Venikovd3f21d32019-01-16 07:05:58 +000086.. option:: -demangle, -C
Alexey Samsonov2bc10122013-03-01 07:58:27 +000087
88 Print demangled function names. Defaults to true.
89
Dmitry Venikov119cf662019-01-21 10:00:57 +000090.. option:: -no-demangle
91
92 Don't print demangled function names.
93
Douglas Yung7876c0e2019-01-24 00:34:09 +000094.. option:: -inlining, -inlines, -i
Alexey Samsonov2bc10122013-03-01 07:58:27 +000095
96 If a source code location is in an inlined function, prints all the
97 inlnied frames. Defaults to true.
98
Alexey Samsonov2ca65362013-06-28 08:15:40 +000099.. option:: -default-arch
100
101 If a binary contains object files for multiple architectures (e.g. it is a
102 Mach-O universal binary), symbolize the object file for a given architecture.
103 You can also specify architecture by writing ``binary_name:arch_name`` in the
104 input (see example above). If architecture is not specified in either way,
105 address will not be symbolized. Defaults to empty string.
106
Alexander Potapenko7aaf5142014-10-17 00:50:19 +0000107.. option:: -dsym-hint=<path/to/file.dSYM>
108
109 (Darwin-only flag). If the debug info for a binary isn't present in the default
110 location, look for the debug info at the .dSYM path provided via the
111 ``-dsym-hint`` flag. This flag can be used multiple times.
112
Dmitry Venikov5c1768f2019-01-14 10:10:51 +0000113.. option:: -print-address, -addresses, -a
Hemant Kulkarnib3d4f212015-11-11 22:14:58 +0000114
Hemant Kulkarni80f82fb2015-10-12 19:26:44 +0000115 Print address before the source code location. Defaults to false.
Alexander Potapenko7aaf5142014-10-17 00:50:19 +0000116
Dmitry Venikov60d71e42019-01-10 15:33:35 +0000117.. option:: -pretty-print, -p
Hemant Kulkarnib3d4f212015-11-11 22:14:58 +0000118
Hemant Kulkarnibdce12a2015-11-11 20:41:43 +0000119 Print human readable output. If ``-inlining`` is specified, enclosing scope is
120 prefixed by (inlined by). Refer to listed examples.
121
James Henderson33c16a32019-01-22 10:24:32 +0000122.. option:: -basenames, -s
123
124 Strip directories when printing the file path.
125
James Henderson759d5e62019-01-25 11:49:21 +0000126.. option:: -adjust-vma=<offset>
127
128 Add the specified offset to object file addresses when performing lookups. This
James Henderson6f39f6a2019-01-29 10:43:48 +0000129 can be used to perform lookups as if the object were relocated by the offset.
James Henderson759d5e62019-01-25 11:49:21 +0000130
Alexey Samsonov2bc10122013-03-01 07:58:27 +0000131EXIT STATUS
132-----------
133
134:program:`llvm-symbolizer` returns 0. Other exit codes imply internal program error.