summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* NFC: Rename (PDB) RawSession to NativeSessionAdrian McCarthy2017-01-251-178/+0
| | | | | | | | This eliminates one overload on the term Raw. Differential Revision: https://reviews.llvm.org/D29098 llvm-svn: 293104
* [pdb] Write the Named Stream mapping to Yaml and binary.Zachary Turner2017-01-201-2/+32
| | | | | | Differential Revision: https://reviews.llvm.org/D28919 llvm-svn: 292665
* Remove PDBFileBuilder::build() and related functions.Rui Ueyama2016-11-221-45/+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
* PDB: Fix some APIs to avoid use-after-freesJustin Bogner2016-11-031-4/+4
| | | | | | | The buffer is already owned by the PDBFile for all of these APIs, so don't pass it in separately. llvm-svn: 285953
* 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-151-1/+23
| | | | | | | | 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] Write TPI hash values to the TPI stream.Zachary Turner2016-09-141-9/+6
| | | | | | | | | | 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] Write PDB TPI Stream from Yaml.Zachary Turner2016-09-091-0/+25
| | | | | | | | | | 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
* [msf] Resubmit "Rename Msf -> MSF".Zachary Turner2016-07-291-7/+7
| | | | | | | | | | | | | 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-291-7/+7
| | | | | | This reverts commit 4d1557ffac41e079bcb1abbcf04f512474dcd6fe. llvm-svn: 277194
* [msf] Rename Msf to MSF.Zachary Turner2016-07-291-7/+7
| | | | | | | | 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] Refactor library to more clearly separate reading/writingZachary Turner2016-07-281-5/+47
| | | | | | | Reviewed By: amccarth, ruiu Differential Revision: https://reviews.llvm.org/D22693 llvm-svn: 277019
* Get rid of IMsfStreamData class.Zachary Turner2016-07-281-3/+7
| | | | | | | | | | | | | | | | | | | | This was a pure virtual base class whose purpose was to abstract away the notion of how you retrieve the layout of a discontiguous stream of blocks in an Msf file. This led to too many layers of abstraction making it difficult to figure out what was going on and extend things. Ultimately, a stream's layout is decided by its length and the array of block numbers that it lives on. So rather than have an abstract base class which can return this in any number of ways, it's more straightforward to simply store them as fields of a trivial struct, and also to give a more appropriate name. This patch does that. It renames IMsfStreamData to MsfStreamLayout, and deletes the 2 concrete implementations, DirectoryStreamData and IndexedStreamData. MsfStreamLayout is a trivial struct with the necessary data. llvm-svn: 277018
* Make PDBFile store an msf::Layout.Zachary Turner2016-07-221-5/+1
| | | | | | | | | | | Previously it was storing all the fields of an msf::Layout as separate members. This is a trivial cleanup to make it store an msf::Layout directly. This makes the code more readable since it becomes clear which fields of PDBFile are actually the msf specific layout information in a sea of other bookkeeping fields. llvm-svn: 276460
* [pdb] Have builders share a single BumpPtrAllocator.Zachary Turner2016-07-221-5/+7
| | | | | | | | | | | | | This makes it easier to have the writable and readable PDB interfaces share code since the read/write and write-only interfaces now share a single allocator, you don't have to worry about a builder building a read only interface and then having the read-only interface's data become corrupt when the builder goes out of scope. Now the allocator is specified explicitly to all constructors, so all interfaces can share a single allocator that is scoped appropriately. llvm-svn: 276459
* [msf] Create LLVMDebugInfoMsfZachary Turner2016-07-221-4/+5
| | | | | | | | | | | | | | This provides a better layering of responsibilities among different aspects of PDB writing code. Some of the MSF related code was contained in CodeView, and some was in PDB prior to this. Further, we were often saying PDB when we meant MSF, and the two are actually independent of each other since in theory you can have other types of data besides PDB data in an MSF. So, this patch separates the MSF specific code into its own library, with no dependencies on anything else, and DebugInfoCodeView and DebugInfoPDB take dependencies on DebugInfoMsf. llvm-svn: 276458
* [pdb] Round-trip module & file info to/from YAML.Zachary Turner2016-07-221-1/+1
| | | | | | | | | | This implements support for writing compiland and compiland source file info to a binary PDB. This is tested by adding support for dumping these fields from an existing PDB to yaml, reading them back in, and dumping them again and verifying the values are as expected. llvm-svn: 276426
* [pdb] Teach MsfBuilder and other classes about the Free Page Map.Zachary Turner2016-07-151-2/+2
| | | | | | | | | | | | | | Block 1 and 2 of an MSF file are bit vectors that represent the list of blocks allocated and free in the file. We had been using these blocks to write stream data and other data, so we mark them as the free page map now. We don't yet serialize these pages to the disk, but at least we make a note of what it is, and avoid writing random data to them. Doing this also necessitated cleaning up some of the tests to be more general and hardcode fewer values, which is nice. llvm-svn: 275629
* [pdb] Use MsfBuilder to handle the writing PDBs.Zachary Turner2016-07-151-70/+45
| | | | | | | | | | | | | | | Previously we would read a PDB, then write some of it back out, but write the directory, super block, and other pertinent metadata back out unchanged. This generates incorrect PDBs since the amount of data written was not always the same as the amount of data read. This patch changes things to use the newly introduced `MsfBuilder` class to write out a correct and accurate set of Msf metadata for the data *actually* written, which opens up the door for adding and removing type records, symbol records, and other types of data to an existing PDB. llvm-svn: 275627
* Refactor the PDB writing to use a builder approachZachary Turner2016-07-111-0/+127
llvm-svn: 275110
OpenPOWER on IntegriCloud