Lines Matching +full:llvm +full:- +full:test
1 llvm-symbolizer - convert addresses into source code locations
4 .. program:: llvm-symbolizer
7 --------
9 :program:`llvm-symbolizer` [*options*] [*addresses...*]
12 -----------
14 :program:`llvm-symbolizer` reads input names and addresses from the command-line
17 :option:`--filter-markup`. Addresses may be specified as numbers or symbol names.
19 If no address is specified on the command-line, it reads the addresses from
20 standard input. If no input name is specified on the command-line, but addresses
25 input or as positional arguments on the command-line. By default, input names
36 :program:`llvm-symbolizer` parses options from the environment variable
38 ``LLVM_SYMBOLIZER_OPTS`` is primarily useful for supplementing the command-line
39 options when :program:`llvm-symbolizer` is invoked by another program or
43 --------
46 use a mixture of C-style and C++-style linkage to illustrate how these names are
47 printed differently (see :option:`--demangle`).
49 .. code-block:: c
51 // test.h
56 .. code-block:: c
58 // test.cpp
59 #include "test.h"
77 .. code-block:: console
79 $ clang -g test.cpp -o test.elf
80 $ clang -g -O2 test.cpp -o inlined.elf
82 Example 1 - addresses and object on command-line:
84 .. code-block:: console
86 $ llvm-symbolizer --obj=test.elf 0x4004d0 0x400490
88 /tmp/test.h:1:0
91 /tmp/test.cpp:11:0
93 Example 2 - addresses on standard input:
95 .. code-block:: console
101 $ llvm-symbolizer --obj=test.elf < addr.txt
103 /tmp/test.cpp:15:0
106 /tmp/test.cpp:11:0
109 /tmp/./test.h:1:0
111 Example 3 - object specified with address:
113 .. code-block:: console
115 $ llvm-symbolizer "test.elf 0x400490" "FILE:inlined.elf 0x400480"
117 /tmp/test.cpp:11:0
120 /tmp/test.cpp:8:10
123 FILE:test.elf 0x4004a0
126 $ llvm-symbolizer < addr2.txt
128 /tmp/test.cpp:15:0
131 /tmp/test.cpp:8:10
133 Example 4 - BUILDID and FILE prefixes:
135 .. code-block:: console
137 $ llvm-symbolizer "FILE:test.elf 0x400490" "DATA BUILDID:123456789abcdef 0x601028"
139 /tmp/test.cpp:11:0
145 FILE:test.elf 0x400490
148 $ llvm-symbolizer < addr3.txt
150 /tmp/test.cpp:11:0
155 Example 5 - CODE and DATA prefixes:
157 .. code-block:: console
159 $ llvm-symbolizer --obj=test.elf "CODE 0x400490" "DATA 0x601028"
161 /tmp/test.cpp:11:0
167 CODE test.elf 0x4004a0
170 $ llvm-symbolizer < addr4.txt
172 /tmp/test.cpp:15:0
177 Example 6 - path-style options:
180 full path is /tmp/foo/test.cpp and is compiled as follows. The first case
181 shows the default absolute path, the second --basenames, and the third
182 shows --relativenames.
184 .. code-block:: console
188 $ clang -g foo/test.cpp -o test.elf
189 $ llvm-symbolizer --obj=test.elf 0x4004a0
191 /tmp/foo/test.cpp:15:0
192 $ llvm-symbolizer --obj=test.elf 0x4004a0 --basenames
194 test.cpp:15:0
195 $ llvm-symbolizer --obj=test.elf 0x4004a0 --relativenames
197 foo/test.cpp:15:0
199 Example 7 - Addresses as symbol names:
201 .. code-block:: console
203 $ llvm-symbolizer --obj=test.elf main
205 /tmp/test.cpp:14:0
206 $ llvm-symbolizer --obj=test.elf "CODE foz"
208 /tmp/test.h:1:0
210 Example 8 - :option:`--skip-line-zero` output for an address with no line correspondence (an address associated with line zero):
212 .. code-block:: c
214 // test.c
226 .. code-block:: console
228 $ clang -g -O2 -S test.c -o test.s
229 $ llvm-mc -filetype=obj -triple=x86_64-unknown-linux test.s -o test.o
231 .. code-block:: console
233 $ llvm-symbolizer --obj=test.o --skip-line-zero 0xa
235 /tmp/test.c:5:7 (approximate)
238 -------
240 .. option:: --adjust-vma <offset>
246 .. option:: --skip-line-zero
249 number from the current sequence in the line-table. Such lines are labeled
252 .. option:: --basenames, -s
257 .. option:: --build-id
260 string. Mutually exclusive with :option:`--obj`.
262 .. option:: --color [=<always|auto|never>]
264 Specify whether to use color in :option:`--filter-markup` mode. Defaults to
266 ``--color`` alone is equivalent to ``--color=always``.
268 .. option:: --debug-file-directory <path>
270 Provide a path to a directory with a `.build-id` subdirectory to search for
274 .. option:: --debuginfod, --no-debuginfod
281 .. _llvm-symbolizer-opt-C:
283 .. option:: --demangle, -C
286 name `_Z3bazv` becomes `baz()`, whilst the non-mangled name `foz` is printed
289 .. option:: --dwp <path>
294 .. option:: --fallback-debug-path <path>
300 .. option:: --filter-markup
303 :doc:`Symbolizer Markup </SymbolizerMarkupFormat>` into human-readable form,
323 .. _llvm-symbolizer-opt-f:
325 .. option:: --functions [=<none|short|linkage>], -f
331 .. option:: --help, -h
335 .. _llvm-symbolizer-opt-i:
337 .. option:: --inlining, --inlines, -i
342 .. option:: --no-inlines
346 .. option:: --no-demangle
350 .. option:: --obj <path>, --exe, -e
352 Path to object file to be symbolized. If ``-`` is specified, read the object
354 :option:`--build-id`.
356 .. _llvm-symbolizer-opt-output-style:
358 .. option:: --output-style <LLVM|GNU|JSON>
360 Specify the preferred output style. Defaults to ``LLVM``. When the output
362 The differences from the ``LLVM`` style are:
371 * Prints an address's debug-data discriminator when it is non-zero. One way to
372 produce discriminators is to compile with clang's -fdebug-info-for-profiling.
378 .. code-block:: console
380 $ llvm-symbolizer --obj=inlined.elf 0x4004be 0x400486 -p
381 baz() at /tmp/test.cpp:11:18
382 (inlined by) main at /tmp/test.cpp:15:0
384 foo() at /tmp/test.cpp:6:3
386 $ llvm-symbolizer --output-style=LLVM --obj=inlined.elf 0x4004be 0x400486 -p --no-inlines
387 main at /tmp/test.cpp:11:18
389 foo() at /tmp/test.cpp:6:3
391 $ llvm-symbolizer --output-style=GNU --obj=inlined.elf 0x4004be 0x400486 -p --no-inlines
392 baz() at /tmp/test.cpp:11
393 foo() at /tmp/test.cpp:6
395 $ clang -g -fdebug-info-for-profiling test.cpp -o profiling.elf
396 $ llvm-symbolizer --output-style=GNU --obj=profiling.elf 0x401167 -p --no-inlines
397 main at /tmp/test.cpp:15 (discriminator 2)
399 $ llvm-symbolizer --output-style=JSON --obj=inlined.elf 0x4004be 0x400486 -p
408 "FileName": "/tmp/test.cpp",
412 "StartFileName": "/tmp/test.cpp",
418 "FileName": "/tmp/test.cpp",
422 "StartFileName": "/tmp/test.cpp",
434 "FileName": "/tmp/test.cpp",
438 "StartFileName": "/tmp/test.cpp",
445 .. option:: --pretty-print, -p
447 Print human readable output. If :option:`--inlining` is specified, the
452 .. code-block:: console
454 $ llvm-symbolizer --obj=inlined.elf 0x4004be --inlining --pretty-print
455 baz() at /tmp/test.cpp:11:18
456 (inlined by) main at /tmp/test.cpp:15:0
458 .. option:: --print-address, --addresses, -a
462 .. code-block:: console
464 $ llvm-symbolizer --obj=inlined.elf --print-address 0x4004be
467 /tmp/test.cpp:11:18
469 /tmp/test.cpp:15:0
471 $ llvm-symbolizer --obj=inlined.elf 0x4004be --pretty-print --print-address
472 0x4004be: baz() at /tmp/test.cpp:11:18
473 (inlined by) main at /tmp/test.cpp:15:0
475 .. option:: --print-source-context-lines <N>
479 .. code-block:: console
481 $ llvm-symbolizer --obj=test.elf 0x400490 --print-source-context-lines=3
483 /tmp/test.cpp:11:0
488 .. option:: --relativenames
491 of the absolute path. If the command-line to the compiler included
494 .. option:: --verbose
498 .. code-block:: console
500 $ llvm-symbolizer --obj=inlined.elf --verbose 0x4004be
502 Filename: /tmp/test.cpp
503 Function start filename: /tmp/test.cpp
509 Filename: /tmp/test.cpp
510 Function start filename: /tmp/test.cpp
516 .. option:: --version, -v
522 Read command-line options from response file `<FILE>`.
525 -----------------------------
527 .. option:: --dia
530 llvm-symbolizer will fall back to the native implementation.
532 MACH-O SPECIFIC OPTIONS
533 -----------------------
535 .. option:: --default-arch <arch>
538 Mach-O universal binary), symbolize the object file for a given architecture.
543 .. code-block:: console
549 $ llvm-symbolizer < addr.txt
556 .. option:: --dsym-hint <path/to/file.dSYM>
563 -----------
565 :program:`llvm-symbolizer` returns 0. Other exit codes imply an internal program
569 --------
571 :manpage:`llvm-addr2line(1)`