summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/CodeView
Commit message (Collapse)AuthorAgeFilesLines
...
* [codeview] Use one byte for S_FRAMECOOKIE CookieKind and add flags byteReid Kleckner2016-06-242-2/+3
| | | | | | | | | | We bailed out while printing codeview for an MSVC compiled SemaExprCXX.cpp that used this record. The MS reference headers look incorrect here, which is probably why we had this bug. They use a 32-bit enum as the field type, but the actual record appears to use one byte for the cookie kind followed by a flags byte. llvm-svn: 273691
* [codeview] Fix the alignment padding that we add to list recordsReid Kleckner2016-06-221-4/+6
| | | | | | | Tweak the big-types.ll test case to catch this bug. We just need an enumerator name that doesn't have a length that is a multiple of 4. llvm-svn: 273477
* [codeview] Add support for splitting field list records over 64KBReid Kleckner2016-06-214-10/+96
| | | | | | | | | | | | | | | | | The basic structure is that once a list record goes over 64K, the last subrecord of the list is an LF_INDEX record that refers to the next record. Because the type record graph must be toplogically sorted, this means we have to emit them in reverse order. We build the type record in order of declaration, so this means that if we don't want extra copies, we need to detect when we were about to split a record, and leave space for a continuation subrecord that will point to the eventual split top-level record. Also adds dumping support for these records. Next we should make sure that large method overload lists work properly. llvm-svn: 273294
* [codeview] Add DIFlags for pointer to member representationsReid Kleckner2016-06-171-0/+1
| | | | | | | | | | | | | | | | Summary: This seems like the least intrusive way to pass this information through. Fixes PR28151 Reviewers: majnemer, aprantl, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D21444 llvm-svn: 273053
* Resubmit "[pdb] Change type visitor pattern to be dynamic."Zachary Turner2016-06-164-223/+342
| | | | | | | 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-164-335/+228
| | | | | | | | This reverts commit fb0dd311e1ad945827b8ffd5354f4810e2be1579. This breaks some llvm-readobj tests. llvm-svn: 272927
* [pdb] Change type visitor pattern to be dynamic.Zachary Turner2016-06-164-228/+335
| | | | | | | | | | | | | | | 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-162-24/+17
| | | | | | | | | 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-162-55/+35
| | | | | | Differential Revision: http://reviews.llvm.org/D21433 llvm-svn: 272898
* [Codeview] Add a class for LF_UDT_MOD_SRC_LINE.Rui Ueyama2016-06-153-1/+25
| | | | | | Differential Revision: http://reviews.llvm.org/D21406 llvm-svn: 272843
* Axe some trailing whitespace from my last commitReid Kleckner2016-06-151-20/+20
| | | | llvm-svn: 272830
* [codeview] Move deserialization methods out of lineReid Kleckner2016-06-151-0/+356
| | | | | | They aren't performance critical and don't need to be inline. llvm-svn: 272829
* Add support for writing through StreamInterface.Zachary Turner2016-06-106-8/+133
| | | | | | | | | | | 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
* [CodeView] Fix a busted assert in TypeTableBuilder::writeClassDavid Majnemer2016-06-041-1/+1
| | | | | | It was checking for Union when it should have checked for Interface. llvm-svn: 271792
* [TypeStreamMerger] visitUnknownMember was supposed to be visitUnknownTypeDavid Majnemer2016-06-041-2/+3
| | | | llvm-svn: 271790
* [codeview] Add basic record type translationReid Kleckner2016-06-031-0/+2
| | | | | | | | | | | This only translates data members for now. Translating overloaded methods is complicated, so I stopped short of doing that. Reviewers: aaboud Differential Revision: http://reviews.llvm.org/D20924 llvm-svn: 271680
* [pdb] Dump file checksums from pdb codeview line info.Zachary Turner2016-06-032-5/+21
| | | | llvm-svn: 271622
* [codeview] Dump line number and column information.Zachary Turner2016-06-033-0/+142
| | | | | | | | | | | | | | | | | | | | | | | | | To facilitate this, a couple of changes had to be made: 1. `ModuleSubstream` got moved from `DebugInfo/PDB` to `DebugInfo/CodeView`, and various codeview related types are defined there. It turns out `DebugInfo/CodeView/Line.h` already defines many of these structures, but this is really old code that is not endian aware, doesn't interact well with `StreamInterface` and not very helpful for getting stuff out of a PDB. Eventually we should migrate the old readobj `COFFDumper` code to these new structures, or at least merge their functionality somehow. 2. A `ModuleSubstream` visitor is introduced. Depending on where your module substream array comes from, different subsets of record types can be expected. We are already hand parsing these substream arrays in many places especially in `COFFDumper.cpp`. In the future we can migrate these paths to the visitor as well, which should reduce a lot of code in `COFFDumper.cpp`. Differential Revision: http://reviews.llvm.org/D20936 Reviewed By: ruiu, majnemer llvm-svn: 271621
* [llvm-pdbdump] Dump CodeView line information.Zachary Turner2016-06-022-1/+21
| | | | | | | | | This first pass only splits apart the records and dumps the line info kinds and binary data. Subsequent patches will parse out the binary data into more useful information and dump it in detail. llvm-svn: 271576
* [codeview] Fix a nasty use after free.Zachary Turner2016-06-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | StreamRef was designed to be a thin wrapper over an abstract stream interface that could itself be treated the same as any other stream interface. For this reason, it inherited publicly from StreamInterface, and stored a StreamInterface* internally. But StreamRef was also designed to be lightweight and easily copyable, similar to ArrayRef. This led to two misuses of the classes. 1) When creating a StreamRef A from another StreamRef B, it was possible to end up with A storing a pointer to B, even when B was a temporary object, leading to use after free. 2) The above situation could be repeated ad nauseum, so that A stores a pointer to B, which itself stores a pointer to another StreamRef C, and so on and so on, creating an unnecessarily level of nesting depth. This patch removes the public inheritance relationship between StreamRef and StreamInterface, making it so that we can never accidentally convert a StreamRef to a StreamInterface. llvm-svn: 271570
* [CodeView] Use None instead of Void if there is no subprogramDavid Majnemer2016-06-021-2/+2
| | | | llvm-svn: 271566
* [pdb] Parse and dump section map and section contribsZachary Turner2016-06-023-266/+371
| | | | | | | Differential Revision: http://reviews.llvm.org/D20876 Reviewed By: rnk, ruiu llvm-svn: 271488
* [codeview] Improve readability of type record assemblyReid Kleckner2016-05-311-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the method MCStreamer::EmitBinaryData, which is usually an alias for EmitBytes. In the MCAsmStreamer case, it is overridden to emit hex dump output like this: .byte 0x0e, 0x00, 0x08, 0x10 .byte 0x03, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x10, 0x00, 0x00 Also, when verbose asm comments are enabled, this patch prints the dump output for each comment before its record, like this: # ArgList (0x1000) { # TypeLeafKind: LF_ARGLIST (0x1201) # NumArgs: 0 # Arguments [ # ] # } .byte 0x06, 0x00, 0x01, 0x12 .byte 0x00, 0x00, 0x00, 0x00 This should make debugging easier and testing more convenient. Reviewers: aaboud Subscribers: majnemer, zturner, amccarth, aaboud, llvm-commits Differential Revision: http://reviews.llvm.org/D20711 llvm-svn: 271313
* [codeview] Add a CVTypeDumper::dump(ArrayRef<uint8_t>) overloadReid Kleckner2016-05-311-0/+13
| | | | | | | This is a convenient wrapper when the type record is already laid out as bytes in memory. llvm-svn: 271309
* Make sure we don't add an empty string to the stringmapDavid Majnemer2016-05-291-1/+2
| | | | llvm-svn: 271172
* [SymbolDumper] Validate the string table offset before using itDavid Majnemer2016-05-281-6/+6
| | | | llvm-svn: 271145
* [SymbolDumper] Validate the string table offset before using itDavid Majnemer2016-05-281-5/+6
| | | | llvm-svn: 271142
* [pdb] Finish conversion to zero copy pdb access.Zachary Turner2016-05-285-51/+15
| | | | | | | | | | | | | | This converts remaining uses of ByteStream, which was still left in the symbol stream and type stream, to using the new StreamInterface zero-copy classes. RecordIterator is finally deleted, so this is the only way left now. Additionally, more error checking is added when iterating the various streams. With this, the transition to zero copy pdb access is complete. llvm-svn: 271101
* Make sure data is available before dereferencing itDavid Majnemer2016-05-271-0/+14
| | | | llvm-svn: 271032
* Resubmit "[pdb] Allow zero-copy read support for symbol streams.""Zachary Turner2016-05-272-2/+2
| | | | | | | | | 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-272-2/+2
| | | | | | | | 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-272-2/+2
| | | | | | | | | | 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-272-29/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-254-0/+191
| | | | | | | | | | 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
* [codeview] Add support for new types and symbols.Zachary Turner2016-05-252-0/+19
| | | | | | | | | | | | This patch adds support for: S_EXPORT LF_BITFIELD With this patch, I have run through a couple of gigabytes of PDB files and cannot find a type or symbol that we do not understand. llvm-svn: 270637
* [codeview] Add support for S_EXPORT symbol.Zachary Turner2016-05-251-0/+16
| | | | llvm-svn: 270636
* [codeview] Add support for new type records.Zachary Turner2016-05-241-1/+182
| | | | | | | | | | | | | | | | | | | This adds support for parsing and dumping the following symbol types: S_LPROCREF S_ENVBLOCK S_COMPILE2 S_REGISTER S_COFFGROUP S_SECTION S_THUNK32 S_TRAMPOLINE As of this patch, the test PDB files no longer have any unknown symbol types. llvm-svn: 270628
* [codeview, pdb] Dump symbol records in publics streamZachary Turner2016-05-241-0/+17
| | | | | | | Differential Revision: http://reviews.llvm.org/D20580 Reviewed By: ruiu llvm-svn: 270597
* Fix build errorsZachary Turner2016-05-241-2/+2
| | | | llvm-svn: 270587
* Dump symbol record details in llvm-pdbdumpZachary Turner2016-05-242-8/+15
| | | | | | | | | | | | | This makes use of the newly introduced `CVSymbolVisitor` to dump details of each type of symbol record in the symbol streams. Future patches will bring this visitor based dumping to the publics stream, as well as creating a `SymbolDumpDelegate` to print more information about relocations etc. Differential Revision: http://reviews.llvm.org/D20545 Reviewed By: ruiu llvm-svn: 270585
* Remove unused variable.Zachary Turner2016-05-241-11/+6
| | | | llvm-svn: 270516
* Make a symbol visitor and use it to dump CV symbols.Zachary Turner2016-05-232-0/+671
| | | | | | | Differential Revision: http://reviews.llvm.org/D20534 Reviewed By: rnk llvm-svn: 270511
* [codeview] Test serialization of all known type recordsReid Kleckner2016-05-171-2/+2
| | | | | | | | | | | This just checks that we emit all type records once, and then after merging the type stream with no other type streams, we still emit every kind of type record. We could test the dumper output more closely, but that would make the test very brittle. Currently we're just getting coverage. llvm-svn: 269778
* [codeview] Add type stream merging prototypeReid Kleckner2016-05-147-88/+504
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This code is intended to be used as part of LLD's PDB writing. Until that exists, this is exposed via llvm-readobj for testing purposes. Type stream merging uses the following algorithm: - Begin with a new empty stream, and a new empty hash table that maps from type record contents to new type index. - For each new type stream, maintain a map from source type index to destination type index. - For each record, copy it and rewrite its type indices to be valid in the destination type stream. - If the new type record is not already present in the destination stream hash table, append it to the destination type stream, assign it the next type index, and update the two hash tables. - If the type record already exists in the destination stream, discard it and update the type index map to forward the source type index to the existing destination type index. Reviewers: zturner, ruiu Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20122 llvm-svn: 269521
* [codeview] Align class and print names of typesReid Kleckner2016-05-135-86/+80
| | | | | | | | | | | | Summary: This way we can get rid of one of the fields in the .def file. Reviewers: llvm-commits Subscribers: zturner Differential Revision: http://reviews.llvm.org/D20251 llvm-svn: 269461
* [codeview] Dump the type index on the first line of each recordReid Kleckner2016-05-131-2/+2
| | | | | | This will make it easier to write FileCheck tests. llvm-svn: 269444
* Get rid of CVLeafTypes.def and combine with TypeRecords.defZachary Turner2016-05-121-26/+17
| | | | | | | | | | This merges the functionality of the macros in `CVLeafTypes.def` and the macros in `TypeRecords.def` into a single set of macros. Differential Revision: http://reviews.llvm.org/D20190 Reviewed By: rnk, amccarth llvm-svn: 269316
* Make CodeView record serialization more generic.Zachary Turner2016-05-123-98/+158
| | | | | | | | | | | This introduces a variadic template and some helper macros to safely and correctly deserialize many types of common record fields while maintaining error checking. Differential Revision: http://reviews.llvm.org/D20183 Reviewed By: rnk, amccarth llvm-svn: 269315
* Fix build breakage in DebugInfoCodeviewZachary Turner2016-05-111-1/+1
| | | | llvm-svn: 269217
* Refactor CodeView type records to use common code.Zachary Turner2016-05-114-373/+267
| | | | | | | Differential Revision: http://reviews.llvm.org/D20138 Reviewed By: rnk llvm-svn: 269216
OpenPOWER on IntegriCloud