summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix unused variable warning. NFCI.Simon Pilgrim2018-09-131-1/+1
| | | | llvm-svn: 342128
* DebugInfo/PDB: Remove unused memberDavid Blaikie2018-09-131-2/+2
| | | | llvm-svn: 342101
* dwarfdump: Improve performance on large DWP filesDavid Blaikie2018-09-121-8/+21
| | | | llvm-svn: 342099
* [PDB] Remove all clone() methods.Zachary Turner2018-09-1218-98/+0
| | | | | | | These are dead code and encourage poor usage patterns, so I'm removing them. They weren't called anywhere anyway. llvm-svn: 342093
* [PDB] Emit old fpo data to the PDB file.Zachary Turner2018-09-121-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | r342003 added support for emitting FPO data from the DEBUG_S_FRAMEDATA subsection of the .debug$S section to the PDB file. However, that is not the end of the story. FPO can end up in two different destinations in a PDB, each corresponding to a different FPO data source. The case handled by r342003 involves copying data from the DEBUG_S_FRAMEDATA subsection of the .debug$S section to the "New FPO" stream in the PDB, which is then referred to by the DBI stream. The case handled by this patch involves copying records from the .debug$F section of an object file to the "FPO" stream (or perhaps more aptly, the "Old FPO" stream) in the PDB file, which is also referred to by the DBI stream. The formats are largely similar, and the difference is mostly only visible in masm generated object files, such as some of the low-level CRT object files like memcpy. MASM doesn't appear to support writing the DEBUG_S_FRAMEDATA subsection, and instead just writes these records to the .debug$F section. Although clang-cl does not emit a .debug$F section ever, lld still needs to support it so we have good debugging for CRT functions. Differential Revision: https://reviews.llvm.org/D51958 llvm-svn: 342080
* Reverting r342048, which caused UBSan failures in dsymutil.Wolfgang Pieb2018-09-127-201/+221
| | | | llvm-svn: 342056
* [DWARF] Refactoring range list dumping to fold DWARF v4 functionality into ↵Wolfgang Pieb2018-09-127-221/+201
| | | | | | | | | | | | | v5 handling Eliminating some duplication of rangelist dumping code at the expense of some version-dependent code in dump and extract routines. Reviewer: dblaikie, JDevlieghere, vleschuk Differential revision: https://reviews.llvm.org/D51081 llvm-svn: 342048
* [PDB] Write FPO Data to the PDB.Zachary Turner2018-09-112-10/+53
| | | | llvm-svn: 342003
* [codeview] Decode and dump FP regs from S_FRAMEPROC recordsReid Kleckner2018-09-112-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There are two registers encoded in the S_FRAMEPROC flags: one for locals and one for parameters. The encoding is described by the ExpandEncodedBasePointerReg function in cvinfo.h. Two bits are used to indicate one of four possible values: 0: no register - Used when there are no variables. 1: SP / standard - Variables are stored relative to the standard SP for the ISA. 2: FP - Variables are addressed relative to the ISA frame pointer, i.e. EBP on x86. If realignment is required, parameters use this. If a dynamic alloca is used, locals will be EBP relative. 3: Alternative - Variables are stored relative to some alternative third callee-saved register. This is required to address highly aligned locals when there are dynamic stack adjustments. In this case, both the incoming SP saved in the standard FP and the current SP are at some dynamic offset from the locals. LLVM uses ESI in this case, MSVC uses EBX. Most of the changes in this patch are to pass around the CPU so that we can decode these into real, named architectural registers. Subscribers: hiraditya Differential Revision: https://reviews.llvm.org/D51894 llvm-svn: 341999
* pdb output: Initialize padding in PublicsStreamHeader.Nico Weber2018-09-111-2/+3
| | | | | | | | | Makes the produced pdbs more deterministic; before they'd contain 2 arbitary bytes where this padding was. Also reorder initialization to match the order of the fields in the struct (nfc) llvm-svn: 341945
* llvm-symbolizer: Fix bug related to TUs interfering with symbolizingDavid Blaikie2018-09-111-13/+16
| | | | | | | | | | | With the merge of TUs and CUs into a single container, some code that relied on the CU range having an ordered range of contiguous addresses (for locating a CU at a given offset) broke. But the units from debug_info (currently only CUs, but CUs and TUs in DWARFv5) are in a contiguous sub-range of that container - searching only through that subrange is still valid & so do that. llvm-svn: 341889
* Re-run clang-format on one file.Zachary Turner2018-09-101-133/+184
| | | | | | | | | clang-format was getting confused due to the presence of a macro invocation that was not terminated by a semicolon. Fixed this by terminating the macro lines with semicolons and re-ran clang-format on the file. llvm-svn: 341864
* [PDB] Change uint32_t to SymIndex wherever it makes sense.Zachary Turner2018-09-107-52/+31
| | | | | | Although it's just a typedef, it helps for readability. NFC. llvm-svn: 341863
* [LLD][COFF] Cleanup error messages / add more coverage testsAlexandre Ganea2018-09-101-1/+1
| | | | | | | | | | | | - Log the reason for a PDB or precompiled-OBJ load failure - Properly handle out-of-date PDB or precompiled-OBJ signature by displaying a corresponding error - Slightly change behavior on PDB failure: any subsequent load attempt from another OBJ would result in the same error message being logged - Slightly change behavior on PDB failure: retry with filename only if previous error was ENOENT ("no such file or directory") - Tests: a. for native PDB errors; b. cover all the cases above Differential Revision: https://reviews.llvm.org/D51559 llvm-svn: 341825
* Fix some of the PDB tests.Zachary Turner2018-09-071-2/+0
| | | | | | | | They were unintentionally calling DIA directly, which requires Windows. We need to pass the -native flag, and this then required fixing up one or two tests. llvm-svn: 341731
* [PDB] Support pointer types in the native reader.Zachary Turner2018-09-0710-195/+364
| | | | | | | | | | In order to start testing this, I've added a new mode to llvm-pdbutil which is only really useful for writing tests. It just dumps the value of raw fields in record format. This isn't really ideal and it won't allow us to test some important cases, but it's better than nothing for now. llvm-svn: 341729
* [PDB] Rename some files in the native reader.Zachary Turner2018-09-077-81/+80
| | | | | | | By calling these NativeType<foo>.cpp, they will all be sorted together, and it also distinguishes the types from the symbols. llvm-svn: 341609
* [PDB] Create a SymbolCache class.Zachary Turner2018-09-077-140/+194
| | | | | | | | | | | | | Part of the responsibility of the native PDB reader is to cache symbols the first time they are accessed, so they can then be looked up by an ID. Furthermore, we need to resolve type indices to records that we vend to the user, and other things. Previously this code was all thrown together a bit haphazardly in the native session class, but it makes sense to collect all of this into a single class whose sole responsibility is to manage the collection of known symbols. llvm-svn: 341608
* Fix some warnings.Zachary Turner2018-09-061-2/+2
| | | | llvm-svn: 341508
* [PDB] Refactor the PDB symbol classes to fix a reuse bug.Zachary Turner2018-09-0541-251/+95
| | | | | | | | | | | | | | | | | | | | The way DIA SDK works is that when you request a symbol, it gets assigned an internal identifier that is unique for the life of the session. You can then use this identifier to get back the same symbol, with all of the same internal state that it had before, even if you "destroyed" the original copy of the object you had. This didn't work properly in our native implementation, and if you destroyed an object for a particular symbol, then requested the same symbol again, it would get assigned a new ID and you'd get a fresh copy of the object. In order to fix this some refactoring had to happen to properly reuse cached objects. Some unittests are added to verify that symbol reuse is taking place, making use of the new unittest input feature. llvm-svn: 341503
* [dwarfdump] Improve -diff option by hiding more data.Jonas Devlieghere2018-09-042-9/+12
| | | | | | | | | | The -diff option makes it easy to diff dwarf by hiding addresses and offsets. However not all of them were hidden, which should be fixed by this patch. Differential revision: https://reviews.llvm.org/D51593 llvm-svn: 341377
* [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
* [DebugInfo] Common behavior for error typesAlexandre Ganea2018-08-3112-161/+44
| | | | | | | | | | | | | | | Following D50807, and heading towards D50664, this intermediary change does the following: 1. Upgrade all custom Error types in llvm/trunk/lib/DebugInfo/ to use the new StringError behavior (D50807). 2. Implement std::is_error_code_enum and make_error_code() for DebugInfo error enumerations. 3. Rename GenericError -> PDBError (the file will be renamed in a subsequent commit) 4. Update custom error messages to follow the same formatting: (\w\s*)+\. 5. Keep generic "file not found" (ENOENT) errors as they are in PDB code. Previously, there used to be a custom enumeration for that purpose. 6. Remove a few extraneous LF in log() implementations. Printing LF is a responsability at a higher level, not at the error level. Differential Revision: https://reviews.llvm.org/D51499 llvm-svn: 341228
* [DWARF] Unify warning callbacks. NFC.Victor Leschuk2018-08-232-20/+14
| | | | | | | | | | | | | | | | | Both DWARFDebugLine and DWARFDebugAddr used the same callback mechanism for handling recoverable errors. They both implemented similar warn() function to be used as such callbacks. In this revision we get rid of code duplication and move this warn() function to DWARFContext as DWARFContext::dumpWarning(). Reviewers: lhames, jhenderson, aprantl, probinson, dblaikie, JDevlieghere Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D51033 llvm-svn: 340528
* [DWARF] Refactor DWARF classes to use unified error reporting. NFC.Victor Leschuk2018-08-208-128/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | DWARF-related classes in lib/DebugInfo/DWARF contained duplicating code for creating StringError instances, like: template <typename... Ts> static Error createError(char const *Fmt, const Ts &... Vals) { std::string Buffer; raw_string_ostream Stream(Buffer); Stream << format(Fmt, Vals...); return make_error<StringError>(Stream.str(), inconvertibleErrorCode()); } Similar function was placed in Support lib in https://reviews.llvm.org/D49824 This revision makes DWARF classes use this function instead of their local implementation of it. Reviewers: aprantl, dblaikie, probinson, wolfgangp, JDevlieghere, jhenderson Reviewed By: JDevlieghere, jhenderson Differential Revision: https://reviews.llvm.org/D49964 llvm-svn: 340163
* [codeview] Use push_macro to avoid conflicts instead of a prefixReid Kleckner2018-08-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: This prefix was added in r333421, and it changed our dumper output to say things like "CVRegEAX" instead of just "EAX". That's a functional change that I'd rather avoid. I tested GCC, Clang, and MSVC, and all of them support #pragma push_macro. They don't issue warnings whem the macro is not defined either. I don't have a Mac so I can't test the real termios.h header, but I looked at the termios.h sources online and looked for other conflicts. I saw only the CR* macros, so those are the ones we work around. Reviewers: zturner, JDevlieghere Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D50851 llvm-svn: 339907
* [DWARF] Verifier now handles .debug_types sections.Paul Robinson2018-08-081-23/+35
| | | | | | Differential Revision: https://reviews.llvm.org/D50466 llvm-svn: 339302
* [llvm-pdbutil] Support PDBs without a DBI streamAlexandre Ganea2018-08-061-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D50258 llvm-svn: 339045
* [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] Remove redundant iterator type. NFCPaul Robinson2018-08-021-25/+20
| | | | llvm-svn: 338759
* [DebugInfo/DWARF] [4/4] Unify handling of compile and type units. NFCPaul Robinson2018-08-012-37/+37
| | | | | | | | | | | | | | | | | | This is patch 4 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 4 combines separate DWARFUnitVectors for compile and type units into a single DWARFUnitVector that contains both. For now the implementation distinguishes compile units from type units by putting all compile units at the front of the vector, reflecting the DWARF v4 distinction between .debug_info and .debug_types sections. A future patch will change this to allow the free mixing of unit kinds, as is specified by DWARF v5. Differential Revision: https://reviews.llvm.org/D49744 llvm-svn: 338633
* [DebugInfo/DWARF] [3/4] Rename DWARFUnitSection to DWARFUnitVector. NFCPaul Robinson2018-08-013-16/+16
| | | | | | | | | | | | | 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] [2/4] Type units no longer in a std::deque. NFCPaul Robinson2018-08-013-80/+82
| | | | | | | | | | | | | | This is patch 2 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 2 takes the existing std::deque<DWARFUnitSection> for type units and makes it a simple DWARFUnitSection, simplifying the handling of type units and making it more consistent with compile units. Differential Revision: https://reviews.llvm.org/D49742 llvm-svn: 338629
* [DebugInfo/DWARF] [1/4] De-templatize DWARFUnitSection. NFCPaul Robinson2018-08-013-24/+117
| | | | | | | | | | | | | | | 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
* [DWARF] Support for .debug_addr (consumer)Victor Leschuk2018-07-313-10/+252
| | | | | | | This patch implements basic support for parsing and dumping DWARFv5 .debug_addr section. llvm-svn: 338447
* [CodeView] Minimal support for S_UNAMESPACE recordsAlexandre Ganea2018-07-314-1/+19
| | | | | | Differential Revision: https://reviews.llvm.org/D50007 llvm-svn: 338417
* This fixes a crash when a second pass is required for the Codeview Type ↵Alexandre Ganea2018-07-301-1/+4
| | | | | | | | | | merging *and* the index points outside of the table (which should lead to an error being printed). This occurs currently until MS precompiled headers .obj is added (see D45213) Differential Revision: https://reviews.llvm.org/D50006 llvm-svn: 338308
* Remove trailing spaceFangrui Song2018-07-303-3/+3
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338293
* [DWARF v5] Don't report an error when the .debug_rnglists section is empty ↵Wolfgang Pieb2018-07-261-16/+18
| | | | | | | | | | | or non-existent. Fixes PR38297. Reviewer: JDevlieghere Differential Revision: https://reviews.llvm.org/D49815 llvm-svn: 337993
* [DWARF] Use deque in place of SmallVector to fix use-after-free issueFangrui Song2018-07-231-3/+6
| | | | | | | | | | | | Summary: SmallVector's elements are moved when resizing and cause use-after-free. Reviewers: probinson, dblaikie Subscribers: JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D49702 llvm-svn: 337772
* Embed a template specialization in a namespace to work around a gcc bug.Wolfgang Pieb2018-07-231-0/+2
| | | | llvm-svn: 337770
* [DWARF v5] Refactor range lists dumping by using a more generic way of ↵Wolfgang Pieb2018-07-234-190/+132
| | | | | | | | | | | | | handling tables of lists. The intent is to use it for location list tables as well. Change is almost NFC with the exception of the spelling of some strings used during dumping (all lowercase now). Reviewer: JDevlieghere Differential Revision: https://reviews.llvm.org/D49500 llvm-svn: 337763
* [llvm] Change 2 instances of std::sort to llvm::sortMandeep Singh Grang2018-07-161-1/+1
| | | | llvm-svn: 337192
* [dwarfdump] Add pretty printer for accelerator table based on Atom.Jonas Devlieghere2018-07-131-3/+9
| | | | | | | | For instance, When dumping .apple_types, the second atom represents the DW_TAG. In addition to printing the raw value, we now also pretty print the value if the ATOM tells us how. llvm-svn: 337026
* [DebugInfo] Fix getPreviousSibling after r336823Fangrui Song2018-07-111-1/+2
| | | | llvm-svn: 336837
* [DebugInfo] Make children iterator bidirectionalJonas Devlieghere2018-07-112-0/+45
| | | | | | | | | Make the DIE iterator bidirectional so we can move to the previous sibling of a DIE. Differential revision: https://reviews.llvm.org/D49173 llvm-svn: 336823
* Use StringRef instead of `const char *`.Rui Ueyama2018-07-091-1/+1
| | | | | | | | | | I don't think there's a need to use `const char *`. In most (probably all?) cases, we need a length of a name later, so discarding a length will lead to a wasted effort. Differential Revision: https://reviews.llvm.org/D49046 llvm-svn: 336612
* [DebugInfo] Change default value of FDEPointerEncodingMaksim Panchenko2018-07-091-1/+1
| | | | | | | | | | | | | | | | Summary: If the encoding is not specified in CIE augmentation string, then it should be DW_EH_PE_absptr instead of DW_EH_PE_omit. Reviewers: ruiu, MaskRay, plotfi, rafauler Reviewed By: MaskRay Subscribers: rafauler, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D49000 llvm-svn: 336577
* [PDB] memicmp only exists on Windows, use StringRef::compare_lower insteadBenjamin Kramer2018-07-061-2/+2
| | | | llvm-svn: 336469
* [PDB] One more fix for hasing GSI records.Zachary Turner2018-07-061-8/+27
| | | | | | | | | | | | | | | | The reference implementation uses a case-insensitive string comparison for strings of equal length. This will cause the string "tEo" to compare less than "VUo". However we were using a case sensitive comparison, which would generate the opposite outcome. Switch to a case insensitive comparison. Also, when one of the strings contains non-ascii characters, fallback to a straight memcmp. The only way to really test this is with a DIA test. Before this patch, the test will fail (but succeed if link.exe is used instead of lld-link). After the patch, it succeeds even with lld-link. llvm-svn: 336464
OpenPOWER on IntegriCloud