summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* pdbdump: Print out section offsets in the publics stream.Rui Ueyama2016-05-181-2/+6
| | | | llvm-svn: 269955
* Try again to fix pdbdump-headers.test on big-endian hosts after r269861.Daniel Sanders2016-05-181-5/+9
| | | | | | | r269898 fixed the problem with HashBuckets but the same issue occurred with AddressMap and ThunkMap too. llvm-svn: 269913
* Attempt to fix pdbdump-headers.test on big-endian hosts after r269861.Daniel Sanders2016-05-181-2/+6
| | | | llvm-svn: 269898
* pdbdump: Print out more strcutures.Rui Ueyama2016-05-171-3/+39
| | | | | | | | | | I don't yet fully understand the meaning of these data strcutures, but at least it seems that their sizes and types are correct. With this change, we can read publics streams till end. Differential Revision: http://reviews.llvm.org/D20343 llvm-svn: 269861
* [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
* Move helper classes into anonymous namespaces. NFC.Benjamin Kramer2016-05-152-0/+4
| | | | llvm-svn: 269591
* [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
* pdbdump: Print "Publics" stream.Rui Ueyama2016-05-134-11/+163
| | | | | | | | | | | | | | | | 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
* [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
* [codeview] Try to handle errors better in record iteratorReid Kleckner2016-05-121-2/+2
| | | | llvm-svn: 269381
* 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
* Fix some Clang-tidy modernize-deprecated-headers and Include What You Use ↵Eugene Zelenko2016-05-092-4/+16
| | | | | | | | warnings; other minor fixes. Differential revision: http://reviews.llvm.org/D20042 llvm-svn: 268989
* [pdb] Parse the module info stream for each module.Zachary Turner2016-05-093-14/+66
| | | | | | | Differential Revision: http://reviews.llvm.org/D20026 Reviewed By: rnk llvm-svn: 268942
* Make TypeIterator generic so it can iterate symbols too.Zachary Turner2016-05-091-1/+1
| | | | | | | Reviewed By: amccarth Differential Revision: http://reviews.llvm.org/D20038 llvm-svn: 268941
* Drop error when trying to fallback from PDB to DWARF.Zachary Turner2016-05-061-0/+4
| | | | llvm-svn: 268813
* Make llvm-pdbdump print CV type recordsZachary Turner2016-05-062-1/+7
| | | | | | | | | | This reuses the CVTypeDumper from libcodeview to dump full information about type records within a PDB file. Differential Revision: http://reviews.llvm.org/D20022 Reviewed By: rnk llvm-svn: 268808
* Add missing include.Zachary Turner2016-05-061-0/+1
| | | | llvm-svn: 268792
* Port DebugInfoPDB over to using llvm::Error.Zachary Turner2016-05-0617-224/+475
| | | | | | | Differential Revision: http://reviews.llvm.org/D19940 Reviewed By: rnk llvm-svn: 268791
* [codeview] Improve some commentsReid Kleckner2016-05-051-1/+0
| | | | | | | This FIXME was already fixed, and these LF_* enum names were inconsistent. llvm-svn: 268683
* Fix CVTypeDumperImpl formatting after class renameReid Kleckner2016-05-051-39/+49
| | | | llvm-svn: 268678
* [codeview] Move dumper into lib/DebugInfo/CodeViewReid Kleckner2016-05-053-0/+852
| | | | | | So that we can call it from llvm-pdbdump. llvm-svn: 268580
* Move pdb code into pdb namespace.Zachary Turner2016-05-0448-26/+81
| | | | llvm-svn: 268544
* [codeview] Add a type visitor to help abstract away type stream handlingReid Kleckner2016-05-041-1/+1
| | | | | | | | | | | | | | | | | | Summary: Port the dumper in llvm-readobj over to it. I'm planning to use this visitor to power type stream merging. While we're at it, try to switch from StringRef to ArrayRef<uint8_t> in some places. Reviewers: zturner, amccarth Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19899 llvm-svn: 268535
* Remove unused variable.Zachary Turner2016-05-031-2/+0
| | | | llvm-svn: 268455
* Move CodeViewTypeStream to DebugInfo/CodeViewZachary Turner2016-05-031-23/+2
| | | | | | | | | | | | | Ability to parse codeview type streams is also needed by DebugInfoPDB for parsing PDBs, so moving this into a library gives us this option. Since DebugInfoPDB had already hand rolled some code to do this, that code is now convereted over to using this common abstraction. Differential Revision: http://reviews.llvm.org/D19887 Reviewed By: dblaikie, amccarth llvm-svn: 268454
* Change operation_not_supported to not_supported.Zachary Turner2016-05-031-1/+1
| | | | | | Apparently operation_not_supported is... not supported everywhere. llvm-svn: 268348
* Parse the TPI (type information) stream of PDB files.Zachary Turner2016-05-036-5/+179
| | | | | | | | | | | | | | | This parses the TPI stream (stream 2) from the PDB file. This stream contains some header information followed by a series of codeview records. There is some additional complexity here in that alongside this stream of codeview records is a serialized hash table in order to efficiently query the types. We parse the necessary bookkeeping information to allow us to reconstruct the hash table, but we do not actually construct it yet as there are still a few things that need to be understood first. Differential Revision: http://reviews.llvm.org/D19840 Reviewed By: ruiu, rnk llvm-svn: 268343
* [llvm-pdbdump] Fix read past EOF when file is too small.Zachary Turner2016-05-021-0/+4
| | | | llvm-svn: 268316
* Thread Expected<...> up from libObject’s getType() for symbols to allow ↵Kevin Enderby2016-05-022-4/+14
| | | | | | | | | | | | | | | | | | | | | | llvm-objdump to produce a good error message. Produce another specific error message for a malformed Mach-O file when a symbol’s section index is more than the number of sections. The existing test case in test/Object/macho-invalid.test for macho-invalid-section-index-getSectionRawName now reports the error with the message indicating that a symbol at a specific index has a bad section index and that bad section index value. Again converting interfaces to Expected<> from ErrorOr<> does involve touching a number of places. Where the existing code reported the error with a string message or an error code it was converted to do the same. Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values.  So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: "// TODO: Actually report errors helpfully" and a call something like consumeError(NameOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. llvm-svn: 268298
* Fix build breakage due to implicit conversion.Zachary Turner2016-05-021-1/+2
| | | | llvm-svn: 268277
* PDB - Instead of hardcoding stream numbers, use an enum.Zachary Turner2016-05-022-12/+17
| | | | llvm-svn: 268270
* Parse PDB Name Hash TableZachary Turner2016-05-024-0/+151
| | | | | | | | | | | | | 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
* Fix crash in PDB when loading corrupt file.Zachary Turner2016-04-291-0/+7
| | | | | | | | | | There are probably hundreds of crashers we can find by fuzzing more. For now we do the simplest possible validation of the block size. Later, more complicated validations can verify that other fields of the super block such as directory size, number of blocks, agree with the size of the file etc. llvm-svn: 268084
* Put PDB parsing code into a pdb namespace.Zachary Turner2016-04-2911-62/+70
| | | | llvm-svn: 268072
* Refactor the PDB Stream reading interface.Zachary Turner2016-04-297-74/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | The motivation for this change is that PDB has the notion of streams and substreams. Substreams often consist of variable length structures that are convenient to be able to treat as guaranteed, contiguous byte arrays, whereas the streams they are contained in are not necessarily so, as a single stream could be spread across many discontiguous blocks. So, when processing data from a substream, we want to be able to assume that we have a contiguous byte array so that we can cast pointers to variable length arrays and such. This leads to the question of how to be able to read the same data structure from either a stream or a substream using the same interface, which is where this patch comes in. We separate out the stream's read state from the underlying representation, and introduce a `StreamReader` class. Then we change the name of `PDBStream` to `MappedBlockStream`, and introduce a second kind of stream called a `ByteStream` which is simply a sequence of contiguous bytes. Finally, we update all of the std::vectors in `PDBDbiStream` to use `ByteStream` instead as a proof of concept. llvm-svn: 268071
* [llvm-pdbdump] Try to appease the ASan botDavid Majnemer2016-04-291-0/+5
| | | | | | We didn't check that the file was large enough to hold a super block. llvm-svn: 267965
* [llvm-pdbdump] Restore error messages, handle bad block sizesDavid Majnemer2016-04-281-1/+1
| | | | | | | We lost the ability to report errors, bring it back. Also, correctly validate the block size. llvm-svn: 267955
* [llvm-pdbdump] Correctly read data larger than a blockDavid Majnemer2016-04-281-25/+15
| | | | | | | | | A bug was introduced when the code was refactored which resulted in a bad memory access. This fixes PR27565. llvm-svn: 267953
* Read discriminators correctly from object file.Dehao Chen2016-04-281-44/+33
| | | | | | | | | | | | | | | Summary: This is the follow-up patch for http://reviews.llvm.org/D19436 * Update the discriminator reading algorithm to match the assignment algorithm. * Add test to cover the new algorithm. Reviewers: dnovillo, echristo, dblaikie Subscribers: danielcdh, dblaikie, echristo, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D19522 llvm-svn: 267945
* Fix warning in PDB code. NFCAmaury Sechet2016-04-281-1/+1
| | | | llvm-svn: 267938
* Add parentheses to silence -Wparentheses warnings.Zachary Turner2016-04-281-6/+6
| | | | llvm-svn: 267934
* Read the rest of the DBI substreams, and parse source info.Zachary Turner2016-04-281-11/+124
| | | | | | | | | | | | | We now read out the rest of the substreams from the DBI streams. One of these substreams, the FileInfo substream, contains information about which source files contribute to each module (aka compiland). This patch additionally parses out the file information from that substream, and dumps it in llvm-pdbdump. Differential Revision: http://reviews.llvm.org/D19634 Reviewed by: ruiu llvm-svn: 267928
* Parse module information from DBI stream.Zachary Turner2016-04-273-2/+161
| | | | | | | | | | | | This gets more data out of the DBI strema of the PDB. In particular it extracts the metadata for the list of modules (compilands) that this PDB contains info about, and adds support for dumping these fields to llvm-pdbdump. Differential Revision: http://reviews.llvm.org/D19570 Reviewed By: ruiu llvm-svn: 267818
* [PDB] Fix function names for private symbols in PDBsReid Kleckner2016-04-271-14/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: llvm-symbolizer wants to get linkage names of functions for historical reasons. Linkage names are only recorded in the PDB for public symbols, and the linkage name is apparently stored separately in some "public symbol" record. We had a workaround in PDBContext which would look for such symbols when the user requested linkage names. However, when given an address that was truly in a private function and public funciton, we would accidentally find nearby public symbols and return those function names. The fix is to look for both function symbols and public symbols and only prefer the public symbol name if the addresses of the symbols agree. Fixes PR27492 Reviewers: zturner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19571 llvm-svn: 267732
* Remove more unused variables.Zachary Turner2016-04-261-3/+0
| | | | llvm-svn: 267598
* [llvm-pdbdump] Fix version reading on big endian systems.Zachary Turner2016-04-261-1/+2
| | | | llvm-svn: 267595
OpenPOWER on IntegriCloud