summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* [DWARF v5] Support for verbose dumping of .debug_rnglist entriesWolfgang Pieb2018-03-083-28/+87
| | | | | | | | | | | | | | | | Adding verbose dumping to the recent implementation of dumping of v5 range list entries. We're capturing the entries as is as they come in during extraction, including their file offset, so we can dump them in more detail. The offset table entries which are table-relative are shown as is (as in non-verbose mode) and with the actual file offset they map to. Reviewers: dblaikie, aprantl, jdevlieghere, jhenderson Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43366 llvm-svn: 327059
* DWARFVerifier: Basic verification of .debug_namesPavel Labath2018-03-081-0/+87
| | | | | | | | | | | | | | | | | Summary: This patch adds basic .debug_names verification capabilities to the DWARF verifier. Right now, it checks that the headers and abbreviation tables of the individual name indexes can be parsed correctly, it verifies the buckets table and the cross-checks the CU lists for consistency. I intend to add further checks in follow-up patches. Reviewers: JDevlieghere, aprantl, probinson, dblaikie Subscribers: vleschuk, echristo, clayborg, llvm-commits Differential Revision: https://reviews.llvm.org/D44211 llvm-svn: 327011
* [DWARF] Don't attempt to parse line tables at invalid offsetsJames Henderson2018-03-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Whilst working on improvements to the error handling of the debug line parsing code, I noticed that if an invalid offset were to be specified in a call to getOrParseLineTable(), an entry in the LineTableMap would still be created, even if the offset was not within the section range. The immediate parsing attempt afterwards would fail (it would end up getting a version of 0), and thereafter, any subsequent calls to getOrParseLineTable or getLineTable would return the default- constructed, invalid line table. In reality, we shouldn't even attempt to parse this table, and we should always return a nullptr from these two functions for this situation. I have tested this via a unit test, which required some new framework for unit testing debug line. My plan is to add quite a few more unit tests for the new error reporting mechanism that will follow shortly, hence the reason why the supporting code for the tests are written the way they are - I intend to extend the DwarfGenerator class to support generating debug line. At that point, I'll make sure that there are a few positive test cases for this and the parsing code too. Differential Revision: https://reviews.llvm.org/D44200 Reviewers: JDevlieghere, aprantl llvm-svn: 326995
* Reland "[DebugInfo] Support DWARF expressions in eh_frame"Rafael Auler2018-03-084-369/+262
| | | | | | | | | | Summary: Original change was D43313 (r326932) and reverted by r326953 because it broke an LLD test and a windows build. The LLD test was already fixed in lld commit r326944 (thanks maskray). This is the original change with the windows build fixed. llvm-svn: 326970
* Fix build broken by r326959Eugene Zemtsov2018-03-081-1/+1
| | | | | | Adding Demangle to link time dependencies of Symbolize llvm-svn: 326964
* Use itaniumDemangle in llvm-symbolizerEugene Zemtsov2018-03-071-9/+4
| | | | | | | | | Currently on Windows (_MSC_VER) LLVMSymbolizer supports only Microsoft mangling. This fix just explicitly uses itaniumDemangle when mangled name starts with _Z. Differential Revision: https://reviews.llvm.org/D44192 llvm-svn: 326959
* Revert r326932: [DebugInfo] Support DWARF expressions in eh_frameRui Ueyama2018-03-074-262/+369
| | | | | | This reverts commit rr326932 because it broke lld/test/ELF/eh-frame-hdr-augmentation.s. llvm-svn: 326953
* [DebugInfo] Support DWARF expressions in eh_frameRafael Auler2018-03-074-369/+262
| | | | | | | | | | | | | | | | | | This patch enhances DWARFDebugFrame with the capability of parsing and printing DWARF expressions in CFI instructions. It also makes FDEs and CIEs accessible to lib users, so they can process them in client tools that rely on LLVM. To make it self-contained with a test case, it teaches llvm-readobj to be able to dump EH frames and checks they are correct in a unit test. The llvm-readobj code is Maksim Panchenko's work (maksfb). Reviewers: JDevlieghere, espindola Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D43313 llvm-svn: 326932
* [dwarfdump] Only print CU relative offset in verbose modeJonas Devlieghere2018-03-071-8/+15
| | | | | | | | | | | | Instead of only printing the CU-relative offset in non-verbose mode, it makes more sense to only printed the resolved address. In verbose mode we still print both. Differential revision: https://reviews.llvm.org/D44148 rdar://33525475 llvm-svn: 326903
* [DebugInfoPDB] Add DIA implementation for getSrcLineOnTypeDefnAaron Smith2018-03-072-0/+16
| | | | | | | | | | | | | | Summary: This helps to determine the line number for a PDB type with definition Reviewers: zturner, llvm-commits, rnk Reviewed By: zturner Subscribers: rengolin, JDevlieghere Differential Revision: https://reviews.llvm.org/D44119 llvm-svn: 326857
* [llvm-symbolizer] Use correct path when resolving .gnu_debuglink in .debugFrancis Ricci2018-03-021-1/+1
| | | | | | | | | | | | | | | Summary: The symbolizer was checking for .debug as a subdirectory of the binary file itself, not of the directory containing the binary. This led to a failure to find split debug info when it was contained in a .debug directory. Reviewers: rnk, glider, zturner Subscribers: llvm-commits, aprantl Differential Revision: https://reviews.llvm.org/D44025 llvm-svn: 326630
* [PDB] Defer writing the build id until the rest of the PDB is written.Zachary Turner2018-03-012-7/+26
| | | | | | | | | | For now this is NFC, but this small refactor opens the door to letting us embed a hash of the PDB in the build id field of the PDB. Differential Revision: https://reviews.llvm.org/D43913 llvm-svn: 326453
* [CodeView] Lower __restrict and other pointer qualifiers correctlyReid Kleckner2018-02-272-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Qualifiers on a pointer or reference type may apply to either the pointee or the pointer itself. Consider 'const char *' and 'char * const'. In the first example, the pointee data may not be modified without casts, and in the second example, the pointer may not be updated to point to new data. In the general case, qualifiers are applied to types with LF_MODIFIER records, which support the usual const and volatile qualifiers as well as the __unaligned extension qualifier. However, LF_POINTER records, which are used for pointers, references, and member pointers, have flags for qualifiers applying to the *pointer*. In fact, this is the only way to represent the restrict qualifier, which can only apply to pointers, and cannot qualify regular data types. This patch causes LLVM to correctly fold 'const' and 'volatile' pointer qualifiers into the pointer record, as well as adding support for '__restrict' qualifiers in the same place. Based on a patch from Aaron Smith Differential Revision: https://reviews.llvm.org/D43060 llvm-svn: 326260
* [codeview] Remove unused variableReid Kleckner2018-02-271-1/+0
| | | | llvm-svn: 326253
* Implement equal_range for the DWARF v5 accelerator tablePavel Labath2018-02-241-19/+177
| | | | | | | | | | | | | | | | | | | Summary: This patch implements the name lookup functionality of the .debug_names accelerator table and hooks it up to "llvm-dwarfdump -find". To make the interface of the two kinds of accelerator tables more consistent, I've created an abstract "DWARFAcceleratorTable::Entry" class, which provides a consistent interface to access the common functionality of the table entries (such as getting the die offset, die tag, etc.). I've also modified the apple table to vend entries conforming to this interface. Reviewers: JDevlieghere, aprantl, probinson, dblaikie Subscribers: vleschuk, clayborg, echristo, llvm-commits Differential Revision: https://reviews.llvm.org/D43067 llvm-svn: 326003
* [DebugInfo] Support DWARF v5 source code embedding extensionScott Linder2018-02-232-29/+73
| | | | | | | | | | | | | | | | | | | In DWARF v5 the Line Number Program Header is extensible, allowing values with new content types. In this extension a content type is added, DW_LNCT_LLVM_source, which contains the embedded source code of the file. Add new optional attribute for !DIFile IR metadata called source which contains source text. Use this to output the source to the DWARF line table of code objects. Analogously extend METADATA_FILE in Bitcode and .file directive in ASM to support optional source. Teach llvm-dwarfdump and llvm-objdump about the new values. Update the output format of llvm-dwarfdump to make room for the new attribute on file_names entries, and support embedded sources for the -source option in llvm-objdump. Differential Revision: https://reviews.llvm.org/D42765 llvm-svn: 325970
* [PDB] Check the result of setLoadAddress()Aaron Smith2018-02-232-3/+3
| | | | | | | | | | | | Summary: Change setLoadAddress() to return true or false on failure. Reviewers: zturner, llvm-commits Reviewed By: zturner Differential Revision: https://reviews.llvm.org/D43638 llvm-svn: 325843
* [PDB] Fix buildbot failure from missing include for DIAEnumLineNumbersAaron Smith2018-02-221-0/+1
| | | | llvm-svn: 325826
* [PDB] Implement more find methods for PDB symbolsAaron Smith2018-02-222-0/+139
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add additional find methods on PDB raw symbols. findChildrenByAddr() findChildrenByVA() findInlineFramesByAddr() findInlineFramesByVA() findInlineLines() findInlineLinesByAddr() findInlineLinesByRVA() findInlineLinesByVA() Reviewers: zturner, llvm-commits Reviewed By: zturner Differential Revision: https://reviews.llvm.org/D43637 llvm-svn: 325824
* [dwarfdump] Fix spurious verification errors for DW_AT_location attributesJonas Devlieghere2018-02-171-15/+20
| | | | | | | | | | | Verifying any DWARF file that is optimized and contains at least one tag with a DW_AT_location with a location list offset as a DW_AT_form_dataXXX results in dwarfdump spuriously claiming that the location list is invalid. Differential revision: https://reviews.llvm.org/D40199 llvm-svn: 325430
* Fix emission of PDB string table.Zachary Turner2018-02-164-171/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was originally reported as a bug with the symptom being "cvdump crashes when printing an LLD-linked PDB that has an S_FILESTATIC record in it". After some additional investigation, I determined that this was a symptom of a larger problem, and in fact the real problem was in the way we emitted the global PDB string table. As evidence of this, you can take any lld-generated PDB, run cvdump -stringtable on it, and it would return no results. My hypothesis was that cvdump could not *find* the string table to begin with. Normally it would do this by looking in the "named stream map", finding the string /names, and using its value as the stream index. If this lookup fails, then cvdump would fail to load the string table. To test this hypothesis, I looked at the name stream map generated by a link.exe PDB, and I emitted exactly those bytes into an LLD-generated PDB. Suddenly, cvdump could read our string table! This code has always been hacky and we knew there was something we didn't understand. After all, there were some comments to the effect of "we have to emit strings in a specific order, otherwise things don't work". The key to fixing this was finally understanding this. The way it works is that it makes use of a generic serializable hash map that maps integers to other integers. In this case, the "key" is the offset into a buffer, and the value is the stream number. If you index into the buffer at the offset specified by a given key, you find the name. The underlying cause of all these problems is that we were using the identity function for the hash. i.e. if a string's offset in the buffer was 12, the hash value was 12. Instead, we need to hash the string *at that offset*. There is an additional catch, in that we have to compute the hash as a uint32 and then truncate it to uint16. Making this work is a little bit annoying, because we use the same hash table in other places as well, and normally just using the identity function for the hash function is actually what's desired. I'm not totally happy with the template goo I came up with, but it works in any case. The reason we never found this bug through our own testing is because we were building a /parallel/ hash table (in the form of an llvm::StringMap<>) and doing all of our lookups and "real" hash table work against that. I deleted all of that code and now everything goes through the real hash table. Then, to test it, I added a unit test which adds 7 strings and queries the associated values. I test every possible insertion order permutation of these 7 strings, to verify that it really does work as expected. Differential Revision: https://reviews.llvm.org/D43326 llvm-svn: 325386
* Revert "Rewrite the cached map used for locating the most precise DIE among ↵David Blaikie2018-02-131-360/+26
| | | | | | | | | | | | | | | inlined subroutines for a given address." Seeing some inlining missing in internal uses of symbolizer. I'll work on a reproduction, tests, improvements & recommit as soon as possible. (Chandler would like it to be known that this improvement did make check-llvm 4x faster... - so there's certainly some fairly good motivation to push on fixing/figuring this out & getting it back in) This reverts commit r321345. llvm-svn: 324981
* Simplify switch statement (NFC)Adrian Prantl2018-02-121-5/+3
| | | | llvm-svn: 324945
* Fix the syntax highlighting of strings in dwarfdump.Adrian Prantl2018-02-121-4/+4
| | | | llvm-svn: 324936
* Factor out common condition into an easier to understand helper function (NFC).Adrian Prantl2018-02-122-2/+12
| | | | llvm-svn: 324935
* [DWARFv5] Fix dumper to show the file table starts at index 0.Paul Robinson2018-02-081-1/+4
| | | | | | | | Emitting the correct (root of compilation) file at index 0 will be posted for review later; I wanted to get this minor change out of the way first. llvm-svn: 324669
* [DWARF] Regularize dumping strings from line tables.Paul Robinson2018-02-053-25/+46
| | | | | | | | | | | | | | | | | The major visible difference here is that in line-table dumps, directory and file names are wrapped in double-quotes; previously, directory names got single quotes and file names were not quoted at all. The improvement in this patch is that when a DWARF v5 line table header has indirect strings, in a verbose dump these will all have their section[offset] printed as well as the name itself. This matches the format used for dumping strings in the .debug_info section. Differential Revision: https://reviews.llvm.org/D42802 llvm-svn: 324270
* Fix more print format specifiers in debug_rnglists dumpingJames Henderson2018-02-051-4/+6
| | | | | | | | | See also r324096. I have made the assumption that DWARF64 is not an issue for the time being with these fixes. llvm-svn: 324223
* Fix MSVC signed/unsigned comparison warning. NFCI.Simon Pilgrim2018-02-031-1/+1
| | | | llvm-svn: 324171
* Fix type sizes that were causing incorrect string formattingJames Henderson2018-02-021-2/+2
| | | | llvm-svn: 324096
* Add missing new files from r324077James Henderson2018-02-022-0/+218
| | | | | | Differential Revision: https://reviews.llvm.org/D42481 llvm-svn: 324078
* [DWARF v5] Add limited support for dumping .debug_rnglistsJames Henderson2018-02-023-12/+29
| | | | | | | | | | | | | | | | | | | | | This change adds support to llvm-dwarfdump for dumping DWARF5 .debug_rnglists sections in regular ELF files. It is not complete, in that several DW_RLE_* encodings are currently not supported, but does dump the headert and the basic ranges for DW_RLE_start_length and DW_RLE_start_end encodings. Obvious next steps are to add verbose dumping that dumps the raw encodings, rather than the interpreted contents, to add -verify support of the section (e.g. to show that the correct number of offsets are specified), add dumping of .debug_rnglists.dwo, and to add support for other encodings. Reviewed by: dblaikie, JDevlieghere Differential Revision: https://reviews.llvm.org/D42481 llvm-svn: 324077
* [CodeView] Micro-optimizations to speed up type merging.Zachary Turner2018-01-302-115/+91
| | | | | | | | | | | | Based on a profile, a couple of hot spots were identified in the main type merging loop. The code was simplified, a few loops were re-arranged, and some outlined functions were inlined. This speeds up type merging by a decent amount, shaving around 3-4 seconds off of a 40 second link in my test case. Differential Revision: https://reviews.llvm.org/D42559 llvm-svn: 323790
* Stop tracking .debug_line_str in DWARFUnit. NFC.Paul Robinson2018-01-292-14/+13
| | | | llvm-svn: 323701
* [DWARFv5] Re-enable dumping a line table with no CU.Paul Robinson2018-01-293-21/+37
| | | | | | | | | | | r323476 added support for DW_FORM_line_strp, and incorrectly made that depend on having a DWARFUnit available. We shouldn't be tracking .debug_line_str in DWARFUnit after all. After this patch, I can do an NFC follow up and undo a bunch of the "plumbing" part of r323476. Differential Revision: https://reviews.llvm.org/D42609 llvm-svn: 323691
* Fix windows test failure caused by r323638Pavel Labath2018-01-291-1/+1
| | | | | | | | | | | | | | The test was failing because of an incorrect sizeof check in the name index parsing code. This code was meant to check that we have enough input to parse the fixed-size part of the dwarf header, which it did by comparing the input to sizeof(Header). Originally struct Header only contained the fixed-size part, but during review, we've moved additional members into it, which rendered the sizeof check invalid. I resolve this by moving the fixed-size part to a separate struct and updating the sizeof-expression to use that. llvm-svn: 323648
* Fix build broken by r323641Pavel Labath2018-01-291-1/+1
| | | | | | | | The call to ScopedPrinter::printNumber with size_t argument was ambiguous (I think) on 32-bit builds. Explicitly cast to a 64-bit int to avoid this. llvm-svn: 323642
* Refactor dwarfdump -apple-names outputPavel Labath2018-01-291-56/+79
| | | | | | | | | | | | | | | | | | Summary: This modifies the dwarfdump output to align it with the new .debug_names dump. It also renames two header fields to match similar fields in the dwarf5 header. A couple of tests needed to be updated to match new output. The changes were fairly straight-forward, although not really automatable. Reviewers: JDevlieghere, aprantl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42415 llvm-svn: 323641
* [DebugInfo] Basic .debug_names dumping supportPavel Labath2018-01-292-18/+438
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit renames DWARFAcceleratorTable to AppleAcceleratorTable to free up the first name as an interface for the different accelerator tables. Then I add a DWARFDebugNames class for the dwarf5 table. Presently, the only common functionality of the two classes is the dump() method, because this is the only method that was necessary to implement dwarfdump -debug-names; and because the rest of the AppleAcceleratorTable interface does not directly transfer to the dwarf5 tables (the main reason for that is that the present interface assumes the tables are homogeneous, but the dwarf5 tables can have different keys associated with each entry). I expect to make the common interface richer as I add more functionality to the new class (and invent a way to represent it in generic way). In terms of sharing the implementation, I found the format of the two tables sufficiently different to frustrate any attempts to have common parsing or dumping code, so presently the implementations share just low level code for formatting dwarf constants. Reviewers: vleschuk, JDevlieghere, clayborg, aprantl, probinson, echristo, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42297 llvm-svn: 323638
* [Support] Move DJB hash to support. NFCJonas Devlieghere2018-01-281-1/+2
| | | | | | | | | | | This patch moves the DJB hash to support. This is consistent with other hashing algorithms living there. The hash is used by the DWARF accelerator tables. We're doing this now because the hashing function is needed by dsymutil and we don't want to link against libBinaryFormat. Differential revision: https://reviews.llvm.org/D42594 llvm-svn: 323616
* [DWARFv5] Classify all the new forms. NFC.Paul Robinson2018-01-251-14/+25
| | | | | | | | | | Move standard forms from a switch statement to the table of forms; fill in all the missing ones defined in DWARF v5. I'm guessing at classifications in a couple of cases where v5 forms aren't actually supported yet, but whoever adds support for the forms can fix the classifications as needed. llvm-svn: 323481
* [DWARFv5] Support DW_FORM_line_strp in llvm-dwarfdump.Paul Robinson2018-01-254-13/+33
| | | | | | | | | | | This form is like DW_FORM_strp, but points to .debug_line_str instead of .debug_str as the string section. It's intended to be used from the line-table header, and allows string-pooling of directory and filenames across compilation units. Differential Revision: https://reviews.llvm.org/D42553 llvm-svn: 323476
* Rename DwarfAcceleratorTable to AppleAcceleratorTable. NFCPavel Labath2018-01-223-31/+31
| | | | | | | | | This frees up the first name to be used as an base class for the apple table and the dwarf5 .debug_names accel table. The rename was split off from D42297 (adding of debug_names support), which is still under review. llvm-svn: 323113
* [DWARFv5] Number the line-table's directory array correctly.Paul Robinson2018-01-181-2/+5
| | | | | | | | | | | | | | The compilation directory has always been #0, but as of DWARF v5 it is explicitly listed in the line-table section instead of implicitly being a reference to the compile_unit DIE's DW_AT_comp_dir attribute. This means the dumper should number the dumped array starting with 0 or 1 depending on the DWARF version of the line table. References in the generated DWARF are correct, it's just the dumper that was wrong. Also some assembler-coded tests were similarly confused about directory numbers. llvm-svn: 322884
* Speed up iteration of CodeView record streams.Zachary Turner2018-01-181-4/+6
| | | | | | | | | | | | | There's some abstraction overhead in the underlying mechanisms that were being used, and it was leading to an abundance of small but not-free copies being made. This showed up on a profile. Eliminating this and going back to a low-level byte-based implementation speeds up lld with /DEBUG between 10 and 15%. Differential Revision: https://reviews.llvm.org/D42148 llvm-svn: 322871
* Fix pretty printing the unspecified param of a variadic functionAaron Smith2018-01-171-0/+19
| | | | | | | | | | | | | | | | | | | | | | | Summary: - Fix a bug in PrettyBuiltinDumper that returns "void" as the name for an unspecified builtin type. Since the unspecified param of a variadic function is considered a builtin of unspecified type in PDBs, we set "..." for its name. - Provide a method to determine if a PDBSymbolFunc is variadic in PrettyFunctionDumper since PDBSymbolFunc::getArgument() doesn't return the last unspecified-type param. - Add a pretty-func-dumper.test to test pretty dumping of variadic functions. Reviewers: zturner, llvm-commits Reviewed By: zturner Differential Revision: https://reviews.llvm.org/D41801 llvm-svn: 322608
* [DebugInfo] Unify dumping of address rangesJonas Devlieghere2018-01-164-12/+23
| | | | | | | | | | | | | | | Summary: This patch unifies the printing of address ranges as [0x0, 0x1). rdar://34822059 Reviewers: aprantl, dblaikie Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D42056 llvm-svn: 322543
* dwarfdump: Match the --uuid output with that of Darwin dwarfdump.Adrian Prantl2018-01-051-1/+2
| | | | | | | | This option is widely used by scripts and there is no reason to break them. rdar://problem/36032398 llvm-svn: 321901
* [MSF] Fix FPM interval calcluationZachary Turner2018-01-051-8/+6
| | | | | | | | | | | | | We have some code to try to determine how many pieces an MSF Free Page Map is split into, and this code had an off by one error which would cause the calculation to be incorrect when there were exactly 4096*k + 1 blocks in an MSF file. Original investigation and patch outline by Colden Cullen. Differential Revision: https://reviews.llvm.org/D41742 llvm-svn: 321880
* [DebugInfo] Don't crash when given invalid DWARFv5 line table prologue.Jonas Devlieghere2018-01-052-7/+10
| | | | | | | | | | | | | This patch replaces an assertion with an explicit check for the validity of the FORM parameters. The assertion was triggered when the DWARFv5 line table contained a zero address size. This fixes OSS-Fuzz Issue 4644 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4644 Differential revision: https://reviews.llvm.org/D41615 llvm-svn: 321863
OpenPOWER on IntegriCloud