summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-dwarfdump
Commit message (Collapse)AuthorAgeFilesLines
* [DebugInfo] Improve error message textJames Henderson2020-01-101-1/+1
| | | | | | | | | | Unlike most of our errors in the debug line parser, the "no end of sequence" message was missing any reference to which line table it refererred to. This change adds the offset to this message. Reviewed by: dblaikie Differential Revision: https://reviews.llvm.org/D72443
* [DebugInfo] Remove redundant checks for past-the-end of prologueJames Henderson2020-01-031-11/+16
| | | | | | | | | | | | | | The V5 directory and filename tables had checks in to make sure we hadn't read past the end of the line table prologue. Since previous changes to the data extractor class ensure we never read past the end, these checks are now redundant, so this patch removes them. There is still a check to show that the whole prologue remains within the prologue length. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D71768
* [test][llvm-dwarfdump] Use --implicit-check-not to simplify test checksJames Henderson2020-01-031-11/+5
| | | | | | | | | This removes the need to duplicate the LASTONLY check pattern and the last part of the NONFATAL pattern in the modified test. Reviewed By: MaskRay, JDevlieghere Differential Revision: https://reviews.llvm.org/D71757
* [test][llvm-dwarfdump] Normalise contents and checks for line tablesJames Henderson2020-01-032-60/+86
| | | | | | | | | | | | | The line tables in debug_line_malformed.s had contents that varied more than was necessary for the testing, making it harder to follow what was important. This patch normalises them so that they all share more-or-less the same body. Additionally, it makes the testing for what was printed more consistent, to show that the right parts of the line table prologue and body are/are not parsed and printed. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D71755
* [test][llvm-dwarfdump] Add missing checks for table dumpingJames Henderson2020-01-031-1/+15
| | | | | | | | | | | | | | | Some of the tables in debug_line_malformed.s were not being checked in the NONFATAL checks in debug_line_invalid.test (only the warnings coming from them were being checked). This made the test harder to follow. Additionally, a later change will change the way the errors are handled such that more of the line table will be printed. That will require checks for these tables (or something equivalent) so that the difference in behaviour can be observed. This patch adds checks for the three tables that were missing checks. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D71753
* [test][llvm-dwarfdump][NFC] Remove unused checkJames Henderson2020-01-021-136/+133
| | | | | | Reviewed by: JDevlieghere Differential Revision: https://reviews.llvm.org/D71756
* [test][llvm-dwarfdump][NFC] Improve test readabilityJames Henderson2020-01-022-38/+68
| | | | | | | | | | | | | This patch adds and improves comments in the debug_line_invalid.test and its associated input file so that it is easier to follow. It uses '##' to make comments stand out from lit and FileCheck commands. It also reflows some commands so that the lines are not so long and are easier to read and fixes some copy/paste errors. Reviewed by: JDevlieghere Differential Revision: https://reviews.llvm.org/D71752
* DebugInfo: Support dumping any exprloc as an expressionDavid Blaikie2019-12-231-0/+101
| | | | | | | Now that DWARFv5 provides a way to identify DWARF expressions based on form, rather than only by attribute - use it to always provide pretty printing for any exprloc attribute, not only the attributes known to contain expressions.
* [DebugInfo] Fix verbose printing of rows added via DW_LNE_end_sequenceJames Henderson2019-12-191-0/+56
| | | | | | | | | | | The debug line verbose printing was printing the wrong values for rows added via DW_LNE_end_sequence, because the row was being printed AFTER its state had been reset following it being appended to the line table. This patch fixes this issue by printing the row before appending it. Reviewers: dblaikie, MaskRay Differential Revision: https://reviews.llvm.org/D71664
* DebugInfo: Don't use implicit zero addr_baseDavid Blaikie2019-12-181-7/+7
| | | | (found when LLVM fails to emit addr_base for gmlt+DWARFv5)
* [DebugInfo] Only print a single blank line after an empty line tableJames Henderson2019-12-171-2/+29
| | | | | | | | | | | | Commit 84a9756 added an extra blank line at the end of any line table. However, a blank line is also printed after the line table header, which meant that two blank lines in a row were being printed after a header, if there were no rows. This patch defers the post-header blank line printing until it has been determined that there are rows to print. Reviewed by: dblaikie Differential Revision: https://reviews.llvm.org/D71540
* [llvm-dwarfdump][Statistics] Don't count coverage less than 1% as 0%Kristina Bessonova2019-12-131-6/+6
| | | | | | | | | | | | | | | | | | | | | 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-60/+60
| | | | | | | | | | | | | | | | 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] Add blank line after printing line tableJames Henderson2019-12-121-0/+1
| | | | | | | | This helps delineate it in the output from later tables or other output. Reviewed by: JDevlieghere Differential Revision: https://reviews.llvm.org/D71344
* [test][llvm-dwarfdump] Add missing testing for some --debug-* optionsJames Henderson2019-12-114-0/+271
| | | | | | | | | | | | | | | | | A number of the --debug-* options in llvm-dwarfdump are not particularly well tested. In some cases, the option is only tested as part of testing another feature, or a specific part of the section that the options dump. This change adds four new tests to address some of these holes. It is not aiming to address every hole however. I kept the --debug-line switch test separate to X86/brief.s because the latter only considers the parts of the line table that are affected by verbose printing, thus missing out things like the header and different values for things like the Line, Column etc registers. Reviewed by: JDevlieghere Differential Revision: https://reviews.llvm.org/D71276
* [DWARF][RISCV] Test resolving of RISC-V relocationsLuís Marques2019-12-102-0/+194
| | | | | | | | | | | Summary: This patch adds an object file (in yaml format) with a synthetic .debug_info section which we use to test that the supported RISC-V relocations are properly resolved. Reviewers: asb, lenary, MaskRay Reviewed By: MaskRay Tags: #llvm Differential Revision: https://reviews.llvm.org/D70541
* [llvm/dwarfdump] Use the architecture string to filter.Jonas Devlieghere2019-12-092-1/+4
| | | | | | | | | | | | | | | | | | 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-085-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [llvm/DWARF] Return section offset from DWARFUnit::get{Loc,Rng}listOffsetPavel Labath2019-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently these function return the raw content of the appropriate table header, which means they are relative to the DW_AT_{loc,rng}list_base, and one has to relocate them in order to do anything. This changes the functions to perform the relocation themselves, which seems more clearer, particularly as they are sitting right next to the find{Rng,Loc}listFromOffset functions, but one *cannot* simply take the result of these functions and take pass them there. The only effect of this patch is to change what value is dumped for the DW_AT_ranges attribute, which I think is for the better, as previously the values appeared to point into thin air. (The main reason I am looking at this is because I was trying to implement equivalent functionality in lldb's DWARFUnit, and was stumped by this behavior. Reviewers: dblaikie, JDevlieghere, aprantl Subscribers: hiraditya, llvm-commits, SouraVX Tags: #llvm Differential Revision: https://reviews.llvm.org/D71006
* [DWARFDebugLoclists] Add support for other DW_LLE encodingsPavel Labath2019-12-041-24/+89
| | | | | | | | | | | | | | | Summary: lldb's loclists parser has support for DW_LLE_start_end(x) encodings. To avoid regressing when switching the implementation to llvm's, I add parsing support for all previously unsupported location list encodings. Reviewers: dblaikie, JDevlieghere, aprantl, SouraVX Subscribers: hiraditya, probinson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70949
* [DWARF] Add support for parsing/dumping section indices in location listsPavel Labath2019-12-031-7/+38
| | | | | | | | | | | | | | | | | | | Summary: This does exactly what it says on the box. The only small gotcha is the section index computation for offset_pair entries, which can use either the base address section, or the section from the offset_pair entry. This is to support both the cases where the base address is relocated (points to the base of the CU, typically), and the case where the base address is a constant (typically zero) and relocations are on the offsets themselves. Reviewers: dblaikie, JDevlieghere, aprantl, SouraVX Subscribers: hiraditya, llvm-commits, probinson Tags: #llvm Differential Revision: https://reviews.llvm.org/D70540
* [DWARFVerifier] Use the new location list apiPavel Labath2019-11-221-0/+7
| | | | | | | | | | | | | | | | | | Summary: Instead of going to the debug_loc section directly, use new DWARFDie::getLocations instead. This means that the code will now automatically support debug_loclists sections. This is the last usage of the old debug_loc methods, and they can now be removed. Reviewers: dblaikie, JDevlieghere, aprantl, SouraVX Subscribers: hiraditya, probinson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70534
* dwarfdump --statistics: Use new location list apiPavel Labath2019-11-212-2/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [DebugInfo] Remove the DIFlagArgumentNotModified debug info flagDjordje Todorovic2019-11-203-6/+6
| | | | | | | Due to changes in D68206, we remove the DIFlagArgumentNotModified and its usage. Differential Revision: https://reviews.llvm.org/D68207
* [NFC] Clean up debug-names-verify-completeness.s testPavel Labath2019-11-181-179/+157
| | | | | | | This patch replaces the tabs by spaces and avoid the need for a debug_str section by moving all strings inline. It also removes the hardcoded DIE offsets in the test, which will simplify a follow-up patch.
* DWARFDebugLoc(v4): Add an incremental parsing functionPavel Labath2019-11-154-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* DWARFDebugLoclists: stricter base address handlingPavel Labath2019-11-142-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This removes the use of zero as a base address in section-based dumping. Although this will often be true for (unlinked) object files with a single compile unit, it is not true in general. This means that section-based dumping will not be able to resolve entries referencing the base address (DW_LLE_offset_pair) -- it wasn't able to do that correctly before either, but now it will be more explicit about it. One exception to that is if the location list contains an explicit DW_LLE_base_address entry -- in this case the dumper will pick it up, and resolve subsequent entries normally. The patch also removes the fallback to zero in the "inline" dumping in case the compile unit does not contain a base address. Reviewers: dblaikie, probinson, JDevlieghere, aprantl, SouraVX Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70115
* DWARFDebugLoclists: add location list "interpretation" logicPavel Labath2019-11-123-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch extracts the logic for computing the "absolute" locations, which was partially present in the debug_loclists dumper, completes it, and moves it into a separate function. This makes it possible to later reuse the same logic for uses other than dumping. The dumper is changed to reuse the location list interpreter, and its format is changed somewhat. In "verbose" mode it prints the "raw" value of a location list, the interpreted location (if available) and the expression itself. In non-verbose mode it prints only one of the location forms: it prefers the interpreted form, but falls back to the "raw" format if interpretation is not possible (for instance, because we were not given a base address, or the resolution of indirect addresses failed). This patch also undos some of the changes made in D69672, namely the part about making all functions static. The main reason for this is that I learned that the original approach (dumping only fully resolved locations) meant that it was impossible to rewrite one of the existing tests. To make that possible (and make the "inline location" dump work in more cases), I now reuse the same dumping mechanism as is used for section-based dumping. As this required having more objects know about the various location lists classes, it seemed like a good idea to create an interface abstracting the difference between them. Therefore, I now create a DWARFLocationTable class, which will serve as a base class for the location list classes. DWARFDebugLoclists is made to inherit from that. DWARFDebugLoc will follow. Another positive effect of this change is that section-based dumping code will not need to use templates (as originally) envisioned, and that the argument lists of the dumping functions become shorter. Reviewers: dblaikie, probinson, JDevlieghere, aprantl, SouraVX Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70081
* DWARFDebugLoclists: Move to a incremental parsing modelPavel Labath2019-11-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch stems from the discussion D68270 (including some offline talks). The idea is to provide an "incremental" api for parsing location lists, which will avoid caching or materializing parsed data. An additional goal is to provide a high level location list api, which abstracts the differences between different encoding schemes, and can be used by users which don't care about those (such as LLDB). This patch implements the first part. It implements a call-back based "visitLocationList" api. This function parses a single location list, calling a user-specified callback for each entry. This is going to be the base api, which other location list functions (right now, just the dumping code) are going to be based on. Future patches will do something similar for the v4 location lists, and add a mechanism to translate raw entries into concrete address ranges. Reviewers: dblaikie, probinson, JDevlieghere, aprantl, SouraVX Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69672
* DWARFDebugLoclists: Make it possible to read relocated addressesPavel Labath2019-11-051-0/+120
| | | | | | | | | | | | | | | | | Summary: Handling relocations was not needed when the loclists section was a DWO-only thing. But since DWARF5, it is possible to use it in regular objects too, and the standard permits embedding addresses into the section directly. These addresses need to be relocated in unlinked files. Reviewers: JDevlieghere, dblaikie, probinson Subscribers: aprantl, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68271
* [llvm/Object] - Make ELFObjectFile::getRelocatedSection return ↵George Rimar2019-10-211-0/+20
| | | | | | | | | | | | | Expected<section_iterator> It returns just a section_iterator currently and have a report_fatal_error call inside. This change adds a way to return errors and handle them on caller sides. The patch also changes/improves current users and adds test cases. Differential revision: https://reviews.llvm.org/D69167 llvm-svn: 375408
* llvm-dwarfdump: Add verbose printing for debug_loclistsDavid Blaikie2019-10-111-1/+3
| | | | llvm-svn: 374582
* llvm-dwarfdump: Support multiple debug_loclists contributionsDavid Blaikie2019-10-092-1/+45
| | | | | | | Also fixing the incorrect "offset" field being computed/printed for each location list. llvm-svn: 374232
* [llvm-dwarfdump] Fix dumping of wrong locstats mapDjordje Todorovic2019-10-021-3/+3
| | | | llvm-svn: 373469
* Fixup r373278: Move test to X86 directoryDiana Picus2019-10-011-0/+0
| | | | | | ...since it's using an x86 triple. llvm-svn: 373314
* DebugInfo: Add parsing support for debug_loc base address specifiersDavid Blaikie2019-10-011-0/+34
| | | | llvm-svn: 373278
* Revert "Reland "[utils] Implement the llvm-locstats tool""Djordje Todorovic2019-09-231-17/+0
| | | | | | This reverts commit rL372554. llvm-svn: 372580
* Reland "[utils] Implement the llvm-locstats tool"Djordje Todorovic2019-09-231-0/+17
| | | | | | | | | | | | | | | | The tool reports verbose output for the DWARF debug location coverage. The llvm-locstats for each variable or formal parameter DIE computes what percentage from the code section bytes, where it is in scope, it has location description. The line 0 shows the number (and the percentage) of DIEs with no location information, but the line 100 shows the number (and the percentage) of DIEs where there is location information in all code section bytes (where the variable or parameter is in the scope). The line 50..59 shows the number (and the percentage) of DIEs where the location information is in between 50 and 59 percentage of its scope covered. Differential Revision: https://reviews.llvm.org/D66526 llvm-svn: 372554
* Revert "[utils] Implement the llvm-locstats tool"Djordje Todorovic2019-09-101-17/+0
| | | | | | This reverts commit rL371520. llvm-svn: 371527
* [utils] Implement the llvm-locstats toolDjordje Todorovic2019-09-101-0/+17
| | | | | | | | | | | | | | | | | | | The tool reports verbose output for the DWARF debug location coverage. The llvm-locstats for each variable or formal parameter DIE computes what percentage from the code section bytes, where it is in scope, it has location description. The line 0 shows the number (and the percentage) of DIEs with no location information, but the line 100 shows the number (and the percentage) of DIEs where there is location information in all code section bytes (where the variable or parameter is in the scope). The line 50..59 shows the number (and the percentage) of DIEs where the location information is in between 50 and 59 percentage of its scope covered. The tool will be very useful for tracking improvements regarding the "debugging optimized code" support with LLVM ecosystem. Differential Revision: https://reviews.llvm.org/D66526 llvm-svn: 371520
* [Object] Implement relocation resolver for COFF ARM/ARM64Martin Storsjo2019-09-104-0/+594
| | | | | | | | | | Adding testscases for this via llvm-dwarfdump. Also add testcases for the existing resolver support for X86. Differential Revision: https://reviews.llvm.org/D67340 llvm-svn: 371515
* [llvm-dwarfdump] Add additional stats fieldsDjordje Todorovic2019-09-101-0/+211
| | | | | | | | | | 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
* [test] Update the name of the debug entry values option. NFCDjordje Todorovic2019-09-061-1/+1
| | | | llvm-svn: 371199
* [DWARF] Support DWARF64 in DWARFListTableHeader.Igor Kudrin2019-09-054-7/+47
| | | | | | | | This enables 64-bit DWARF support for parsing range and location list tables. Differential Revision: https://reviews.llvm.org/D66643 llvm-svn: 371014
* [DWARFVerifier] Verify GNU extensions of call site DWARF symbolsDjordje Todorovic2019-09-021-0/+103
| | | | | | | | | Verify that the call site DWARF symbols (added during the implementation of the debug entry values feature) are generated properly. Differential Revision: https://reviews.llvm.org/D66865 llvm-svn: 370631
* [DWARF] Fix reading 64-bit DWARF type units.Igor Kudrin2019-08-202-0/+115
| | | | | | | | | | The type_offset field is 8 bytes long in DWARF64. The patch extends TypeOffset to uint64_t and fixes its reading. The patch also fixes checking of TypeOffset bounds as it was inaccurate in DWARF64 case. Differential Revision: https://reviews.llvm.org/D66465 llvm-svn: 369378
* [DWARF] Fix DWARFUnit::getDebugInfoSize() for 64-bit DWARF.Igor Kudrin2019-08-201-0/+37
| | | | | | | | The calculation there was correct only for DWARF32. Differential Revision: https://reviews.llvm.org/D66421 llvm-svn: 369356
* Reland "[DwarfDebug] Dump call site debug info"Djordje Todorovic2019-07-311-0/+76
| | | | | | | | | The build failure found after the rL365467 has been resolved. Differential Revision: https://reviews.llvm.org/D60716 llvm-svn: 367446
* [DWARF] Add more error handling to debug line parser.Jonas Devlieghere2019-07-222-2/+175
| | | | | | | | | | This patch exnteds the error handling in the debug line parser to get rid of the existing MD5 assertion. I want to reuse the debug line parser from LLVM in LLDB where we cannot crash on invalid input. Differential revision: https://reviews.llvm.org/D64544 llvm-svn: 366762
* Revert "[DwarfDebug] Dump call site debug info"Djordje Todorovic2019-07-121-76/+0
| | | | | | | | A build failure was found on the SystemZ platform. This reverts commit 9e7e73578e54cd22b3c7af4b54274d743b6607cc. llvm-svn: 365886
OpenPOWER on IntegriCloud