summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp
Commit message (Collapse)AuthorAgeFilesLines
* NFC: Rename (PDB) RawSession to NativeSessionAdrian McCarthy2017-01-251-425/+0
| | | | | | | | This eliminates one overload on the term Raw. Differential Revision: https://reviews.llvm.org/D29098 llvm-svn: 293104
* [PDB] Rename some files to be more intuitive.Zachary Turner2017-01-201-1/+0
| | | | llvm-svn: 292663
* [DebugInfo] Fix some Clang-tidy modernize-use-default and Include What You ↵Eugene Zelenko2016-11-231-5/+10
| | | | | | | | Use warnings; other minor fixes (NFC). Per Zachary Turner and Mehdi Amini suggestion to make only post-commit reviews. llvm-svn: 287838
* [msf] Resubmit "Rename Msf -> MSF".Zachary Turner2016-07-291-3/+3
| | | | | | | | | | | | | 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-3/+3
| | | | | | This reverts commit 4d1557ffac41e079bcb1abbcf04f512474dcd6fe. llvm-svn: 277194
* [msf] Rename Msf to MSF.Zachary Turner2016-07-291-3/+3
| | | | | | | | 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] Refactor library to more clearly separate reading/writingZachary Turner2016-07-281-41/+10
| | | | | | | Reviewed By: amccarth, ruiu Differential Revision: https://reviews.llvm.org/D22693 llvm-svn: 277019
* Get rid of IMsfStreamData class.Zachary Turner2016-07-281-1/+0
| | | | | | | | | | | | | | | | | | | | 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
* [msf] Create LLVMDebugInfoMsfZachary Turner2016-07-221-10/+10
| | | | | | | | | | | | | | 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] Move file layout header structs to RawTypes.hZachary Turner2016-07-221-59/+11
| | | | | | | | This facilitates code reuse between the builder classes and the "frozen" read only versions of the classes used for parsing existing PDB files. llvm-svn: 276427
* [pdb] Round-trip module & file info to/from YAML.Zachary Turner2016-07-221-8/+47
| | | | | | | | | | 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] Use MsfBuilder to handle the writing PDBs.Zachary Turner2016-07-151-4/+27
| | | | | | | | | | | | | | | 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-32/+15
| | | | llvm-svn: 275110
* Give helper classes/functions internal linkage. NFC.Benjamin Kramer2016-07-101-2/+2
| | | | llvm-svn: 275014
* [pdb] Round trip the PDB stream between YAML and binary PDB.Zachary Turner2016-07-061-0/+2
| | | | | | This gets writing of the PDB stream working. llvm-svn: 274647
* [pdb] Don't error on missing FPO streamsReid Kleckner2016-06-171-0/+5
| | | | | | | | 64-bit PDBs never have FPO data. They have xdata instead. Also improve error recovery of stream summary dumping while I'm here. llvm-svn: 273046
* [pdb] Handle stream index errors better.Zachary Turner2016-06-081-23/+26
| | | | | | | Reviewed By: ruiu Differential Revision: http://reviews.llvm.org/D21128 llvm-svn: 272172
* [pdb] Try to fix use after free.Zachary Turner2016-06-081-0/+6
| | | | llvm-svn: 272078
* [pdb] Use MappedBlockStream to parse the PDB directory.Zachary Turner2016-06-071-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to efficiently write PDBs, we need to be able to make a StreamWriter class similar to a StreamReader, which can transparently deal with writing to discontiguous streams, and we need to use this for all writing, similar to how we use StreamReader for all reading. Most discontiguous streams are the typical numbered streams that appear in a PDB file and are described by the directory, but the exception to this, that until now has been parsed by hand, is the directory itself. MappedBlockStream works by querying the directory to find out which blocks a stream occupies and various other things, so naturally the same logic could not possibly work to describe the blocks that the directory itself resided on. To solve this, I've introduced an abstraction IPDBStreamData, which allows the client to query for the list of blocks occupied by the stream, as well as the stream length. I provide two implementations of this: one which queries the directory (for indexed streams), and one which queries the super block (for the directory stream). This has the side benefit of vastly simplifying the code to parse the directory. Whereas before a mini state machine was rolled by hand, now we simply use FixedStreamArray to read out the stream sizes, then build a vector of FixedStreamArrays for the stream map, all in just a few lines of code. Reviewed By: ruiu Differential Revision: http://reviews.llvm.org/D21046 llvm-svn: 271982
* [pdbdump] Print out New FPO stream contents.Rui Ueyama2016-06-061-1/+24
| | | | | | | | | | The data strucutre in the new FPO stream is described in the PE/COFF spec. There is one record per function if frame pointer is omitted. Differential Revision: http://reviews.llvm.org/D20999 llvm-svn: 271926
* [pdb] Print out file names instead of file offsets.Zachary Turner2016-06-031-8/+18
| | | | | | | | | | | | When printing line information and file checksums, we were printing the file offset field from the struct header. This teaches llvm-pdbdump how to turn those numbers into the filename. In the case of file checksums, this is done by looking in the global string table. In the case of line contributions, this is done by indexing into the file names buffer of the DBI stream. Why they use a different technique I don't know. llvm-svn: 271630
* pdbdump: print out COFF section headers.Rui Ueyama2016-06-021-1/+27
| | | | | | | | | | | | Unlike other sections that can grow to any size, the COFF section header stream has maximum length because each record is fixed size and the COFF file format limits the maximum number of sections. So I decided to not create a specific stream class for it. Instead, I added a member function to DbiStream class which returns a vector of COFF headers. Differential Revision: http://reviews.llvm.org/D20717 llvm-svn: 271557
* [pdb] Parse and dump section map and section contribsZachary Turner2016-06-021-10/+71
| | | | | | | Differential Revision: http://reviews.llvm.org/D20876 Reviewed By: rnk, ruiu llvm-svn: 271488
* Resubmit "[pdb] Allow zero-copy read support for symbol streams.""Zachary Turner2016-05-271-6/+4
| | | | | | | | | Due to differences in template instantiation rules, it is not portable to static_assert(false) inside of an invalid specialization of a template. Instead I just =delete the method so that it can't be used, and leave a comment that it must be explicitly specialized. llvm-svn: 271027
* Revert "[pdb] Allow zero-copy read support for symbol streams."Chad Rosier2016-05-271-4/+6
| | | | | | | | This reverts commit r271024 due to error: static_assert failed "You must either provide a specialization of VarStreamArrayExtractor or a custom extractor" llvm-svn: 271026
* [pdb] Allow zero-copy read support for symbol streams.Zachary Turner2016-05-271-6/+4
| | | | | | | | | | This reduces the amount of memory used by llvm-pdbdump by roughly 1/3 of the size of the PDB file. Differential Revision: http://reviews.llvm.org/D20724 Reviewed By: ruiu llvm-svn: 271025
* [codeview,pdb] Try really hard to conserve memory when reading.Zachary Turner2016-05-271-42/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | PDBs can be extremely large. We're already mapping the entire PDB into the process's address space, but to make matters worse the blocks of the PDB are not arranged contiguously. So, when we have something like an array or a string embedded into the stream, we have to make a copy. Since it's convenient to use traditional data structures to iterate and manipulate these records, we need the memory to be contiguous. As a result of this, we were using roughly twice as much memory as the file size of the PDB, because every stream was copied out and re-stitched together contiguously. This patch addresses this by improving the MappedBlockStream to allocate from a BumpPtrAllocator only when a read requires a discontiguous read. Furthermore, it introduces some data structures backed by a stream which can iterate over both fixed and variable length records of a PDB. Since everything is backed by a stream and not a buffer, we can read almost everything from the PDB with zero copies. Differential Revision: http://reviews.llvm.org/D20654 Reviewed By: ruiu llvm-svn: 270951
* [codeview] Move StreamInterface and StreamReader to libcodeview.Zachary Turner2016-05-251-3/+3
| | | | | | | | | | We have need to reuse this functionality, including making additional generic stream types that are smarter about how and when they copy memory versus referencing the original memory. So all of these structures belong in the common library rather than being pdb specific. llvm-svn: 270751
* [llvm-pdbdump] Decipher the remaining PDB streams.Zachary Turner2016-05-251-0/+12
| | | | | | | We know at least know the meaning of every stream of the PDB file. Yay! llvm-svn: 270669
* [llvm-pdbdump] Rework command line options.Zachary Turner2016-05-241-0/+4
| | | | | | | | | When dumping huge PDB files, too many of the options were grouped together so you would get neverending spew of output. This patch introduces more granular display options so you can only dump the fields you actually care about. llvm-svn: 270607
* pdbdump: Rename NumberOfSymbols -> SymbolRecordStreamIndex.Rui Ueyama2016-05-191-4/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D20441 llvm-svn: 270088
* pdbdump: Print "Publics" stream.Rui Ueyama2016-05-131-11/+15
| | | | | | | | | | | | | | | | Publics stream seems to contain information as to public symbols. It actually contains a serialized hash table along with fixed-sized headers. This patch is not complete. It scans only till the end of the stream and dump the header information. I'll write code to de-serialize the hash table later. Reviewers: zturner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20256 llvm-svn: 269484
* Port DebugInfoPDB over to using llvm::Error.Zachary Turner2016-05-061-29/+52
| | | | | | | Differential Revision: http://reviews.llvm.org/D19940 Reviewed By: rnk llvm-svn: 268791
* PDB - Instead of hardcoding stream numbers, use an enum.Zachary Turner2016-05-021-1/+1
| | | | llvm-svn: 268270
* Parse PDB Name Hash TableZachary Turner2016-05-021-0/+4
| | | | | | | | | | | | | PDB has a lot of similar data structures. We already have code for parsing a Name Map, but PDB seems to have a different but very similar structure that is a hash table. This is the beginning of code needed in order to parse the name hash table, but it is not yet complete. It parses the basic metadata of the hash table, the bucket array, and the names buffer, but doesn't use any of these fields yet as the data structure requires a non-trivial amount of work to understand. llvm-svn: 268268
* Put PDB parsing code into a pdb namespace.Zachary Turner2016-04-291-0/+267
llvm-svn: 268072
OpenPOWER on IntegriCloud