[PATCH] D83262: [llvm-symbolizer] Add options to disable printing source files & inlining

Dan Zimmerman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 6 15:00:55 PDT 2020


danzimm created this revision.
danzimm added a reviewer: hiraditya.
Herald added subscribers: llvm-commits, rupprecht, MaskRay.
Herald added a reviewer: jhenderson.
Herald added a project: LLVM.

Currently there is no way to disable source file output from `llvm-symbolizer`. Similarly there's no way to disable symbolicating inlined functions with `llvm-symbolzer` (this option is automatically disabled when `llvm-addr2line` is invoked instead of `llvm-symbolizer`).

This diff introduces flags to further customize `llvm-symbolizer`'s output to support these two usecases:

- `--no-inlining`: This disables symbolicating inlined frames. When paired with `--output-style=LLVM` and `--use-symbol-table` this results in a list of functions that appear in the final binary
- `--no-source-file`: This disables printing source file information when symbolicating an address
- `--source-file`: This enables printing source file information (the default). This option was added to balance `--no-source-file`.

The last of `--no-source-file` and `--source-file` passed will determine whether source file information is printed or not. The behavior of `llvm-symbolizer` before this diff should be identical to the behavior after this diff when none of the new options are specified.

Together `--functions=linkage --demangle --output-style=LLVM --no-source-file --no-inlining` results in a list of symbol names which appear in the resulting binary. This is useful when symbolicating a list of addresses e.g. for link order files.

N.B. The same data can be extracted with a processor on top of `--functions=linkage --demangle --output-style=LLVM`, however with large lists of symbols I've found that this takes quite a long time (my processor(s) were in perl/python- in theory I could've written a C/++ one, but I figure best just add these as formatting options to `llvm-symbolizer` instead).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83262

Files:
  llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h
  llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
  llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83262.275844.patch
Type: text/x-patch
Size: 4571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200706/c517d20a/attachment.bin>


More information about the llvm-commits mailing list