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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 01:54:07 PDT 2020


jhenderson added reviewers: rupprecht, MaskRay, grimar.
jhenderson added a comment.

Hi @danzimm,

In LLVM tools using the cl::opt interface, like llvm-symbolizer and llvm-addr2line, where you see a `cl::opt<bool>` (such as `--inlining`) you should be able to do `--inlininng=0` to disable it. I'm not necessarily opposed to `--no-inlining` too mind you, but wanted to raise that before going further. If you wish to go ahead with adding `--no-inlining`, I'd recommend moving it to a separate patch, as it is independent of the `--source-files` stuff. Also, please add any new options to the llvm-symbolizer and llvm-addr2line docs (located in llvm/docs/CommandGuide).

In D83262#2134394 <https://reviews.llvm.org/D83262#2134394>, @danzimm wrote:

> If there are tests somewhere that I can add to, please point me to them! I'd love to add some tests, just couldn't quite find any (I'm guessing I'm just not looking in the right place... 😅)


Most tests for llvm-symbolizer (and llvm-addr2line) are located in llvm/test/tools/llvm-symbolizer (there are a few in other scattered locations - grep for llvm-symbolizer). Any new front-end options like these should be tested there.

> 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).

Are you specifically interested in symbols at specific addresses, or with a specific type? llvm-nm and llvm-readobj can both be used to dump symbols too. It doesn't feel to me like llvm-symbolizer is the right tool for the job if you want to dump all symbols (or all functions), though I could possibly see an argument if you are limiting it to the symbols with specific addresses. I personally would think it would make more sense to add any necessary options to llvm-nm or possibly llvm-readelf. Adding a few others with binutils knowledge for more visibility and to get their input.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83262/new/

https://reviews.llvm.org/D83262





More information about the llvm-commits mailing list