summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Raw
Commit message (Collapse)AuthorAgeFilesLines
* NFC: Rename (PDB) RawSession to NativeSessionAdrian McCarthy2017-01-2524-3496/+0
| | | | | | | | This eliminates one overload on the term Raw. Differential Revision: https://reviews.llvm.org/D29098 llvm-svn: 293104
* [pdb] Correctly parse the hash adjusters table from TPI stream.Zachary Turner2017-01-251-9/+6
| | | | | | | | | | | | | This is not a list of pairs, it is a hash table data structure. We now correctly parse this out and dump it from llvm-pdbdump. We still need to understand the conditions that lead to a type getting an entry in the hash adjuster table. That will be done in a followup investigation / patch. Differential Revision: https://reviews.llvm.org/D29090 llvm-svn: 293090
* [pdb] Write the Named Stream mapping to Yaml and binary.Zachary Turner2017-01-204-12/+47
| | | | | | Differential Revision: https://reviews.llvm.org/D28919 llvm-svn: 292665
* [pdb] Merge NamedStreamMapBuilder and NamedStreamMap.Zachary Turner2017-01-205-70/+69
| | | | | | | | | | | While the builder pattern has proven useful for certain other larger types, in this case it was hampering the ability to use the data structure, as for runtime access we need a map that we can efficiently read from and write to. So the two are merged into a single data structure that can efficiently be read to, written from, deserialized from bytes, and serialized to bytes. llvm-svn: 292664
* [PDB] Rename some files to be more intuitive.Zachary Turner2017-01-207-40/+40
| | | | llvm-svn: 292663
* Fix a few more build errors.Zachary Turner2017-01-191-0/+2
| | | | llvm-svn: 292538
* Fix incorrectly formed assert statement.Zachary Turner2017-01-191-1/+1
| | | | llvm-svn: 292537
* [pdb] Add HashTable data structure.Zachary Turner2017-01-193-170/+330
| | | | | | | | | | | | | | | | This was being parsed / serialized ad-hoc inside the code for a specific PDB stream. But this data structure is used in multiple ways / places within the PDB format. To be able to re-use it we need to raise this code out and make it more generic. In doing so, a number of bugs are fixed in the original implementation, and support is added for growing the hash table and deleting items from the hash table, which had either been omitted or incorrect implemented in the initial version. Differential Revision: https://reviews.llvm.org/D28715 llvm-svn: 292535
* PDB: Add a class to create the /names stream contents.Rui Ueyama2017-01-152-8/+104
| | | | | | | | | | This patch adds a new class NameHashTableBuilder which creates /names streams. This patch contains a test to confirm that a stream created by NameHashTableBuilder can be read by NameHashTable reader class. Differential Revision: https://reviews.llvm.org/D28707 llvm-svn: 292040
* [PDB] Don't use the long typeDavid Majnemer2016-12-181-1/+1
| | | | | | | | Long is not the same size across a number of the platforms we support. Use unsigned int here instead, it is more appropriate because overflow/wrap-around is possible and, in this case, expected. llvm-svn: 290068
* [PDB] Don't reimplement CRC32David Majnemer2016-12-181-50/+5
| | | | | | | We already have a CRC32 implementation which is compatible with the PDB hash, reuse it. llvm-svn: 290054
* [pdb] handle missing pdb streams more gracefullyBob Haarman2016-12-051-30/+73
| | | | | | | | | | | | Summary: The code we use to read PDBs assumed that streams we ask it to read exist, and would read memory outside a vector and crash if this wasn't the case. This would, for example, cause llvm-pdbdump to crash on PDBs generated by lld. This patch handles such cases more gracefully: the PDB reading code in LLVM now reports errors when asked to get a stream that is not present, and llvm-pdbdump will report missing streams and continue processing streams that are present. Reviewers: ruiu, zturner Subscribers: thakis, amccarth Differential Revision: https://reviews.llvm.org/D27325 llvm-svn: 288722
* [DebugInfo] Fix some Clang-tidy modernize-use-default and Include What You ↵Eugene Zelenko2016-11-2311-85/+115
| | | | | | | | Use warnings; other minor fixes (NFC). Per Zachary Turner and Mehdi Amini suggestion to make only post-commit reviews. llvm-svn: 287838
* Remove PDBFileBuilder::build() and related functions.Rui Ueyama2016-11-224-103/+0
| | | | | | | | | | | | | | | | | | | PDBFileBuilder supports two different ways to create files. One is PDBFileBuilder::commit. That function takes a filename and write a result to the file. The other is PDBFileBuilder::build. That returns a new PDBFile object. This patch removes the latter because no one is using it and in a real life situation we are very unlikely to need it. Even if you need it, it'd be easy to write a new PDB to a memory buffer and read it back. Removing PDBFileBuilder::build enables us to remove other classes build transitively. Differential Revision: https://reviews.llvm.org/D26987 llvm-svn: 287697
* Align Modi and FileInfo substreams on 32-byte offsets.Rui Ueyama2016-11-161-4/+4
| | | | | | | | | | This is required by DbiStream, but DbiStreamBuilder didn't align these substreams, so the output of DbiSTreamBuilder couldn't be read by DbiStream. Test will be added to LLD. llvm-svn: 287067
* 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
* 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
* 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
* 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
* Define calculateDbgStreamSize for consistency.Rui Ueyama2016-10-291-1/+5
| | | | llvm-svn: 285487
* [pdb] added support for dumping globals streamBob Haarman2016-10-215-46/+234
| | | | | | | | | | | | 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
* Remove LLVM_NOEXCEPT and replace it with noexceptReid Kleckner2016-10-191-1/+1
| | | | | | | Now that we have dropped MSVC 2013, all supported compilers support noexcept and we can drop this portability macro. llvm-svn: 284672
* 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
* Do not pass a superblock to PDBFileBuilder.Rui Ueyama2016-09-301-10/+3
| | | | | | | | | | | | | | | | | | | | | 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
* [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-141-6/+6
| | | | | | | | | | | 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-146-111/+201
| | | | | | | | | | 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] Pass CVRecord's through the visitor as non-const references.Zachary Turner2016-09-091-8/+7
| | | | | | | | | | | | | | | | | | 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-093-67/+162
| | | | | | | | | | 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] Properly propagate the TypeLeafKind through the pipeline.Zachary Turner2016-09-011-3/+3
| | | | llvm-svn: 280388
* [codeview] Have visitTypeBegin return the record type.Zachary Turner2016-08-311-2/+3
| | | | | | | | | | | | | | | | | | | Previously we were assuming that any visitation of types would necessarily be against a type we had binary data for. Reasonable assumption when were just reading PDBs and dumping them, but once we start writing PDBs from Yaml this breaks down, because we have no binary data yet, only Yaml, and from that we need to read the record kind and perform the switch based on that. So this patch does that. Instead of having the visitor switch on the kind that is already in the CVType record, we change the visitTypeBegin() method to return the Kind, and switch on the returned value. This way, the default implementation can still return the value from the CVType, but the implementation which visits Yaml records and serializes binary PDB type records can use the field in the Yaml as the source of the switch. llvm-svn: 280307
* [codeview] Add TypeVisitorCallbackPipeline.Zachary Turner2016-08-311-2/+8
| | | | | | | | | | | | | | | | | We were kind of hacking this together before by embedding the ability to forward requests into the TypeDeserializer. When we want to start adding more different kinds of visitor callback interfaces though, this doesn't scale well and is very inflexible. So introduce the notion of a pipeline, which itself implements the TypeVisitorCallbacks interface, but which contains an internal list of other callbacks to invoke in sequence. Also update the existing uses of CVTypeVisitor to use this new pipeline class for deserializing records before visiting them with another visitor. llvm-svn: 280293
* [CodeView] Decouple record deserialization from visitor dispatch.Zachary Turner2016-08-051-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, our use case for the visitor has been to take a stream of bytes representing a type stream, deserialize the records in sequence, and do something with them, where "something" is determined by how the user implements a particular set of callbacks on an abstract class. For actually writing PDBs, however, we want to do the reverse. We have some kind of description of the list of records in their in-memory format, and we want to process each one. Perhaps by serializing them to a byte stream, or perhaps by converting them from one description format (Yaml) to another (in-memory representation). This was difficult in the current model because deserialization and invoking the callbacks were tightly coupled. With this patch we change this so that TypeDeserializer is itself an implementation of the particular set of callbacks. This decouples deserialization from the iteration over a list of records and invocation of the callbacks. TypeDeserializer is initialized with another implementation of the callback interface, so that upon deserialization it can pass the deserialized record through to the next set of callbacks. In a sense this is like an implementation of the Decorator design pattern, where the Deserializer is a decorator. This will be useful for writing Pdbs from yaml, where we have a description of the type records in Yaml format. In this case, the visitor implementation would have each visitation callback method implemented in such a way as to extract the proper set of fields from the Yaml, and it could maintain state that builds up a list of these records. Finally at the end we can pass this information through to another set of callbacks which serializes them into a byte stream. Reviewed By: majnemer, ruiu, rnk Differential Revision: https://reviews.llvm.org/D23177 llvm-svn: 277871
* pdbdump: Fix crash bug.Rui Ueyama2016-08-031-1/+4
| | | | | | | | | | pdbdump calls DbiStreamBuilder::commit through PDBFileBuilder::commit without calling DbiStreamBuilder::finalize. Because `finalize` initializes `Header` member, `Header` remained nullptr which caused a crash bug. Differential Revision: https://reviews.llvm.org/D23143 llvm-svn: 277681
* [msf] Make FPM reader use MappedBlockStream.Zachary Turner2016-08-031-17/+13
| | | | | | | | | | | | | MappedBlockSTream can work with any sequence of block data where the ordering is specified by a list of block numbers. So rather than manually stitch them together in the case of the FPM, reuse this functionality so that we can treat the FPM as if it were contiguous. Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D23066 llvm-svn: 277609
* [msf] Teach LLVM to parse a split Fpm.Zachary Turner2016-08-011-8/+35
| | | | | | | | | | | | | | | | | | | | The FPM is split at regular intervals across the MSF file, as the MS code suggests. It turns out that the value of the interval is precisely the block size. If the block size is 4096, then there are two Fpm pages every 4096 blocks. So here we teach the PDBFile class to parse a split FPM, and also add more options when dumping the FPM to display some additional information such as orphaned pages (pages which the FPM says are allocated, but which nothing appears to use), use after free pages (pages which the FPM says are not allocated, but which are referenced by a stream), and multiple use pages (pages which the FPM says are allocated but are used more than once). Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D23022 llvm-svn: 277388
* pdbdump: Dump Free Page Map contents.Rui Ueyama2016-07-291-0/+11
| | | | | | Differential Revision: https://reviews.llvm.org/D22974 llvm-svn: 277216
* [msf] Resubmit "Rename Msf -> MSF".Zachary Turner2016-07-2915-36/+36
| | | | | | | | | | | | | Previously this change was submitted from a Windows machine, so changes made to the case of filenames and directory names did not survive the commit, and as a result the CMake source file names and the on-disk file names did not match on case-sensitive file systems. I'm resubmitting this patch from a Linux system, which hopefully allows the case changes to make it through unfettered. llvm-svn: 277213
* Revert "[msf] Rename Msf to MSF."Zachary Turner2016-07-2915-36/+36
| | | | | | This reverts commit 4d1557ffac41e079bcb1abbcf04f512474dcd6fe. llvm-svn: 277194
* [msf] Rename Msf to MSF.Zachary Turner2016-07-2915-36/+36
| | | | | | | | In a previous patch, it was suggested to use all caps instead of rolling caps for initialisms, so this patch changes everything to do this. llvm-svn: 277190
* [pdb] Fix an ambiguity when writing size_t on x64 platforms.Zachary Turner2016-07-281-1/+2
| | | | llvm-svn: 277025
* [pdb] Fix some warnings that break -Werror builds.Zachary Turner2016-07-281-2/+2
| | | | llvm-svn: 277021
OpenPOWER on IntegriCloud