summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* [pdbutil] Add a command to dump the FPM.Zachary Turner2017-08-023-18/+21
| | | | | | | | | | | | | | 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
* DebugInfo: Test & handle (differently) non-zero DW_AT_ranges_baseDavid Blaikie2017-08-021-6/+7
| | | | | | | | | Followup to r309570, fixing it slightly differently (ranges_base and addr_base should never be read from a DWO file - so there shouldn't be any issue with 'overriding' the values - conditionalize the code and assert that the values aren't being overriden). llvm-svn: 309879
* [DebugInfo] Use shrink_to_fit to simplify code. NFCI.Benjamin Kramer2017-08-012-14/+4
| | | | llvm-svn: 309683
* [lld/pdb] Add an empty globals stream.Zachary Turner2017-07-314-1/+107
| | | | | | | | | | We don't write any actual symbols to this stream yet, but for now we just create the stream and hook it up to the appropriate places and give it a valid header. Differential Revision: https://reviews.llvm.org/D35290 llvm-svn: 309608
* [DWARF] Added verification check for tags in accelerator tables. This patch ↵Spyridoula Gravani2017-07-312-7/+23
| | | | | | | | verifies that the atom tag is actually the same with the tag of the DIE that we retrieve from the table. Differential Revision: https://reviews.llvm.org/D35963 llvm-svn: 309596
* [DebugInfo] Don't overwrite DWARFUnit fields if the CU DIE doesn't have them.Benjamin Kramer2017-07-311-2/+6
| | | | | | | | | | DIEs are lazily deserialized so it's possible that the DWO CU is created before the DIE is parsed. DWO shares .debug_addr and .debug_ranges with the object file so overwriting the offset with 0 will make the CU unusable. No test case because I couldn't get clang to emit a non-zero range base. llvm-svn: 309570
* DebugInfo: Fix for CU index usage in 309507David Blaikie2017-07-301-1/+3
| | | | | | Not sure quite how I failed so clearly to test this, but anyway. llvm-svn: 309514
* DebugInfo: Use DWP cu_index to speed up symbolizing (as intended)David Blaikie2017-07-302-3/+26
| | | | | | | | | | | I was a bit lazy when I first implemented this & skipped the index lookup - obviously for large files this becomes pretty crucial, so here we go, do the index lookup. Speeds up large DWP symbolizing by... lots. (20m -> 20s, actually, maybe more in a release build (that was a release build without index lookup, compared to a debug/non-release build with the index usage)) llvm-svn: 309507
* DebugInfo: Provide option for explicitly specifying the name of the DWP fileDavid Blaikie2017-07-302-13/+19
| | | | | | | | | | | | | | | | If you've archived the DWP file somewhere it's probably useful to be able to just tell llvm-symbolizer where it is when you're symbolizing stack traces from the binary. This only provides a mechanism for specifying a single DWP file, good if you're symbolizing a program with a single DWP file, but it's likely if the program is dynamically linked that you might have a DWP for each dynamic library - in which case this feature won't help (at least as it's surfaced in llvm-symbolizer for now) - in theory it could be extended to specify a collection of DWP files that could all be consulted for split CU hash resolution. llvm-svn: 309498
* [PDB] Initialize the std::array<ulittle32_t> used for the gsi bitmapReid Kleckner2017-07-271-0/+2
| | | | | | | | With ASan, we would write about 512 bytes of malloc fill value to the PDB, with some random bits ORed in here and there. Dumping the PDB would always fail reliably. llvm-svn: 309331
* [PDB] Write public symbol records and the publics hash tableReid Kleckner2017-07-273-38/+165
| | | | | | | | | | | | | | Summary: MSVC link.exe records all external symbol names in the publics stream. It provides similar functionality to an ELF .symtab. Reviewers: zturner, ruiu Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D35871 llvm-svn: 309303
* [DWARF] Minor code style modification, no functionality change.Spyridoula Gravani2017-07-271-8/+5
| | | | llvm-svn: 309240
* [PDB] Remove stale GSI.h header that I intended to remove in the previous commitReid Kleckner2017-07-263-55/+0
| | | | llvm-svn: 309069
* [DWARF] Generalized verification of .apple_names accelerator table to be ↵Spyridoula Gravani2017-07-262-48/+65
| | | | | | | | applicable to any acceleration table. Added verification for .apple_types, .apple_namespaces and .apple_objc sections. Differential Revision: https://reviews.llvm.org/D35853 llvm-svn: 309068
* [PDB] Improve GSI hash table dumping for publics and globalsReid Kleckner2017-07-268-158/+103
| | | | | | | | | | | | | | | 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
* DWARFVerifier.cpp: Fix -m32 in r308928. Use PRIx64.NAKAMURA Takumi2017-07-251-1/+2
| | | | llvm-svn: 308949
* [DWARF] Added verification check for die ranges. If highPC is an address, ↵Spyridoula Gravani2017-07-241-0/+13
| | | | | | | | then it should be greater than lowPC for each range. Differential Revision: https://reviews.llvm.org/D35733 llvm-svn: 308928
* Move DWARFSectionMap to a .cpp file.Rafael Espindola2017-07-241-0/+6
| | | | | | Thanks to Paul Robinson for the suggestion. llvm-svn: 308913
* Revert "Debug: handle dumping the D language."Tim Northover2017-07-241-1/+0
| | | | | | Reid beat me to it. llvm-svn: 308902
* Debug: handle dumping the D language.Tim Northover2017-07-241-0/+1
| | | | | | | Mostly just to silence a warning about an unhandled case. There don't seem to be any tests for this operator (at least that I could find). llvm-svn: 308901
* Add missing case to switchReid Kleckner2017-07-241-0/+1
| | | | llvm-svn: 308894
* [codeview] Emit 'D' as the cv source language for D codeReid Kleckner2017-07-241-1/+1
| | | | | | | | | This matches DMD: https://github.com/dlang/dmd/blob/522263965cf3a27ed16b31f3c3562db86cdeabec/src/ddmd/backend/cv8.c#L199 Fixes PR33899. llvm-svn: 308890
* Fix DebugInfo/PDB build by adding missing changesReid Kleckner2017-07-212-1/+2
| | | | llvm-svn: 308765
* [PDB] Dump extra info about the publics streamReid Kleckner2017-07-213-5/+5
| | | | | | | | | | This includes the hash table, the address map, and the thunk table and section offset table. The last two are only used for incremental linking, which LLD doesn't support, so they are less interesting. The hash table is particularly important to get right, since this is the one of the streams that debuggers use to translate addresses to symbols. llvm-svn: 308764
* [DWARF] Generalized verification of .debug_abbrev to be applicable to both ↵Spyridoula Gravani2017-07-211-14/+24
| | | | | | | | .debug_abbrev and .debug_abbrev.dwo sections. Differential Revision: https://reviews.llvm.org/D35698 llvm-svn: 308703
* [DWARF] Added check that verifies that no abbreviation declaration has more ↵Spyridoula Gravani2017-07-202-0/+32
| | | | | | | | | | | | | than one attribute with the same name. SUMMARY This patch adds a verification check on the abbreviation declarations in the .debug_abbrev section. The check makes sure that no abbreviation declaration has more than one attributes with the same name. Differential Revision: https://reviews.llvm.org/D35643 llvm-svn: 308579
* Use llvm::make_unique once more to avoid ADL ambiguity with std::make_uniqueReid Kleckner2017-07-191-2/+3
| | | | llvm-svn: 308552
* Use llvm::make_unique to try to fix the windows build.Rafael Espindola2017-07-191-2/+2
| | | | llvm-svn: 308551
* Remove some leftover DWARFContextInMemory.Rafael Espindola2017-07-191-14/+0
| | | | | | Not sure how I missed these on the previous commit. llvm-svn: 308550
* Use delegation instead of inheritance.Rafael Espindola2017-07-196-265/+443
| | | | | | | | | | This changes DwarfContext to delegate to DwarfObject instead of having pure virtual methods. With this DwarfContextInMemory is replaced with an implementation of DwarfObject that is local to a .cpp file. llvm-svn: 308543
* [DWARF] Modification of code for the verification of .debug_info section.Spyridoula Gravani2017-07-182-45/+85
| | | | | | | | | | | | | | | Summary: This patch modifies the handleDebugInfo() function so that we verify the contents of each unit in the .debug_info section only if its header has been successfully verified. This change will allow for more/different verification checks depending on the type of the unit since from dwarf5, the .debug_info section may consist of different types of units. Subscribers: aprantl Differential Revision: https://reviews.llvm.org/D35521 llvm-svn: 308245
* [PDB] Finish and simplify TPI hashingReid Kleckner2017-07-181-75/+53
| | | | | | | | | | | | | | | | | | | | | | | | 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] Fix YAML for LF_TYPESERVER2 by hoisting PDB_UniqueIdReid Kleckner2017-07-179-24/+24
| | | | | | | | | | | | | | | | | | Summary: We were treating the GUIDs in TypeServer2Record as strings, and the non-ASCII bytes in the GUID would not round-trip through YAML. We already had the PDB_UniqueId type portably represent a Windows GUID, but we need to hoist that up to the DebugInfo/CodeView library so that we can use it in the TypeServer2Record as well as in PDB parsing code. Reviewers: inglorion, amccarth Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D35495 llvm-svn: 308234
* [codeview] Don't use the type visitor to merge typesReid Kleckner2017-07-171-71/+58
| | | | | | | | | | | | | | | Summary: This didn't do much to speed things up, but it implements a FIXME, and I think it's a nice simplification. We don't need the record kind switch. We're doing that ourselves. Reviewers: ruiu, inglorion Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D35496 llvm-svn: 308213
* [codeview] Remove TypeServerHandler and PDBTypeServerHandlerReid Kleckner2017-07-175-217/+19
| | | | | | | | | | | | | | | | | Summary: Instead of wiring these through the CVTypeVisitor interface, clients should inspect the CVTypeArray before visiting it and potentially load up the type server's TPI stream if they need it. No tests relied on this functionality because LLD was the only client. Reviewers: ruiu Subscribers: mgorny, hiraditya, zturner, llvm-commits Differential Revision: https://reviews.llvm.org/D35394 llvm-svn: 308212
* [CodeView] Dump BuildInfoSym and ProcSym type indicesReid Kleckner2017-07-151-1/+1
| | | | | | | 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
* Remove set but not used variables from the debug info verifier code.Eric Christopher2017-07-141-6/+1
| | | | llvm-svn: 307987
* [DWARF] Introduce verification for the unit header chain in .debug_info ↵Spyridoula Gravani2017-07-132-0/+94
| | | | | | | | | | | | | | | section to llvm-dwarfdump. This patch adds verification checks for the unit header chain in the .debug_info section. Specifically, for each unit in the .debug_info section, the verifier checks that: The unit length is valid (i.e. the unit can actually fit in the .debug_info section) The dwarf version of the unit is valid The address size is valid (4 or 8) The unit type (if the unit is in dwarf5) is valid The debug_abbrev_offset is valid llvm-svn: 307975
* [PDB] Fix type server handling for archivesReid Kleckner2017-07-133-16/+13
| | | | | | | | | | | | | | | | | | | Summary: This fixes type indices for SDK or CRT static archives. Previously we'd try to look next to the archive object file path, which would not exist on the local machine. Also error out if we can't resolve a type server record. Hypothetically we can recover from this error by discarding debug info for this object, but that is not yet implemented. Reviewers: ruiu, amccarth Subscribers: aprantl, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D35369 llvm-svn: 307946
* [DWARF] Fixing a bug with processing of DWARF v5 indexed strings in Mach-O ↵Wolfgang Pieb2017-07-131-4/+4
| | | | | | | | | | | objects. Code to convert MachO - specific section debug section names to standard DWARF v5 section names was in the wrong place. Differential Revision: https://reviews.llvm.org/D35321 llvm-svn: 307872
* Don't expose a map in the DWARFContext interface.Rafael Espindola2017-07-121-6/+6
| | | | | | | | | Doing so is leaking an implementation detail. I have an implementation that uses the lld infrastructure and doesn't use a map or object::SectionRef. llvm-svn: 307846
* Fix non-Windows build after PDB native builtin type changeReid Kleckner2017-07-122-6/+8
| | | | | | Some C++14 features slipped in along with an extra member qualification. llvm-svn: 307835
* [PDB] Enable NativeSession to create symbols for built-in types on demandAdrian McCarthy2017-07-126-5/+108
| | | | | | | | | | | | | | | | Summary: There is a reserved range of type indexes for built-in types (like integers). This will create a symbol for a built-in type if the caller askes for one by type index. This is also plumbing for being able to recall symbols by type index in general, but user-defined types will come in subsequent patches. Reviewers: rnk, zturner Subscribers: mgorny, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D35163 llvm-svn: 307834
* [codeview] Change readobj symbol dumping formatReid Kleckner2017-07-111-72/+19
| | | | | | | | Avoid duplicating DictScope with hand-written names everywhere. Print the S_-prefixed symbol kind for every record. This should make it easier to search for certain kinds of records when debugging PDB linking. llvm-svn: 307732
* [codeview] Fix type index discovery for four symbol recordsReid Kleckner2017-07-111-0/+12
| | | | | | | | | | | | I encountered these when linking LLD, which uses atls.lib. Those objects appear to use these uncommon symbol records: 0x115E S_HEAPALLOCSITE 0x113D S_ENVBLOCK 0x1113 S_GTHREAD32 0x1153 S_FILESTATIC llvm-svn: 307725
* [lld/pdb] Create an empty public symbol record stream.Zachary Turner2017-07-105-16/+127
| | | | | | | | | | | | | | This is part of the continuing effort to increase parity between LLD and MSVC PDBs. link still doesn't like our PDBs, so the most obvious thing to check was whether adding an empty publics stream would get it to do something else. It still fails in the same way but at least this removes one more variable from the equation. The next logical step would be to try creating an empty globals stream. Differential Revision: https://reviews.llvm.org/D35224 llvm-svn: 307598
* [DWARF] - Rename variable. NFC.George Rimar2017-07-101-3/+3
| | | | | | | | | | | | Variable was called 'Name' and contained text name of relocation type. Problem was that outside of this error handling scope we already have different 'Name' variable that contains section name. Change helps to avoid confusion. llvm-svn: 307530
* [DWARF] - Remove unused variables. NFC.George Rimar2017-07-101-6/+2
| | | | llvm-svn: 307528
* [PDB] More changes to bring lld PDBs to parity with MSVC.Zachary Turner2017-07-072-4/+4
| | | | | | | | | | | | | | | | | | | 1) Don't write a /src/headerblock stream. This appears to be written conditionally by MSVC, but it's not clear what the condition is. For now, just remove it since we dont' know what it is anyway and the particular pdb we've checked in for the test doesn't have one. 2) Write a valid timestamp for the PDB file signature. This leads to non-reproducible builds, but it matches the default behavior of link, so it should be out default as well. If we need reproducibility, we should add a separate command line option for it that is off by default. 3) Write an empty FPO stream. MSVC seems to always write an FPO stream. This change makes the stream directory match up, although we still need to make the contents of the FPO stream match. llvm-svn: 307436
* Fix some differences between lld and MSVC generated PDBs.Zachary Turner2017-07-073-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A couple of things were different about our generated PDBs. 1) We were outputting the wrong Version on the PDB Stream. The version we were setting was newer than what MSVC is setting. It's not clear what the implications are, but we change LLD to use PdbImplVC70, as MSVC does. 2) For the optional debug stream indices in the DBI Stream, we were outputting 0 to mean "the stream is not present". MSVC outputs uint16_t(-1), which is the "correct" way to specify that a stream is not present. So we fix that as well. 3) We were setting the PDB Stream signature to 0. This is supposed to be the result of calling time(nullptr). Although this leads to non-deterministic builds, a better way to solve that is by having a command line option explicitly for generating a reproducible build, and have the default behavior of lld-link match the default behavior of link. To test this, I'm making use of the new and improved `pdb diff` sub command. To make it suitable for writing tests against, I had to modify the diff subcommand slightly to print less verbose output. Previously it would always print | <column> | <value1> | <value2> | which is quite verbose, and the values are fragile. All we really want to know is "did we produce the same value as link?" So I added command line options to print a single character representing the result status (different, identical, equivalent), and another to hide the value display. Note that just inspecting the diff output used to write the test, you can see some things that are obviously wrong. That is just reflective of the fact that this is the state of affairs today, not that we're asserting that this is "correct". We can use this as a starting point to discover differences, fix them, and update the test. Differential Revision: https://reviews.llvm.org/D35086 llvm-svn: 307422
OpenPOWER on IntegriCloud