aboutsummaryrefslogtreecommitdiff
path: root/llvm/docs/CommandGuide/llvm-symbolizer.rst
AgeCommit message (Collapse)AuthorFilesLines
34 hours[llvm] Proofread *.rst (#151087)Kazu Hirata1-2/+2
This patch hyphenates words that are used as adjecives, such as: - architecture specific - human readable - implementation defined - language independent - language specific - machine readable - machine specific - target independent - target specific
2024-08-05[Symbolizer] Support for Missing Line Numbers. (#82240)Amit Kumar Pandey1-0/+33
LLVM Symbolizer attempt to symbolize addresses of optimized binaries reports missing line numbers for some cases. It maybe due to compiler which sometimes cannot map an instruction to line number due to optimizations. Symbolizer should handle those cases gracefully. Adding an option '--skip-line-zero' to symbolizer so as to report the nearest non-zero line number. --------- Co-authored-by: Amit Pandey <amit.pandey@amd.com>
2023-11-01[symbolizer] Support symbol lookupSerge Pavlov1-1/+12
Recent versions of GNU binutils starting from 2.39 support symbol+offset lookup in addition to the usual numeric address lookup. This change adds symbol lookup to llvm-symbolize and llvm-addr2line. Now llvm-symbolize behaves closer to GNU addr2line, - if the value specified as address in command line or input stream is not a number, it is treated as a symbol name. For example: llvm-symbolize --obj=abc.so func_22 llvm-symbolize --obj=abc.so "CODE func_22" This lookup is now supported only for functions. Specification with offset is not supported yet. This is a recommit of 2b27948783e4bbc1132d3220d8517ef62607b558, reverted in 39fec5457c0925bd39f67f63fe17391584e08258 because the test llvm/test/Support/interrupts.test started failing on Windows. The test was changed in 18f036d0105589c3175bb51a518c5d272dae61e2 and is also updated in this commit. Differential Revision: https://reviews.llvm.org/D149759
2023-10-02Revert "[symbolizer] Support symbol lookup"Serge Pavlov1-12/+1
This reverts commit 2b27948783e4bbc1132d3220d8517ef62607b558. On some buildbots the test LLVM::interrupts.test start failing.
2023-10-02[symbolizer] Support symbol lookupSerge Pavlov1-1/+12
Recent versions of GNU binutils starting from 2.39 support symbol+offset lookup in addition to the usual numeric address lookup. This change adds symbol lookup to llvm-symbolize and llvm-addr2line. Now llvm-symbolize behaves closer to GNU addr2line, - if the value specified as address in command line or input stream is not a number, it is treated as a symbol name. For example: llvm-symbolize --obj=abc.so func_22 llvm-symbolize --obj=abc.so "CODE func_22" This lookup is now supported only for functions. Specification with offset is not supported yet. Differential Revision: https://reviews.llvm.org/D149759
2023-08-30[symbolizer] Change reaction on invalid inputSerge Pavlov1-2/+2
If llvm-symbolizer finds a malformed command, it echoes it to the standard output. New versions of binutils (starting from 2.39) allow to specify an address by a symbols. Implementation of this feature in llvm-symbolizer makes the current reaction on invalid input inappropriate. Almost any invalid command may be treated as a symbol name, so the right reaction should be "symbol not found" in such case. The exception are commands that are recognized but have incorrect syntax, like "FILE:FILE:". The utility must produce descriptive diagnostic for such input and route it to the stderr. This change implements the new reaction on invalid input and is a prerequisite for implementation of symbol lookup in llvm-symbolizer. Differential Revision: https://reviews.llvm.org/D157210
2023-08-13Fix typos in documentationChris Cotter1-1/+1
2023-08-12Revert "[symbolizer] Change reaction on invalid input"Douglas Yung1-2/+2
This reverts commit a5fe6c7f5e2d1d265bd7c312ef55259fee7a68f9. This change is causing problems with Windows build bots due to a hanging zombie llvm-symbolizer.exe process.
2023-08-12[symbolizer] Change reaction on invalid inputSerge Pavlov1-2/+2
If llvm-symbolizer finds a malformed command, it echoes it to the standard output. New versions of binutils (starting from 2.39) allow to specify an address by a symbols. Implementation of this feature in llvm-symbolizer makes the current reaction on invalid input inappropriate. Almost any invalid command may be treated as a symbol name, so the right reaction should be "symbol not found" in such case. The exception are commands that are recognized but have incorrect syntax, like "FILE:FILE:". The utility must produce descriptive diagnostic for such input and route it to the stderr. This change implements the new reaction on invalid input and is a prerequisite for implementation of symbol lookup in llvm-symbolizer. Differential Revision: https://reviews.llvm.org/D157210
2022-10-03[llvm-objdump] Find debug information with Build ID/debuginfod.Daniel Thornburgh1-0/+6
Uses the library introduced in https://reviews.llvm.org/D132504 to add build ID fetching to llvm-objdump. This allows viewing source when disassembling stripped objects. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D131224
2022-08-31[Symbolizer] Handle {{{bt}}} symbolizer markup element.Daniel Thornburgh1-3/+15
This adds support for backtrace generation to the llvm-symbolizer markup filter, which is likely the largest use case. Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D132706
2022-08-08[Symbolizer] Implement pc element in symbolizing filter.Daniel Thornburgh1-1/+0
Implements the pc element for the symbolizing filter, including it's "ra" and "pc" modes. Return addresses ("ra") are adjusted by decrementing one. By default, {{{pc}}} elements are assumed to point to precise code ("pc") locations. Backtrace elements will adopt the opposite convention. Along the way, some minor refactors of value printing and colorization. Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D131115
2022-08-04[Symbolizer] Implement data symbolizer markup element.Daniel Thornburgh1-6/+6
This connects the Symbolizer to the markup filter and enables the first working end-to-end flow using the filter. Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D130187
2022-07-21[Symbolizer] Implement contextual symbolizer markup elements.Daniel Thornburgh1-0/+3
This change implements the contextual symbolizer markup elements: reset, module, and mmap. These provide information about the runtime context of the binary necessary to resolve addresses to symbolic values. Summary information is printed to the output about this context. Multiple mmap elements for the same module line are coalesced together. The standard requires that such elements occur on their own lines to allow for this; accordingly, anything after a contextual element on a line is silently discarded. Implementing this cleanly requires that the filter drive the parser; this allows skipped sections to avoid being parsed. This also makes the filter quite a bit easier to use, at the cost of some unused flexibility. Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D129519
2022-06-27[Symbolize] Add log markup --filter to llvm-symbolizer.Daniel Thornburgh1-1/+18
This adds a --filter option to llvm-symbolizer. This takes log-bearing symbolizer markup from stdin and writes a human-readable version to stdout. For now, this only implements the "symbol" markup tag; all others are passed through unaltered. This is a proof-of-concept bit of functionalty; implement the various tags is more-or-less just a matter of hooking up various parts of the Symbolize library to the architecture established here. Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D126980
2022-02-25[Debuginfod] Add BUILD_ID syntax to llvm-symbolizer.Daniel Thornburgh1-15/+40
This adds a BUILD_ID prefix to the llvm-symbolizer stdin and argument syntax. The prefix causes the given binary name to be interpreted as a build ID instead of an object file path. The semantics are analagous to the behavior of --obj and --build-id. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D119901
2022-02-09[Debuginfod] Flag-determine debuginfod lookups in llvm-symbolizer.Daniel Thornburgh1-0/+7
This change adds a pair of flags controlling whether llvm-symbolizer attempts debuginfod lookups. Lookups are attempted if --debuginfod is passed and disabled if --no-debuginfod is passed. The default behavior is made more nuanced: debuginfod lookups are now only attempted if an HTTP client is compiled in and at least one backing debuginfod URL was configured via environment variable. Previously, debuginfod lookups would always be attempted, even if there were no chance that they could succeed. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D118665
2022-02-08[Symbolizer] Add Build ID flag to llvm-symbolizer.Daniel Thornburgh1-1/+7
This adds a --build-id=<hex build ID> flag to llvm-symbolizer. If --obj is unspecified, this will attempt to look up the provided build ID using whatever mechanisms are available to the Symbolizer (typically, debuginfod). The semantics are then as if the found binary were given using the --obj flag. Reviewed By: jhenderson, phosek Differential Revision: https://reviews.llvm.org/D118633
2021-12-07[llvm-symbolizer][docs] Update --output-style=JSON examplegbreynoo1-3/+3
The fields output when using --output-style=JSON has changed but the guide wasn't updated. This change fixes up the example. Differential Revision: https://reviews.llvm.org/D115164
2021-11-15[NFC] Trim trailing whitespace in *.rstShao-Ce SUN1-2/+2
2021-06-17[llvm-symbolizer][docs] Update example for --verbose in the guideAndrew Ng1-2/+4
Differential Revision: https://reviews.llvm.org/D104128
2021-06-16[llvm-symbolizer] improve test and fix doc example after recent ↵Ben Dunbobbin1-1/+1
--print-source-context-lines behaviour change I believe that after https://reviews.llvm.org/D102355 the behaviour of --print-source-context-lines has changed. Before: --print-source-context-lines=3 prints 4 lines. After: --print-source-context-lines=3 prints 3 lines. Adjust the example in the docs for this change and make the testing a little more robust. Differential Revision: https://reviews.llvm.org/D104114
2021-05-19[symbolizer] Added StartAddress for the resolved function.Alex Orlov1-3/+5
In many cases it is helpful to know at what address the resolved function starts. This patch adds a new StartAddress member to the DILineInfo structure. Reviewed By: jhenderson, dblaikie Differential Revision: https://reviews.llvm.org/D102316
2021-05-11* Add support for JSON output style to llvm-symbolizerAlex Orlov1-1/+53
This patch adds JSON output style to llvm-symbolizer to better support CLI automation by providing a machine readable output. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D96883
2021-05-10[llvm-symbolizer] Update Command Guidegbreynoo1-9/+1
The option --use-symbol-table is now a noop and does not appear in the help text, however it still appears in the command guide. This change removes it from the command guide and updates the description of --output-style . Differential Revision: https://reviews.llvm.org/D102078
2021-01-20[llvm-symbolizer][doc] Reorder --relativenames in options listJames Henderson1-6/+6
This puts it in alphabetical order, matching the rest of the list. Reviewed by: MaskRay, saugustine Differential Revision: https://reviews.llvm.org/D94481
2020-11-30Recommit "[llvm-symbolizer] Switch to using native symbolizer by default on ↵Amy Huang1-0/+8
Windows" This reverts commit 1b63177a56e8cd6196778d2b90295f03e96b5800.
2020-11-23Revert "[llvm-symbolizer] Switch to using native symbolizer by default on ↵Amy Huang1-8/+0
Windows" Breaks some asan tests on the buildbot. This reverts commit c74b427cb2a90309ee0c29df21ad1ca26390263c.
2020-11-23[llvm-symbolizer] Switch to using native symbolizer by default on WindowsAmy Huang1-0/+8
llvm-symbolizer used to use the DIA SDK for symbolization on Windows; this patch switches to using native symbolization, which was implemented recently. Users can still make the symbolizer use DIA by adding the `-dia` flag in the LLVM_SYMBOLIZER_OPTS environment variable. Differential Revision: https://reviews.llvm.org/D91814
2020-08-10[llvm-symbolizer] Add back --version and add a -v aliasFangrui Song1-1/+1
The switch from llvm::cl to OptTable (D83530) dropped --version, which is needed by some users. This patch also adds a -v alias, which is available in GNU addr2line. The version dumping is similar to llvm-objcopy --version (exotic): ``` llvm-symbolizer LLVM (http://llvm.org/): LLVM version 12.0.0git Optimized build with assertions. Default target: x86_64-unknown-linux-gnu Host CPU: skylake-avx512 ``` Reviewed By: dyung, jhenderson Differential Revision: https://reviews.llvm.org/D85624
2020-08-04[llvm-symbolizer] Switch command line parsing from llvm::cl to OptTableFangrui Song1-8/+8
for the advantage outlined by D83639 ([OptTable] Support grouped short options) Some behavior changes: * -i={0,false} is removed. Use --no-inlines instead. * --demangle={0,false} is removed. Use --no-demangle instead * -untag-addresses={0,false} is removed. Use --no-untag-addresses instead Added a higher level API OptTable::parseArgs which handles optional initial options populated from an environment variable, expands response files recursively, and parses options. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D83530
2020-04-13Address sphinx warningsBenjamin Kramer1-2/+3
LanguageExtensions.rst:2191: WARNING: Title underline too short. llvm-symbolizer.rst:157: Error in "code-block" directive: maximum 1 argument(s) allowed, 30 supplied.
2020-03-31New symbolizer option to print files relative to the compilation directory.Sterling Augustine1-1/+29
Summary: New "--relative" option to allow printing files relative to the compilation directory. Reviewers: jhenderson Subscribers: MaskRay, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D76733
2020-02-26[docs][llvm-symbolizer] Fix indentation of inline option examplesJames Henderson1-42/+42
The examples for different options were inconsistently indented in the HTML display. As they are tied to the options, this change normalises to indent them the same as the option description body.
2020-02-26[docs][llvm-symbolizer] Fix --functions descriptionJames Henderson1-1/+1
"--functions none" and "--functions=none" are not the same. One is the option "--functions" with its default value of "linkage", followed by an input address of "none", and the other is "--functions" with the value "none". This patch fixes the doc to match the actual behaviour by adding an extra '=' sign in the allowed values description.
2020-01-29Print discriminators when printing .debug_line in GNU style.Sterling Augustine1-0/+7
Summary: gnu addr2line prints DWARF line table discriminators like so: <file>:<line> (discriminator <Number>) This matches that behavior. Document how and when --output-style=GNU prints discriminators Add test for new GNU-style discriminator printing. Reviewers: rupprecht, labath, jhenderson Subscribers: aprantl, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D73318
2019-12-20[llvm-symbolizer] Support reading options from environmentPetr Hosek1-0/+6
llvm-symbolizer is used by sanitizers to symbolize errors discovered by sanitizer, but there's no way to pass options to llvm-symbolizer since the tool is invoked directly by the sanitizer runtime. Therefore, we don't have a way to pass options needed to find debug symbols such as -dsym-hint or -debug-file-directory. This change enables reading options from the LLVM_SYMBOLIZER_OPTS in addition to command line which can be used to pass those additional options to llvm-symbolizer invocations made by sanitizer runtime. Differential Revision: https://reviews.llvm.org/D71668
2019-07-10[docs][llvm-symbolizer] Fix grammarJames Henderson1-1/+1
llvm-svn: 365630
2019-06-27[docs][tools] Add missing "program" tags to rst filesJames Henderson1-0/+2
Sphinx allows for definitions of command-line options using `.. option <name>` and references to those options via `:option:<name>`. However, it looks like there is no scoping of these options by default, meaning that links can end up pointing to incorrect documents. See for example the llvm-mca document, which contains references to -o that, prior to this patch, pointed to a different document. What's worse is that these links appear to be non-deterministic in which one is picked (on my machine, some references end up pointing to opt, whereas on the live docs, they point to llvm-dwarfdump, for example). The fix is to add the .. program <name> tag. This essentially namespaces the options (definitions and references) to the named program, ensuring that the links are kept correct. Reviwed by: andreadb Differential Revision: https://reviews.llvm.org/D63873 llvm-svn: 364538
2019-06-26[docs][llvm-symbolizer] Improve llvm-symbolizer documentationJames Henderson1-99/+271
As detailed in https://bugs.llvm.org/show_bug.cgi?id=42253, there were a number of issues in the llvm-symbolizer documentation. This patch fixes them by: 1. Adding [addresses...] to the synopsis, and matching the formatting of other tools. 2. Rewriting the description to fix grammar issues and mention other usage options. 3. Rewriting the examples to be easier to read. 4. Re-ordering the options into alphabetical order. 5. Improving the text of some of the option descriptions, and adding some examples to individual options. 6. Splitting the Mach-O options into a separate section of the document. 7. Standardizing on double dashes for long options throughout the file. 8. Adding a reference to the llvm-addr2line document. Reviewed by: mtrent, ikudrin Differential Revision: https://reviews.llvm.org/D63651 llvm-svn: 364410
2019-06-21[binutils] Add response file option to help and docsJames Henderson1-0/+4
Many LLVM-based tools already support response files (i.e. files containing a list of options, specified with '@'). This change simply updates the documentation and help text for some of these tools to include it. I haven't attempted to fix all tools, just a selection that I am interested in. I've taken the opportunity to add some tests for --help behaviour, where they were missing. We could expand these tests, but I don't think that's within scope of this patch. This fixes https://bugs.llvm.org/show_bug.cgi?id=42233 and https://bugs.llvm.org/show_bug.cgi?id=42236. Reviewed by: grimar, MaskRay, jkorous Differential Revision: https://reviews.llvm.org/D63597 llvm-svn: 364036
2019-06-13[docs][llvm-symbolizer] Fix formatting issue with --functionsJames Henderson1-4/+4
Reviewed by: rupprecht Differential Revision: https://reviews.llvm.org/D63195 llvm-svn: 363266
2019-06-12[docs][llvm-symbolizer] Fix typo and grammar errorJames Henderson1-2/+3
llvm-svn: 363145
2019-04-19[llvm-symbolizer] Add llvm-addr2lineIgor Kudrin1-0/+10
This adds an alias for llvm-symbolizer with different defaults so that it can be used as a drop-in replacement for GNU's addr2line. If a substring "addr2line" is found in the tool's name: * it defaults "-i", "-f" and "-C" to OFF; * it uses "--output-style=GNU" by default. Differential Revision: https://reviews.llvm.org/D60067 llvm-svn: 358749
2019-04-19[llvm-symbolizer] Unhide and document the "-output-style" optionIgor Kudrin1-0/+31
With the latest changes, the option gets useful for users of llvm-symbolizer, not only for the upcoming llvm-addr2line. Differential Revision: https://reviews.llvm.org/D60816 llvm-svn: 358748
2019-01-29[llvm-symbolizer][doc] Tweak wording of --adjust-vma switch descriptionJames Henderson1-2/+1
The address isn't dynamically relocated. The object is. llvm-svn: 352477
2019-01-25[llvm-symbolizer] Add switch to adjust addresses by fixed offsetJames Henderson1-0/+6
If a stack trace or similar has a list of addresses from an executable or DSO loaded at a variable address (e.g. due to ASLR), the addresses will not directly correspond to the addresses stored in the object file. If a user wishes to use llvm-symbolizer, they have to subtract the load address from every address. This is somewhat inconvenient, especially as the output of --print-address will result in the adjusted address being listed, rather than the address coming from the stack trace, making it harder to map results between the two. This change adds a new switch to llvm-symbolizer --adjust-vma which takes an offset, which is then used to automatically do this calculation. The printed address remains the input address (allowing for easy mapping), whilst the specified offset is applied to the addresses when performing the lookup. The switch is conceptually similar to llvm-objdump's new switch of the same name (see D57051), which in turn mirrors a GNU switch. There is no equivalent switch in addr2line. Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D57151 llvm-svn: 352195
2019-01-24[llvm-symbolizer] Add support for -i and -inlines as aliases for -inliningDouglas Yung1-1/+1
This change adds two options, -i and -inlines as aliases for the -inlining option to llvm-symbolizer to improve compatibility with the GNU addr2line utility which accepts these options. It also modifies existing tests that use -inlining to exercise these new aliases as well. This fixes PR40073. Reviewed by: jhenderson, Quolyk, ruiu Differential Revision: https://reviews.llvm.org/D57083 llvm-svn: 351999
2019-01-23[llvm-symbolizer] Improve compatibility of --functions with GNU addr2lineJames Henderson1-1/+1
This fixes https://bugs.llvm.org/show_bug.cgi?id=40072. GNU addr2line's --functions switch is off by default, has a short alias of -f, and does not take an argument. This patch changes llvm-symbolizer to allow the second and third point (changing the default behaviour may have negative impacts on users). If the option is missing a value, it now treats it as "linkage". This change does cause one previously valid command-line to behave differently. Before --functions <value> was accepted, but now only --functions=<value> is allowed (as well as --functions). The old behaviour will result in the value being treated as a positional argument. The previous testing for --functions=short has been pulled out into a new test that also tests the other accepted values and option formats. Reviewed by: ruiu Differential Revision: https://reviews.llvm.org/D57049 llvm-svn: 351968
2019-01-22[llvm-symbolizer] Add support for --basenames/-sJames Henderson1-0/+4
This fixes https://bugs.llvm.org/show_bug.cgi?id=40068. --basenames is a GNU addr2line switch which strips the directory names from the file path in the output. Reviewed by: ruiu Differential Revision: https://reviews.llvm.org/D56919 llvm-svn: 351795