summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile
Commit message (Collapse)AuthorAgeFilesLines
...
* [NativePDB] Make GetOrCreateDeclForUid return an lldb CompilerDeclNathan Lanza2019-07-213-12/+16
| | | | | | | | | We intend to make PdbAstBuilder abstract and implement PdbAstBuilderClang along with any other languages that wish to use PDBs. Thus, change GetOrCreateDeclForUid from returning a clang decl to a lldb_private::CompilerDecl. llvm-svn: 366650
* Support Linux signal return trampolines in frame initializationJoseph Tremoulet2019-07-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add __kernel_rt_sigreturn to the list of trap handlers for Linux (it's used as such on aarch64 at least), and __restore_rt as well (used on x86_64). Skip decrement-and-recompute for trap handlers in InitializeNonZerothFrame, as signal dispatch may point the child frame's return address to the start of the return trampoline. Parse the 'S' flag for signal handlers from eh_frame augmentation, and propagate it to the unwind plan. Reviewers: labath, jankratochvil, compnerd, jfb, jasonmolenda Reviewed By: jasonmolenda Subscribers: clayborg, MaskRay, wuzish, nemanjai, kbarton, jrtc27, atanasyan, jsji, javed.absar, kristof.beyls, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D63667 llvm-svn: 366580
* [FileSpecList] Add EmplaceBack method (NFC)Jonas Devlieghere2019-07-181-1/+1
| | | | | | | | Instead of having to write FileSpecList::Append(FileSpec(args)) you can now call FileSpecList::EmplaceBack(args), similar to std::vector<>::emplace_back. llvm-svn: 366489
* [NativePDB] Add a FromCompilerDecl for going from lldb -> clangNathan Lanza2019-07-172-0/+5
| | | | | | | | | | Summary: A common transformation in NativePDB is to go from lldb types to clang types and vice versa. This function automates one of those steps. Differential Revision: https://reviews.llvm.org/D64851 llvm-svn: 366345
* [NativePDB] Make GetTranslationUnitDecl return an lldb CompilerDeclCtxNathan Lanza2019-07-172-10/+11
| | | | | | | | | | | Summary: We intend to make PdbAstBuilder abstract and implement PdbAstBuilderClang along with any other languages that wish to use PDBs. This is the first step. Differential Revision: https://reviews.llvm.org/D64852 llvm-svn: 366293
* [DWARFContext] Strip leading dot in section namesJonas Devlieghere2019-07-131-0/+2
| | | | | | The LLVM context doesn't expect the leading dot in the section name. llvm-svn: 365978
* Add convenience methods to convert LLDB to LLVM data structures.Jonas Devlieghere2019-07-115-9/+51
| | | | | | | | | | This patch adds two convenience methods named GetAsLLVM to the LLDB counterparts of the DWARF DataExtractor and the DWARF context. The DWARFContext, once created, is cached for future usage. Differential revision: https://reviews.llvm.org/D64535 llvm-svn: 365819
* [Core] Generalize ValueObject::IsRuntimeSupportValueAlex Langford2019-07-011-1/+2
| | | | | | | | | | | | | | | Summary: Instead of falling back to ObjCLanguageRuntime, we should be falling back to every loaded language runtime. This makes ValueObject more language agnostic. Reviewers: labath, compnerd, JDevlieghere, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D63240 llvm-svn: 364845
* Use const auto *Fangrui Song2019-06-291-5/+5
| | | | llvm-svn: 364702
* DWARF: Add support for type units+split dwarf comboPavel Labath2019-06-256-14/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With the last round of refactors, supporting type units in dwo files becomes almost trivial. This patch contains a couple of small fixes, which taken as a whole make type units work in the split dwarf scenario (both DWARF4 and DWARF5): - DWARFContext: make sure we actually read the debug_types.dwo section - DWARFUnit: set string offsets base on all units in the dwo file, not just the main CU - ManualDWARFIndex: index all units in the file - SymbolFileDWARFDwo: Search for the single compile unit in the file, as we can no longer assume it will be the first one The last part makes it obvious that there is still some work to be done here, namely that we do not support dwo files with multiple compile units. That is something that should be easier after the DIERef refactors, but it still requires more work. Tests are added for the type units+split dwarf + dwarf4/5 scenarios, as well as a test that checks we behave reasonably in the presence of dwo files with multiple CUs. Reviewers: clayborg, JDevlieghere, aprantl Subscribers: arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D63643 llvm-svn: 364274
* DWARF: Add "dwo_num" field to the DIERef classPavel Labath2019-06-2123-138/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When dwo support was introduced, it used a trick where debug info entries were referenced by the offset of the compile unit in the main file, but the die offset was relative to the dwo file. Although there was some elegance to it, this representation was starting to reach its breaking point: - the fact that the skeleton compile unit owned the DWO file meant that it was impossible (or at least hard and unintuitive) to support DWO files containing more than one compile unit. These kinds of files are produced by LTO for example. - it made it impossible to reference any DIEs in the skeleton compile unit (although the skeleton units are generally empty, clang still puts some info into them with -fsplit-dwarf-inlining). - (current motivation) it made it very hard to support type units placed in DWO files, as type units don't have any skeleton units which could be referenced in the main file This patch addresses this problem by introducing an new "dwo_num" field to the DIERef class, whose purpose is to identify the dwo file. It's kind of similar to the dwo_id field in DWARF5 unit headers, but while this is a 64bit hash whose main purpose is to catch file mismatches, this is just a smaller integer used to indentify a loaded dwo file. Currently, this is based on the index of the skeleton compile unit which owns the dwo file, but it is intended to be eventually independent of that (to support the LTO use case). Simultaneously the cu_offset is dropped to conserve space, as it is no longer necessary. This means we can remove the "BaseObjectOffset" field from the DWARFUnit class. It also means we can remove some of the workarounds put in place to support the skeleton-unit+dwo-die combo. More work is needed to remove all of them, which is out of scope of this patch. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: mehdi_amini, dexonsmith, arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D63428 llvm-svn: 364009
* Fix -Wmismatched-tags introduced in r363910Pavel Labath2019-06-203-4/+1
| | | | | | | | That commit changed DIERef from a struct to a class, but did not update the forward-declarations. This fixes one forward-declaration, and removes other (unused) decls. llvm-svn: 363915
* DWARF: Provide accessors to DIERef fieldsPavel Labath2019-06-209-24/+65
| | | | | | | | | | | | | | | | | | | | | | Summary: Instead of accessing the fields directly, use accessor functions to provide access to the DIERef components. This allows us to decouple the external interface, from the internal representation. The external interface can use llvm::Optional and similar goodies, while the data can still be stored internally in a more compact representation. I also document the purpose of the existing DIERef fields. The main motivation for this change is a need to introduce an additional field to the DIERef class, but I believe the change has its own merit. Reviewers: JDevlieghere, aprantl, clayborg Subscribers: arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D63400 llvm-svn: 363910
* DWARF: Make DIERefs always validPavel Labath2019-06-1914-124/+101
| | | | | | | | | | | | | | | | | | | | | Summary: This patch makes the DIERef class always valid by default constructor and operator bool. This allows one to express the validity of a DIERef in the type system. Places which are working with potentially-invalid DIERefs have been updated to use Optional<DIERef> instead. The constructor taking a DWARFFormValue was not needed, as all places which were constructing a DIERef this way were immediately converting it into a DWARFDIE or a user_id. This can be done without constructing an intermediate DIERef. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D63399 llvm-svn: 363767
* DWARF: Avoid storing DIERefs in long-lived containersPavel Labath2019-06-174-51/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A user_id_t carries the same information as a DIERef, but it takes up less space. Furthermore, DIERef::operator<'s implementation is very questionable, as it does not take the cu_offset and section fields into account. Using just the die offset was correct in the days when all debug info lived in a single section, but since we started supporting DWO debug info, this was no longer true. The comparison operator could be fixed, but it seems like using the user_id_t for these purposes is a better idea overall. I think this did not cause any bugs, because the only place the comparison operator was used is in m_function_scope_qualified_name_map, and this one is local to a dwo file, but I am not 100% sure of that. Reviewers: clayborg, JDevlieghere Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D63322 llvm-svn: 363528
* Don't try to parse ObjC method if CU isn't ObjCGreg Clayton2019-06-141-20/+24
| | | | | | | | Improve manual indexing performance when indexing non objective C code. Differential Revision: https://reviews.llvm.org/D63171 llvm-svn: 363441
* DWARF: port debug_ranges/rnglists over to DWARFContextPavel Labath2019-06-146-37/+35
| | | | llvm-svn: 363400
* DWARF: Remove unused includes from DWARFDebugAranges.h/cppPavel Labath2019-06-142-15/+3
| | | | llvm-svn: 363382
* Have DWARFUnit store a *reference* to SymbolFileDWARFPavel Labath2019-06-1416-117/+84
| | | | | | | | | | | | Previously it was storing a *pointer*, which left open the possibility of this pointer being null. We never made use of that possibility (it does not make sense), and most of the code was already assuming that. However, there were a couple of null-checks scattered around the code. This patch replaces the reference with a pointer, making the non-null-ness explicit, and removes the remaining null-checks. llvm-svn: 363381
* DWARFIndex: s/ReportInvalidDIEOffset/ReportInvalidDIERefPavel Labath2019-06-147-27/+17
| | | | | | | | | | | | In a dwo/debug_types world, the die offset is not enough to uniquely idendify a debug info entry. Pass the the entire DIERef object instead. This is technically NFC, because only AppleIndex implemented this method (and there, the die offset *is* enough for unique identification). However, this makes the code simpler, and simplifies some of the follow-up patches. llvm-svn: 363373
* DWARF: Don't create lldb CompileUnits for DWARF type unitsPavel Labath2019-06-1311-199/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Type units don't represent actual compilations and a lot of the operations that we do with lldb compile units (getting their line tables, variables, etc.) don't make sense for them. There is also a lot more of them (sometimes over 100x), so making them more lightweight pays off. The main change in this patch is that we stop creating lldb CompileUnits for DWARF type units. The trickiest part here is that the SymbolFile interface requires that we assign consecutive sequence IDs to the compile units we create. As DWARF type and compile units can come in any order (in v5), this means we can no longer use 1-1 mapping between DWARF and lldb compile units. Instead I build a translation table between the two indices. To avoid pessimizing the case where there are no type units, I build the translation table only in case we have at least one type unit. Additionaly, I also tried to strenghted type safete by replacing DWARFUnit with DWARFCompileUnit where applicable. Though that was not stricly necessary, I found it a good way to ensure that the transformations I am doing here make sense. In the places where I was changing the function signatures, and where it was obvious that the objects being handled were not null, I also replaced pointers with references. There shouldn't be any major functional change with this patch. The only change I observed is that now the types in the type units will not be parsed when one calls Module::ParseAllDebugSymbols, unless they are referenced from other compile units. This makes sense, given how ParseAllDebugSymbols is implemented (it iterates over all compile units), and it only matters for one hand-writted test where I did not bother to reference the types from the compile units (which I now do). Reviewers: clayborg, JDevlieghere, aprantl Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D63005 llvm-svn: 363250
* DWARF: Share line tables of type unitsPavel Labath2019-06-1210-105/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch creates a cache of file lists in line tables referenced by type units. This cache is used to avoid parsing a line table twice (since a file list will generally be shared by many type units). It also sets things up in a way that parsing of DW_AT_decl_file attributes will keep working even when we stop creating lldb compile units for dwarf type units, but it stops short of actually doing that. This means that the request for files now go directly to SymbolFileDWARF instead of being routed there indirectly via the lldb_private::CompileUnit class. As a result of this, a number of occurences of SymbolContext variables in DWARFASTParserClang have become unused, so I remove them. This patch reduces the number of times a file list is being parsed, but the situation is still suboptimal, as the parsed list is being copied multiple times. This will be fixed when we stop creating CompileUnits for DWARF type units. Reviewers: clayborg, aprantl, JDevlieghere Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D62894 llvm-svn: 363143
* Revert "DWARF: Simplify SymbolFileDWARF::GetDWARFCompileUnit"Alex Langford2019-06-081-1/+9
| | | | | | | | | This reverts commit 58afc1bdebf9fa8b178d6c9d89af94c5cc091760. This commit caused the test suite on macOS to fail many tests. It appears that setting breakpoints is the issue. One example that fails is the lit test Breakpoint/case-sensitive.test. llvm-svn: 362862
* [lldb] Fix msan use-of-uninitialized-value in DWARFDebugLine::FileNameEntry.Jorge Gorbe Moya2019-06-071-1/+2
| | | | | | | | lldb/lit/SymbolFile/DWARF/debug-types-expressions.test fails with msan. This change fixes the issue by ensuring FileNameEntry::checksum is always default-initialized. llvm-svn: 362843
* DWARF: Simplify SymbolFileDWARF::GetDWARFCompileUnitPavel Labath2019-06-071-9/+1
| | | | | | | | | | | | | | | | | Summary: The DWARFCompileUnit is set as the "user data" of the lldb compile unit directly in the constructor (see ParseCompileUnit). This means that instead of going through unit indexes, we can just fetch the DWARF unit directly from there. Reviewers: clayborg, JDevlieghere Subscribers: aprantl, jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D62943 llvm-svn: 362783
* Ignore DIEs in the skeleton unit in a DWO scenarioPavel Labath2019-06-051-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: r362103 exposed a bug, where we could read incorrect data if a skeleton unit contained more than the single unit DIE. Clang emits these kinds of units with -fsplit-dwarf-inlining (which is also the default). Changing lldb to handle these DIEs is nontrivial, as we'd have to change the UID encoding logic to be able to reference these DIEs, and fix up various places which are assuming that all DIEs come from the separate compile unit. However, it turns out this is not necessary, as the DWO unit contains all the information that the skeleton unit does. So, this patch just skips parsing the extra DIEs if we have successfully found the DWO file. This enforces the invariant that the rest of the code is already operating under. This patch fixes a couple of existing tests, but I've also included a simpler test which does not depend on execution of binaries, and would have helped us in catching this sooner. Reviewers: clayborg, JDevlieghere, aprantl Subscribers: probinson, dblaikie, lldb-commits Differential Revision: https://reviews.llvm.org/D62852 llvm-svn: 362586
* [COFF, ARM64] Fix CodeView API change for getRegisterNamesTom Tan2019-06-031-1/+12
| | | | | | | | | Change rL362280 changed CodeView API getRegisterNames() by adding an input parameter in CPUType. It is called in LLDB and needs to be updated. Differential Revision: https://reviews.llvm.org/D62772 llvm-svn: 362349
* Code and comment cleanups [NFC]Greg Clayton2019-05-302-51/+44
| | | | | | | | | Changes: - update comments to detail the info can come from .debug_info or .debug_types - Rename "debug_info_data" to "data" now that we can get data from .debug_info or .debug_types. - Also call DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(...) instead of manually grabbing abbreviation. llvm-svn: 362116
* Fix a regression in DWARF access speed caused by svn revision 356190Greg Clayton2019-05-302-8/+10
| | | | | | | | | | | | | | The issue was caused by the error checking code that was added. It was incorrectly adding an extra abbreviation when DWARFEnumState::Complete was received since it would push an extra abbreviation onto the list with the abbreviation code of zero. This cause m_idx_offset in each DWARFAbbreviationDeclarationSet to be set to UINT32_MAX. This valid indicates we must linearly search for attributes, not access them in O(1) time. This caused every DWARFDebugInfoEntry that would try to get its DWARFAbbreviationDeclaration from the CU's DWARFAbbreviationDeclarationSet to always linearly search the abbreviation set for a given abbreviation code. Easy to see why this would cause things to be slow. This regression was caused by: https://reviews.llvm.org/D59370. I asked to ensure there was no regression is parsing or access speed, but that must not have been done. In my test with 40 DWARF files trying to set a breakpoint by function name and in a header file, I see a 8% speed improvement with this fix. There was no regression in correctness, just very inefficient access. Added full unit testing for DWARFAbbreviationDeclarationSet parsing to ensure this doesn't regress. Differential Revision: https://reviews.llvm.org/D62630 llvm-svn: 362105
* Improve DWARF parsing and accessing by 1% to 2%Greg Clayton2019-05-302-38/+18
| | | | | | | | | | When LLDB first started we didn't have our mmap of the DWARF data done correctly and if the backing file would change we would get live changes as the file changed and it would cause problems. We now mmap correctly and do not run into these issues. There was legacy code in DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(...) that would always extract the abbrev index each time the function was called to verify that DWARF data hadn't changed and a warning was emitted if it did. We no longer need this and the code was removed. The other thing this function did when it parsed the abbrev index was give us the offset of the first attribute bytes by adding the LEB128 size to the offset. This required an extra parameter to DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(...) which is now removed. I added "lldb::offset_t DWARFDebugInfoEntry::GetFirstAttributeOffset() const" which calculates this when we need it and modified all sites that need the offset to call it. Now that we aren't decoding and verifying the abbrev index, it speeds up DWARF access by 1% to 2%. Differential Revision: https://reviews.llvm.org/D62634 llvm-svn: 362103
* DWARFASTParserClang: Delete dead codePavel Labath2019-05-301-33/+0
| | | | | | | This removes places where DW_AT_decl_file/line/column was being parsed, but not used. llvm-svn: 362086
* DWARFASTParserClang: Move attribute parsing into a single functionPavel Labath2019-05-301-634/+427
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The ParseTypeFromDWARF function consists of a huge switch on the kind of type being parsed. Each case in this switch starts with parsing the attributes of the current DIE. A lot of these attributes are specific to one kind of a type, but a lot of them are common too, leading to code duplication. This patch reduces the duplication (and the size of ParseTypeFromDWARF) by moving the attribute parsing to a separate function. It creates a struct (ParsedTypeAttributes), which contains a parsed form of all attributes which are useful for parsing any kind of a type. The parsing code for a specific type kind can then access the fields which are relevant for that specific case. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D62477 llvm-svn: 362075
* DWARFDebugInfoEntry: delete unused Extract() and rename FastExtract() to ↵Fangrui Song2019-05-303-172/+10
| | | | | | | | | | | | | Extract() The function Extract() is almost a duplicate of FastExtract() but is not used. Delete it and rename FastExtract() to Extract(). Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D62593 llvm-svn: 362049
* Clean up DWARFDebugInfoEntryFangrui Song2019-05-292-106/+0
| | | | llvm-svn: 361962
* Revert "D11003: Tolerate DWARF compile unit without filename."Pavel Labath2019-05-291-13/+0
| | | | | | | | | | | | | | | | | | | | | | Summary: This code is modifying a support file list after it has been created. This makes it hard to share the file list between type units and compile units in DWARF. It's not a total showstopper, but supporting this while also sharing the lists would make things more complicated. Given that this was added to support a project which never fully materialised, and that even back then there were some concerns about the correctness of this approach (according to D11003#200772 the compile unit name is not guaranteed to be the first one in the support file list), I think we should just delete this workaround. Reviewers: clayborg, tberghammer, dsrbecky Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D62517 llvm-svn: 361948
* DWARFASTParserClang: Unify compilation unit language handlingPavel Labath2019-05-291-8/+5
| | | | | | | | | | | | | | | | | | Summary: The function was not being consistent in how it retrieved the language of the current compile unit. Sometimes it did so from the lldb CU object, and sometimes from the DWARF die. This patch unifies the handling on the latter. The reason for choosing the DWARF method is because I'd eventually like to stop creating lldb CUs for dwarf type units (and so this code needs to would need to work without them). Reviewers: clayborg, JDevlieghere, aprantl Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D62481 llvm-svn: 361939
* DWARF: Fix address range support in mixed 4+5 scenarioPavel Labath2019-05-295-93/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: debug_ranges got renamed to debug_rnglists in DWARF 5. Prior to this patch lldb was just picking the first section it could find in the file, and using that for all address ranges lookups. This is not correct in case the file contains a mixture of compile units with various standard versions (not a completely unlikely scenario). In this patch I make lldb support reading from both sections simulaneously, and decide the correct section to use based on the version number of the compile unit. SymbolFileDWARF::DebugRanges is split into GetDebugRanges and GetDebugRngLists (the first one is renamed mainly so we can catch all incorrect usages). I tried to structure the code similarly to how llvm handles this logic (hence DWARFUnit::FindRnglistFromOffset/Index), but the implementations are still relatively far from each other. Reviewers: JDevlieghere, aprantl, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D62302 llvm-svn: 361938
* [SymbolFileDWARF] Remove unused member (NFC)Jonas Devlieghere2019-05-282-4/+2
| | | | | | Removes the unused debug line instance. llvm-svn: 361886
* [DWARFExpression] Remove ctor that takes just a compile unit.Jonas Devlieghere2019-05-285-32/+34
| | | | | | | | | | | | | | | | Like many of our DWARF classes, the DWARFExpression can be initialized in several ways. One such way was through a constructor that takes just the compile unit. This constructor is used to initialize both empty DWARFExpressions, and DWARFExpression that will be populated later. To make the distinction more clear, I changed the constructor to a default constructor and updated its call sites. Where the DWARFExpression was being populated later, I replaced that with a call to the copy assignment constructor. Differential revision: https://reviews.llvm.org/D62425 llvm-svn: 361849
* DWARFDebugArangeSet: Remove references to SymbolFileDWARFPavel Labath2019-05-272-7/+4
| | | | | | | This class does not depend on SymbolFileDWARF. Instead, include more appropriate low-level headers. llvm-svn: 361765
* DWARF: Remove cu_idx variables from parsing functionsPavel Labath2019-05-274-46/+31
| | | | | | | | These variables were useful when looking up the compile unit index required a binary search. Now that we can look up a compile unit index in constant time, they are no longer needed. llvm-svn: 361754
* Cleanup fixed form sizes.Greg Clayton2019-05-2410-161/+80
| | | | | | | | | | | | | The fix form sizes use to have two arrays: one for 4 byte addresses and in for 8 byte addresses. The table had an issue where DW_FORM_flag_present wasn't being represented as a fixed size form because its actual size _is_ zero and zero was used to indicate the form isn't fixed in size. Any code that needed to quickly access the DWARF had to get a FixedFormSizes instance using the address byte size. This fix cleans things up by adding a DWARFFormValue::GetFixedSize() both as a static method and as a member function on DWARFFormValue. It correctly can indicate if a form size is zero. This cleanup is a precursor to a follow up patch where I hope to speed up DWARF parsing. I verified performance doesn't regress by loading hundreds of DWARF files and setting a breakpoint by file and line and by name in files that do not have DWARF indexes. Performance remained consistent between the two approaches. Differential Revision: https://reviews.llvm.org/D62416 llvm-svn: 361675
* DWARF: Implement DW_AT_signature lookup for type unit supportPavel Labath2019-05-248-28/+80
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements the main feature of type units. When completing a type, if we encounter a DW_AT_signature attribute, we use it's value to lookup the complete definition of the type in the relevant type unit. To enable this lookup, we build up a map of all type units in a symbol file when parsing the units. Then we consult this map when resolving the DW_AT_signature attribute. I include add a couple of tests which exercise the type lookup feature, including one that ensure we do something reasonable in case we fail to lookup the type. A lot of the ideas in this patch have been taken from D32167 and D61505. Reviewers: clayborg, JDevlieghere, aprantl, alexshap Subscribers: mgrang, lldb-commits Differential Revision: https://reviews.llvm.org/D62246 llvm-svn: 361603
* DWARFContext: Make loading of sections thread-safePavel Labath2019-05-242-41/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: SymbolFileDWARF used to load debug sections in a thread-safe manner. When we moved to DWARFContext, we dropped the thread-safe part, because we thought it was not necessary. It turns out this was only mostly correct. The "mostly" part is there because this is a problem only if we use the manual index, as that is the only source of intra-module paralelism. Also, this only seems to occur for extremely simple files (like the ones I've been creating for tests lately), where we've managed to start indexing before loading the debug_str section. Then, two threads start to load the section simultaneously and produce wrong results. On more complex files, something seems to be loading the debug_str section before we start indexing, as I haven't been able to reproduce this there, but I have not investigated what it is. I've tried to come up with a test for this, but I haven't been able to reproduce the problem reliably. Still, while doing so, I created a way to generate many compile units on demand. Given that most of our tests work with only one or two compile units, it seems like this could be useful anyway. Reviewers: aprantl, JDevlieghere, clayborg Subscribers: arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D62316 llvm-svn: 361602
* Fix integer literals which are cast to boolJonas Devlieghere2019-05-242-3/+3
| | | | | | | | | This change replaces built-in types that are implicitly converted to booleans. Differential revision: https://reviews.llvm.org/D62284 llvm-svn: 361580
* [lldb] NFC modernize codebase with modernize-use-nullptrKonrad Kleine2019-05-2321-175/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]] This commit is the result of modernizing the LLDB codebase by using `nullptr` instread of `0` or `NULL`. See https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html for more information. This is the command I ran and I to fix and format the code base: ``` run-clang-tidy.py \ -header-filter='.*' \ -checks='-*,modernize-use-nullptr' \ -fix ~/dev/llvm-project/lldb/.* \ -format \ -style LLVM \ -p ~/llvm-builds/debug-ninja-gcc ``` NOTE: There were also changes to `llvm/utils/unittest` but I did not include them because I felt that maybe this library shall be updated in isolation somehow. NOTE: I know this is a rather large commit but it is a nobrainer in most parts. Reviewers: martong, espindola, shafik, #lldb, JDevlieghere Reviewed By: JDevlieghere Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits Tags: #lldb, #llvm Differential Revision: https://reviews.llvm.org/D61847 llvm-svn: 361484
* DWARFASTParserClang: Reduce indentationPavel Labath2019-05-231-1507/+1495
| | | | | | by two levels via early returns. llvm-svn: 361471
* DWARF: Don't compute address ranges for type unitsPavel Labath2019-05-237-116/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Type units don't describe any code, so they should never be the result of any address lookup queries. Previously, we would compute the address ranges for the type units for via the line tables they reference because the type units looked a lot like line-tables-only compile units. However, this is not correct, as the line tables are only referenced from type units so that other declarations can use the file names contained in them. In this patch I make the BuildAddressRangeTable function virtual, and implement it only for compile units. Testing this was a bit tricky, because the behavior depends on the order in which we add things to the address range map. This rarely caused a problem with DWARF v4 type units, as they are always added after all CUs. It happened more frequently with DWARF v5, as there clang emits the type units first. However, this is still not something that it is required to do, so for testing I've created an assembly file where I've deliberately sandwiched a compile unit between two type units, which should isolate us from both changes in how the compiler emits the units and changes in the order we process them. Reviewers: clayborg, aprantl, JDevlieghere Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D62178 llvm-svn: 361465
* Simplify `GetName`+`AppendTypeName` by `DWARFDIE`Jan Kratochvil2019-05-234-168/+131
| | | | | | | | | | | | | | | In D61502#1503247 @clayborg suggested that DWARFUnit *+dw_offset_t can be now replaced by DWARFDIE. It is moved from DWARFDebugInfoEntry to DWARFDIE as noted by @clayborg. I have also removed return type as (1) it was wrong in one case and (2) no existing caller used the return type. I also refactored the deep nesting noted by @JDevlieghere. Differential Revision: https://reviews.llvm.org/D62211 llvm-svn: 361463
* DWARFDebugInfoEntry: remove unused variablePavel Labath2019-05-221-4/+1
| | | | llvm-svn: 361361
OpenPOWER on IntegriCloud