summaryrefslogtreecommitdiffstats
path: root/lld/COFF/PDB.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't do a full scan of the type stream before processing records.Zachary Turner2017-05-241-2/+1
| | | | | | | | | | | | | LazyRandomTypeCollection is designed for random access, and in order to provide this it lazily indexes ranges of types. In the case of types from an object file, there is no partial index to build off of, so it has to index the full stream up front. However, merging types only requires sequential access, and when that is needed, this extra work is simply wasted. Changing the algorithm to work on sequential arrays of types rather than random access type collections eliminates this up front scan. llvm-svn: 303707
* Implement various flavors of type merging.Zachary Turner2017-05-221-2/+3
| | | | | | | | | | | | | | 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-5/+5
| | | | | | | | | | | | 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-5/+5
| | | | | | | | | | | | | | | | | | 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
* [CodeView] Raise the source to ID map out of the TypeStreamMerger.Zachary Turner2017-05-181-2/+3
| | | | | | | This map will be needed to rewrite symbol streams after re-writing the corresponding type streams. llvm-svn: 303390
* [CodeView] Provide a common interface for type collections.Zachary Turner2017-05-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now we have multiple notions of things that represent collections of types. Most commonly used are TypeDatabase, which is supposed to keep mappings from TypeIndex to type name when reading a type stream, which happens when reading PDBs. And also TypeTableBuilder, which is used to build up a collection of types dynamically which we will later serialize (i.e. when writing PDBs). But often you just want to do some operation on a collection of types, and you may want to do the same operation on any kind of collection. For example, you might want to merge two TypeTableBuilders or you might want to merge two type streams that you loaded from various files. This dichotomy between reading and writing is responsible for a lot of the existing code duplication and overlapping responsibilities in the existing CodeView library classes. For example, after building up a TypeTableBuilder with a bunch of type records, if we want to dump it we have to re-invent a bunch of extra glue because our dumper takes a TypeDatabase or a CVTypeArray, which are both incompatible with TypeTableBuilder. This patch introduces an abstract base class called TypeCollection which is shared between the various type collection like things. Wherever we previously stored a TypeDatabase& in some common class, we now store a TypeCollection&. The advantage of this is that all the details of how the collection are implemented, such as lazy deserialization of partial type streams, is completely transparent and you can just treat any collection of types the same regardless of where it came from. Differential Revision: https://reviews.llvm.org/D33293 llvm-svn: 303388
* lld Fixups for TypeDatabase changes.Zachary Turner2017-05-051-2/+2
| | | | llvm-svn: 302304
* Revert "Fix misnamed #include. Remove _NC suffix from ELF relocations ↵Rafael Espindola2017-05-021-1/+1
| | | | | | | | TLSDESC_{LD64,ADD}_LO12" This reverts commit r301964. It broke the build. llvm-svn: 301969
* Fix misnamed #include. Remove _NC suffix from ELF relocations ↵Joel Jones2017-05-021-1/+1
| | | | | | TLSDESC_{LD64,ADD}_LO12 llvm-svn: 301964
* Rename pdb::StringTable -> pdb::PDBStringTable.Zachary Turner2017-05-021-1/+1
| | | | | | | | With the forthcoming codeview::StringTable which a pdb::StringTable would hold an instance of as one member, this ambiguity becomes confusing. Rename to PDBStringTable to avoid this. llvm-svn: 301948
* [PDB] Save one type record copyReid Kleckner2017-04-041-21/+10
| | | | | | | | | | | | | | | | | | Summary: The TypeTableBuilder provides stable storage for type records. We don't need to copy all of the bytes into a flat vector before adding it to the TpiStreamBuilder. This makes addTypeRecord take an ArrayRef<uint8_t> and a hash code to go with it, which seems like a simplification. Reviewers: ruiu, zturner, inglorion Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31634 llvm-svn: 299406
* [PDB] Split item and type records when merging type streamsReid Kleckner2017-03-241-34/+36
| | | | | | | | | | | | Summary: MSVC does this when producing a PDB. Reviewers: ruiu Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31316 llvm-svn: 298717
* [pdb] Write the module info and symbol record streams.Zachary Turner2017-03-151-1/+1
| | | | | | | | | | | Previously we did not have support for writing detailed module information for each module, as well as the symbol records. This patch adds support for this, and in doing so enables the ability to construct minimal PDBs from just a few lines of YAML. A test is added to illustrate this functionality. llvm-svn: 297900
* [Support] Move Stream library from MSF -> Support.Zachary Turner2017-03-021-1/+1
| | | | | | | | | | After several smaller patches to get most of the core improvements finished up, this patch is a straight move and header fixup of the source. Differential Revision: https://reviews.llvm.org/D30266 llvm-svn: 296810
* [PDB] Make streams carry their own endianness.Zachary Turner2017-02-281-3/+3
| | | | | | | | | | | | | Before the endianness was specified on each call to read or write of the StreamReader / StreamWriter, but in practice it's extremely rare for streams to have data encoded in multiple different endiannesses, so we should optimize for the 99% use case. This makes the code cleaner and more general, but otherwise has NFC. llvm-svn: 296415
* [PDB] Partial resubmit of r296215, which improved PDB Stream Library.Zachary Turner2017-02-271-6/+6
| | | | | | | | | | | | | | | | | This was reverted because it was breaking some builds, and because of incorrect error code usage. Since the CL was large and contained many different things, I'm resubmitting it in pieces. This portion is NFC, and consists of: 1) Renaming classes to follow a consistent naming convention. 2) Fixing the const-ness of the interface methods. 3) Adding detailed doxygen comments. 4) Fixing a few instances of passing `const BinaryStream& X`. These are now passed as `BinaryStreamRef X`. llvm-svn: 296394
* Revert r296215, "[PDB] General improvements to Stream library." and followings.NAKAMURA Takumi2017-02-251-6/+6
| | | | | | | | | | | | | | | | | r296215, "[PDB] General improvements to Stream library." r296217, "Disable BinaryStreamTest.StreamReaderObject temporarily." r296220, "Re-enable BinaryStreamTest.StreamReaderObject." r296244, "[PDB] Disable some tests that are breaking bots." r296249, "Add static_cast to silence -Wc++11-narrowing." std::errc::no_buffer_space should be used for OS-oriented errors for socket transmission. (Seek discussions around llvm/xray.) I could substitute s/no_buffer_space/others/g, but I revert whole them ATM. Could we define and use LLVM errors there? llvm-svn: 296258
* [PDB] General improvements to Stream library.Zachary Turner2017-02-251-6/+6
| | | | | | | | | | | | | | | This adds various new functionality and cleanup surrounding the use of the Stream library. Major changes include: * Renaming of all classes for more consistency / meaningfulness * Addition of some new methods for reading multiple values at once. * Full suite of unit tests for reader / writer functionality. * Full set of doxygen comments for all classes. * Streams now store their own endianness. * Fixed some bugs in a few of the classes that were discovered by the unit tests. llvm-svn: 296215
* [PDB] Rename Stream related source files.Zachary Turner2017-02-251-1/+1
| | | | | | | | | | | | | | This is part of a larger effort to get the Stream code moved up to Support. I don't want to do it in one large patch, in part because the changes are so big that it will treat everything as file deletions and add, losing history in the process. Aside from that though, it's just a good idea in general to make small changes. So this change only changes the names of the Stream related source files, and applies necessary source fix ups. llvm-svn: 296211
* [pdb] Add the ability to resolve TypeServer PDBs.Zachary Turner2017-02-161-1/+11
| | | | | | | | | | | | | | Some PDBs or object files can contain references to other PDBs where the real type information lives. When this happens, all type indices in the original PDB are meaningless because their records are not there. With this patch we add the ability to pull type info from those secondary PDBs. Differential Revision: https://reviews.llvm.org/D29973 llvm-svn: 295382
* COFF: prevent nullptr dereferenceSaleem Abdulrasool2017-02-071-3/+6
| | | | | | | | If `/debugtypes` is used to omit the codeview information, we would not have constructed the debug info codeview record which is used to tie the PDB to the binary. In such a case, rub out the GUID and Age fields. llvm-svn: 294279
* Re-submit r293820: Return Error instead of bool from mergeTypeStreams().Rui Ueyama2017-02-021-2/+2
| | | | llvm-svn: 293847
* Revert r293820: Return Error instead of bool from mergeTypeStreams().Rui Ueyama2017-02-011-2/+2
| | | | | | It broke buildbots. llvm-svn: 293824
* Return Error instead of bool from mergeTypeStreams().Rui Ueyama2017-02-011-2/+2
| | | | | | | | | | Previously, mergeTypeStreams returns only true or false, so it was impossible to know the reason if it failed. This patch changes the function signature so that it returns an Error object. Differential Revision: https://reviews.llvm.org/D29362 llvm-svn: 293820
* NFC: Rename (PDB) RawSession to NativeSessionAdrian McCarthy2017-01-251-9/+9
| | | | | | | | This eliminates one overload on the term Raw. Differential Revision: https://reviews.llvm.org/D29098 llvm-svn: 293104
* [pdb] Write the Named Stream mapping to Yaml and binary.Zachary Turner2017-01-201-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D28919 llvm-svn: 292665
* PDB: Merge type info.Rui Ueyama2017-01-121-25/+54
| | | | | | | | | | | | | | | | | | | This patch is to merge type info in multiple .debug$T sections. One mystery that needs to be solved is that it is not clear how the MSVC linker uses TPI and IPI streams. Both streams contain type info, and it is not obvious what kind of record should go which. dumppdb command in microsoft-pdb repository prints out IPI stream contents as "IDs" and TPI stream as "TYPES", but looks like the tool don't really care about which stream type recrods were read from. For now, in this patch, I emit all type records to TPI stream. It might just work with other tools. If not, we need to investigate it more. llvm-svn: 291739
* [CodeView] Finish decoupling TypeDatabase from TypeDumper.Zachary Turner2017-01-111-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the type dumper itself was passed around to a lot of different places and manipulated in ways that were more appropriate on the type database. For example, the entire TypeDumper was passed into the symbol dumper, when all the symbol dumper wanted to do was lookup the name of a TypeIndex so it could print it. That's what the TypeDatabase is for -- mapping type indices to names. Another example is how if the user runs llvm-pdbdump with the option to dump symbols but not types, we still have to visit all types so that we can print minimal information about the type of a symbol, but just without dumping full symbol records. The way we did this before is by hacking it up so that we run everything through the type dumper with a null printer, so that the output goes to /dev/null. But really, we don't need to dump anything, all we want to do is build the type database. Since TypeDatabaseVisitor now exists independently of TypeDumper, we can do this. We just build a custom visitor callback pipeline that includes a database visitor but not a dumper. All the hackery around printers etc goes away. After this patch, we could probably even delete the entire CVTypeDumper class since really all it is at this point is a thin wrapper that hides the details of how to build a useful visitation pipeline. It's not a priority though, so CVTypeDumper remains for now. After this patch we will be able to easily plug in a different style of type dumper by only implementing the proper visitation methods to dump one-line output and then sticking it on the pipeline. Differential Revision: https://reviews.llvm.org/D28524 llvm-svn: 291724
* [CodeView/PDB] Rename a bunch of files.Zachary Turner2017-01-111-1/+1
| | | | | | | | | | | We were starting to get some name clashes between llvm-pdbdump and the common CodeView framework, so I took this opportunity to rename a bunch of files to more accurately describe their usage. This also helps in llvm-pdbdump to distinguish between different files and whether they are used for pretty dump mode or raw dump mode. llvm-svn: 291627
* COFF: tie the execute and the PDB togetherSaleem Abdulrasool2017-01-041-6/+6
| | | | | | | | The PDB GUID, Age, and version are tied together by the RSDS record in the binary. Pass along the BuildId information into the createPDB to allow us to tie the binary and the PDB together. llvm-svn: 290975
* Create a TPI stream only when /debugpdb is given.Rui Ueyama2016-12-101-1/+2
| | | | | | | Adding type records to TPI stream is too time consuming. It is reported that linking chrome_child.dll took 5 minutes. llvm-svn: 289330
* Add type records to TPI stream.Rui Ueyama2016-12-091-3/+29
| | | | | | | | | I don't think the data I add to a TPI stream in this patch is correct, but at least it can be displayed using llvm-pdbdump. Until I add more streams to a PDB file, I'm not able to know whether the data will be accepted by MSVC tools or not. llvm-svn: 289183
* Dump Codeview type information correctly.Rui Ueyama2016-12-011-21/+36
| | | | llvm-svn: 288298
* Dump not only type records but symbol records.Rui Ueyama2016-11-221-3/+19
| | | | llvm-svn: 287723
* Do plumbing work for CodeView debug info.Rui Ueyama2016-11-211-0/+30
| | | | | | | | | | Previously, we discarded .debug$ sections. This patch adds them to files so that PDB.cpp can access them. This patch also adds a debug option, /dumppdb, to dump debug info fed to createPDB so that we can verify that valid data has been passed. llvm-svn: 287555
* PDB: Add "* Linker *" module.Rui Ueyama2016-11-161-0/+2
| | | | | | | The added module contains nothing, but it is still useful as a test to ensure that we are emitting modules that can be read back. llvm-svn: 287071
* Fix heap-use-after-free coff::createPDBVitaly Buka2016-11-141-2/+1
| | | | | | | | | | | | | | Summary: getInputSections returns std::vector by value and ArrayRef pointed to destroyed temporarily. Reviewers: ruiu Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26630 llvm-svn: 286880
* Emit Section Contributions.Rui Ueyama2016-11-121-1/+24
| | | | | | Differential Revision: https://reviews.llvm.org/D26211 llvm-svn: 286684
* Fix -Wcast-qual warnings.Rui Ueyama2016-11-041-1/+1
| | | | llvm-svn: 286001
* Re-commit r285607: Emit Section Map stream."Rui Ueyama2016-10-311-0/+9
| | | | | | Removed some test fields that overspecified test conditions. llvm-svn: 285638
* Revert r285607: Emit Section Map stream.Rui Ueyama2016-10-311-9/+0
| | | | | | That change broke buildbots. llvm-svn: 285618
* Emit Section Map stream.Rui Ueyama2016-10-311-0/+9
| | | | | | | | This is how we use DbiStreamBuilder::addSectionMap. Differential Revision: https://reviews.llvm.org/D26113 llvm-svn: 285607
* Re-submit r283825: Add section header stream to PDB.Rui Ueyama2016-10-111-1/+5
| | | | | | | It was reverted because the change that depends on was reverted. Now it was submitted as r283925, so we can submit this as well. llvm-svn: 283926
* Revert "Add section header stream to PDB." because it depends on r283823.Rui Ueyama2016-10-111-5/+1
| | | | | | The change this patch depends on was reverted. llvm-svn: 283837
* Add section header stream to PDB.Rui Ueyama2016-10-101-1/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D25357 llvm-svn: 283825
* Add an empty DBI stream.Rui Ueyama2016-10-061-1/+4
| | | | llvm-svn: 283504
* Add exact number of streams for reserved stream #s.Rui Ueyama2016-10-051-5/+4
| | | | llvm-svn: 283397
* Add an empty IPI stream.Rui Ueyama2016-10-051-0/+6
| | | | | | | | With this, "llvm-pdbdump yaml -ipi-stream" prints out an IPI stream. Previously it crashed because it can't handle the case where IPI stream doesn't exist. llvm-svn: 283392
* Remove unused parameter.Rui Ueyama2016-10-041-3/+3
| | | | | | | | | I do not fully understand how to use these classes yet, but seems like these arguments are not used, since without them all tests still pass. In order to simplify the situation, I'll remove them now. llvm-svn: 283174
* Change for LLVM upstream change r282944.Rui Ueyama2016-09-301-12/+1
| | | | llvm-svn: 282945
OpenPOWER on IntegriCloud