summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* [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
* [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
* pdbdump: print out TPI hashes.Rui Ueyama2016-06-031-9/+29
| | | | | | Differential Revision: http://reviews.llvm.org/D20945 llvm-svn: 271736
* Fix non-Windows build when inserting a move only type into a mapReid Kleckner2016-06-031-1/+1
| | | | llvm-svn: 271727
* [Symbolize] Check if the PE file has a PDB and emit an error if we can't load itReid Kleckner2016-06-031-64/+90
| | | | | | | | | | | | | | | | | | | | | Summary: Previously we would try to load PDBs for every PE executable we tried to symbolize. If that failed, we would fall back to DWARF. If there wasn't any DWARF, we'd print mostly useless symbol information using the export table. With this change, we only try to load PDBs for executables that claim to have them. If that fails, we can now print an error rather than falling back silently. This should make it a lot easier to diagnose and fix common symbolization issues, such as not having DIA or not having a PDB. Reviewers: zturner, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20982 llvm-svn: 271725
* [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] Print out file names instead of file offsets.Zachary Turner2016-06-033-8/+44
| | | | | | | | | | | | 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
* [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-035-17/+109
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add comments.Rui Ueyama2016-06-021-0/+2
| | | | llvm-svn: 271597
* [llvm-pdbdump] Dump CodeView line information.Zachary Turner2016-06-025-4/+80
| | | | | | | | | 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
* 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-027-276/+485
| | | | | | | Differential Revision: http://reviews.llvm.org/D20876 Reviewed By: rnk, ruiu llvm-svn: 271488
* [PDB] Make ModStream::symbols report errorsDavid Majnemer2016-06-011-1/+2
| | | | llvm-svn: 271417
* [pdb] Add unit tests for PDB MappedBlockStream and zero copyZachary Turner2016-05-315-1/+10
| | | | | | | Differential Revision: http://reviews.llvm.org/D20837 Reviewed By: ruiu llvm-svn: 271346
* Change llvm-objdump, llvm-nm and llvm-size when reporting an object file errorKevin Enderby2016-05-311-2/+3
| | | | | | | | | | | | | | | | | | | when the object is from a slice of a Mach-O Universal Binary use something like "foo.o (for architecture i386)" as part of the error message when expected. Also fixed places in these tools that were ignoring object file errors from MachOUniversalBinary::getAsObjectFile() when the code moved on to see if the slice was an archive. To do this MachOUniversalBinary::getAsObjectFile() and MachOUniversalBinary::getObjectForArch() were changed from returning ErrorOr<...> to Expected<...> then that was threaded up to its users. Converting these interfaces to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now the use of errorToErrorCode() is still used in two places yet to be fully converted. llvm-svn: 271332
* [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
* Tighten some of the name map checks furtherDavid Majnemer2016-05-281-1/+5
| | | | llvm-svn: 271130
* Bounds check the number of bitmap blocks in the name mapDavid Majnemer2016-05-281-0/+10
| | | | llvm-svn: 271105
* Make sure the directory contains info for all streamsDavid Majnemer2016-05-281-3/+8
| | | | llvm-svn: 271103
* [pdb] Finish conversion to zero copy pdb access.Zachary Turner2016-05-2810-89/+45
| | | | | | | | | | | | | | 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
* Don't discard errorsDavid Majnemer2016-05-271-2/+4
| | | | llvm-svn: 271056
* [pdb] Fix size check when reading stream bytes.Zachary Turner2016-05-271-2/+2
| | | | | | | We were accidentally bounds checking the read against the output ArrayRef instead of against the size of the read. llvm-svn: 271040
* 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-275-11/+18
| | | | | | | | | 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-275-18/+11
| | | | | | | | 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-275-11/+18
| | | | | | | | | | 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
* Make sure these error codes are marked as checkedDavid Majnemer2016-05-273-46/+65
| | | | llvm-svn: 271013
* Make sure there are enough blocks for the streamDavid Majnemer2016-05-271-0/+18
| | | | llvm-svn: 271012
* Make sure the directory block array fits in the fileDavid Majnemer2016-05-271-0/+4
| | | | llvm-svn: 271011
* Validate the blocksize before using itDavid Majnemer2016-05-271-5/+5
| | | | | | | The blocksize could be zero on disk causing later checks to divide by zero. llvm-svn: 271008
* Apply clang-tidy's misc-move-constructor-init throughout LLVM.Benjamin Kramer2016-05-271-4/+4
| | | | | | No functionality change intended, maybe a tiny performance improvement. llvm-svn: 270997
* [codeview] Remove StreamReader copying method.Zachary Turner2016-05-272-44/+15
| | | | | | | | | | | Since we want to move toward zero-copy access to stream data, we want to remove all instances of copying operations. So get rid of some of those here. Differential Revision: http://reviews.llvm.org/D20720 Reviewed By: ruiu llvm-svn: 270960
* [codeview,pdb] Try really hard to conserve memory when reading.Zachary Turner2016-05-2713-175/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2513-31/+97
| | | | | | | | | | 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] Dump the IPI stream and all records.Zachary Turner2016-05-252-3/+12
| | | | llvm-svn: 270661
* pdbdump: fix bug in name hash table.Rui Ueyama2016-05-251-3/+1
| | | | | | | | | | | name_ids() did not return all IDs but only the first NameCount items. The number of non-zero entries in IDs vector is NameCount, but it does not mean that all non-zero entries are at the beginning of IDs vector. Differential Revision: http://reviews.llvm.org/D20611 llvm-svn: 270656
* [llvm-pdbdump] Stream 0 isn't actually the MSF superblock.Zachary Turner2016-05-251-0/+1
| | | | | | | Oddly enough, I realized we don't actually know what stream 0 is (if anything). llvm-svn: 270655
* [llvm-pdbdump] Dump stream summary list.Zachary Turner2016-05-253-0/+18
| | | | | | | | | Try to figure out what each stream is, and dump its name. This gives us a better picture of what streams we still don't understand. llvm-svn: 270653
* [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-243-64/+246
| | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud