summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* [CodeView] Use actual strings for dealing with checksums and lines.Zachary Turner2017-05-034-17/+41
| | | | | | | | | | | | | | | | | | | | | The raw CodeView format references strings by "offsets", but it's confusing what table the offset refers to. In the case of line number information, it's an offset into a buffer of records, and an indirection is required to get another offset into a different table to find the final string. And in the case of checksum information, there is no indirection, and the offset refers directly to the location of the string in another buffer. This would be less confusing if we always just referred to the strings by their value, and have the library be smart enough to correctly resolve the offsets on its own from the right location. This patch makes that possible. When either reading or writing, all the user deals with are strings, and the library does the appropriate translations behind the scenes. llvm-svn: 302053
* [llvm-readobj] Update readobj to re-use parsing code.Zachary Turner2017-05-033-25/+32
| | | | | | | | | | llvm-readobj hand rolls some CodeView parsing code for string tables, so this patch updates it to re-use some of the newly introduced parsing code in LLVMDebugInfoCodeView. Differential Revision: https://reviews.llvm.org/D32772 llvm-svn: 302052
* Create DWARFVerifier.cpp and .h and move all DWARF verification code over ↵Greg Clayton2017-05-033-7/+261
| | | | | | | | | | into it. Adrian requested we create a DWARFVerifier.cpp file to contain all of the DWARF verification stuff. This change simply moves the functionality over into DWARFVerifier.h and DWARFVerifier.cpp, renames the DWARFVerifier methods to start with lower case, and switches DWARFContext.cpp over to using the new functionality. Differential Revision: https://reviews.llvm.org/D32809 llvm-svn: 302044
* Resubmit r301986 and r301987 "Add codeview::StringTable"Zachary Turner2017-05-037-87/+206
| | | | | | | | | | | | | | | | | | | | | | This was reverted due to a "missing" file, but in reality what happened was that I renamed a file, and then due to a merge conflict both the old file and the new file got added to the repository. This led to an unused cpp file being in the repo and not referenced by any CMakeLists.txt but #including a .h file that wasn't in the repo. In an even more unfortunate coincidence, CMake didn't report the unused cpp file because it was in a subdirectory of the folder with the CMakeLists.txt, and not in the same directory as any CMakeLists.txt. The presence of the unused file was then breaking certain tools that determine file lists by globbing rather than by what's specified in CMakeLists.txt In any case, the fix is to just remove the unused file from the patch set. llvm-svn: 302042
* Verify that no compile units share the same line table in "llvm-dwarfdump ↵Greg Clayton2017-05-031-2/+19
| | | | | | | | | | --verify" Check to make sure no compile units have the same DW_AT_stmt_list values. Report a verification error if they do. Differential Revision: https://reviews.llvm.org/D32771 llvm-svn: 302039
* Revert r301986 (and subsequent r301987).Daniel Jasper2017-05-038-329/+87
| | | | | | | | | The patch is failing to add StringTableStreamBuilder.h, but that isn't even discovered because the corresponding StringTableStreamBuilder.cpp isn't added to any CMakeLists.txt file and thus never built. I think this patch is just incomplete. llvm-svn: 302002
* Fix use after free in BinaryStream library.Zachary Turner2017-05-033-4/+13
| | | | | | | | | | | | | | | This was reported by the ASAN bot, and it turned out to be a fairly fundamental problem with the design of VarStreamArray and the way it passes context information to the extractor. The fix was cumbersome, and I'm not entirely pleased with it, so I plan to revisit this design in the future when I'm not pressed to get the bots green again. For now, this fixes the issue by storing the context information by value instead of by reference, and introduces some impossibly-confusing template magic to make things "work". llvm-svn: 301999
* Fix type conversion error.Zachary Turner2017-05-021-1/+1
| | | | llvm-svn: 301987
* Make codeview::StringTable.Zachary Turner2017-05-028-87/+329
| | | | | | | | | | | | | | | | | | | | Previously we had knowledge of how to serialize and deserialize a string table inside of DebugInfo/PDB, but the string table that it serializes contains a piece that is actually considered CodeView and can appear outside of a PDB. We already have logic in llvm-readobj and MCCodeView to read and write this format, so it doesn't make sense to duplicate the logic in DebugInfoPDB as well. This patch makes codeview::StringTable (for writing) and codeview::StringTableRef (for reading), updates DebugInfoPDB to use these classes for its own writing, and updates llvm-readobj to additionally use StringTableRef for reading. It's a bit more difficult to get MCCodeView to use this for writing, but it's a logical next step. llvm-svn: 301986
* Add line table verification to lldb-dwarfdump --verifyGreg Clayton2017-05-022-3/+80
| | | | | | | | | | | | This patch verifies the .debug_line: - verify all addresses in a line table sequence have ascending addresses - verify that all line table file indexes are valid Unit tests added for both cases. Differential Revision: https://reviews.llvm.org/D32765 llvm-svn: 301984
* [DWARFv5] Parse new line-table header format.Paul Robinson2017-05-021-18/+147
| | | | | | | | | | | | The directory and file tables now have form-based content descriptors. Parse these and extract the per-directory/file records based on the descriptors. For now we support only DW_FORM_string (inline) for the path names; follow-up work will add support for indirect forms (i.e., DW_FORM_strp, strx<N>, and line_strp). Differential Revision: http://reviews.llvm.org/D32713 llvm-svn: 301978
* Verify that all references point to actual DIEs in "llvm-dwarfdump --verify"Greg Clayton2017-05-021-81/+142
| | | | | | | | | | LTO and other fancy linking previously led to DWARF that contained invalid references. We already validate that CU relative references fall into the CU, and the DW_FORM_ref_addr references fall inside the .debug_info section, but we didn't validate that the references pointed to correct DIE offsets. This new verification will ensure that all references refer to actual DIEs and not an offset in between. This caught a bug in DWARFUnit::getDIEForOffset() where if you gave it any offset, it would match the DIE that mathes the offset _or_ the next DIE. This has been fixed. Differential Revision: https://reviews.llvm.org/D32722 llvm-svn: 301971
* Rename pdb::StringTable -> pdb::PDBStringTable.Zachary Turner2017-05-025-38/+39
| | | | | | | | 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
* Make DWARFDebugLine use StringRef for directory/file tables. NFCPaul Robinson2017-05-021-16/+13
| | | | | | Differential Revision: http://reviews.llvm.org/D32728 llvm-svn: 301940
* [PDB/CodeView] Read/write codeview inlinee line information.Zachary Turner2017-05-026-2/+146
| | | | | | | | 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
* Stylistic makeover of DWARFDebugLine before working on it. NFCPaul Robinson2017-05-011-180/+177
| | | | | | | Rename parameters and locals to CamelCase, doxygenize the header, and run clang-format on the whole thing. llvm-svn: 301883
* [CodeView] Write CodeView line information.Zachary Turner2017-05-019-7/+246
| | | | | | Differential Revision: https://reviews.llvm.org/D32716 llvm-svn: 301882
* Adds initial llvm-dwarfdump --verify support with unit tests.Greg Clayton2017-05-012-2/+117
| | | | | | | | | | | | | | | | | | lldb-dwarfdump gets a new "--verify" option that will verify a single file's DWARF debug info and will print out any errors that it finds. It will return an non-zero exit status if verification fails, and a zero exit status if verification succeeds. Adding the --quiet option will suppress any output the STDOUT or STDERR. The first part of the verify does the following: - verifies that all CU relative references (DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref8, DW_FORM_ref_udata) have valid CU offsets - verifies that all DW_FORM_ref_addr references have valid .debug_info offsets - verifies that all DW_AT_ranges attributes have valid .debug_ranges offsets - verifies that all DW_AT_stmt_list attributes have valid .debug_line offsets - verifies that all DW_FORM_strp attributes have valid .debug_str offsets Unit tests were added for each of the above cases. Differential Revision: https://reviews.llvm.org/D32707 llvm-svn: 301844
* [PDB/CodeView] Rename some classes.Zachary Turner2017-05-015-20/+22
| | | | | | | | | | | | In preparation for introducing writing capabilities for each of these classes, I would like to adopt a Foo / FooRef naming convention, where Foo indicates that the class can manipulate and serialize Foos, and FooRef indicates that it is an immutable view of an existing Foo. In other words, Foo is a writer and FooRef is a reader. This patch names some existing readers to conform to the FooRef convention, while offering no functional change. llvm-svn: 301810
* [llvm-pdbdump] Abstract some of the YAML/Raw printing code.Zachary Turner2017-04-295-8/+13
| | | | | | | | | 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
* [llvm-readobj] Use LLVMDebugInfoCodeView to parse line tables.Zachary Turner2017-04-281-3/+0
| | | | | | | | The llvm-readobj parsing code currently exists in our CodeView library, so we use that to parse instead of re-writing the logic in the tool. llvm-svn: 301718
* [DWARF] - Fix mistype in dump output of pub* tables. NFC.George Rimar2017-04-281-1/+1
| | | | | | | There was a garbage character in output introduced by myself in r290040 "[DWARF] - Introduce DWARFDebugPubTable class for dumping pub* sections." llvm-svn: 301631
* [CodeView] Isolate Debug Info Fragments into standalone classes.Zachary Turner2017-04-278-120/+200
| | | | | | | | | | | | | | | | | | | | | Previously parsing of these were all grouped together into a single master class that could parse any type of debug info fragment. With writing forthcoming, the complexity of each individual fragment is enough to warrant them having their own classes so that reading and writing of each fragment type can be grouped together, but isolated from the code for reading and writing other fragment types. In doing so, I found a place where parsing code was duplicated for the FileChecksums fragment, across llvm-readobj and the CodeView library, and one of the implementations had a bug. Now that the codepaths are merged, the bug is resolved. Differential Revision: https://reviews.llvm.org/D32547 llvm-svn: 301557
* [Support] Make BinaryStreamArray extractors stateless.Zachary Turner2017-04-271-3/+2
| | | | | | | Instead, we now pass a context memeber through the extraction process. llvm-svn: 301556
* Rename some PDB classes.Zachary Turner2017-04-2713-224/+248
| | | | | | | | | | | | | | | | | | | We have a lot of very similarly named classes related to dealing with module debug info. This patch has NFC, it just renames some classes to be more descriptive (albeit slightly more to type). The mapping from old to new class names is as follows: Old | New ModInfo | DbiModuleDescriptor ModuleSubstream | ModuleDebugFragment ModStream | ModuleDebugStream With the corresponding Builder classes renamed accordingly. Differential Revision: https://reviews.llvm.org/D32506 llvm-svn: 301555
* [llvm-dwarfdump] - Change format for .gdb_index dump.George Rimar2017-04-271-2/+3
| | | | | | | | | | | | | | It is useful to output size of ranges when address ranges section of .gdb_index is dumped. It helps to compare outputs produced by different linkers, for example. In that case address ranges can look very different, when they are the same at fact. Difference comes from different low address because of different address of .text. Differential revision: https://reviews.llvm.org/D32492 llvm-svn: 301527
* [llvm-pdbdump] Allow sorting / filtering by immediate paddingZachary Turner2017-04-251-2/+13
| | | | llvm-svn: 301358
* [llvm-pdbdump] Dump File / Line Info to YAML.Zachary Turner2017-04-251-0/+4
| | | | | | | | | We were already parsing and dumping this to the human readable format, but not to the YAML format. This does so, in preparation for reading it in and reconstructing the line information from YAML. llvm-svn: 301357
* [llvm-pdbdump] Re-write the record layout code to be more resilient.Zachary Turner2017-04-244-203/+168
| | | | | | | | This reworks the way virtual bases are handled, and also the way padding is detected across multiple levels of aggregates, producing a much more accurate result. llvm-svn: 301203
* [DWARF] - Take relocations in account when extracting ranges from .debug_rangesGeorge Rimar2017-04-243-14/+22
| | | | | | | | | | | | | | | I found this when investigated "Bug 32319 - .gdb_index is broken/incomplete" for LLD. When we have object file with .debug_ranges section it may be filled with zeroes. Relocations are exist in file to relocate this zeroes into real values later, but until that a pair of zeroes is treated as terminator. And DWARF parser thinks there is no ranges at all when I am trying to collect address ranges for building .gdb_index. Solution implemented in this patch is to take relocations in account when parsing ranges. Differential revision: https://reviews.llvm.org/D32228 llvm-svn: 301170
* [DWARF] - Refactoring: localize handling of relocations in a single place.George Rimar2017-04-215-41/+27
| | | | | | | | | | | This is splitted from D32228, currently DWARF parsers code has few places that applied relocations values manually. These places has similar duplicated code. Patch introduces separate method that can be used to obtain relocated value. That helps to reduce code and simplifies things. Differential revision: https://reviews.llvm.org/D32284 llvm-svn: 300956
* Code style change as suggested in https://reviews.llvm.org/D32177 (NFC)Dehao Chen2017-04-191-16/+11
| | | | llvm-svn: 300753
* Using address range map to speedup finding inline stack for address.Dehao Chen2017-04-192-43/+48
| | | | | | | | | | | | | | | | | | | | Summary: In the current implementation, to find inline stack for an address incurs expensive linear search in 2 places: * linear search for the top-level DIE * recursive linear traverse the DIE tree to find the path to the leaf DIE In this patch, a map is built from address to its corresponding leaf DIE. The inline stack is built by traversing from the leaf DIE up to the root DIE. This speeds up batch symbolization by ~10X without noticible memory overhead. Reviewers: dblaikie Reviewed By: dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32177 llvm-svn: 300742
* Revert r300697 which causes buildbot failure.Dehao Chen2017-04-192-47/+43
| | | | llvm-svn: 300708
* Using address range map to speedup finding inline stack for address.Dehao Chen2017-04-192-43/+47
| | | | | | | | | | | | | | | | | | | | Summary: In the current implementation, to find inline stack for an address incurs expensive linear search in 2 places: * linear search for the top-level DIE * recursive linear traverse the DIE tree to find the path to the leaf DIE In this patch, a map is built from address to its corresponding leaf DIE. The inline stack is built by traversing from the leaf DIE up to the root DIE. This speeds up batch symbolization by ~10X without noticible memory overhead. Reviewers: dblaikie Reviewed By: dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32177 llvm-svn: 300697
* Add GNU_discriminator support for inline callsites in llvm-symbolizer.Dehao Chen2017-04-172-3/+7
| | | | | | | | | | | | | | Summary: LLVM symbolize cannot recognize GNU_discriminator for inline callsites. This patch adds support for it. Reviewers: dblaikie Reviewed By: dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32134 llvm-svn: 300486
* [llvm-pdbdump] Recursively dump class layout.Zachary Turner2017-04-133-42/+191
| | | | llvm-svn: 300258
* [DWARF] - Simplify (use dyn_cast instead of isa + cast).George Rimar2017-04-131-2/+2
| | | | | | This addresses post commit review comments for r300039. llvm-svn: 300188
* Fix initialization order of class members.Zachary Turner2017-04-121-2/+2
| | | | llvm-svn: 300137
* [llvm-pdbdump] Minor prepatory refactor of Class Def Dumper.Zachary Turner2017-04-121-4/+9
| | | | | | | | | | | | | | | | | In a followup patch I intend to introduce an additional dumping mode which dumps a graphical representation of a class's layout. In preparation for this, the text-based layout printer needs to be split out from the graphical layout printer, and both need to be able to use the same code for printing the intro and outro of a class's definition (e.g. base class list, etc). This patch does so, and in the process introduces a skeleton definition for the graphical printer, while currently making the graphical printer just print nothing. NFC llvm-svn: 300134
* [llvm-pdbdump] More advanced class definition dumping.Zachary Turner2017-04-129-9/+243
| | | | | | | | | | | | | | | | | | | | | | | | Previously the dumping of class definitions was very primitive, and it made it hard to do more than the most trivial of output formats when dumping. As such, we would only dump one line for each field, and then dump non-layout items like nested types and enums. With this patch, we do a complete analysis of the object hierarchy including aggregate types, bases, virtual bases, vftable analysis, etc. The only immediately visible effects of this are that a) we can now dump a line for the vfptr where before we would treat that as padding, and b) we now don't treat virtual bases that come at the end of a class as padding since we have a more detailed analysis of the class's storage usage. In subsequent patches, we should be able to use this analysis to display a complete graphical view of a class's layout including recursing arbitrarily deep into an object's base class / aggregate member hierarchy. llvm-svn: 300133
* [DWARF] Fix compiler warnings in DWARFContext.cpp, NFCiKrasimir Georgiev2017-04-121-2/+1
| | | | llvm-svn: 300051
* [DWARF] - Refactoring of DWARFContextInMemory implementation.George Rimar2017-04-121-64/+71
| | | | | | | | | | | | | | This change is basically relative to D31136, where I initially wanted to implement some relocations handling optimization which shows it can give significant boost. Though even without any caching algorithm looks code can have some cleanup at first. Refactoring separates out code for taking symbol address, used in relocations computation. Differential revision: https://reviews.llvm.org/D31747 llvm-svn: 300039
* [PDB] Emit index/offset pairs for TPI and IPI streamsReid Kleckner2017-04-112-21/+51
| | | | | | | | | | | | | | | | | | | Summary: This lets PDB readers lookup type record data by type index in O(log n) time. It also enables makes `cvdump -t` work on PDBs produced by LLD. cvdump will not dump a PDB that doesn't have an index-to-offset table. The table is sorted by type index, and has an entry every 8KB. Looking up a type record by index is a binary search of this table, followed by a scan of at most 8KB. Reviewers: ruiu, zturner, inglorion Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31636 llvm-svn: 299958
* Remove unused functions. Remove static qualifier from functions in header ↵Vassil Vassilev2017-04-111-9/+0
| | | | | | files. NFC. llvm-svn: 299947
* Improves pretty printing of variable types in llvm-pdbdumpAdrian McCarthy2017-04-103-0/+12
| | | | | | | | | | | | | | | | | * Adds support for pointers to arrays, which was missing * Adds some tests * Improves consistency of const and volatile qualifiers * Eliminates non-composable special case code for arrays and function by using a more general recursive approach * Has a hack for getting the calling convention into the right spot for pointer-to-functions Given the rapid changes happenning in llvm-pdbdump, this may be difficult to merge. Differential Revision: https://reviews.llvm.org/D31832 llvm-svn: 299848
* General usability improvements to generic PDB library.Zachary Turner2017-04-1031-65/+110
| | | | | | | | | | | | | | | | | | | | 1. Added some asserts to make sure concrete symbol types don't get constructed with RawSymbols that have an incompatible SymTag enum value. 2. Added new forwarding macros that auto-define an Id/Sym method pair whenever there is a method that returns a SymIndexId. Previously we would just provide one method that returned only the SymIndexId and it was up to the caller to use the Session object to get a pointer to the symbol. Now we automatically get both the method that returns the Id, as well as a method that returns the pointer directly with just one macro. 3. Added some methods for dumping straight to stdout that can be used from inside the debugger for diagnostics during a debug session. 4. Added a clone() method and a cast<T>() method to PDBSymbol that can shorten some usage patterns. llvm-svn: 299831
* [PDB] Save one type record copyReid Kleckner2017-04-041-16/+18
| | | | | | | | | | | | | | | | | | 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
* [codeview] Cope with unsorted streams in type mergingReid Kleckner2017-04-031-38/+106
| | | | | | | | | | | | | | | Summary: MASM can produce type streams that are not topologically sorted. It can even produce type streams with circular references, but those are not common in practice. Reviewers: inglorion, ruiu Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31629 llvm-svn: 299403
* [codeview] Add support for label type recordsReid Kleckner2017-04-034-0/+22
| | | | | | MASM can produce these type records. llvm-svn: 299388
OpenPOWER on IntegriCloud