summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-pdbutil] Improve diff mode.Zachary Turner2017-07-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're getting to the point that some MS tools (e.g. DIA) can recognize our PDBs but others (e.g. link.exe) cannot. I think the way forward is to improve our tooling to help us find differences more easily. For example, if we can compile the same program with clang-cl and cl and have a tool tell us all the places where the PDBs differ, this could tell us what we're doing wrong. It's tricky though, because there are a lot of "benign" differences in a PDB. For example, if the string table in one PDB consists of "foo" followed by "bar" and in the other PDB it consists of "bar" followed by "foo", this is not necessarily a critical difference, as long as the uses of these strings also refer to the correct location. On the other hand, if the second PDB doesn't even contain the string "foo" at all, this is a critical difference. diff mode has been in llvm-pdbutil for quite a while, but because of the above challenge along with some others, it's been hard to make it useful. I think this patch addresses that. It looks for all the same things, but it now prints the output in tabular format (carefully formatted and aligned into tables and fields), and it highlights critical differences in red, non-critical differences in yellow, and identical fields in green. This makes it easy to spot the places we differ, and the general concept of outputting arbitrary fields in tabular format can be extended to provide analysis into many of the different types of information that show up in a PDB. Differential Revision: https://reviews.llvm.org/D35039 llvm-svn: 307421
* Fix variable names. NFC.Rafael Espindola2017-07-071-18/+18
| | | | llvm-svn: 307406
* Reduce code duplication.Rafael Espindola2017-07-071-33/+27
| | | | | | | By addding a mapNameToDWARFSection we only need to check section names in one place. llvm-svn: 307359
* [PDB] Teach libpdb to write DBI Stream ECNames.Zachary Turner2017-07-073-3/+19
| | | | | | | | | | | | | | | | | | | | | | | 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
* fix trivial typos in comments; NFCHiroshi Inoue2017-07-031-1/+1
| | | | llvm-svn: 307004
* [CodeView, PDB] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-06-3013-56/+78
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 306911
* [llvm-pdbutil] Output the symbol offset when dumping.Zachary Turner2017-06-301-4/+24
| | | | | | | | | | | | | | | | 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
* [llvm-pdbutil] Add the ability to dump the dependency tree for a typeZachary Turner2017-06-301-0/+19
| | | | | | | | | | | | | | | Previously we had the -type-index option which would dump the record of a single, but we had no way to follow the dependency graph backwards and also dump all dependent types. Having this option makes test-writing better, because we can limit the test to only those records that are of importance for the thing we're trying to test, which allows us to use things like CHECK-NEXT to reduce fragility. Differential Revision: https://reviews.llvm.org/D34899 llvm-svn: 306852
* [DWARF] Added verification checks for the .apple_names section.Spyridoula Gravani2017-06-292-3/+102
| | | | | | | | This patch verifies the number of atoms, the validity of the form for each atom, as well as the validity of the hashdata. For hashdata, we're verifying that the hashdata offset is correct and that the offset in the .debug_info for each DIE in the hashdata is also valid. llvm-svn: 306735
* [DWARF] NFC: DWARFDataExtractor combines relocs with DataExtractor.Paul Robinson2017-06-2912-94/+96
| | | | | | | | | | | Requires callers to directly associate relocations with a DataExtractor used to read data from a DWARF section, which helps a callee not make assumptions about which section it is reading. This is the next step in reducing DWARFFormValue's dependence on DWARFUnit. Differential Revision: https://reviews.llvm.org/D34704 llvm-svn: 306699
* [DWARF] - Fix message reporting about broken relocation.George Rimar2017-06-291-1/+1
| | | | | | | | | | | | | Because of mistake introduced in r306517, wrong variable ("name" instead of "Name") was used in error message. As a result it reported section name instead of relocation name. This file still needs cleanup to match LLVM coding style and more tests I think. llvm-svn: 306677
* [CodeView] Fix some Clang-tidy modernize-use-using and Include What You Use ↵Eugene Zelenko2017-06-2911-46/+127
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 306616
* Introduce symbol cache to PDB NativeSessionAdrian McCarthy2017-06-282-5/+20
| | | | | | | | | | | | | Instead of creating symbols directly in the findChildren methods of the native symbol implementations, they will rely on the NativeSession to act as a factory for these types. This lets NativeSession cache the NativeRawSymbols in its new symbol cache and makes that cache the source of unique IDs for the symbols. Right now, this affects only NativeCompilandSymbols. There's no external change yet, so I think the existing tests are still sufficient. Coming soon are patches to extend this to built-in types and enums. llvm-svn: 306610
* Recommit "[ELF] - Add ability for DWARFContextInMemory to exit early when ↵George Rimar2017-06-281-9/+21
| | | | | | | | | | | | | | | | | | | | | any error happen." With fix in include folder character case: #include "llvm/Codegen/AsmPrinter.h" -> #include "llvm/CodeGen/AsmPrinter.h" Original commit message: Change introduces error reporting policy for DWARFContextInMemory. New callback provided by client is able to handle error on it's side and return Halt or Continue. That allows to either keep current behavior when parser prints all errors but continues parsing object or implement something very different, like stop parsing on a first error and report an error in a client style. Differential revision: https://reviews.llvm.org/D34328 llvm-svn: 306517
* Revert r306512 "[ELF] - Add ability for DWARFContextInMemory to exit early ↵George Rimar2017-06-281-21/+9
| | | | | | | | | | | | | | | | | when any error happen." It broke BB: [13/106] 13 0.022 Generating VCSRevision.h [25/106] 24 1.209 Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o FAILED: unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o /home/bb/bin/g++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_GLOBAL_ISEL -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iunittests/DebugInfo/DWARF -I../llvm-project/llvm/unittests/DebugInfo/DWARF -Iinclude -I../llvm-project/llvm/include -I../llvm-project/llvm/utils/unittest/googletest/include -I../llvm-project/llvm/utils/unittest/googlemock/include -fPIC -fvisibility-inlines-hidden -m32 -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3 -UNDEBUG -Wno-variadic-macros -fno-exceptions -fno-rtti -MD -MT unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o -MF unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o.d -o unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o -c ../llvm-project/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp ../llvm-project/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp:18:37: fatal error: llvm/Codegen/AsmPrinter.h: No such file or directory #include "llvm/Codegen/AsmPrinter.h" ^ compilation terminated. llvm-svn: 306513
* [ELF] - Add ability for DWARFContextInMemory to exit early when any error ↵George Rimar2017-06-281-9/+21
| | | | | | | | | | | | | | | | happen. Change introduces error reporting policy for DWARFContextInMemory. New callback provided by client is able to handle error on it's side and return Halt or Continue. That allows to either keep current behavior when parser prints all errors but continues parsing object or implement something very different, like stop parsing on a first error and report an error in a client style. Differential revision: https://reviews.llvm.org/D34328 llvm-svn: 306512
* [DWARF] NFC: Make string-offset handling more like address-table handling; Paul Robinson2017-06-272-12/+3
| | | | | | do the indirection and relocation all in the same method. llvm-svn: 306418
* [DWARF] NFC: Give DwarfFormat a 1-byte base type.Paul Robinson2017-06-261-2/+2
| | | | | | | In particular this reduces DWARFFormParams from 64 to 32 bits; pass it around by value. llvm-svn: 306324
* [DWARF] NFC: Collect info used by DWARFFormValue into a helper.Paul Robinson2017-06-265-150/+99
| | | | | | | | | | | Some forms have sizes that depend on the DWARF version, DWARF format (32/64-bit), or the size of an address. Collect these into a struct to simplify passing them around. Require callers to provide one when they query a form's size. Differential Revision: http://reviews.llvm.org/D34570 llvm-svn: 306315
* [pdb] Fix reading of llvm-generated PDBs by cvdump.Zachary Turner2017-06-251-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you dump a pdb to yaml, and then round-trip it back to a pdb, and run cvdump -l <file> on the new pdb, cvdump will generate output such as this. *** LINES ** Module: "d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj" Error: Line number corrupted: invalid file id 0 <Unknown> (MD5), 0001:00000010-0000001A, line/addr pairs = 3 5 00000010 6 00000013 7 00000018 Note the error message about the corrupted line number. It turns out that the problem is that cvdump cannot find the /names stream (e.g. the global string table), and the reason it can't find the /names stream is because it doesn't understand the NameMap that we serialize which tells pdb consumers which stream has the string table. Some experimentation shows that if we add items to the hash table in a specific order before serializing it, cvdump can read it. This suggests that either we're using the wrong hash function, or we're serializing something incorrectly, but it will take some deeper investigation to figure out how / why. For now, this at least allows cvdump to read our line information (and incidentally, produces an identical byte sequence to what Microsoft tools produce when writing the named stream map). Differential Revision: https://reviews.llvm.org/D34491 llvm-svn: 306233
* [llvm-pdbutil] Dump raw bytes of module symbols and debug chunks.Zachary Turner2017-06-231-8/+28
| | | | llvm-svn: 306179
* [DebugInfo] Fix some Clang-tidy modernize-use-using and Include What You Use ↵Eugene Zelenko2017-06-237-35/+61
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 306169
* [llvm-pdbutil] Dump raw bytes of type and id records.Zachary Turner2017-06-232-1/+18
| | | | llvm-svn: 306167
* [llvm-pdbutil] Dump raw bytes of various DBI stream subsections.Zachary Turner2017-06-231-16/+36
| | | | llvm-svn: 306160
* [llvm-pdbutil] Dump raw bytes of pdb name map.Zachary Turner2017-06-231-0/+8
| | | | | | | | 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 a function for formatting MSF data.Zachary Turner2017-06-231-0/+8
| | | | | | | | | | | | | | | | | | | 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
* Fix build break by using llvm::make_unique instead of std::make_unique.Adrian McCarthy2017-06-222-2/+5
| | | | llvm-svn: 306043
* Add IDs and clone methods to NativeRawSymbolAdrian McCarthy2017-06-225-10/+17
| | | | | | | | | | | | All NativeRawSymbols will have a unique symbol ID (retrievable via getSymIndexId). For now, these are initialized to 0, but soon the NativeSession will be responsible for creating the raw symbols, and it will assign unique IDs. The symbol cache in the NativeSession will also require the ability to clone raw symbols, so I've provided implementations for that as well. llvm-svn: 306042
* Make IPDBSession::getGlobalScope a non-const methodAdrian McCarthy2017-06-222-5/+4
| | | | | | | | | | | | There doesn't seem to be a compelling reason why this method should be const other than it was possible with the DIA implementation. The native session is going to act as a symbol factory and cache. This could be acheived with mutable (and the existing const_cast), but it seems cleaner to accept that this method affects the state of the session. This change eliminates an existing const_cast. llvm-svn: 306041
* [DWARF] Support for DW_FORM_strx3 and complete support for DW_FORM_strx{1,2,4}Wolfgang Pieb2017-06-211-1/+17
| | | | | | | | | | (consumer). Reviewer: aprantl Differential Revision: https://reviews.llvm.org/D34418 llvm-svn: 305944
* [PDB] Add symbols to the PDBReid Kleckner2017-06-211-0/+82
| | | | | | | | | | | | | | | | | | | Summary: The main complexity in adding symbol records is that we need to "relocate" all the type indices. Type indices do not have anything like relocations, an opaque data structure describing where to find existing type indices for fixups. The linker just has to "know" where the type references are in the symbol records. I added an overload of `discoverTypeIndices` that works on symbol records, and it seems to be able to link the standard library. Reviewers: zturner, ruiu Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D34432 llvm-svn: 305933
* [PDB] Don't write uninitialized bytes to a PDB file.Zachary Turner2017-06-202-0/+3
| | | | | | | | | | There were certain fields that we didn't know how to write, as well as various padding bytes that we would ignore. This leads to garbage data in the PDB. While not strictly necessary, we should initialize these bytes to something meaningful, as it makes for easier binary comparison between PDBs. llvm-svn: 305819
* Remove convenient but probably not worthwhile macro for lambda workaroundDavid Blaikie2017-06-191-15/+18
| | | | | | Cleanup from r305405 llvm-svn: 305731
* [PDB] Start emitting source file and line informationReid Kleckner2017-06-193-12/+32
| | | | | | | | | | | | | | | | | | | | | | | Summary: This is a first step towards getting line info to show up in VS and windbg. So far, only llvm-pdbutil can parse the PDBs that we produce. cvdump doesn't like something about our file checksum tables. I'll have to dig into that next. This patch adds a new DebugSubsectionRecordBuilder which takes bytes directly from some other producer, such as a linker, and sticks it into the PDB. Line tables only need to be relocated. No data needs to be rewritten. File checksums and string tables, on the other hand, need to be re-done. Reviewers: zturner, ruiu Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D34257 llvm-svn: 305713
* [CodeView] Fix dumping of public symbol record flagsReid Kleckner2017-06-193-2/+12
| | | | | | | I noticed nonsensical type information while dumping PDBs produced by MSVC. llvm-svn: 305708
* Delete TypeDatabase.Zachary Turner2017-06-185-585/+86
| | | | | | | | Merge the functionality into the random access type collection. This class was only being used in 2 places, so getting rid of it simplifies the code. llvm-svn: 305653
* Don't crash if a type record can't be found.Zachary Turner2017-06-171-0/+9
| | | | | | | This was a regression introduced in a previous patch. Adding back the code that handles this case. llvm-svn: 305617
* [CodeView] Fix random access of type names.Zachary Turner2017-06-163-10/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose we had a type index offsets array with a boundary at type index N. Then you request the name of the type with index N+1, and that name requires the name of index N-1 (think a parameter list, for example). We didn't handle this, and we would print something like (<unknown UDT>, <unknown UDT>). The fix for this is not entirely trivial, and speaks to a larger problem. I think we need to kill TypeDatabase, or at the very least kill TypeDatabaseVisitor. We need a thing that doesn't do any caching whatsoever, just given a type index it can compute the type name "the slow way". The reason for the bug is that we don't have anything like that. Everything goes through the type database, and if we've visited a record, then we're "done". It doesn't know how to do the expensive thing of re-visiting dependent records if they've not yet been visited. What I've done here is more or less copied the code (albeit greatly simplified) from TypeDatabaseVisitor, but wrapped it in an interface that just returns a std::string. The logic of caching the name is now in LazyRandomTypeCollection. Eventually I'd like to move the record database here as well and the visited record bitfield here as well, at which point we can actually just delete TypeDatabase. I don't see any reason for it if a "sequential" collection is just a special case of a random access collection with an empty partial offsets array. Differential Revision: https://reviews.llvm.org/D34297 llvm-svn: 305612
* Remove some dead code / includes.Zachary Turner2017-06-162-4/+0
| | | | | | | I'm trying to get rid of the TypeDatabase class, so the first step is to minimize its footprint. llvm-svn: 305611
* [DWARF] Corrected behavior for when no .apple_names section is present in ↵Spyridoula Gravani2017-06-161-3/+3
| | | | | | | | | | the object. The verifier should not output any message in such a case. Added test case with no .apple_name section in the file to verify new functionality. Made existing test case more specific. llvm-svn: 305597
* [llvm-pdbutil] Add support for dumping lines and inlinee lines.Zachary Turner2017-06-153-9/+17
| | | | llvm-svn: 305529
* [llvm-pdbutil] Add back support for dumping file checksums.Zachary Turner2017-06-151-0/+9
| | | | | | 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-0/+1
| | | | | | | 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-155-77/+96
| | | | | | | | | 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-155-96/+77
| | | | | | | | | This reverts commit 83ea17ebf2106859a51fbc2a86031b44d33696ad. This is failing due to some strange template problems, so reverting until it can be straightened out. llvm-svn: 305505
* [DWARF] Removed dead code. The verifier functionality is provided bySpyridoula Gravani2017-06-151-242/+0
| | | | | | the DWARFVerifier class (as it should). llvm-svn: 305503
* [llvm-pdbutil] rewrite the "raw" output style.Zachary Turner2017-06-155-77/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Specified ReportError as noreturn friendly to old compilers.Galina Kistanova2017-06-141-9/+14
| | | | llvm-svn: 305405
* Resubmit "[codeview] Make obj2yaml/yaml2obj support .debug$S..."Zachary Turner2017-06-148-38/+67
| | | | | | | | | This was originally reverted because of some non-deterministic failures on certain buildbots. Luckily ASAN eventually caught this as a stack-use-after-scope, so the fix is included in this patch. llvm-svn: 305393
* Revert "[codeview] Make obj2yaml/yaml2obj support .debug$S..."Zachary Turner2017-06-147-65/+37
| | | | | | | | This is causing failures on linux bots with an invalid stream read. It doesn't repro in any configuration on Windows, so reverting until I have a chance to investigate on Linux. llvm-svn: 305371
OpenPOWER on IntegriCloud