summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix Modi and File count if there are more than 65535 modules/files.Rui Ueyama2016-11-161-2/+2
| | | | | | | | These numbers are intended to be capped at 65535, but `std::max<uint16_t>(UINT16_MAX, N)` always returns N for any N because the expression is the same as `std::max((uint16_t)UINT16_MAX, (uint16_t)N)`. llvm-svn: 287060
* Improve DWARF parsing speed by improving DWARFAbbreviationDeclarationGreg Clayton2016-11-153-36/+132
| | | | | | | | | | | | | | | | | | | | This patch gets a DWARF parsing speed improvement by having DWARFAbbreviationDeclaration instances know if they have a fixed byte size. If an abbreviation has a fixed byte size that can be calculated given a DWARFUnit, then parsing a DIE becomes two steps: parse ULEB128 abbrev code, and then add constant size to the offset. This patch also adds a fixed byte size to each DWARFAbbreviationDeclaration::AttributeSpec so that attributes can quickly skip their values if needed without the need to lookup the fixed for size. Notable improvements: - DWARFAbbreviationDeclaration::findAttributeIndex() now returns an Optional<uint32_t> instead of a uint32_t and we no longer have to look for the magic -1U return value - Optional<uint32_t> DWARFAbbreviationDeclaration::findAttributeIndex(dwarf::Attribute attr) const; - DWARFAbbreviationDeclaration now has a getAttributeValue() function that extracts an attribute value given a DIE offset that takes advantage of the DWARFAbbreviationDeclaration::AttributeSpec::ByteSize - bool DWARFAbbreviationDeclaration::getAttributeValue(const uint32_t DIEOffset, const dwarf::Attribute Attr, const DWARFUnit &U, DWARFFormValue &FormValue) const; - A DWARFAbbreviationDeclaration instance can return a fixed byte size for itself so DWARF parsing is faster: - Optional<size_t> DWARFAbbreviationDeclaration::getFixedAttributesByteSize(const DWARFUnit &U) const; - Any functions that used to take a "const DWARFUnit *U" that would crash if U was NULL now take a "const DWARFUnit &U" and are only called with a valid DWARFUnit Differential Revision: https://reviews.llvm.org/D26567 llvm-svn: 286924
* Remove extra semicolon.Rui Ueyama2016-11-121-1/+1
| | | | llvm-svn: 286688
* Define DbiStreamBuilder::addSectionContribs.Rui Ueyama2016-11-111-3/+40
| | | | | | | | | | | | | | This patch defines a new function to add a SectionContribs stream to a PDB file. Unlike SectionMap, SectionContribs contains a list of input sections as opposed to output sections. Note that this patch needs improving because currently we do not set Module field in SectionContribs entries. In a follow-up patch, I'll add Modules and then fix it after that. Differential Revision: https://reviews.llvm.org/D26210 llvm-svn: 286677
* Fixed issues found by Paul Robinson with my patch for:Greg Clayton2016-11-111-4/+7
| | | | | | | | | | https://reviews.llvm.org/D26526 - Fixed DW_FORM_strp to be correctly sized and extracted for DWARF64 - Added some missing strp variants as well - Fixed comment typo llvm-svn: 286603
* Clean up DWARFFormValue by reducing duplicated code and removing ↵Greg Clayton2016-11-112-182/+235
| | | | | | | | | | | | | | | | | | | | | DWARFFormValue::getFixedFormSizes() In preparation for a follow on patch that improves DWARF parsing speed, clean up DWARFFormValue so that we have can get the fixed byte size of a form value given a DWARFUnit or given the version, address byte size and dwarf32/64. This patch cleans up code so that everyone is using one of the new DWARFFormValue functions: static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, const DWARFUnit *U = nullptr); static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, uint16_t Version, uint8_t AddrSize, bool Dwarf32); This patch changes DWARFFormValue::skipValue() to rely on the output of DWARFFormValue::getFixedByteSize(...) instead of duplicating the code in each function. This will reduce the number of changes we need to make to DWARF to fewer places in DWARFFormValue when we add support for new form. This patch also starts to support DWARF64 so that we can get correct byte sizes for forms that vary according the DWARF 32/64. To reduce the code duplication a new FormSizeHelper pure virtual class was created that can be created as a FormSizeHelperDWARFUnit when you have a DWARFUnit, or FormSizeHelperManual where you manually specify the DWARF version, address byte size and DWARF32/DWARF64. There is now a single implementation of a function that gets the fixed byte size (instead of two where one took a DWARFUnit and one took the DWARF version, address byte size and DWARFFormat enum) and one function to skip the form values. https://reviews.llvm.org/D26526 llvm-svn: 286597
* Fix some size_t / uint32_t ambiguity errors.Zachary Turner2016-11-081-7/+7
| | | | llvm-svn: 286305
* [CodeView] Hook up CodeViewRecordIO to type serialization path.Zachary Turner2016-11-0813-850/+374
| | | | | | | | | | | | Previously support had been added for using CodeViewRecordIO to read (deserialize) CodeView type records. This patch adds support for writing those same records. With this patch, reading and writing of CodeView type records finally uses a single codepath. Differential Revision: https://reviews.llvm.org/D26253 llvm-svn: 286304
* PDB: Fix some APIs to avoid use-after-freesJustin Bogner2016-11-034-14/+13
| | | | | | | The buffer is already owned by the PDBFile for all of these APIs, so don't pass it in separately. llvm-svn: 285953
* Add CodeViewRecordIO for reading and writing.Zachary Turner2016-11-029-436/+657
| | | | | | | | | | | | | | | Using a pattern similar to that of YamlIO, this allows us to have a single codepath for translating codeview records to and from serialized byte streams. The current patch only hooks this up to the reading of CodeView type records. A subsequent patch will hook it up for writing of CodeView type records, and then a third patch will hook up the reading and writing of CodeView symbols. Differential Revision: https://reviews.llvm.org/D26040 llvm-svn: 285836
* Define DbiStreamBuilder::addSectionMap.Rui Ueyama2016-10-311-2/+85
| | | | | | | | | | | | | This change enables LLD to construct a Section Map stream in a PDB file. I do not understand all these fields in the Section Map yet, but it seems like a copy of a COFF section header in another format. With this patch, DbiStreamBuilder can emit a Section Map which llvm-pdbdump can dump. Differential Revision: https://reviews.llvm.org/D26112 llvm-svn: 285606
* Modify DWARFFormValue to remember the DWARFUnit that it was decoded with.Greg Clayton2016-10-314-32/+36
| | | | | | | | Modifying DWARFFormValue to remember the DWARFUnit that it was encoded with can simplify the usage of instances of this class. Previously users would have to try and pass in the same DWARFUnit that was used to decode the form value and there was a possibility that a different DWARFUnit might be supplied to the functions that extract values (strings, CU relative references, addresses) and cause problems. This fixes this potential issue by storing the DWARFUnit inside the DWARFFormValue so that this mistake can't be made. Instances of DWARFFormValue are not stored permanently and are used as temporary values, so the increase in size of an instance of DWARFFormValue isn't a big deal. This makes decoding form values more bullet proof and is a change that will be used by future modifications. https://reviews.llvm.org/D26052 llvm-svn: 285594
* Define calculateDbgStreamSize for consistency.Rui Ueyama2016-10-291-1/+5
| | | | llvm-svn: 285487
* Import/update constants from the DWARF 5 public review draft document.Adrian Prantl2016-10-283-4/+4
| | | | | | https://reviews.llvm.org/D26051 llvm-svn: 285421
* Switch all DWARF variables for tags, attributes and forms over to use the ↵Greg Clayton2016-10-274-37/+47
| | | | | | | | llvm::dwarf enumerations instead of using raw uint16_t values. This allows easier debugging as users can see the values of the enumerations in the variables view that will show the enumeration string instead of just a number. https://reviews.llvm.org/D26013 llvm-svn: 285309
* [codeview] support emitting indirect virtual base class informationBob Haarman2016-10-251-2/+2
| | | | | | | | | | | | | | | | Summary: Fixes PR28281. MSVC lists indirect virtual base classes in the field list of a class, using LF_IVBCLASS records. This change makes LLVM emit such records when processing DW_TAG_inheritance tags with the DIFlagVirtual and (newly introduced) DIFlagIndirect tags. Reviewers: rnk, ruiu, zturner Differential Revision: https://reviews.llvm.org/D25578 llvm-svn: 285130
* [pdb] added support for dumping globals streamBob Haarman2016-10-216-46/+236
| | | | | | | | | | | | Summary: This adds support for dumping the globals stream from PDB files using llvm-pdbdump, similar to the support we have for the publics stream. Reviewers: ruiu, zturner Subscribers: beanz, mgorny, modocache Differential Revision: https://reviews.llvm.org/D25801 llvm-svn: 284861
* [CodeView] Refactor serialization to use StreamInterface.Zachary Turner2016-10-204-217/+242
| | | | | | | | | | | | | | | | | | | This was all using ArrayRef<>s before which presents a problem when you want to serialize to or deserialize from an actual PDB stream. An ArrayRef<> is really just a special case of what can be handled with StreamInterface though (e.g. by using a ByteStream), so changing this to use StreamInterface allows us to plug in a PDB stream and get all the record serialization and deserialization for free on a MappedBlockStream. Subsequent patches will try to remove TypeTableBuilder and TypeRecordBuilder in favor of class that operate on Streams as well, which should allow us to completely merge the reading and writing codepaths for both types and symbols. Differential Revision: https://reviews.llvm.org/D25831 llvm-svn: 284762
* Remove LLVM_NOEXCEPT and replace it with noexceptReid Kleckner2016-10-195-5/+5
| | | | | | | Now that we have dropped MSVC 2013, all supported compilers support noexcept and we can drop this portability macro. llvm-svn: 284672
* [pdb] Improve error messages when DIA is not found.Zachary Turner2016-10-193-22/+27
| | | | llvm-svn: 284610
* dwarfdump: add space missing from the type unit header descriptionDavid Blaikie2016-10-181-1/+1
| | | | llvm-svn: 284540
* dwarfdump: Include the name in the unit description, even in non-summarized modeDavid Blaikie2016-10-181-0/+1
| | | | | | | (accidentally removed this from my previous change when I was rejecting some clang-format formatting... ) llvm-svn: 284539
* dwarfdump: -summarize-types: print a short summary (unqualified type name, ↵David Blaikie2016-10-183-8/+25
| | | | | | | | | | hash, length) of type units rather than dumping contents This is just a quick utility handy for getting rough summaries of types in a given object or dwo file. I've been using it to investigate the amount of type info redundancy across a project build, for example. llvm-svn: 284537
* Truncate long names in type recordsReid Kleckner2016-10-132-18/+29
| | | | | | | | | In the MS ABI, the frontend is supposed to MD5 such pathologically long names. LLVM should still defend itself from long names, though. Fixes part of PR29098. llvm-svn: 284136
* Update _MSC_VER equality checks for msdiaNNN.dllReid Kleckner2016-10-121-10/+6
| | | | | | | | | Use inequality instead of equality to defend against minor version increases in _MSC_VER. An _MSC_VER value of 1901 should still use msdia140.dll, as described in this blog post: https://blogs.msdn.microsoft.com/vcblog/2016/10/05/visual-c-compiler-version/ llvm-svn: 284058
* Avoid braced initialization for default member initializers for MSVC 2013Reid Kleckner2016-10-111-1/+1
| | | | llvm-svn: 283928
* Re-submit r283823: Define DbiStreamBuilder::addDbgStream to add stream.Rui Ueyama2016-10-111-2/+30
| | | | | | | The previous commit was failing because we filled empty slots of the debug stream index with kInvalidStreamIndex. It should've been 0. llvm-svn: 283925
* Revert r283824 and r283823: Define DbiStreamBuilder::addDbgStream to add stream.Rui Ueyama2016-10-111-30/+2
| | | | | | This reverts commit r283824 and r283823 to fix buildbots. llvm-svn: 283828
* Fix a bug in DbiStreamBuilder::addDbgStream.Rui Ueyama2016-10-101-1/+1
| | | | | | This feature will be tested in LLD unit tests. llvm-svn: 283824
* Define DbiStreamBuilder::addDbgStream to add stream.Rui Ueyama2016-10-101-2/+30
| | | | | | | | | | Previously, there is no way to create a stream other than pre-defined special stream such as DBI or IPI. This patch adds a new method, addDbgStream, to add a debug stream to a PDB file. Differential Revision: https://reviews.llvm.org/D25356 llvm-svn: 283823
* [pdb] Dump Module Symbols to Yaml.Zachary Turner2016-10-081-2/+1
| | | | | | | | | | | | | | This is the first step towards round-tripping symbol information, and thusly being able to write symbol information to a PDB. This patch writes the symbol information for each compiland to the Yaml when running in pdb2yaml mode. There's still some loose ends, such as what to do about relocations (necessary in order to print linkage names), how to print enums with friendly names, and how to give the dumper access to the StringTable, but this is a good first start. llvm-svn: 283641
* Refactor Symbol visitor code.Zachary Turner2016-10-073-93/+223
| | | | | | | | | | | | | Type visitor code had already been refactored previously to decouple the visitor and the visitor callback interface. This was necessary for having the flexibility to visit in different ways (for example, dumping to yaml, reading from yaml, dumping to ScopedPrinter, etc). This patch merely implements the same visitation pattern for symbol records that has already been implemented for type records. llvm-svn: 283609
* Re-commit "Use StringRef in Support/Darf APIs (NFC)"Mehdi Amini2016-10-056-29/+36
| | | | | | | This reverts commit r283285 and re-commit r283275 with a fix for format("%s", Str); where Str is a StringRef. llvm-svn: 283298
* Revert "Re-commit "Use StringRef in Support/Darf APIs (NFC)""Mehdi Amini2016-10-055-32/+27
| | | | | | One test seems randomly broken: DebugInfo/X86/gnu-public-names.ll llvm-svn: 283285
* Re-commit "Use StringRef in Support/Darf APIs (NFC)"Mehdi Amini2016-10-055-27/+32
| | | | | | | This reverts commit r283278 and re-commit r283275 with the update to fix the build on the LLDB side. llvm-svn: 283281
* Revert "Use StringRef in Support/Darf APIs (NFC)"Mehdi Amini2016-10-055-32/+27
| | | | | | This reverts commit r283275, it broke LLDB Android debug server. llvm-svn: 283278
* Use StringRef in Support/Darf APIs (NFC)Mehdi Amini2016-10-045-27/+32
| | | | llvm-svn: 283275
* Do not pass a superblock to PDBFileBuilder.Rui Ueyama2016-09-302-11/+6
| | | | | | | | | | | | | | | | | | | | | When we create a PDB file using PDBFileBuilder, the information in the superblock, such as the size of the resulting file, is not available. Previously, PDBFileBuilder::initialize took a superblock assuming that all the members of the struct are correct. That is useful when you want to restore the exact information from a YAML file, but that's probably the only use case in which that is useful. When we are creating a PDB file on the fly, we have to backfill the members. This patch redefines PDBFileBuilder::initialize to take only a block size. Now all the other members are left as default values, so that they'll be updated when commit() is called. Differential Revision: https://reviews.llvm.org/D25108 llvm-svn: 282944
* Pass a filename instead of a msf::WritableStream to PDBFileBuilder::commit.Rui Ueyama2016-09-301-3/+11
| | | | | | | | | | | | | | | WritableStream needs the exact file size to open a file, but until we fix the final layout of a PDB file, we don't know the size of the file. This patch changes the parameter type of PDBFileBuilder::commit to solve that chiecken-and-egg problem. Now the function opens a file after fixing the layout, so it can create a file with the exact size. Differential Revision: https://reviews.llvm.org/D25107 llvm-svn: 282940
* Revert r282238 "Revert r282235 "[llvm-dwarfdump] - Teach dwarfdump to dump ↵George Rimar2016-09-233-0/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | gdb-index section."" Build bot issues (http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15856/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3Adwarfdump-dump-gdbindex.test) should be fixed in that version. Issue was that MSVS does not support "%zu". Though it works fine on MSCS 2015, Bot looks running MSVS 2013 that does not like it. MSDN also says that "z" prefix is not supported: https://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx I had to use PRId64 instead. Original commit message: [llvm-dwarfdump] - Teach dwarfdump to dump gdb-index section. gold linker's --gdb-index option currently is able to create the .gdb_index section that allows GDB to locate and read the .dwo files as it needs them, this helps reduce the total size of the object files processed by the linker. More info about that: https://gcc.gnu.org/wiki/DebugFission https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html Patch teaches dwarfdump tool to dump this section. Differential revision: https://reviews.llvm.org/D21503 llvm-svn: 282239
* Revert r282235 "[llvm-dwarfdump] - Teach dwarfdump to dump gdb-index section."George Rimar2016-09-233-193/+0
| | | | | | | It broke BB: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15856 llvm-svn: 282238
* [llvm-dwarfdump] - Teach dwarfdump to dump gdb-index section.George Rimar2016-09-233-0/+193
| | | | | | | | | | | | | | | gold linker's --gdb-index option currently is able to create the .gdb_index section that allows GDB to locate and read the .dwo files as it needs them, this helps reduce the total size of the object files processed by the linker. More info about that: https://gcc.gnu.org/wiki/DebugFission https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html Patch teaches dwarfdump tool to dump this section. Differential revision: https://reviews.llvm.org/D21503 llvm-svn: 282235
* [pdb] Write the IPI stream.Zachary Turner2016-09-152-7/+30
| | | | | | | | The IPI stream is structurally identical to the TPI stream, but it contains different record types. So we just re-use the TPI writing code. llvm-svn: 281638
* [pdb] Fix the TPI stream size computation.Zachary Turner2016-09-151-2/+1
| | | | | | | | We were inadvertently adding the size of the hash value stream to the size of the TPI stream, even though the hash value stream is an entirely separate stream. llvm-svn: 281636
* [pdb] Get rid of Data and RawData in CVType.Zachary Turner2016-09-144-62/+116
| | | | | | | | | | | The `CVType` had two redundant fields which were confusing and error-prone to fill out. By treating member records as a distinct type from leaf records, we are able to simplify this quite a bit. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D24432 llvm-svn: 281556
* [pdb] Write TPI hash values to the TPI stream.Zachary Turner2016-09-148-116/+208
| | | | | | | | | | This completes being able to write all the interesting values of a PDB TPI stream. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D24370 llvm-svn: 281555
* [pdb] Print out some more info when dumping a raw stream.Zachary Turner2016-09-091-0/+4
| | | | | | | | | | | | | | | We have various command line options that print the type of a stream, the size of a stream, etc but nowhere that it can all be viewed together. Since a previous patch introduced the ability to dump the bytes of a stream, this seems like a good place to present a full view of the stream's properties including its size, what kind of data it represents, and the blocks it occupies. So I added the ability to print that information to the -stream-data command line option. llvm-svn: 281077
* [pdb] Pass CVRecord's through the visitor as non-const references.Zachary Turner2016-09-095-85/+85
| | | | | | | | | | | | | | | | | | This simplifies a lot of code, and will actually be necessary for an upcoming patch to serialize TPI record hash values. The idea before was that visitors should be examining records, not modifying them. But this is no longer true with a visitor that constructs a CVRecord from Yaml. To handle this until now, we were doing some fixups on CVRecord objects at a higher level, but the code is really awkward, and it makes sense to just have the visitor write the bytes into the CVRecord. In doing so I uncovered a few bugs related to `Data` and `RawData` and fixed those. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D24362 llvm-svn: 281067
* [pdb] Write PDB TPI Stream from Yaml.Zachary Turner2016-09-097-73/+174
| | | | | | | | | | This writes the full sequence of type records described in Yaml to the TPI stream of the PDB file. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D24316 llvm-svn: 281063
* [codeview] Use the correct max CV record length of 0xFF00Reid Kleckner2016-09-021-4/+5
| | | | | | | | | | | Previously we were splitting our records at 0xFFFF bytes, which the Microsoft tools don't like. Should fix failure on the new Windows self-host buildbot. This length appears in microsoft-pdb/PDB/dbi/dbiimpl.h llvm-svn: 280522
OpenPOWER on IntegriCloud