summaryrefslogtreecommitdiffstats
path: root/llvm/test/DebugInfo/PDB
Commit message (Collapse)AuthorAgeFilesLines
...
* [pdbutil] Add a command to dump the FPM.Zachary Turner2017-08-021-0/+9
| | | | | | | | | | | | | | Recently problems have been discovered in the way we write the FPM (free page map). In order to fix this, we first need to establish a baseline about what a correct FPM looks like using an MSVC generated PDB, so that we can then make our own generated PDBs match. And in order to do this, the dumper needs a mode where it can dump an FPM so that we can write tests for it. This patch adds a command to dump the FPM, as well as a test against a known-good PDB. llvm-svn: 309894
* [PDB] Improve GSI hash table dumping for publics and globalsReid Kleckner2017-07-261-4/+8
| | | | | | | | | | | | | | | The PDB "symbol stream" actually contains symbol records for the publics and the globals stream. The globals and publics streams are essentially hash tables that point into a single stream of records. In order to match cvdump's behavior, we need to only dump symbol records referenced from the hash table. This patch implements that, and then implements global stream dumping, since it's just a subset of public stream dumping. Now we shouldn't see S_PROCREF or S_GDATA32 records when dumping publics, and instead we should see those record in the globals stream. llvm-svn: 309066
* Fix pdbdump-headers.test after TPI hash changesReid Kleckner2017-07-181-15/+15
| | | | llvm-svn: 308244
* [PDB] Finish and simplify TPI hashingReid Kleckner2017-07-181-75/+75
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This removes the CVTypeVisitor updater and verifier classes. They were made dead by the minimal type dumping refactoring. Replace them with a single function that takes a type record and produces a hash. Call this from the minimal type dumper and compare the hash. I also noticed that the microsoft-pdb reference repository uses a basic CRC32 for records that aren't special. We already have an implementation of that CRC ready to use, because it's used in COFF for ICF. I'll make LLD call this hashing utility in a follow-up change. We might also consider using this same hash in type stream merging, so that we don't have to hash our records twice. Reviewers: inglorion, ruiu Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D35515 llvm-svn: 308240
* [CodeView] Dump BuildInfoSym and ProcSym type indicesReid Kleckner2017-07-151-2/+2
| | | | | | | I need to print the type index in hex so that I can match it in FileCheck for a test I'm writing. llvm-svn: 308107
* [PDB] Teach libpdb to write DBI Stream ECNames.Zachary Turner2017-07-071-0/+50
| | | | | | | | | | | | | | | | | | | | | | | Based strictly on the name, this seems to have something to do width edit & continue. The goal of this patch has nothing to do with supporting edit and continue though. msvc link.exe writes very basic information into this area even when *not* compiling with support for E&C, and so the goal here is to bring lld-link to parity. Since we cannot know what assumptions standard tools make about the content of PDB files, we need to be as close as possible. This ECNames data structure is a standard PDB string hash table. link.exe puts a single string into this hash table, which is the full path to the PDB file on disk. It then references this string from the module descriptor for the compiler generated `* Linker *` module. With this patch, lld-link will generate the exact same sequence of bytes as MSVC link for this subsection for a given object file input (as reported by `llvm-pdbutil bytes -ec`). llvm-svn: 307356
* [PDB] Add a test that verifies every known type record.Zachary Turner2017-07-057-50/+621
| | | | | | | | | | | | | | We had a lot of one-off tests for this type and that type, or "every type that happens to be generated by this program I built". Eventually I got a bug report filed where we were crashing on a type that was not covered by any of these tests. So this test carefully constructs a minimal C++ program that will cause every type we support to be emitted. This ensures full coverage for type records. Differential Revision: https://reviews.llvm.org/D34915 llvm-svn: 307187
* [llvm-pdbutil] Output the symbol offset when dumping.Zachary Turner2017-06-301-50/+50
| | | | | | | | | | | | | | | | Type records have a unique type index, but symbol records do not. Instead, symbol records refer to other symbol records by referencing their offset in the symbol stream. In a sense this is the analogue of the TypeIndex, but we are not printing it in the dumper. Printing it not only gives us more useful information when manually investigating the contents of a PDB, but also allows us to write better tests by enabling us to verify that fields that reference other symbol records do so correctly. Differential Revision: https://reviews.llvm.org/D34906 llvm-svn: 306890
* Fix test broken by parameter mixup.Zachary Turner2017-06-302-15/+15
| | | | llvm-svn: 306856
* [llvm-pdbutil] Add a mode to `bytes` for dumping split debug chunks.Zachary Turner2017-06-261-0/+12
| | | | llvm-svn: 306309
* [llvm-pdbutil] Dump raw bytes of module symbols and debug chunks.Zachary Turner2017-06-231-0/+73
| | | | llvm-svn: 306179
* [llvm-pdbutil] Dump raw bytes of type and id records.Zachary Turner2017-06-231-0/+27
| | | | llvm-svn: 306167
* [llvm-pdbutil] Dump raw bytes of various DBI stream subsections.Zachary Turner2017-06-231-0/+59
| | | | llvm-svn: 306160
* [llvm-pdbutil] Show what blocks a stream occupies.Zachary Turner2017-06-231-17/+34
| | | | | | | | This is useful when you want to look at a specific chunk of a stream or look for discontinuities, and you need to know the list of blocks occupied by a stream. llvm-svn: 306150
* [llvm-pdbutil] Dump raw bytes of pdb name map.Zachary Turner2017-06-231-0/+10
| | | | | | | | This patch dumps the raw bytes of the pdb name map which contains the mapping of stream name to stream index for the string table and other reserved streams. llvm-svn: 306148
* [llvm-pdbutil] Add the ability to dump raw bytes from the file.Zachary Turner2017-06-232-6/+21
| | | | | | | | | | Normally we can only make sense of the content of a PDB in terms of streams and blocks, but in some cases it may be useful to dump bytes at a specific absolute file offset. For example, if you know that some interesting data is at a particular location and you want to see some surrounding data. llvm-svn: 306146
* [llvm-pdbutil] Add a function for formatting MSF data.Zachary Turner2017-06-231-10/+51
| | | | | | | | | | | | | | | | | | | The goal here is to make it possible to display absolute file offsets when dumping byets from an MSF. The problem is that when dumping bytes from an MSF, often the bytes will cross a block boundary and encounter a discontinuity. We can't use the normal formatBinary() function for this because this would just treat the sequence as entirely ascending, and not account out-of-order blocks. This patch adds a formatMsfData() function to our printer, and then uses this function to improve the output of the -stream-data command line option for dumping bytes from a particular stream. Test coverage is also expanded to make sure to include all possible scenarios of offsets, sizes, and crossing block boundaries. llvm-svn: 306141
* [llvm-pdbutil] Create a "bytes" subcommand.Zachary Turner2017-06-223-14/+15
| | | | | | | | | | | | | | | | | | | This idea originally came about when I was doing some deep investigation of why certain bytes in a PDB that we round-tripped differed from their original bytes in the source PDB. I found myself having to hack up the code in many places to dump the bytes of this substream, or that record. It would be nice if we could just do this for every possible stream, substream, debug chunk type, etc. It doesn't make sense to put this under dump because there's just so many options that would detract from the more common use case of just dumping deserialized records. So making a new subcommand seems like the most logical course of action. In doing so, we already have two command line options that are suitable for this new subcommand, so start out by moving them there. llvm-svn: 306056
* [llvm-pdbutil] Rename "raw" to "dump".Zachary Turner2017-06-226-15/+15
| | | | | | | | | Now you run llvm-pdbutil dump <options>. This is a followup after having renamed the tool, whereas before raw was obviously just the style of dumping, whereas now "dump" is the action to perform with the "util". llvm-svn: 306055
* [codeview] respect signedness of APSInts when printing to YAMLBob Haarman2017-06-211-1/+1
| | | | | | | | | | | | | | | | | | Summary: This fixes a bug where we always treat APSInts in Codeview as signed when writing them to YAML. One symptom of this problem is that llvm-pdbdump raw would show Enumerator Values that differ between the original PDB and a PDB that has been round-tripped through YAML. Reviewers: zturner Reviewed By: zturner Subscribers: llvm-commits, fhahn Differential Revision: https://reviews.llvm.org/D34013 llvm-svn: 305965
* [codeview] YAMLize all section offsets and indices in symbol recordsReid Kleckner2017-06-201-1/+2
| | | | | | | | | | | | We forgot to serialize these because llvm-readobj didn't dump them. They are typically all zeros in an object file. The linker fills them in with relocations before adding them to the PDB. Now we can properly round trip these symbols through pdb2yaml -> yaml2pdb. I made these fields optional with a zero default so that we can elide them from our test cases. llvm-svn: 305857
* [CodeView] Fix dumping of public symbol record flagsReid Kleckner2017-06-191-2/+2
| | | | | | | I noticed nonsensical type information while dumping PDBs produced by MSVC. llvm-svn: 305708
* [llvm-pdbutil] Add support for dumping lines and inlinee lines.Zachary Turner2017-06-151-0/+11
| | | | llvm-svn: 305529
* [llvm-pdbutil] Add back support for dumping file checksums.Zachary Turner2017-06-151-399/+371
| | | | | | When dumping module source files, also dump checksums. llvm-svn: 305526
* [llvm-pdbutil] Add back the ability to dump hashes and index offsets.Zachary Turner2017-06-151-90/+96
| | | | | | | This was regressed in a previous patch that re-wrote the dumper, and I'm incrementally adding back the pieces that are missing. llvm-svn: 305524
* Resubmit "[llvm-pdbutil] rewrite the "raw" output style."Zachary Turner2017-06-159-3325/+1274
| | | | | | | | | This resubmits commit c0c249e9f2ef83e1d1e5f166b50673d92f3579d7. It was broken due to some weird template issues, which have since been fixed. llvm-svn: 305517
* Revert "[llvm-pdbutil] rewrite the "raw" output style."Zachary Turner2017-06-159-1274/+3325
| | | | | | | | | This reverts commit 83ea17ebf2106859a51fbc2a86031b44d33696ad. This is failing due to some strange template problems, so reverting until it can be straightened out. llvm-svn: 305505
* [llvm-pdbutil] rewrite the "raw" output style.Zachary Turner2017-06-159-3325/+1274
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After some internal discussions, we agreed that the raw output style had outlived its usefulness. It was originally created before we had even thought of dumping to YAML, and it was intended to give us some insight into the internals of a PDB file. Now we have YAML mode which does almost exactly this but is more powerful in that it can round-trip back to a PDB, which the raw mode could not do. So the raw mode had become purely a maintenance burden. One option was to just delete it. However, its original goal was to be as readable as possible while staying close to the "metal" - i.e. presenting the output in a way that maps directly to the underlying file format. We don't actually need that last requirement anymore since it's covered by the yaml mode, so we could repurpose "raw" mode to actually just be as readable as possible. This patch implements about 80% of the functionality previously in raw mode, but in a completely different style that is more akin to what cvdump outputs. Records are very compressed, often times appearing on just one line. One nice thing about this is that it makes full record matching easier, because you can grep for indices, names, and leaf types on a single line often. See the tests for some examples of what the new output looks like. Note that this patch actually regresses the functionality of raw mode in a few areas, but only because the patch was already unreasonably large and going 100% would have been even worse. Specifically, this patch is missing: The ability to dump module debug subsections (checksums, lines, etc) The ability to dump section headers Aside from that everything is here. While goign through the tests fixing them all up, I found many duplicate tests. They've been deleted. In subsequent patches I will go through and re-add the missing functionality. Differential Revision: https://reviews.llvm.org/D34191 llvm-svn: 305495
* Fix line endings.Zachary Turner2017-06-122-16/+16
| | | | llvm-svn: 305249
* [pdb] Don't choke on unknown symbol types.Zachary Turner2017-06-122-0/+16
| | | | | | | | | When we get an unknown symbol type, we might as well at least dump it. Same goes for round-tripping through YAML, we can dump the record contents as raw bytes even if we don't know how to interpret it semantically. llvm-svn: 305248
* Rename llvm-pdbdump -> llvm-pdbutil.Zachary Turner2017-06-0921-70/+70
| | | | | | | | | | This is to reflect the evolving nature of the tool as being useful for more than just dumping PDBs, as it can do many other things. Differential Revision: https://reviews.llvm.org/D34062 llvm-svn: 305106
* llvm/test/DebugInfo/PDB/pdbdump-debug-subsections.test: Try to unbreak r305043.NAKAMURA Takumi2017-06-091-2/+2
| | | | llvm-svn: 305063
* [codeview] use 32-bit integer for RelocOffset in DebugLinesSubsectionBob Haarman2017-06-091-1/+1
| | | | | | | | | | | | | | | | | Summary: RelocOffset is a 32-bit value, but we previously truncated it to 16 bits. Fixes PR33335. Reviewers: zturner, hiraditya! Reviewed By: zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33968 llvm-svn: 305043
* [CodeView] Support remaining debug subsection typesZachary Turner2017-06-092-63/+130
| | | | | | | | | | | | | | | | This adds support for Symbols, StringTable, and FrameData subsection types. Even though these subsections rarely if ever appear in a PDB file (they are usually in object files), there's no theoretical reason why they *couldn't* appear in a PDB. The real issue though is that in order to add support for dumping and writing them (which will be useful for object files), we need a way to test them. And since there is no support for reading and writing them to / from object files yet, making PDB support them is the best way to both add support for the underlying format and add support for tests at the same time. Later, when we go to add support for reading / writing them from object files, we'll need only minimal changes in the underlying read/write code. llvm-svn: 305037
* [llvm-pdbdump] Support native ordering of subsections in raw mode.Zachary Turner2017-06-082-70/+76
| | | | | | | | | | | | | This is the same change for the YAML Output style applied to the raw output style. Previously we would queue up all subsections until every one had been read, and then output them in a pre- determined order. This was because some subsections need to be read first in order to properly dump later subsections. This patch allows them to be dumped in the order they appear. Differential Revision: https://reviews.llvm.org/D34015 llvm-svn: 305034
* [llvm-pdbdump] Improve consistency among subcommands.Zachary Turner2017-06-0812-241/+208
| | | | | | | | | | | | | | | The pdb2yaml and raw subcommands did something very similar but with a different output format, and they used a lot of the same command line options, but each one re-implemented the command line option with slightly different spellings / options. This patch merges them together into a single definition which is shared by both subcommands. This new syntax also allows for more flexibility in the way debug subsections are dumped. Differential Revision: https://reviews.llvm.org/D33996 llvm-svn: 305032
* [CodeView] Handle Cross Module Imports and Exports.Zachary Turner2017-06-052-0/+84
| | | | | | | | | | | | | | | While it's not entirely clear why a compiler or linker might put this information into an object or PDB file, one has been spotted in the wild which was causing llvm-pdbdump to crash. This patch adds support for reading-writing these sections. Since I don't know how to get one of the native tools to generate this kind of debug info, the only test here is one in which we feed YAML into the tool to produce a PDB and then spit out YAML from the resulting PDB and make sure that it matches. llvm-svn: 304738
* [CodeView] Support CodeView subsections in any order.Zachary Turner2017-06-022-41/+43
| | | | | | | | | | | | | | | Previously we would expect certain subsections to appear in a certain order because some subsections would reference other subsections, but in practice we need to support arbitrary orderings since some object file and PDB file producers generate them this way. This also paves the way for supporting Yaml <-> Object File conversion of CodeView, since Object Files typically have quite a large number of subsections in their debug info. Differential Revision: https://reviews.llvm.org/D33807 llvm-svn: 304588
* [CodeView] Properly align symbol records on read/write.Zachary Turner2017-06-011-3/+3
| | | | | | | | | | | | | | | | | Object files have symbol records not aligned to any particular boundary (e.g. 1-byte aligned), while PDB files have symbol records padded to 4-byte aligned boundaries. Since they share the same reading / writing code, we have to provide an option to specify the alignment and propagate it up to the producer or consumer who knows what the alignment is supposed to be for the given container type. Added a test for this by modifying the existing PDB -> YAML -> PDB round-tripping code to round trip symbol records as well as types. Differential Revision: https://reviews.llvm.org/D33785 llvm-svn: 304484
* [pdb] pad source file name buffer at the end instead of the beginningBob Haarman2017-05-253-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | Summary: DbiStreamBuilder calculated the offset of the source file names inside the file info substream as the size of the file info substream minus the size of the file names. Since the file info substream is padded to a multiple of 4 bytes, this caused the first file name to be aligned on a 4-byte boundary. By contrast, DbiModuleList would read the file names immediately after the file name offset table, without skipping to the next 4-byte boundary. This change makes it so that the file names are written to the location where DbiModuleList expects them, and puts any necessary padding for the file info substream after the file names instead of before it. Reviewers: amccarth, rnk, zturner Reviewed By: amccarth, zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33475 llvm-svn: 303917
* [llvm-pdbdump] [yaml2pdb] always include object file name in module infoBob Haarman2017-05-251-0/+14
| | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, the yaml2pdb subcommand of llvm-pdbdump only included object file names in module info if a module info stream was present. This change makes it so that we include the object file name even if there is no module info stream for the module. As a result, running llvm-pdbdump pdb2yaml -dbi-module-info original.pdb > original.yaml && llvm-pdbdump yaml2pdb -pdb=new.pdb original.yaml && llvm-pdbdump pdb2yaml -dbi-module-info new.pdb > new.yaml now produces identical original.yaml and new.yaml files. Reviewers: amccarth, zturner Reviewed By: zturner Subscribers: fhahn, llvm-commits Differential Revision: https://reviews.llvm.org/D33463 llvm-svn: 303891
* Implement various flavors of type merging.Zachary Turner2017-05-229-2/+421
| | | | | | | | | | | | | | Previous algotirhm assumed that types and ids are in a single unified stream. For inputs that come from object files, this is the case. But if the input is already a PDB, or is the result of a previous merge, then the types and ids will already have been split up, in which case we need an algorithm that can accept operate on independent streams of types and ids that refer across stream boundaries to each other. Differential Revision: https://reviews.llvm.org/D33417 llvm-svn: 303577
* Resubmit "[CodeView] Provide a common interface for type collections."Zachary Turner2017-05-191-2/+2
| | | | | | | | | | | | This was originally reverted because it was a breaking a bunch of bots and the breakage was not surfacing on Windows. After much head-scratching this was ultimately traced back to a bug in the lit test runner related to its pipe handling. Now that the bug in lit is fixed, Windows correctly reports these test failures, and as such I have finally (hopefully) fixed all of them in this patch. llvm-svn: 303446
* Revert "[CodeView] Provide a common interface for type collections."Zachary Turner2017-05-191-2/+2
| | | | | | | | | | | | | | | | | | This is a squash of ~5 reverts of, well, pretty much everything I did today. Something is seriously broken with lit on Windows right now, and as a result assertions that fire in tests are triggering failures. I've been breaking non-Windows bots all day which has seriously confused me because all my tests have been passing, and after running lit with -a to view the output even on successful runs, I find out that the tool is crashing and yet lit is still reporting it as a success! At this point I don't even know where to start, so rather than leave the tree broken for who knows how long, I will get this back to green, and then once lit is fixed on Windows, hopefully hopefully fix the remaining set of problems for real. llvm-svn: 303409
* Fix a broken test.Zachary Turner2017-05-191-2/+2
| | | | | | | | | | | | Similar to my previous fix, it turns out llvm-pdbdump has been printing an incorrect value since the beginning of time, but we didn't know it was incorrect. Specifically, we were interpreting a TypeIndex as referencing a type from the TPI stream when it actually should come from the IPI stream. So we were printing a string that looked like a valid string, but was just from the wrong place. llvm-svn: 303403
* [llvm-pdbdump] Add the ability to merge PDBs.Zachary Turner2017-05-183-0/+128
| | | | | | | | | | | | | | | Merging PDBs is a feature that will be used heavily by the linker. The functionality already exists but does not have deep test coverage because it's not easily exposed through any tools. This patch aims to address that by adding the ability to merge PDBs via llvm-pdbdump. It takes arbitrarily many PDBs and outputs a single PDB. Using this new functionality, a test is added for merging type records. Future patches will add the ability to merge symbol records, module information, etc. llvm-svn: 303389
* [llvm-pdbdump] Add the option to sort functions and data.Zachary Turner2017-05-141-2/+2
| | | | llvm-svn: 302998
* [PDB/CodeView] Read/write codeview inlinee line information.Zachary Turner2017-05-022-4/+28
| | | | | | | | Previously we wrote line information and file checksum information, but we did not write information about inlinee lines and functions. This patch adds support for that. llvm-svn: 301936
* [CodeView] Write CodeView line information.Zachary Turner2017-05-013-2/+92
| | | | | | Differential Revision: https://reviews.llvm.org/D32716 llvm-svn: 301882
* [llvm-pdbdump] Abstract some of the YAML/Raw printing code.Zachary Turner2017-04-292-79/+87
| | | | | | | | | There is a lot of duplicate code for printing line info between YAML and the raw output printer. This introduces a base class that can be shared between the two, and makes some minor cleanups in the process. llvm-svn: 301728
OpenPOWER on IntegriCloud