summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* Rewrite the cached map used for locating the most precise DIE amongChandler Carruth2017-12-221-26/+360
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | inlined subroutines for a given address. This is essentially the hot path of llvm-symbolizer when extracting inlined frames during symbolization. Previously, we would read every subprogram and every inlined subroutine, building a std::map across the entire PC space to the best DIE, and then do only a handful of queries as we symbolized a backtrace. A huge fraction of the time was spent building the map itself. This patch changes it two a two-level system. First, we just build a map from PC-interval to DWARF subprograms. These are required to be disjoint and so constructing this is pretty easy. Second, we build a map *just* for the inlined subroutines within the subprogram containing the query address. This allows us to look at far fewer DIEs and build a *much* smaller set of cached maps in the llvm-symbolizer case where only a few address get symbolized during the entire run. It also builds both interval maps in a very different way. It constructs a single flat vector of pairs that maps from offset -> index. The indices point into collections of DIE objects, but can also be "tombstones" (-1) to mark gaps. In the case of subprograms, this mostly just simplifies the data structure a bit. For inlined subroutines, because we carefully split them as we build the map, we end up in many cases having no holes and not having to store both start and stop offsets. Finally, the PC ranges for the inlined subroutines are compressed into 32-bits by making them relative to the base PC of the outer subprogram. This means that if you have a single function body with over 2gb of executable code in it, we will stop mapping address past the first 2gb of that function into inlined subroutines and just give you the subprogram. This doesn't seem like a problem. ;] All of this combines to make llvm-symbolizer *well* over 2x faster for symbolizing backtraces out of LLVM's unittests. Death-test heavy unit tests are running >2x faster. I'm still going to look at completely disabling symbolization there, but figured while I had a good benchmark we should make symbolization a bit better. Sadly, the logic to build the flat interval map for the inlined subroutines is fairly complex. I'm not super happy about this and welcome any simplifying suggestions. Huge thanks to Dave Blaikie who helped walk me through what the various things I needed to do in DWARF to make this work. Differential Revision: https://reviews.llvm.org/D40987 llvm-svn: 321345
* [DWARF] Fix formatting bug with r321295. This fixes a MIPS buildbot failure.Wolfgang Pieb2017-12-221-1/+1
| | | | llvm-svn: 321330
* [DWARF v5] Rework of string offsets table readerWolfgang Pieb2017-12-212-66/+206
| | | | | | | | | | | | | Reorganizes the DWARF consumer to derive the string offsets table contribution's format from the contribution header instead of (incorrectly) from the unit's format. Reviewers: JDevliegehere, aprantl Differential Revision: https://reviews.llvm.org/D41146 llvm-svn: 321295
* Silence a bunch of implicit fallthrough warningsAdrian Prantl2017-12-191-0/+1
| | | | llvm-svn: 321114
* Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header."Paul Robinson2017-12-182-14/+39
| | | | | | | | | | | Adds missing support for DW_FORM_data16. Update of r320852/r320886, fixing the unittest again, this time use a raw char string for the test data. Differential Revision: https://reviews.llvm.org/D41090 llvm-svn: 321011
* Revert "Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header.""Paul Robinson2017-12-152-39/+14
| | | | | | | This reverts commit 0afef672f63f0e4e91938656bc73424a8c058bfc. Still failing at runtime on bots. llvm-svn: 320888
* Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header."Paul Robinson2017-12-152-14/+39
| | | | | | | | | | | Adds missing support for DW_FORM_data16. Update of r320852, fixing the unittest to use a hand-coded struct instead of std::array to guarantee data layout. Differential Revision: https://reviews.llvm.org/D41090 llvm-svn: 320886
* Revert "[DWARFv5] Dump an MD5 checksum in the line-table header."Paul Robinson2017-12-152-39/+14
| | | | | | Unit test fails on some bots. llvm-svn: 320857
* [DWARFv5] Dump an MD5 checksum in the line-table header.Paul Robinson2017-12-152-14/+39
| | | | | | | | Adds missing support for DW_FORM_data16. Differential Revision: https://reviews.llvm.org/D41090 llvm-svn: 320852
* [COFF] Teach LLD to use the COFF .debug$H section.Zachary Turner2017-12-142-13/+116
| | | | | | | | | | | | This adds the /DEBUG:GHASH option to LLD which will look for the existence of .debug$H sections in linker inputs and use them to accelerate type merging. The clang-cl side has already been added, so this completes the work necessary to begin experimenting with this feature. Differential Revision: https://reviews.llvm.org/D40980 llvm-svn: 320719
* [CodeView] Teach clang to emit the .debug$H COFF section.Zachary Turner2017-12-132-0/+128
| | | | | | | | | | | | | | | Currently this is an LLVM extension to the COFF spec which is experimental and intended to speed up linking. For now it is behind a hidden cl::opt flag, but in the future we can move it to a "real" cc1 flag and have the driver pass it through whenever it is appropriate. The patch to actually make use of this section in lld will come in a followup. Differential Revision: https://reviews.llvm.org/D40917 llvm-svn: 320649
* Remove redundant includes from lib/DebugInfo.Michael Zolotukhin2017-12-1324-33/+0
| | | | llvm-svn: 320620
* [dwarfdump] Fix off-by-one bug in accelerator table extractor.Jonas Devlieghere2017-12-113-8/+14
| | | | | | | | | | | | | | | This fixes a bug where the verifier was complaining about empty accelerator tables. When the table is empty, its size is not a valid offset as it points after the end of the section. This patch also makes the extractor return llvm:Error instead of bool for better error reporting in the verifier. Differential revision: https://reviews.llvm.org/D41063 rdar://35932007 llvm-svn: 320399
* dwarfdump: Add support for the --diff option.Adrian Prantl2017-12-082-21/+29
| | | | | | | | | --diff Emit the output in a diff-friendly way by omitting offsets and addresses. <rdar://problem/34502625> llvm-svn: 320214
* [DebugInfo] Fix register variables not showing up in pdb.Zachary Turner2017-12-071-0/+3
| | | | | | | | | | | | | Previously, when linking against libcmt from the MSVC runtime, lld-link /verbose would show "Ignoring unknown symbol record with kind 0x1006". It turns out this was because TypeIndexDiscovery did not handle S_REGISTER records, so these records were not getting properly remapped. Patch by: Alexnadre Ganea Differential Revision: https://reviews.llvm.org/D40919 llvm-svn: 320108
* Teach llvm-pdbutil to dump types from object files.Zachary Turner2017-12-051-4/+10
| | | | llvm-svn: 319859
* Fix -Wmissing-braces error.Zachary Turner2017-12-051-2/+2
| | | | llvm-svn: 319855
* [CodeView] Add support for content hashing CodeView type records.Zachary Turner2017-12-053-34/+83
| | | | | | | | | Currently nothing uses this, but this at least gets the core algorithm in, and adds some test to demonstrate correctness. Differential Revision: https://reviews.llvm.org/D40736 llvm-svn: 319854
* [DebugInfo] Bail out if making no progress dumping line tables.Paul Robinson2017-12-011-0/+4
| | | | llvm-svn: 319564
* Simplify the DenseSet used for hashing CodeView records.Zachary Turner2017-11-301-96/+44
| | | | | | | | | | | | | | This was storing the hash alongside the key so that the hash doesn't need to be re-computed every time, but in doing so it was allocating a structure to keep the key size small in the DenseMap. This is a noble goal, but it also leads to a pointer indirection on every probe, and this cost of this pointer indirection ends up being higher than the cost of having a slightly larger entry in the hash table. Removing this not only simplifies the code, but yields a small but noticeable performance improvement in the type merging algorithm. llvm-svn: 319493
* Split TypeTableBuilder into two classes.Zachary Turner2017-11-304-48/+143
| | | | llvm-svn: 319456
* [CodeView] Factor some code out of TypeTableBuilder.Zachary Turner2017-11-292-38/+36
| | | | | | | | | | | This class had some code that would automatically remap type indices before hashing and serializing. The only caller of this method was the TypeStreamMerger anyway, and the method doesn't make general sense, and prevents making certain future improvements to the class. So, factoring this up one level into the TypeStreamMerger where it belongs. llvm-svn: 319377
* Make TypeTableBuilder inherit from TypeCollection.Zachary Turner2017-11-291-0/+37
| | | | | | | | | | | | | | A couple of places in LLD were passing references to TypeTableCollections around, which makes it hard to change the implementation at runtime. However, these cases only needed to iterate over the types in the collection, and TypeCollection already provides a handy abstract interface for this purpose. By implementing this interface, we can get rid of the need to pass TypeTableBuilder references around, which should allow us to swap the implementation at runtime in subsequent patches. llvm-svn: 319345
* llvm-dwarfdump: honor the --show-children option when dumping a specific DIE.Adrian Prantl2017-11-291-1/+1
| | | | llvm-svn: 319271
* Fix a warning.Zachary Turner2017-11-291-1/+1
| | | | llvm-svn: 319263
* [NFC] Minor cleanups in CodeView TypeTableBuilder.Zachary Turner2017-11-281-10/+7
| | | | llvm-svn: 319260
* Fix non assert build warnings.Rafael Espindola2017-11-281-0/+3
| | | | llvm-svn: 319200
* [CodeView] Refactor / Rewrite TypeSerializer and TypeTableBuilder.Zachary Turner2017-11-288-393/+530
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The motivation behind this patch is that future directions require us to be able to compute the hash value of records independently of actually using them for de-duplication. The current structure of TypeSerializer / TypeTableBuilder being a single entry point that takes an unserialized type record, and then hashes and de-duplicates it is not flexible enough to allow this. At the same time, the existing TypeSerializer is already extremely complex for this very reason -- it tries to be too many things. In addition to serializing, hashing, and de-duplicating, ti also supports splitting up field list records and adding continuations. All of this functionality crammed into this one class makes it very complicated to work with and hard to maintain. To solve all of these problems, I've re-written everything from scratch and split the functionality into separate pieces that can easily be reused. The end result is that one class TypeSerializer is turned into 3 new classes SimpleTypeSerializer, ContinuationRecordBuilder, and TypeTableBuilder, each of which in isolation is simple and straightforward. A quick summary of these new classes and their responsibilities are: - SimpleTypeSerializer : Turns a non-FieldList leaf type into a series of bytes. Does not do any hashing. Every time you call it, it will re-serialize and return bytes again. The same instance can be re-used over and over to avoid re-allocations, and in exchange for this optimization the bytes returned by the serializer only live until the caller attempts to serialize a new record. - ContinuationRecordBuilder : Turns a FieldList-like record into a series of fragments. Does not do any hashing. Like SimpleTypeSerializer, returns references to privately owned bytes, so the storage is invalidated as soon as the caller tries to re-use the instance. Works equally well for LF_FIELDLIST as it does for LF_METHODLIST, solving a long-standing theoretical limitation of the previous implementation. - TypeTableBuilder : Accepts sequences of bytes that the user has already serialized, and inserts them by de-duplicating with a hash table. For the sake of convenience and efficiency, this class internally stores a SimpleTypeSerializer so that it can accept unserialized records. The same is not true of ContinuationRecordBuilder. The user is required to create their own instance of ContinuationRecordBuilder. Differential Revision: https://reviews.llvm.org/D40518 llvm-svn: 319198
* Fixed the ability to recursively get an attribute value from a DWARFDie.Greg Clayton2017-11-271-10/+9
| | | | | | | | The previous implementation would only look 1 DW_AT_specification or DW_AT_abstract_origin deep. This means DWARFDie::getName() would fail in certain cases. I ran into such a case while creating a tool that used the LLVM DWARF parser to generate a symbolication format so I have seen this in the wild. Differential Revision: https://reviews.llvm.org/D40156 llvm-svn: 319104
* [BinaryStream] Support growable streams.Zachary Turner2017-11-271-4/+4
| | | | | | | | | The existing library assumed that a stream's length would never change. This makes some things simpler, but it's not flexible enough for what we need, especially for writable streams where what you really want is for each call to write to actually append. llvm-svn: 319070
* [llvm-dwarfdump] Display DW_AT_high_pc as absolute valueJonas Devlieghere2017-11-271-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | DWARF4 relative DW_AT_high_pc values are now displayed as absolute addresses. The relative value is only shown when explicitly dumping the forms, i.e. in show-form or verbose mode. ``` DW_AT_low_pc (0x0000000000000049) DW_AT_high_pc (0x00000019) ``` becomes ``` DW_AT_low_pc (0x0000000000000049) DW_AT_high_pc (0x0000000000000062) ``` Differential revision: https://reviews.llvm.org/D40317 rdar://35416943 llvm-svn: 319044
* [DwarfDump] -debug-line=offset applies to .dwo too.Paul Robinson2017-11-221-1/+3
| | | | llvm-svn: 318856
* [DebugInfo] Dump a .debug_line section, including line-number program,Paul Robinson2017-11-222-5/+18
| | | | | | | | without any compile units. Differential Revision: https://reviews.llvm.org/D40114 llvm-svn: 318842
* [DWARFv5] Support DW_FORM_strp in the .debug_line.dwo header.Paul Robinson2017-11-222-33/+70
| | | | | | | | | | | As a side effect, the .debug_line section will be dumped in physical order, rather than in the order that compile units refer to their associated portions of the .debug_line section. These are probably always the same order anyway, and no tests noticed the difference. Differential Revision: https://reviews.llvm.org/D39854 llvm-svn: 318839
* [DWARF] Fix handling of extended line-number opcodesPaul Robinson2017-11-221-5/+24
| | | | | | Differential Revision: https://reviews.llvm.org/D40200 llvm-svn: 318838
* Don't #include MemoryBuffer.h from Host.h.Zachary Turner2017-11-171-0/+1
| | | | | | | | | | It turns out this #include isn't used from Host.h anyway, but by having it it causes circular include dependencies. This issues only surfaced while I was working on a separate patch, so I'm submitting this first so that it's independent of the other, unrelated patch. llvm-svn: 318489
* Fix my typo of PDB_TableTypeReid Kleckner2017-11-161-1/+1
| | | | llvm-svn: 318447
* Fix -Wreturn-type falling off the end of a function in new DIA codeReid Kleckner2017-11-161-0/+1
| | | | llvm-svn: 318444
* [DebugInfo/PDB] Adding getUndecoratedNameEx and IPDB interfaces for ↵Aaron Smith2017-11-168-0/+151
| | | | | | | | | | | IDiaEnumTables and IDiaTable. Initial changes to support debugging PE/COFF files with LLDB on Windows through DIA SDK. There is another set of changes required on the LLDB side before this does anything. Differential Revision: https://reviews.llvm.org/D39517 llvm-svn: 318403
* Test commit. Add a missing dash to the standard llvm file header; NFC.Aaron Smith2017-11-161-1/+1
| | | | llvm-svn: 318400
* Convert FileOutputBuffer to Expected. NFC.Rafael Espindola2017-11-081-3/+2
| | | | llvm-svn: 317649
* [DWARFv5] Support DW_FORM_strp in the .debug_line header.Paul Robinson2017-11-076-27/+31
| | | | | | | | Supporting this form in .debug_line.dwo will be done as a follow-up. Differential Revision: https://reviews.llvm.org/D33155 llvm-svn: 317607
* Fix warnings discovered by rL317076. [-Wunused-private-field]NAKAMURA Takumi2017-11-011-2/+1
| | | | llvm-svn: 317091
* Revert "[DWARF] Now that Optional is standard layout, put it into an union ↵Benjamin Kramer2017-10-311-2/+2
| | | | | | | | instead of splatting it." GCC doesn't like it. This reverts commit r317028. llvm-svn: 317030
* [DWARF] Now that Optional is standard layout, put it into an union instead ↵Benjamin Kramer2017-10-311-2/+2
| | | | | | | | of splatting it. No functionality change intended. llvm-svn: 317028
* Fix BB after r316756 "[llvm-dwarfdump] - Teach verifier to report broken ↵George Rimar2017-10-271-1/+1
| | | | | | | | | | | DWARF expressions." Bot: http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/6255 Changed format of this message by mistake. llvm-svn: 316757
* [llvm-dwarfdump] - Teach verifier to report broken DWARF expressions.George Rimar2017-10-272-29/+45
| | | | | | | | | | | | | Patch improves next things: * Fixes assert/crash in getOpDesc when giving it a invalid expression op code. * DWARFExpression::print() called DWARFExpression::Operation::getEndOffset() which returned and used uninitialized field EndOffset. Patch fixes that. * Teaches verifier to verify DW_AT_location and error out on broken expressions. Differential revision: https://reviews.llvm.org/D39294 llvm-svn: 316756
* [PDB] Handle an empty globals hash table with no bucketsReid Kleckner2017-10-271-2/+3
| | | | llvm-svn: 316722
* Re-land "[dwarfdump] Add -lookup option"Jonas Devlieghere2017-10-252-2/+30
| | | | | | | | | Add the option to lookup an address in the debug information and print out the file, function, block and line table details. Differential revision: https://reviews.llvm.org/D38409 llvm-svn: 316619
* [llvm-dwarfdump] - Fix array out of bounds access crash.George Rimar2017-10-252-0/+17
| | | | | | | | | | | This fixes possible out of bound access in DWARFDie::getFirstChild() which might happen when .debug_info section is corrupted, like shown in testcase. Differential revision: https://reviews.llvm.org/D39185 llvm-svn: 316566
OpenPOWER on IntegriCloud