summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-dwarfdump
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-dwarfdump][Statistics] Don't count coverage less than 1% as 0%Kristina Bessonova2019-12-131-12/+10
| | | | | | | | | | | | | | | | | | | | | Summary: This is a follow up for D70548. Currently, variables with debug info coverage between 0% and 1% are put into zero-bucket. D70548 changed the way statistics calculate a variable's coverage: we began to use enclosing scope rather than a possible variable life range. Thus more variables might be moved to zero-bucket despite they have some debug info coverage. The patch is to distinguish between a variable that has location info but it's significantly less than its enclosing scope and a variable that doesn't have it at all. Reviewers: djtodoro, aprantl, dblaikie, avl Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71070
* [llvm-dwarfdump][Statistics] Change the coverage buckets representation. NFCKristina Bessonova2019-12-131-6/+6
| | | | | | | | | | | | | | | | Summary: This changes the representation of 'coverage buckets' in llvm-dwarfdump and llvm-locstats to one that makes more clear what the buckets contain. See some related details in D71070. Reviewers: djtodoro, aprantl, cmtice, jhenderson Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71366
* [llvm/dwarfdump] Use the architecture string to filter.Jonas Devlieghere2019-12-091-1/+1
| | | | | | | | | | | | | | | | | | Currently dwarfdump uses the ArchType to filter out architectures, which is problematic for architectures like arm64e and x86_64h that map back to arm64 and x86_64 respectively. The result is that the filter doesn't work for these architectures because it matches all the variants. This is especially bad because usually these architectures are the reason to use the filter in the first place. Instead, we should match the architecture based on the string name. This means the filter works for the values printed by dwarfdump. It has the unfortunate side effect of not working for aliases, like AArch64, but I think that's worth the trade-off. rdar://53653014 Differential revision: https://reviews.llvm.org/D71230
* [llvm-dwarfdump][Statistics] Unify coverage statistic computationKristina Bessonova2019-12-081-60/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The patch removes OffsetToFirstDefinition in the 'scope bytes total' statistic computation. Thus it unifies the way the scope and the coverage buckets are computed. The rationals behind that are the following: 1. OffsetToFirstDefinition was used to calculate the variable's life range. However, there is no simple way to do it accurately, so the scope calculated this way might be misleading. See D69027 for more details on the subject. 2. Both 'scope bytes total' and coverage buckets seem to be intended to represent the same data in different ways. Otherwise, the statistics might be controversial and confusing. Note that the approach gives up a thorough evaluation of debug information completeness (i.e. coverage buckets by themselves doesn't tell how good the debug information is). Only changes in coverage over time make a 'physical' sense. Reviewers: djtodoro, aprantl, vsk, dblaikie, avl Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70548
* dwarfdump --statistics: Use new location list apiPavel Labath2019-11-211-38/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch removes manual location list handling in the statistics code and replaces it with the new DWARFDie api, which provides access to a "cooked" location list. This has the following effects: - the code now properly handles split-dwarf location lists - it will automatically support dwarf5 location lists once support for those is added - it properly handles location lists with base address selection entries - it fixes a bug where the location list code was using the first DW_AT_ranges range as a "base address" of the compile unit (it should have used DW_AT_low_pc instead. The effect of this was that the computation of the start address of a variable in its scope was broken for these kinds of compile units. This only manifested itself on linked files, since in object files the first DW_AT_ranges range normally starts at 0. Since pretty much every kind of location list was broken in some way, it's hard to verify that the new implementation is correct -- the output will be different in all non-trivial cases, and mostly with good reason. Most of the existing statistics tests continue to pass though, and a visual inspection of the statistics for non-trivial inputs shows that the data is more "reasonable" now. I have updated the "dwo statistics" test to include the new numbers, as the previous ones were completely bogus, and I have added a targeted test for the "base address" bug. Reviewers: dblaikie, cmtice, vsk Subscribers: aprantl, SouraVX, JDevlieghere, djtodoro, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70444
* DWARFDebugLoc(v4): Add an incremental parsing functionPavel Labath2019-11-151-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds a visitLocationList function to the DWARF v4 location lists, similar to what already exists for DWARF v5. It follows the approach outlined in previous patches (D69672), where the parsed form is always stored in the DWARF v5 format, which makes it easier for generic code to be built on top of that. v4 location lists are "upgraded" during parsing, and then this upgrade is undone while dumping. Both "inline" and section-based dumping is rewritten to reuse the existing "generic" location list dumper. This means that the output format is consistent for all location lists (the only thing one needs to implement is the function which prints the "raw" form of a location list), and that debug_loc dumping correctly processes base address selection entries, etc. The previous existing debug_loc functionality (e.g., parseOneLocationList) is rewritten on top of the new API, but it is not removed as there is still code which uses them. This will be done in follow-up patches, after I build the API to access the "interpreted" location lists in a generic way (as that is what those users really want). Reviewers: dblaikie, probinson, JDevlieghere, aprantl, SouraVX Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69847
* [Tools] Mark output of tools as text if it is textKai Nacke2019-10-081-1/+1
| | | | | | | | | | | | | | | | | | | | Several LLVM tools write text files/streams without using OF_Text. This can cause problems on platforms which distinguish between text and binary output. This PR adds the OF_Text flag for the following tools: - llvm-dis - llvm-dwarfdump - llvm-mca - llvm-mc (assembler files only) - opt (assembler files only) - RemarkStreamer (used e.g. by opt) Reviewers: rnk, vivekvpandya, Bigcheese, andreadb Differential Revision: https://reviews.llvm.org/D67696 llvm-svn: 374024
* [llvm-dwarfdump] Fix dumping of wrong locstats mapDjordje Todorovic2019-10-021-1/+1
| | | | llvm-svn: 373469
* [llvm-dwarfdump] Adjust Windows path to be acceptable by JSONDjordje Todorovic2019-09-201-7/+4
| | | | | | | | | | Backslash is a special character according to JSON specification, so we should avoid that when printing a file path with the --statistics option. Differential Revision: https://reviews.llvm.org/D67699 llvm-svn: 372378
* [llvm-dwarfdump] Add additional stats fieldsDjordje Todorovic2019-09-101-13/+205
| | | | | | | | | | The additional fields will be parsed by the llvm-locstats tool in order to produce more human readable output of the DWARF debug location quality generated. Differential Revision: https://reviews.llvm.org/D66525 llvm-svn: 371506
* [llvm-dwarfdump] Fix spelling in the comments. NFCDjordje Todorovic2019-09-041-2/+2
| | | | llvm-svn: 370861
* llvm-dwarfdump: Cache CU low_pc when computing statistics.David Blaikie2019-08-311-6/+6
| | | | llvm-svn: 370559
* Reland "[DwarfDebug] Dump call site debug info"Djordje Todorovic2019-07-311-4/+16
| | | | | | | | | The build failure found after the rL365467 has been resolved. Differential Revision: https://reviews.llvm.org/D60716 llvm-svn: 367446
* Revert "[DwarfDebug] Dump call site debug info"Djordje Todorovic2019-07-121-16/+4
| | | | | | | | A build failure was found on the SystemZ platform. This reverts commit 9e7e73578e54cd22b3c7af4b54274d743b6607cc. llvm-svn: 365886
* [DwarfDebug] Dump call site debug infoDjordje Todorovic2019-07-091-4/+16
| | | | | | | | | | | | | | | | | | | Dump the DWARF information about call sites and call site parameters into debug info sections. The patch also provides an interface for the interpretation of instructions that could load values of a call site parameters in order to generate DWARF about the call site parameters. ([13/13] Introduce the debug entry values.) Co-authored-by: Ananth Sowda <asowda@cisco.com> Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com> Co-authored-by: Ivan Baev <ibaev@cisco.com> Differential Revision: https://reviews.llvm.org/D60716 llvm-svn: 365467
* [binutils] Add response file option to help and docsJames Henderson2019-06-211-0/+2
| | | | | | | | | | | | | | | | | | | | | 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
* [llvm-dwarfdump] Remove unnecessary explicit -h behaviourJames Henderson2019-06-211-7/+0
| | | | | | | | | | | | | | | | | --help and -h are automatically supported by the command-line parser, unless overridden by the tool. The behaviour of the PrintHelpMessage being used for -h prior to this patch is subtly different to that provided by --help automatically (it omits certain elements of help text and options, such as --help-list), so overriding the default is not desirable, without good reason. This patch removes the explicit specification of -h and its behaviour, so that the default behaviour is used. Reviewed by: hintonda Differential Revision: https://reviews.llvm.org/D63565 llvm-svn: 364029
* [docs][llvm-dwarfdump] Make the --show-parents and --show-children help text ↵James Henderson2019-06-141-2/+2
| | | | | | | | | | | | | | | | | | and docs more consistent and correct The docs and help text for --show-parents and --show-children were a bit inconsistent. The help text claimed they had an effect when "=<offset>" was used, whereas the doc said it had an effect when "--find" or "--name" were used. This change changes the doc to mention "=<offset>" and removes this reference from the help text, to avoid having a very long description in the help text (it still says "when selectively printing entries"). Reviewed by: JDevlieghere, aprantl Differential Revision: https://reviews.llvm.org/D63275 llvm-svn: 363380
* [llvm-dwarfdump] Simplify --ignore-case help text and documentationJames Henderson2019-06-111-4/+3
| | | | | | | | | | | | | | | There was a typo in the --ignore-case help text that was copied into the llvm-dwarfdump command-guide. Additionally, this patch simplifies the wording, since it was unnecessarily verbose: the switch applies for searching in general and doesn't need explicitly stating different search modes (which might go out-of-date as options are added or removed). Reviwed by: JDevlieghere Differential Revision: https://reviews.llvm.org/D63133 llvm-svn: 363066
* [llvm-dwarfdump] Add -o to help text and remove --out-file from docJames Henderson2019-06-111-5/+4
| | | | | | | | | | | | | -o is in the documentation, but not in the llvm-dwarfdump help text. This patch adds it by inverting the -o and --out-file aliasing. It also removes --out-file from the documentation, since we don't really want people to be using this switch in practice. Reviewed by: aprantl, JDevlieghere, dblaikie Differential Revision: https://reviews.llvm.org/D63013 llvm-svn: 363044
* [dwarfdump] Add flag to limit the number of parents DIEsJonas Devlieghere2019-05-241-9/+15
| | | | | | | | | This adds `-parent-recurse-depth` which limits the number of parent DIEs being dumped. Differential revision: https://reviews.llvm.org/D62359 llvm-svn: 361671
* llvm-dwarfdump: Add dwo parsing to --statistics.Caroline Tice2019-05-091-1/+1
| | | | | | | | | | | Add check for, and parsing of, .dwo files to Statistics.cpp; create a new getNon SkeletonUnitDie function for DWARFUnit.h Reviewers: dblaikie Differential Revision: https://review.llvm.org/D61755 llvm-svn: 360380
* [CommandLine] Provide parser<unsigned long> instantiation to allow ↵Fangrui Song2019-04-241-1/+2
| | | | | | | | | | | | | cl::opt<uint64_t> on LP64 platforms Summary: And migrate opt<unsigned long long> to opt<uint64_t> Fixes PR19665 Differential Revision: https://reviews.llvm.org/D60933 llvm-svn: 359068
* llvm-dwarfdump: Support alternative architecture names in the -arch filterAdrian Prantl2019-04-041-7/+4
| | | | | | <rdar://problem/47918606> llvm-svn: 357706
* [llvm-dwarfdump] Simplify -o handlingFangrui Song2019-03-271-15/+10
| | | | | | | | | | ToolOutputFile handles '-' so no need to specialize here. Also, we neither reassign the variable nor pass it around, thus no need to use std::unique_ptr<ToolOutputFile>. exit(1) -> return 1; to call the destructor of raw_fd_stream llvm-svn: 357051
* llvm-dwarfdump: Add new variable, parameter and inlining statistics; also ↵Caroline Tice2019-03-011-21/+116
| | | | | | | | | | | | | function source location statistics. Add statistics for abstract origins, function, variable and parameter locations; break the 'variable' counts down into variables and parameters. Also update call site counting to check for DW_AT_call_{file,line} in addition to DW_TAG_call_site. Differential revision: https://reviews.llvm.org/D58849 llvm-svn: 355243
* [DebugInfo] add SectionedAddress to DebugInfo interfaces.Alexey Lapshin2019-02-271-3/+11
| | | | | | | | | | | | | | | | | That patch is the fix for https://bugs.llvm.org/show_bug.cgi?id=40703 "wrong line number info for obj file compiled with -ffunction-sections" bug. The problem happened with only .o files. If object file contains several .text sections then line number information showed incorrectly. The reason for this is that DwarfLineTable could not detect section which corresponds to specified address(because address is the local to the section). And as the result it could not select proper sequence in the line table. The fix is to pass SectionIndex with the address. So that it would be possible to differentiate addresses from various sections. With this fix llvm-objdump shows correct line numbers for disassembled code. Differential review: https://reviews.llvm.org/D58194 llvm-svn: 354972
* lvm-dwarfdump: Stop counting out-of-line subprogram in the "inlined ↵Caroline Tice2019-02-081-17/+28
| | | | | | | | | | functions" statistic. DW_TAG_subprogram DIEs should not be counted in the inlined function statistic. This also addresses the source variables count, as that uses the inlined function count in its calculations. Differential revision: https://reviews.llvm.org/D57849 llvm-svn: 353491
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-193-12/+9
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Revert r347490 as it breaks address sanitizer buildsLuke Cheeseman2018-11-231-0/+2
| | | | llvm-svn: 347499
* Revert r343341Luke Cheeseman2018-11-231-2/+0
| | | | | | | - Cannot reproduce the build failure locally and the build logs have been deleted. llvm-svn: 347490
* Add total function byte size and inline function byte size to ↵Greg Clayton2018-11-091-11/+35
| | | | | | | | "llvm-dwarfdump --statistics" Differential Revision: https://reviews.llvm.org/D54217 llvm-svn: 346531
* Make llvm-dwarfdump -name work on type units.Paul Robinson2018-10-241-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D53672 llvm-svn: 345203
* [dwarfdump] Make incompatibility between -diff and -verbose explicit.Jonas Devlieghere2018-10-231-1/+9
| | | | | | | | Using -diff and -verbose together doesn't work today. We should audit where these two options interact and fix them. In the meantime we error out when the user try to specify both. llvm-svn: 345084
* Use llvm::{all,any,none}_of instead std::{all,any,none}_of. NFCFangrui Song2018-10-191-1/+1
| | | | llvm-svn: 344774
* llvm-dwarfdump: Extend --name to also search DW_AT_linkage_name.Adrian Prantl2018-10-091-19/+32
| | | | | | rdar://problem/45132695 llvm-svn: 344079
* Add missing spaceAdrian Prantl2018-10-091-1/+1
| | | | llvm-svn: 344064
* [DebugInfo] Add support for DWARF5 call site-related attributesVedant Kumar2018-10-051-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DWARF v5 introduces DW_AT_call_all_calls, a subprogram attribute which indicates that all calls (both regular and tail) within the subprogram have call site entries. The information within these call site entries can be used by a debugger to populate backtraces with synthetic tail call frames. Tail calling frames go missing in backtraces because the frame of the caller is reused by the callee. Call site entries allow a debugger to reconstruct a sequence of (tail) calls which led from one function to another. This improves backtrace quality. There are limitations: tail recursion isn't handled, variables within synthetic frames may not survive to be inspected, etc. This approach is not novel, see: https://gcc.gnu.org/wiki/summit2010?action=AttachFile&do=get&target=jelinek.pdf This patch adds an IR-level flag (DIFlagAllCallsDescribed) which lowers to DW_AT_call_all_calls. It adds the minimal amount of DWARF generation support needed to emit standards-compliant call site entries. For easier deployment, when the debugger tuning is LLDB, the DWARF requirement is adjusted to v4. Testing: Apart from check-{llvm, clang}, I built a stage2 RelWithDebInfo clang binary. Its dSYM passed verification and grew by 1.4% compared to the baseline. 151,879 call site entries were added. rdar://42001377 Differential Revision: https://reviews.llvm.org/D49887 llvm-svn: 343883
* Format the dwarfdump --statistics version as an integer instead of a string.Adrian Prantl2018-10-051-1/+1
| | | | llvm-svn: 343864
* Revert r343317Luke Cheeseman2018-09-281-0/+2
| | | | | | - asan buildbots are breaking and I need to investigate the issue llvm-svn: 343341
* Reapply changes reverted by r343235Luke Cheeseman2018-09-281-2/+0
| | | | | | | | - Add fix so that all code paths that create DWARFContext with an ObjectFile initialise the target architecture in the context - Add an assert that the Arch is known in the Dwarf CallFrameString method llvm-svn: 343317
* Revert r343192 as an ubsan build is currently failingLuke Cheeseman2018-09-271-1/+1
| | | | llvm-svn: 343235
* Reapply changes reverted in r343114, lldb patch to follow shortlyLuke Cheeseman2018-09-271-1/+1
| | | | llvm-svn: 343192
* llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)Fangrui Song2018-09-271-1/+1
| | | | | | | | | | | | Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: dblaikie, javed.absar, JDevlieghere, andreadb Subscribers: MatzeB, sanjoy, arsenm, dschuff, mehdi_amini, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, eraman, aheejin, kbarton, JDevlieghere, javed.absar, gbedwell, jrtc27, mgrang, atanasyan, steven_wu, george.burgess.iv, dexonsmith, kristina, jsji, llvm-commits Differential Revision: https://reviews.llvm.org/D52573 llvm-svn: 343163
* Revert r343112 as CallFrameString API change has broken lldb buildsLuke Cheeseman2018-09-261-1/+1
| | | | llvm-svn: 343114
* [AArch64] - Return address signing dwarf supportLuke Cheeseman2018-09-261-1/+1
| | | | | | - Reapply r343089 with a fix for DebugInfo/Sparc/gnu-window-save.ll llvm-svn: 343112
* Revert r343089 "[AArch64] - Return address signing dwarf support"Hans Wennborg2018-09-261-1/+1
| | | | | | | | | | | | | | | | | | | This caused the DebugInfo/Sparc/gnu-window-save.ll test to fail. > Functions that have signed return addresses need additional dwarf support: > - After signing the LR, and before authenticating it, the LR register is in a > state the is unusable by a debugger or unwinder > - To account for this a new directive, .cfi_negate_ra_state, is added > - This directive says the signed state of the LR register has now changed, > i.e. unsigned -> signed or signed -> unsigned > - This directive has the same CFA code as the SPARC directive GNU_window_save > (0x2d), adding a macro to account for multiply defined codes > - This patch matches the gcc implementation of this support: > https://patchwork.ozlabs.org/patch/800271/ > > Differential Revision: https://reviews.llvm.org/D50136 llvm-svn: 343103
* [AArch64] - Return address signing dwarf supportLuke Cheeseman2018-09-261-1/+1
| | | | | | | | | | | | | | | | | Functions that have signed return addresses need additional dwarf support: - After signing the LR, and before authenticating it, the LR register is in a state the is unusable by a debugger or unwinder - To account for this a new directive, .cfi_negate_ra_state, is added - This directive says the signed state of the LR register has now changed, i.e. unsigned -> signed or signed -> unsigned - This directive has the same CFA code as the SPARC directive GNU_window_save (0x2d), adding a macro to account for multiply defined codes - This patch matches the gcc implementation of this support: https://patchwork.ozlabs.org/patch/800271/ Differential Revision: https://reviews.llvm.org/D50136 llvm-svn: 343089
* llvm-dwarfdump --statistics: Unique abstract origins across multiple CUs.Adrian Prantl2018-09-211-23/+46
| | | | | | | | Instead of indexing local variables by DIE offset, use the variable name + the path through the lexical block tree. This makes the lookup key consistent across duplicate abstract origins in different CUs. llvm-svn: 342776
* [DebugInfo/DWARF] Remove redundant iterator type. NFCPaul Robinson2018-08-021-2/+2
| | | | llvm-svn: 338759
OpenPOWER on IntegriCloud