summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF
Commit message (Collapse)AuthorAgeFilesLines
...
* DWARFDIE split out to DWARFBaseDIEJan Kratochvil2018-05-245-306/+358
| | | | | | | | | | | | This new DWARFBaseDIE is going to be used for DWARFUnit::GetUnitDIEOnly() as other DIEs are unavailable that time so the caller should not have methods available to access them. This patch is only a mechanical split without any use of it. Differential revision: https://reviews.llvm.org/D47275 llvm-svn: 333222
* DWARF: Move indexing code from DWARFUnit to ManualDWARFIndexPavel Labath2018-05-244-346/+346
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I think this makes sense for several reasons: - better separation of concerns: DWARFUnit's job should be to provide a nice interface to its users to access the unit contents. ManualDWARFIndex can then use this interface to build an index and provide it to its users. - closer alignment with llvm parsers: there is no indexing equivalent in llvm, and there probably never will be, as the index is very centered around how lldb wants to access debug info. If we ever switch to llvm's parser, this will allow us swap out DWARFUnit implementations and keep indexing as-is. - closer proximity of the indexing code to AppleDWARFIndex will make it easier to keep the two in sync (e.g. right now the two use very different algorithms to determine whether a DW_TAG_subroutine represents a "method"). This is my primary motivation for making this change now, but I am leaving this work to a separate patch. The only interface change to DWARFUnit I needed to make was to add an efficient way to iterate over the list of all DIEs. Adding this also aligns us closer to the llvm parser. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D47253 llvm-svn: 333178
* Reland "[DWARF] Extract indexing code into a separate class hierarchy"Pavel Labath2018-05-2112-702/+911
| | | | | | | After this commit, the xcode project will need to be updated to include the new files added here. llvm-svn: 332841
* Revert "[DWARF] Extract indexing code into a separate class hierarchy"Amara Emerson2018-05-1812-911/+702
| | | | | | | This reverts commit r332719 due to breaking this green dragon build: http://green.lab.llvm.org/green/job/lldb-xcode/6644 llvm-svn: 332730
* [DWARF] Extract indexing code into a separate class hierarchyPavel Labath2018-05-1812-702/+911
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This places the `if(m_using_apple_tables)` branches inside the SymbolFileDWARF class behind an abstract DWARFIndex class. The class currently has two implementations: - AppleIndex, which searches using .apple_names and friends - ManualIndex, which searches using a manually built index Most of the methods of the class are very simple, and simply extract the list of DIEs for the given name from the appropriate sub-table. The main exception are the two GetFunctions overloads, which take a couple of extra paramenters, including some callbacks. It was not possible to split these up the same way as other methods, as here we were doing a lot of post-processing on the results. The post-processing is similar for the two cases, but not identical. I hope to factor these further in separate patches. Other interesting methods are: - Preload(): do any preprocessing to make lookups faster (noop for AppleIndex, forces a build of the lookup tables for ManualIndex). - ReportInvalidDIEOffset(): Used to notify the users of an invalid index (prints a message for AppleIndex, noop for ManualIndex). - Dump(): dumps the index state (noop for AppleIndex, prints the lookup tables for ManualIndex). Reviewers: clayborg, JDevlieghere Subscribers: mgorny, aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D46889 llvm-svn: 332719
* [DWARF] Have HashedNameToDIE store a DataExtractor by valuePavel Labath2018-05-171-2/+2
| | | | | | | | | | | | | | | | | Summary: The DataExtractors are cheap to copy so there is no reason to store them by reference. Also, in my upcoming indexing refactor I am planning to remove the apple tables data extractor members from the SymbolFileDWARF class, so there will not be a DataExtractor with a suitable lifetime to refer to. Reviewers: clayborg, JDevlieghere Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D46888 llvm-svn: 332596
* Use const_iterator in DWARFUnitJan Kratochvil2018-05-131-3/+3
| | | | | | | Function DWARFUnit::GetDIE is using m_die_array only for reading so it can use DWARFDebugInfoEntry::const_iterator. llvm-svn: 332201
* Revert "Protect DWARFCompileUnit::m_die_array by a new mutex"Jan Kratochvil2018-05-132-18/+3
| | | | | | | | | Pavel Labath found this patch is incomplete and racy. I think there needs to be some more mutexes even before considering DW_TAG_partial_unit. This reverts commit 331229 which was: https://reviews.llvm.org/D40470 llvm-svn: 332200
* General cleanup to minimize the .debug_types patchGreg Clayton2018-05-0915-335/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | This cleanup is designed to make the https://reviews.llvm.org/D32167 patch smaller and easier to read. Cleanup in this patch: Allow DWARFUnit subclasses to hand out the data that should be used when decoding data for a DIE. The information might be in .debug_info or could be in .debug_types. There is a new virtual function on DWARFUnit that each subclass must override: virtual const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const; This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different data to be used when decoding the DIE information. Add a new pure virtual function to get the size of the DWARF unit header: virtual uint32_t DWARFUnit::GetHeaderByteSize() const = 0; This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different offsets where the first DIE starts when decoding DIE information from the unit. Added a new function to DWARFDataExtractor to get the size of an offset: size_t DWARFDataExtractor::GetDWARFSizeOfOffset() const; Removed dead dumping and parsing code in the DWARFDebugInfo class. Inlined a bunch of calls in DWARFUnit for accessors that were just returning integer member variables. Renamed DWARFUnit::Size() to DWARFUnit::GetHeaderByteSize() as it clearly states what it is doing and makes more sense. Differential Revision: https://reviews.llvm.org/D46606 llvm-svn: 331892
* [DWARF] Align non-accelerated function fullname searching with the ↵Pavel Labath2018-05-092-45/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | apple-tables path Summary: Before this patch the two paths were doing very different things - the apple path searched the .apple_names section, which contained mangled names, as well as basenames of all functions. It returned any name it found. - the non-accelerated path looked in the "full name" index we built ourselves, which contained mangled as well as demangled names of all functions (but no basenames). Then however, if it did not find a match it did an extra search in the basename index, with some special handling for anonymous namespaces. This aligns the two paths by changing the non-accelerated path to return the same results as in the apple-tables one. In pratice, this means we will search in both the "basename", "method" and "fullname" indexes (in the manual indexes these are separate indexes. This means the function will return some slightly inappropriate results (e.g. bar::baz::foo when one asks for a "full name" foo), but this can be handled by additional filtering, independently indexing method. I've also stopped inserting demangled names into the "fullname" index, as that is inconsistent with the apple path. Reviewers: clayborg, JDevlieghere Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D46576 llvm-svn: 331855
* Add support to object files for accessing the .debug_types sectionGreg Clayton2018-05-082-0/+6
| | | | | | | | In an effort to make the .debug_types patch smaller, breaking out the part that reads the .debug_types from object files into a separate patch Differential Revision: https://reviews.llvm.org/D46529 llvm-svn: 331777
* Remove premature caching of the global variables list in CompileUnit.Adrian Prantl2018-04-301-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This fixes a bug where (lldb) target var g_ptr would populate the global variables list with exactly one entry because SymbolFileDWARF::ParseVariables() was invoked with a list of DIEs pre-filtered by name, such that a subsequent call to (lldb) fr var --show-globals would only list that one variable, because CompileUnit::m_variables was already initialized, fooling CompileUnit::GetVariableList(). CompileUnit::GetVariableList() grabs the *complete* list of variables via (SymbolFileDWARF, ...)::ParseVariablesForContext and that still calls CompileUnit::SetVariableList(variables) which acts as the caching mechanism. Differential Revision: https://reviews.llvm.org/D46220 llvm-svn: 331230
* Protect DWARFCompileUnit::m_die_array by a new mutexJan Kratochvil2018-04-302-3/+18
| | | | | | | | | | | | | | Multiple DW_TAG_compile_unit being indexed in a multithreaded way can request reading of the same DW_TAG_partial_unit. Unfortunately one cannot detect DWZ file ahead of time to disable such locking overhead as DWARFCompileUnit::Extract does not read the first DIE which is the only place one could find early enough if the DWARF file is using any DW_TAG_partial_unit. Differential revision: https://reviews.llvm.org/D40470 llvm-svn: 331229
* Reflow paragraphs in comments.Adrian Prantl2018-04-3015-1024/+897
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
* Match also DW_TAG_partial_unit when DW_TAG_compile_unit is matchedJan Kratochvil2018-04-309-19/+42
| | | | | | | | | | Code commonly checks if the parent DIE is DW_TAG_compile_unit. But DW_TAG_partial_unit also acts as DW_TAG_compile_unit for DWZ as DWZ is using DW_TAG_imported_unit only at the top unit level. Differential revision: https://reviews.llvm.org/D40469 llvm-svn: 331194
* Support reading section ".gnu_debugaltlink"Jan Kratochvil2018-04-292-0/+7
| | | | | | Differential revision: https://reviews.llvm.org/D40468 llvm-svn: 331148
* Always normalize FileSpec paths.Greg Clayton2018-04-273-20/+22
| | | | | | | | Always normalizing lldb_private::FileSpec paths will help us get a consistent results from comparisons when setting breakpoints and when looking for source files. This also removes a lot of complexity from the comparison routines. Modified the DWARF line table parser to use the normalized compile unit directory if needed. Differential Revision: https://reviews.llvm.org/D45977 llvm-svn: 331049
* Fix a crash when resolving overloads of C++ virtual methods.Adrian Prantl2018-04-201-1/+4
| | | | | | | | | The isOverload() method needs to account for situations where the two methods being compared don't have the same number of arguments. rdar://problem/39542960 llvm-svn: 330450
* [DWARFASTParserClang] Remove dead code. NFCI.Davide Italiano2018-04-201-42/+0
| | | | llvm-svn: 330385
* Reapply "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding ↵Jan Kratochvil2018-04-148-828/+569
| | | | | | | | | | | | | | DWARFTypeUnit". This patch by Greg Clayton drops the virtualization for DWARFPartialUnit. The virtualization of DWARFUnit now matches more its LLVM counterpart. DWZ patchset is going to be implementable without DWARFPartialUnit remapping. https://reviews.llvm.org/D40474 This reverts commit 329423. This reapplies commit r329305. llvm-svn: 330084
* Revert "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding ↵Jan Kratochvil2018-04-068-569/+828
| | | | | | | | | | | | | | | | | DWARFTypeUnit" The reverted commit changed DWARFUnit from https://reviews.llvm.org/D40466 and https://reviews.llvm.org/D42892 that was prepared for DWARFPartialUnit and made from it a superclass for DWARFTypeUnit. DWARFUnit's intention was: DWARFUnit->DWARFSomeNameUnit->DWARFCompileUnit DWARFUnit->DWARFSomeNameUnit->DWARFTypeUnit DWARFUnit->DWARFPartialUnit Discussed at: https://reviews.llvm.org/D45170 This reverts commit r329305. llvm-svn: 329423
* Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnitGreg Clayton2018-04-058-828/+569
| | | | | | | | Many things that were in DWARFCompileUnit actually need to be in DWARFUnit. This patch moves all DWARFUnit specific things over into DWARFUnit and fixes the layering. This is in preparation for adding DWARFTypeUnit for the .debug_types patch. Differential Revision: https://reviews.llvm.org/D45170 llvm-svn: 329305
* Support template template parametersFrederic Riss2018-04-021-2/+17
| | | | | | | | | | | | | | | | | | Summary: We would fail to resolve (and thus display the value of) any templated type which contained a template template argument even though we don't really use template arguments. This patch adds minimal support for template template arguments, but I doubt we need any more than that. Reviewers: clayborg, jingham Subscribers: JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D44613 llvm-svn: 328984
* Use the DWARF linkage name when importing C++ methods.Davide Italiano2018-03-271-6/+7
| | | | | | | | | | | | | | | | | | | | When importing C++ methods into clang AST nodes from the DWARF symbol table, preserve the DW_AT_linkage_name and use it as the linker ("asm") name for the symbol. Concretely, this enables `expression` to call into names that use the GNU `abi_tag` extension, and enables lldb to call into code using std::string or std::list from recent versions of libstdc++. See https://bugs.llvm.org/show_bug.cgi?id=35310 . It also seems broadly more robust than relying on the DWARF->clang->codegen pipeline to roundtrip properly, but I'm not immediately aware of any other cases in which it makes a difference. Patch by Nelson Elhage! Differential Revision: https://reviews.llvm.org/D40283 llvm-svn: 328658
* Add support for __attribute__(trivial_abi).Jim Ingham2018-03-231-2/+22
| | | | | | <rdar://problem/36035075>, <rdar://problem/36035039> llvm-svn: 328389
* Move the codebase to use: DWARFCompileUnit -> DWARFUnitJan Kratochvil2018-03-1825-204/+204
| | | | | | | | | | | | Now the codebase can use the DWARFUnit superclass. It will make it later seamlessly work also with DWARFPartialUnit for DWZ. This patch is only a search-and-replace easily undone, nothing interesting in it. Differential revision: https://reviews.llvm.org/D42892 llvm-svn: 327810
* DWARFUnit split out of DWARFCompileUnitJan Kratochvil2018-03-185-561/+796
| | | | | | | | | DW_TAG_partial_unit for DWZ can be then presented by DWARFPartialUnit also inherited from DWARFUnit. Differential revision: https://reviews.llvm.org/D40466 llvm-svn: 327809
* Fix the Windows build after r327750Frederic Riss2018-03-161-1/+1
| | | | llvm-svn: 327753
* [DWARFASTParserClang] Complete external record types before using them as a ↵Frederic Riss2018-03-161-0/+37
| | | | | | | | | | | | | | | | | | decl context. Summary: When in a gmodules-like debugging scenario, you can have a parent decl context that gets imported from an external AST. When this happens, we must be careful to complete this type before adding children to it, otherwise it sometimes results in a crash. Reviewers: clayborg, jingham Subscribers: aprantl, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D43592 llvm-svn: 327750
* Replace HashStringUsingDJB with llvm::djbHashPavel Labath2018-02-233-43/+42
| | | | | | | | | | | | | | | | | | | | | | Summary: The llvm function is equivalent to this one. Where possible I tried to replace const char* with llvm::StringRef to avoid extra strlen computations. In most places, I was able to track the c string back to the ConstString it was created from. I also create a test that verifies we are able to lookup names with unicode characters, as a bug in the llvm compiler (it accidentally used a different hash function) meant this was not working until recently. This also removes the unused ExportTable class. Reviewers: aprantl, davide Subscribers: JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D43596 llvm-svn: 325927
* Remove dead code for handling DWARF pubnamesAdrian McCarthy2018-02-127-540/+0
| | | | | | | | | | | | Summary: LLDB doesn't use this code, the code has no tests, and the code does suspicious things like hashing pointers to strings instead of the strings themselves. Subscribers: sanjoy, mgorny, JDevlieghere Differential Revision: https://reviews.llvm.org/D43202 llvm-svn: 324925
* Remove function DW_DSC_value_to_namePavel Labath2018-02-072-12/+0
| | | | | | It is unused, and the underlying llvm function has been removed as well. llvm-svn: 324472
* refactor: DWARFCompileUnit::Producer -> DWARFProducerJan Kratochvil2018-02-053-18/+14
| | | | | | Differential revision: https://reviews.llvm.org/D42891 llvm-svn: 324275
* Remove unused Args variable, and #include of Args.h. NFC.Jim Ingham2018-02-011-2/+0
| | | | llvm-svn: 324008
* [lldb] Enable debugging of binaries with mixed (splitted/regular) dwarfDavide Italiano2018-01-311-3/+4
| | | | | | | This recommits the patch, now that I verified that the bot instability is due to something else. Sorry for the noise. llvm-svn: 323879
* Revert "[lldb] Enable debugging of binaries with mixed (splitted/regular) dwarf"Davide Italiano2018-01-311-4/+3
| | | | | | It might have caused some instability on the bots. llvm-svn: 323845
* [lldb] Enable debugging of binaries with mixed (splitted/regular) dwarfAlexander Shaposhnikov2018-01-301-3/+4
| | | | | | | | | | | | | | Initialize the default value of SymbolFileDWARF uuid with the appropriately shifted DW_INVALID_OFFSET constant. This change fixes the collision in the computation of DIE uid (inside DIERef::GetUID) and incorrect CompileUnit lookup (because of the misleading cu_offset value). Test plan: make check-lldb Differential revision: https://reviews.llvm.org/D42563 llvm-svn: 323832
* Remove unused class declarationsJan Kratochvil2018-01-272-6/+0
| | | | | | | | Simplification by removing excessive DWARFCompileUnit references for D40466 . Differential revision: https://reviews.llvm.org/D42613 llvm-svn: 323586
* [lldb] Fix some C++ virtual method call bugs in LLDB expression evaluation byLang Hames2018-01-221-0/+88
| | | | | | | | | | | | | | | | | | | building method override tables for CXXMethodDecls in DWARFASTParserClang::CompleteTypeFromDWARF. C++ virtual method calls in LLDB expressions may fail if the override table for the method being called is not correct as IRGen will produce references to the wrong (or a missing) vtable entry. This patch does not fix calls to virtual methods with covariant return types as it mistakenly treats these as overloads, rather than overrides. This will be addressed in a future patch. Review: https://reviews.llvm.org/D41997 Partially fixes <rdar://problem/14205774> llvm-svn: 323163
* Clean up #include "DWARFCompileUnit.h"Jan Kratochvil2018-01-214-3/+1
| | | | | | | | | Clean up needless+missing #include "DWARFCompileUnit.h" for split of DWARFCompileUnit to DWARFUnit as discussed in D40466. Differential revision: https://reviews.llvm.org/D42355 llvm-svn: 323069
* Look for external types in all clang modules imported by the current symbol ↵Adrian Prantl2018-01-043-51/+86
| | | | | | | | | | | | | file. This fixes a bug in -gmodules DWARF handling when debugging without a .dSYM bundle that was particularly noticable when debugging LLVM itself. Debugging without clang modules and DWO handling should be unaffected by this patch. <rdar://problem/32436209> llvm-svn: 321802
* Bring clang options in error messages up to date.Adrian Prantl2017-12-211-4/+4
| | | | llvm-svn: 321322
* ObjectFile: remove ReadSectionData/MemoryMapSectionData mutual recursionPavel Labath2017-12-141-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: These two functions were calling each other, while handling different branches of the if(IsInMemory()). This had a reason at some point in the past, but right now it's just confusing. I resolve this by removing the MemoryMapSectionData function and inlining the !IsInMemory branch into ReadSectionData. There isn't anything mmap-related in this function anyway, as the decision whether to mmap is handled at a higher level. This is a preparatory step to make ObjectFileELF be able to decompress compressed sections (I want to make sure that all calls reading section data are routed through a single piece of code). Reviewers: clayborg Subscribers: emaste, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D41169 llvm-svn: 320705
* Prevent vain lldb::user_id_t 0xffffffff lookupsJan Kratochvil2017-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | I have found LLDB commonly looks up lldb::user_id_t 0xffffffff failing to find its DIE. One would rather expect LLDB_INVALID_UID == 0xffffffffffffffff in such case. DWARFASTParserClang.cpp:495 492 type_sp.reset( 493 new Type(die.GetID(), dwarf, type_name_const_str, byte_size, NULL, 494 DIERef(encoding_uid).GetUID(dwarf), encoding_data_type, 495 &decl, clang_type, resolve_state)); encoding_uid = (DWARFFormValue) {m_cu = 0x0, m_form = 0, m_value = {value = {uval = 0, sval = 0, cstr = 0x0}, data = 0x0}} -> DIERef::DIERef(const DWARFFormValue &form_value = {m_cu = 0x0, m_form = 0, m_value = {value = {uval = 0, sval = 0, cstr = 0x0}, data = 0x0}}) -> (DIERef) {cu_offset = 0xffffffff, die_offset = 0xffffffff} -> lldb::user_id_t DIERef::GetUID(SymbolFileDWARF *dwarf = 0x61d00000b480) const -> Type::Type(lldb::user_id_t encoding_uid = 0xffffffff) But 0xffffffff != #define LLDB_INVALID_UID UINT64_MAX Differential revision: https://reviews.llvm.org/D37492 llvm-svn: 319580
* ClangASTContext::ParseClassTemplateDecl doesn't always succeed.Jim Ingham2017-12-011-1/+11
| | | | | | | | | When it does, it returns a NULL ClassTemplateDecl. Don't use it if it is NULL... <rdar://problem/35672107> llvm-svn: 319516
* refactor: Simplify loop with DWARFCompileUnit::ExtractJan Kratochvil2017-11-301-6/+2
| | | | | | | | Forgotten small simplification in D40212. Differential revision: https://reviews.llvm.org/D40635 llvm-svn: 319402
* refactor: Unify+simplify DWARFCompileUnit ctor+Clear() into in-class ↵Jan Kratochvil2017-11-294-80/+47
| | | | | | | | | | | | | | initializers + Extract() It has no functionality effect. I was concerned about the worse performance of DWARFDebugInfo::Parse this way of allocating+destroying a CU for each iteration but I see it is now used only by DWARFDebugInfo::Dump so that is no longer a problem. Differential revision: https://reviews.llvm.org/D40212 llvm-svn: 319359
* Due to changes for DWZ I would need to update those such as renaming it toJan Kratochvil2017-11-252-27/+0
| | | | | | | | SetFileOffset. Differential revision: https://reviews.llvm.org/D40458 llvm-svn: 318981
* Remove 2 unused methods DWARFDebugInfo::Find and their FindCallbackStringJan Kratochvil2017-11-192-81/+0
| | | | | | Differential revision: https://reviews.llvm.org/D40216 llvm-svn: 318631
* Add comments to DWARFCompileUnit length fields/methodsJan Kratochvil2017-11-191-9/+8
| | | | | | Differential revision: https://reviews.llvm.org/D40211 llvm-svn: 318626
OpenPOWER on IntegriCloud