summaryrefslogtreecommitdiff
path: root/lib/DebugInfo
AgeCommit message (Collapse)Author
2017-12-22Rewrite the cached map used for locating the most precise DIE amongChandler Carruth
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321345 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-22[DWARF] Fix formatting bug with r321295. This fixes a MIPS buildbot failure.Wolfgang Pieb
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321330 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21[DWARF v5] Rework of string offsets table readerWolfgang Pieb
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321295 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19Silence a bunch of implicit fallthrough warningsAdrian Prantl
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321114 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header."Paul Robinson
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321011 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15Revert "Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header.""Paul Robinson
This reverts commit 0afef672f63f0e4e91938656bc73424a8c058bfc. Still failing at runtime on bots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320888 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header."Paul Robinson
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320886 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15Revert "[DWARFv5] Dump an MD5 checksum in the line-table header."Paul Robinson
Unit test fails on some bots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320857 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15[DWARFv5] Dump an MD5 checksum in the line-table header.Paul Robinson
Adds missing support for DW_FORM_data16. Differential Revision: https://reviews.llvm.org/D41090 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320852 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[COFF] Teach LLD to use the COFF .debug$H section.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320719 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13[CodeView] Teach clang to emit the .debug$H COFF section.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320649 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13Remove redundant includes from lib/DebugInfo.Michael Zolotukhin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320620 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-11[dwarfdump] Fix off-by-one bug in accelerator table extractor.Jonas Devlieghere
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320399 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-08dwarfdump: Add support for the --diff option.Adrian Prantl
--diff Emit the output in a diff-friendly way by omitting offsets and addresses. <rdar://problem/34502625> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320214 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-07[DebugInfo] Fix register variables not showing up in pdb.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320108 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05Teach llvm-pdbutil to dump types from object files.Zachary Turner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05Fix -Wmissing-braces error.Zachary Turner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319855 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[CodeView] Add support for content hashing CodeView type records.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[DebugInfo] Bail out if making no progress dumping line tables.Paul Robinson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319564 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30Simplify the DenseSet used for hashing CodeView records.Zachary Turner
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319493 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30Split TypeTableBuilder into two classes.Zachary Turner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319456 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[CodeView] Factor some code out of TypeTableBuilder.Zachary Turner
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319377 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29Make TypeTableBuilder inherit from TypeCollection.Zachary Turner
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319345 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29llvm-dwarfdump: honor the --show-children option when dumping a specific DIE.Adrian Prantl
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319271 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29Fix a warning.Zachary Turner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319263 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28[NFC] Minor cleanups in CodeView TypeTableBuilder.Zachary Turner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319260 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28Fix non assert build warnings.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319200 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28[CodeView] Refactor / Rewrite TypeSerializer and TypeTableBuilder.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319198 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27Fixed the ability to recursively get an attribute value from a DWARFDie.Greg Clayton
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319104 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27[BinaryStream] Support growable streams.Zachary Turner
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319070 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27[llvm-dwarfdump] Display DW_AT_high_pc as absolute valueJonas Devlieghere
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319044 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-22[DwarfDump] -debug-line=offset applies to .dwo too.Paul Robinson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318856 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-22[DebugInfo] Dump a .debug_line section, including line-number program,Paul Robinson
without any compile units. Differential Revision: https://reviews.llvm.org/D40114 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318842 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-22[DWARFv5] Support DW_FORM_strp in the .debug_line.dwo header.Paul Robinson
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318839 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-22[DWARF] Fix handling of extended line-number opcodesPaul Robinson
Differential Revision: https://reviews.llvm.org/D40200 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318838 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17Don't #include MemoryBuffer.h from Host.h.Zachary Turner
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16Fix my typo of PDB_TableTypeReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318447 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16Fix -Wreturn-type falling off the end of a function in new DIA codeReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318444 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16[DebugInfo/PDB] Adding getUndecoratedNameEx and IPDB interfaces for ↵Aaron Smith
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318403 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16Test commit. Add a missing dash to the standard llvm file header; NFC.Aaron Smith
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318400 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Convert FileOutputBuffer to Expected. NFC.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317649 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[DWARFv5] Support DW_FORM_strp in the .debug_line header.Paul Robinson
Supporting this form in .debug_line.dwo will be done as a follow-up. Differential Revision: https://reviews.llvm.org/D33155 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317607 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-01Fix warnings discovered by rL317076. [-Wunused-private-field]NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317091 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-31Revert "[DWARF] Now that Optional is standard layout, put it into an union ↵Benjamin Kramer
instead of splatting it." GCC doesn't like it. This reverts commit r317028. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317030 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-31[DWARF] Now that Optional is standard layout, put it into an union instead ↵Benjamin Kramer
of splatting it. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317028 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27Fix BB after r316756 "[llvm-dwarfdump] - Teach verifier to report broken ↵George Rimar
DWARF expressions." Bot: http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/6255 Changed format of this message by mistake. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316757 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27[llvm-dwarfdump] - Teach verifier to report broken DWARF expressions.George Rimar
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316756 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27[PDB] Handle an empty globals hash table with no bucketsReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316722 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25Re-land "[dwarfdump] Add -lookup option"Jonas Devlieghere
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316619 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[llvm-dwarfdump] - Fix array out of bounds access crash.George Rimar
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316566 91177308-0d34-0410-b5e6-96231b3b80d8