summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Fixes -Wrange-loop-analysis warningsMark de Wever2020-01-011-1/+1
| | | | | | This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D71857
* [DWARF5][DWARFVerifier] Check that Skeleton compilation unit does not have ↵Alexey Lapshin2019-12-121-0/+8
| | | | | | | | | children. That patch adds checking into DWARFVerifier that the Skeleton compilation unit does not have children. Differential Revision: https://reviews.llvm.org/D71244
* [DWARFVerifier] Use the new location list apiPavel Labath2019-11-221-43/+25
| | | | | | | | | | | | | | | | | | 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
* [Debuginfo][NFC] removes redundant semicolon.Alexey Lapshin2019-11-211-1/+1
|
* DWARFDebugLoc(v4): Add an incremental parsing functionPavel Labath2019-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix minor warning in DWARFVerifier.Zinovy Nis2019-10-201-2/+2
| | | | llvm-svn: 375357
* [DWARFVerifier] Verify GNU extensions of call site DWARF symbolsDjordje Todorovic2019-09-021-2/+7
| | | | | | | | | 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
* DWARFDebugLoc: Make parsing and error reporting more robustPavel Labath2019-08-291-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: While examining this class for possible use in lldb, I noticed two things: - it spits out parsing errors directly to stderr - the loclists parser can incorrectly return valid location lists when parsing malformed (truncated) data I improve the stderr situation by making the parseOneLocationList functions return Expected<T>s. The errors are still dumped to stderr by their callers, so this is only a partial fix, but it is enough for my use case, as I intend to parse the locations lists one by one. I fix the behavior in the truncated scenario by using the newly introduced DataExtractor Cursor API. I also add tests for handling the error cases, as they currently have no coverage. Reviewers: dblaikie, JDevlieghere, probinson Subscribers: lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63591 llvm-svn: 370363
* [llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-151-2/+2
| | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
* DebugInfo/DWARF: Normalize DWARFObject members on the DWARF spec section namesDavid Blaikie2019-08-071-13/+13
| | | | | | | | | Some of these names were abbreviated, some were not, some pluralised, some not. Made the API difficult to use - since it's an exact 1:1 mapping to the DWARF sections - use those names (changing underscore separation for camel casing). llvm-svn: 368189
* Switch LLVM to use 64-bit offsets (2/5)Igor Kudrin2019-08-061-29/+30
| | | | | | | | | This updates all libraries and tools in LLVM Core to use 64-bit offsets which directly or indirectly come to DataExtractor. Differential Revision: https://reviews.llvm.org/D65638 llvm-svn: 368014
* [DWARF] Change DWARFDebugLoc::Entry::Loc from SmallVector<char, 4> to ↵Fangrui Song2019-08-051-2/+2
| | | | | | | | | SmallString<4> SmallString has a conversion to StringRef, which can be leveraged to simplify two use sites. llvm-svn: 367801
* [DWARF][NFC] Add constants for reserved values of an initial length field.Igor Kudrin2019-07-241-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D65039 llvm-svn: 366887
* dwarfdump: Add a bit more DWARF64 supportDavid Blaikie2019-05-241-8/+5
| | | | | | | | | | | | This test case was incorrect because it mixed DWARF32 and DWARF64 for a single unit (DWARF32 unit referencing a DWARF64 str_offsets section). So fix enough of the unit parsing for DWARF64 and make the test valid. (not sure if anyone needs DWARF64 support though - support in libDebugInfoDWARF has been added piecemeal and LLVM doesn't produce it at all) llvm-svn: 361582
* [DWARF] Use hasFileAtIndex to properly verify DWARF 5 after rL358732Fangrui Song2019-04-191-3/+5
| | | | llvm-svn: 358734
* [DWARF] Pass ReferenceToDIEOffsets elements by referenceFangrui Song2019-04-171-3/+3
| | | | llvm-svn: 358558
* [DWARF] Fix DWARFVerifier::DieRangeInfo::containsFangrui Song2019-04-151-19/+18
| | | | | | | | | It didn't handle empty LHS correctly. If two ranges of LHS were contiguous and jointly contained one range of RHS, it could also be incorrect. DWARFAddressRange::contains can be removed and its tests can be merged into DWARFVerifier::DieRangeInfo::contains llvm-svn: 358387
* [DWARF] Fix DWARFVerifier::DieRangeInfo::intersectsFangrui Song2019-04-151-16/+9
| | | | | | It was incorrect if RHS had more than 1 ranges and one of the ranges interacted with *this llvm-svn: 358376
* [dwarfdump] Remove bogus verifier errorJonas Devlieghere2019-04-031-11/+1
| | | | | | | | The standard doesn't require a DW_TAG_variable, DW_TAG_formal_parameter or DW_TAG_constant to A DW_AT_type attribute describing the type of the variable. It only specifies that it *can* have one. llvm-svn: 357628
* [DWARF] Simplify DWARFVerifier::handleDebugAbbrev. NFCFangrui Song2019-03-271-10/+3
| | | | llvm-svn: 357053
* [DebugInfo] add SectionedAddress to DebugInfo interfaces.Alexey Lapshin2019-02-271-2/+2
| | | | | | | | | | | | | | | | | 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
* [DebugInfo] Prep llvm-dwarfdump for typed DW5 ops.Markus Lavin2019-02-211-1/+1
| | | | | | | | | | | Adds llvm-dwarfdump support for pretty printing Dwarf5 expressions ops that reference a base type (right now only DW_OP_convert is added). Includes verification to verify that the ops operand is actually a DW_TAG_base_type DIE. Differential Revision: https://reviews.llvm.org/D58442 llvm-svn: 354552
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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
* [DWARFv5] Read and dump multiple .debug_info sections.Paul Robinson2018-11-071-5/+8
| | | | | | | | Type units go in .debug_info comdats, not .debug_types, in v5. Differential Revision: https://reviews.llvm.org/D53907 llvm-svn: 346360
* [DWARF v5] Verifier: Add checks for DW_FORM_strx* forms.Wolfgang Pieb2018-11-031-0/+39
| | | | | | | | | Adding functionality to the DWARF verifier for DWARF v5 strx* forms which index into the string offsets table. Differential Revision: https://reviews.llvm.org/D54049 llvm-svn: 346061
* DWARFVerifier: make the verifier more comprehensive for objectsSaleem Abdulrasool2018-10-301-1/+1
| | | | | | | Make the code do what was mentioned in the comment: only skip the CU types. This enables the lexical blocks to be verified as well. llvm-svn: 345675
* Revert "Revert "DebugInfo: reduce DIE range verification on object files""Saleem Abdulrasool2018-10-281-13/+45
| | | | | | | This reverts commit 836c763dadbd9478fa35b1a291a38bf17aa206ba. Default initialize the values that MSAN caught. llvm-svn: 345482
* Revert "DebugInfo: reduce DIE range verification on object files"Vlad Tsyrklevich2018-10-271-44/+13
| | | | | | | This reverts commits r345441 and r345444, they were causing msan buildbot failures. llvm-svn: 345457
* DebugInfo: reduce DIE range verification on object filesSaleem Abdulrasool2018-10-271-13/+44
| | | | | | | | Relocatable content may have overlapping ranges until the sections are finalized. This reduces the amount of verification that is done on an object file so that invalid errors are not raised. llvm-svn: 345441
* [DWARF] Make llvm-dwarfdump display location lists in a .dwp file correctly. ↵Wolfgang Pieb2018-10-191-6/+8
| | | | | | | | | | | | | Fixes PR38990. Considers the index when extracting location lists from a .dwp file. Majority of the patch by David Blaikie. Reviewers: dblaikie Differential revision: https://reviews.llvm.org/D53155 llvm-svn: 344807
* [DwarfVerifier] Fixed -Wimplicit-fallthrough warningDavid Bolvansky2018-10-101-1/+2
| | | | | | | | | | | | Reviewers: JDevlieghere, RKSimon Reviewed By: JDevlieghere Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D52963 llvm-svn: 344176
* [DebugInfo] Add support for DWARF5 call site-related attributesVedant Kumar2018-10-051-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [dwarfdump] Verify DW_AT_type is set and points to a compatible DIE.Jonas Devlieghere2018-09-211-0/+21
| | | | | | | | | | | | | This extends the verifier to catch three new errors: * Missing DW_AT_type attributes for DW_TAG_formal_parameter, DW_TAG_variable and DW_TAG_array_type. * Valid references for DW_AT_type pointing to a non-type tag. Differential revision: https://reviews.llvm.org/D52223 llvm-svn: 342713
* [dwarfdump] Verify compatibility of attribute TAGs.Jonas Devlieghere2018-09-211-7/+25
| | | | | | | | | Verify that DW_AT_specification and DW_AT_abstract_origin reference a DIE with a compatible tag. Differential revision: https://reviews.llvm.org/D38719 llvm-svn: 342712
* [DWARF Verifier] Add helper function to dump DIEs. [NFC]Jonas Devlieghere2018-09-191-24/+18
| | | | | | | | | It's pretty common for the verifier to dump the relevant DIE when it finds an issue. This tends to be relatively verbose and error prone because we have to pass the DIDumpOptions to the DIE's dump method. This patch adds a helper function to the verifier to make this easier. llvm-svn: 342526
* [DebugInfo] Remove redundant argument. [NFC]Jonas Devlieghere2018-09-171-18/+17
| | | | | | | Removes the redundant UnitType parameter from verifyUnitContents. I also fixed some formatting issues as I was touching the file. llvm-svn: 342396
* [DebugInfo] Have the verifier accept missing linkage names.Jonas Devlieghere2018-09-031-5/+10
| | | | | | | | | | | | | | | | | | According to the standard, for the .debug_names (the "dwarf accelerator tables"): > If a subprogram or inlined subroutine is included, and has a > DW_AT_linkage_name attribute, there will be an additional index entry > for the linkage name. For Swift we generate DW_structure_types with a linkage name and the verifier was incorrectly rejecting this. This patch fixes that by only considering the linkage name in those particular cases. The test is the "reduced" debug info of the failing swift test on swift.org. Differential revision: https://reviews.llvm.org/D51420 llvm-svn: 341311
* [DWARF] Verifier now handles .debug_types sections.Paul Robinson2018-08-081-23/+35
| | | | | | Differential Revision: https://reviews.llvm.org/D50466 llvm-svn: 339302
* [DebugInfo/Verifier] Don't emit error for missing module in indexJonas Devlieghere2018-08-031-1/+2
| | | | | | | | | We don't expect module names to be present in the index. This patch adds DW_TAG_module to the blacklist. Differential revision: https://reviews.llvm.org/D50237 llvm-svn: 338878
* [DebugInfo/DWARF] [3/4] Rename DWARFUnitSection to DWARFUnitVector. NFCPaul Robinson2018-08-011-3/+3
| | | | | | | | | | | | | This is patch 3 of 4 NFC refactorings to handle type units and compile units more consistently and with less concern about the object-file section that they came from. Patch 3 simply renames DWARFUnitSection to DWARFUnitVector, as the object-file section of a unit is nearly irrelevant now. Differential Revision: https://reviews.llvm.org/D49743 llvm-svn: 338632
* [DebugInfo/DWARF] [1/4] De-templatize DWARFUnitSection. NFCPaul Robinson2018-08-011-7/+7
| | | | | | | | | | | | | | | This is patch 1 of 4 NFC refactorings to handle type units and compile units more consistently and with less concern about the object-file section that they came from. Patch 1 replaces the templated DWARFUnitSection with a non-templated version. That is, instead of being a SmallVector of pointers to a specific unit kind, it is not a SmallVector of pointers to the base class for both type and compile units. Virtual methods are magic. Differential Revision: https://reviews.llvm.org/D49741 llvm-svn: 338628
* Pass DWARFUnit to verifier by reference not by value. I am moderatelyPaul Robinson2018-06-291-1/+1
| | | | | | sure this should not cause a memory leak. llvm-svn: 336007
* [DWARF] Improved error reporting for range lists. Wolfgang Pieb2018-06-201-1/+8
| | | | | | | | | | | Errors found processing the DW_AT_ranges attribute are propagated by lower level routines and reported by their callers. Reviewer: JDevlieghere Differential Revision: https://reviews.llvm.org/D48344 llvm-svn: 335188
* [DWARF/AccelTable] Remove getDIESectionOffset for DWARF v5 entriesPavel Labath2018-06-131-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This method was not correct for entries in DWO files as it assumed it could just add up the CU and DIE offsets to get the absolute DIE offset. This is not correct for the DWO files, as here the CU offset will reference the skeleton unit, whereas the DIE offset will be the offset in the full unit in the DWO file. Unfortunately, this means that we are not able to determine the absolute DIE offset using the information in the .debug_names section alone, which means we have to offload some of this work to the users of this class. To demonstrate how this can be done, I've added/fixed the ability to lookup entries using accelerator tables in DWO files in llvm-dwarfdump. To make this happen, I've needed to make two extra changes in other classes: - made the DWARFContext method to lookup a CU based on the section offset public. I've needed this functionality to lookup a CU, and this seems like a useful thing in general. - made DWARFUnit::getDWOId call extractDIEsIfNeeded. Before this, the DWOId was filled in only if the root DIE happened to be parsed before we called the accessor. Since the lazy parsing is supposed to happen under the hood, calling extractDIEsIfNeeded seems appropriate. Reviewers: JDevlieghere, aprantl, dblaikie Subscribers: mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D48009 llvm-svn: 334578
* DWARFAcceleratorTable: Add an iterator-based api for accessing names in the ↵Pavel Labath2018-06-011-19/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | index Summary: Back when we were introducing the DWARF v5 name index, there was a short discussion whether we shouldn't have a nicer api for iterating over the index. At that time, I did not find it necessary since the iteration over names was done only from within the index itself (and I figured the internal implementation can deal with a slightly rough interface). However, now I ran into a use for this kind of API in LLDB (for finding all names matching a regular expression), so it looked like a nice opportunity to introduce one. To make the API more useful, I've made the NameTableEntry class a bit smarter: it now stores the string section reference (so it can return its name) and its position in the name index (mainly useful for dumping/logging). I also convert the internal users to use the new API, which also gives test coverage for the added code. Reviewers: JDevlieghere, aprantl, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47590 llvm-svn: 333738
* [DebugInfo] Invert DIE order for range errors.Jonas Devlieghere2018-05-221-3/+2
| | | | | | | | | When printing an error for an invalid address range in a DIE, we used to print the child above the parent, which is counter intuitive. This patch reverses the order and indents the child to mimic the way we print the debug info section. llvm-svn: 333006
* [DebugInfo] Fix location list check in the verifierJonas Devlieghere2018-05-221-4/+4
| | | | | | | We weren't properly verifying location lists because we tried obtaining the offset as a constant. llvm-svn: 333005
* Reapply "DWARFVerifier: Check "completeness" of .debug_names section"Pavel Labath2018-05-151-0/+145
| | | | | | | | | This is a resubmit of r331868 (D46583), which was reverted due to failures on the PS4 bot. These have been resolved with r332246/D46748. llvm-svn: 332349
* [DWARF] Factor out a DWARFUnitHeader class. NFCPaul Robinson2018-05-141-7/+6
| | | | | | | | | | | Extract information related to a "unit header" from DWARFUnit into a new DWARFUnitHeader class, and add a DWARFUnit member for the header. This is one step in the direction of allowing type units in the .debug_info section for DWARF v5. Differential Revision: https://reviews.llvm.org/D46707 llvm-svn: 332289
* [CodeGen/AccelTable]: Handle -dwarf-linkage-names=Abstract correctlyPavel Labath2018-05-141-0/+1
| | | | | | | | | | | | | | | | | | | | Summary: If we are not emitting a linkage name in the .debug_info sections, we should not add it into the index either. This makes sure our index is consistent with the actual debug info. I am also explicitly setting the --dwarf-linkage-names=All in the name-collsions test as that one would now fail on targets where this defaults to "Abstract" (in fact, it would have failed already if there wasn't a bug in the DWARF verifier, which I fix as well). Reviewers: probinson, aprantl, JDevlieghere Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46748 llvm-svn: 332246
OpenPOWER on IntegriCloud