summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB
Commit message (Collapse)AuthorAgeFilesLines
...
* [pdb] Use MsfBuilder to handle the writing PDBs.Zachary Turner2016-07-159-135/+166
| | | | | | | | | | | | | | | 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
* DebugInfo: reorder some initializersSaleem Abdulrasool2016-07-151-2/+2
| | | | | | Fix a few initialization ordering warnings from gcc from `-Wreorder`. NFC. llvm-svn: 275615
* [pdb] Introduce MsfBuilder for laying out PDB files.Zachary Turner2016-07-153-0/+290
| | | | | | | Reviewed by: ruiu Differential Revision: https://reviews.llvm.org/D22308 llvm-svn: 275611
* Re-enable TPI hash verification for enum records.Rui Ueyama2016-07-121-1/+1
| | | | | | | We didn't read unique names correctly. As a result, we computed hashes on (non-)unique names instead of unique names. llvm-svn: 275150
* Refactor the PDB writing to use a builder approachZachary Turner2016-07-117-121/+276
| | | | llvm-svn: 275110
* Give helper classes/functions internal linkage. NFC.Benjamin Kramer2016-07-101-2/+2
| | | | llvm-svn: 275014
* [pdb] Sanity check the stream mapDavid Majnemer2016-07-101-1/+7
| | | | | | | | Some abstractions in LLVM "know" that they are reading in-bounds, FixedStreamArray, and provide a simple result. This breaks down if the stream map is bogus. llvm-svn: 275010
* [llvm-pdbdump] Propagate errors a little more consistentlyDavid Majnemer2016-07-102-9/+18
| | | | | | | PDBFile::getBlockData didn't really return any indication that it failed. It merely returned an empty buffer. llvm-svn: 275009
* [pdb] Round trip the PDB stream between YAML and binary PDB.Zachary Turner2016-07-068-11/+164
| | | | | | This gets writing of the PDB stream working. llvm-svn: 274647
* Disable hash verification of enums.Zachary Turner2016-07-062-1/+3
| | | | llvm-svn: 274639
* [pdb] Check the display name for <unnamed-tag>, not the linkage nameReid Kleckner2016-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This issue was encountered on libcmt.pdb, which has a type record that looks like this: Struct (0x1094) { TypeLeafKind: LF_STRUCTURE (0x1505) MemberCount: 3 Properties [ (0x200) HasUniqueName (0x200) ] FieldList: <field list> (0x1093) DerivedFrom: 0x0 VShape: 0x0 SizeOf: 4 Name: <unnamed-tag> LinkageName: .?AU<unnamed-tag>@@ } The checks for startswith/endswith "<unnamed-tag>" should look at the display name, not the linkage name. llvm-svn: 274376
* [pdb] Avoid reporting an error when the module symbol stream is emptyReid Kleckner2016-07-011-0/+3
| | | | llvm-svn: 274309
* [PDB] Indicate which type record failed hash validationReid Kleckner2016-07-011-2/+8
| | | | llvm-svn: 274308
* [pdb] Re-add code to write PDB files.Zachary Turner2016-06-302-47/+88
| | | | | | | | | Somehow all the functionality to write PDB files got removed, probably accidentally when uploading the patch perhaps the wrong one got uploaded. This re-adds all the code, as well as the corresponding test. llvm-svn: 274248
* [pdb] Treat a stream size of ~0U as 0Reid Kleckner2016-06-221-2/+4
| | | | | | My PDBs always have this size for stream 11. Not sure why. llvm-svn: 273504
* [codeview] Add an extra check for TPI hash values.Rui Ueyama2016-06-201-2/+10
| | | | | | | This patch adds a function that corresponds to `fUDTAnon` and use that to compute TPI hash values as the reference does. llvm-svn: 273139
* [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
* [codeview] Use hashBufferV8 to verify all type records.Rui Ueyama2016-06-161-15/+15
| | | | | | Differential Revision: http://reviews.llvm.org/D21393 llvm-svn: 272930
* Resubmit "[pdb] Change type visitor pattern to be dynamic."Zachary Turner2016-06-162-19/+23
| | | | | | | There was a regression introduced during type stream merging when visiting a field list record. This has been fixed in this patch. llvm-svn: 272929
* Revert "[pdb] Change type visitor pattern to be dynamic."Zachary Turner2016-06-162-23/+19
| | | | | | | | This reverts commit fb0dd311e1ad945827b8ffd5354f4810e2be1579. This breaks some llvm-readobj tests. llvm-svn: 272927
* [pdb] Change type visitor pattern to be dynamic.Zachary Turner2016-06-162-19/+23
| | | | | | | | | | | | | | | This allows better catching of compiler errors since we can use the override keyword to verify that methods are actually overridden. Also in this patch I've changed from storing a boolean Error code everywhere to returning an llvm::Error, to propagate richer error information up the call stack. Reviewed By: ruiu, rnk Differential Revision: http://reviews.llvm.org/D21410 llvm-svn: 272926
* [codeview] Pass CVRecord to visitTypeBegin callback.Rui Ueyama2016-06-161-3/+1
| | | | | | | | | Both parameters to visitTypeBegin are actually members of CVRecord, so we can just pass CVRecord instead of destructuring it. Differential Revision: http://reviews.llvm.org/D21435 llvm-svn: 272899
* [codeview] Remove unused parameter.Rui Ueyama2016-06-161-9/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D21433 llvm-svn: 272898
* Implement pdb::hashBufferV8 hash function.Rui Ueyama2016-06-162-10/+55
| | | | llvm-svn: 272894
* Remove redundant namespace specifiers.Rui Ueyama2016-06-161-9/+9
| | | | llvm-svn: 272889
* [codeview] Use CVTypeVisitor instead of a hand-written switch-cases.Rui Ueyama2016-06-161-68/+64
| | | | | | Differential Revision: http://reviews.llvm.org/D21418 llvm-svn: 272888
* [pdbdump] Verify LF_{CLASS,ENUM,INTERFACE,STRUCTURE,UNION} records.Rui Ueyama2016-06-151-8/+53
| | | | | | Differential Revision: http://reviews.llvm.org/D21361 llvm-svn: 272815
* [pdbdump] Verify TPI hash for LF_ENUM type records.Rui Ueyama2016-06-141-5/+21
| | | | llvm-svn: 272728
* Resubmit "[pdb] Actually write a PDB to disk from YAML.""Zachary Turner2016-06-141-0/+15
| | | | | | | Reviewed By: ruiu Differential Revision: http://reviews.llvm.org/D21220 llvm-svn: 272708
* Revert "[pdb] Actually write a PDB to disk from YAML."Zachary Turner2016-06-141-15/+0
| | | | | | | | | This reverts commit 879139e1c6577b09df52de56a6bab856a19ed185. This was committed accidentally when I blindly typed git svn dcommit instead of the command to generate a patch. llvm-svn: 272693
* [pdb] Actually write a PDB to disk from YAML.Zachary Turner2016-06-141-0/+15
| | | | llvm-svn: 272692
* [pdb] Fix issues with pdb writing.Zachary Turner2016-06-101-1/+1
| | | | | | | | | This fixes an alignment issue by forcing all cached allocations to be 8 byte aligned, and also fixes an issue arising on big endian systems by writing ulittle32_t's instead of uint32_t's in the test. llvm-svn: 272437
* Make PDBFile take a StreamInterface instead of a MemBuffer.Zachary Turner2016-06-102-118/+79
| | | | | | | | | | | | | | | This is the next step towards being able to write PDBs. MemoryBuffer is immutable, and StreamInterface is our replacement which can be any combination of read-only, read-write, or write-only depending on the particular implementation. The one place where we were creating a PDBFile (in RawSession) is updated to subclass ByteStream with a simple adapter that holds a MemoryBuffer, and initializes the superclass with the buffer's array, so that all the functionality of ByteStream works transparently. llvm-svn: 272370
* Add support for writing through StreamInterface.Zachary Turner2016-06-103-9/+169
| | | | | | | | | | | This adds method and tests for writing to a PDB stream. With this, even a PDB stream which is discontiguous can be treated as a sequential stream of bytes for the purposes of writing. Reviewed By: ruiu Differential Revision: http://reviews.llvm.org/D21157 llvm-svn: 272369
* [pdbdump] Verify part of TPI hash streams.Rui Ueyama2016-06-091-0/+28
| | | | | | | | | | | | | | | | | TPI hash table contains a parallel array for the type records. For each type record R, a hash value is calculated by `H(R) % NumBuckets` where H is a hash function, and the result is stored to a bucket element. H is TPI1::hashPrec function in microsoft-pdb repository. Our hash function does not support all type record types yet. Currently it supports only records for line number. I'll extend it in a follow up patch. The aim of verify the hash table is not only detect corrupted files. It ensures that our understanding of how the hash values are calculated is correct. llvm-svn: 272229
* Function names should start with lowercase letters.Rui Ueyama2016-06-082-3/+3
| | | | llvm-svn: 272225
* [PDB] Move PDB functions to a separate file.Rui Ueyama2016-06-083-59/+79
| | | | | | | | We are going to use the hash functions from TPI streams. Differential Revision: http://reviews.llvm.org/D21142 llvm-svn: 272223
* [pdb] Handle stream index errors better.Zachary Turner2016-06-088-89/+143
| | | | | | | Reviewed By: ruiu Differential Revision: http://reviews.llvm.org/D21128 llvm-svn: 272172
* Remove a patch .rej file.Rui Ueyama2016-06-081-11/+0
| | | | llvm-svn: 272171
* [pdb] Try to fix use after free.Zachary Turner2016-06-083-0/+13
| | | | llvm-svn: 272078
* [pdbdump] Print out # of hash buckets.Rui Ueyama2016-06-071-0/+1
| | | | | | In the reference code, the field name is `cHashBuckets`. llvm-svn: 272075
* [pdbdump] Print out TPI hash key size.Rui Ueyama2016-06-071-0/+2
| | | | llvm-svn: 272073
* [pdb] Convert StringRefs to ArrayRef<uint8_t>s.Zachary Turner2016-06-072-9/+11
| | | | llvm-svn: 272058
* [pdb] Fix a potential overflow and remove unnecessary comments.Zachary Turner2016-06-071-3/+0
| | | | llvm-svn: 272043
* [pdb] Use MappedBlockStream to parse the PDB directory.Zachary Turner2016-06-0711-125/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add comments.Rui Ueyama2016-06-071-0/+2
| | | | llvm-svn: 271967
* [pdbdump] Verify the size of TPI hash records.Rui Ueyama2016-06-061-0/+5
| | | | llvm-svn: 271954
* [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
* [DebugInfo, PDB] Use sparse bitfields for the name mapDavid Majnemer2016-06-041-21/+12
| | | | | | | The name map might not be densely packed on disk. Using a sparse map will save memory in such situations. llvm-svn: 271811
* pdbdump: print out TPI hashes.Rui Ueyama2016-06-031-9/+29
| | | | | | Differential Revision: http://reviews.llvm.org/D20945 llvm-svn: 271736
OpenPOWER on IntegriCloud