summaryrefslogtreecommitdiffstats
path: root/lldb/lit/SymbolFile/DWARF
Commit message (Collapse)AuthorAgeFilesLines
...
* lldb-test symbols: Add -file argument and the ability to dump global ↵Pavel Labath2018-06-122-0/+23
| | | | | | | | | | | | | | | variables in a file The motivation for this is to be able to Dwarf index ability to look up variables within a given compilation unit. It also fits in with the patch in progress at D47939, which will add the ability to look up funtions using file+line pairs. The verification of which lldb-test options can be used together was getting a bit unwieldy, so I moved the logic out into a separate function. llvm-svn: 334498
* lit/SymbolFile/DWARF: Simplify test RUN linesPavel Labath2018-06-128-22/+14
| | | | | | | Use -mllvm compiler argument to enable DWARF v5 accelerator tables instead of piping the IR through llc. llvm-svn: 334496
* DWARFDebugNames: Fix lookup in dwo filesPavel Labath2018-06-111-0/+25
| | | | | | | | | | | | The getDIESectionOffset function is not correct for split dwarf files (and will probably be removed in D48009). This patch implements correct section offset computation for split and non-split compile units -- we first need to check if the referenced unit is a skeleton unit, and if it is, we add the die offset to the full unit base offset (as the full unit is the one which contains the die). llvm-svn: 334402
* DebugNamesDWARFIndex: Implement regex version of the GetFunctions methodPavel Labath2018-06-081-0/+27
| | | | | | | | | This also fixes a bug where SymbolFileDWARF was returning the same function multiple times - this can happen if both mangled and demangled names match the regex. Other lookup lookup functions had code to handle this case, but it was forgotten here. llvm-svn: 334277
* DebugNamesDWARFIndex: Implement GetFunctions methodPavel Labath2018-06-081-0/+16
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements the non-regex variant of GetFunctions. To share more code with the Apple implementation, I've extracted the common filtering code from that class into a utility function on the DWARFIndex base class. The new implementation also searching the accelerator table multiple times -- previously it could happen that the apple table would return the same die more than once if one specified multiple search flags in name_type_mask. This way, I separate table iteration from filtering, and so we can be sure each die is inserted at most once. Reviewers: clayborg, JDevlieghere Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47881 llvm-svn: 334273
* DebugNamesDWARFIndex: Add type lookup suportPavel Labath2018-06-071-0/+10
| | | | | | | | This implements just one of the GetTypes overloads. The other is not testable from lldb-test so I'm leaving it unimplemented until I figure out what to do with testing. llvm-svn: 334190
* DebugNamesDWARFIndex: add namespace lookup supportPavel Labath2018-06-071-0/+10
| | | | llvm-svn: 334186
* DebugNamesDWARFIndex: Add support for partial indexesPavel Labath2018-06-071-0/+25
| | | | | | | | | | | | | | | | | | | | | Summary: It possible that a single module has indexed and non-indexed compile units. In this case, we can use the fast indexed lookup for the first ones and fall back to the manual index for the others. This patch implements this functionality by adding a units_to_avoid argument to the ManualDWARFIndex constructor. Any units present in that list will be ignored for the purposes of manual index. Individual DebugNamesDWARFIndex then always consult both the manual fallback index as well as the index in the .debug_names section. Reviewers: JDevlieghere, clayborg Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47832 llvm-svn: 334185
* DebugNamesDWARFIndex: Add ability to lookup variablesPavel Labath2018-06-073-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds the ability to lookup variables to the DWARF v5 index class. During review we discovered an inconsistency between how the existing two indexes handle looking up qualified names of the variables: - manual index would return a value if the input string exactly matched the demangled name of some variable. - apple index ignored the context and returned any variable with the same base name. So, this patch also rectifies that situation: - it removes all context handling from the index classes. The GetGlobalVariables functions now just take a base name. For manual index, this meant we can stop putting demangled names into the variable index (this matches the behavior for functions). - context extraction is put into SymbolFileDWARF, so that it is common to all indexes. - additional filtering based on the context is also done in SymbolFileDWARF. This is done via a simple substring search, which is not ideal, but it matches what we are doing for functions (cf. Module::LookupInfo::Prune). Reviewers: clayborg, JDevlieghere Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47781 llvm-svn: 334181
* [DWARF] Add (empty) DebugNamesDWARFIndex class and a setting to control its usePavel Labath2018-06-061-0/+8
| | | | | | | | | | | | | | | | | | | Summary: This patch adds the skeleton for implementing the DWARF v5 name index class. All of the methods are stubbed out and will be implemented in subsequent patches. The interesting part of the patch is the addition of a "ignore-file-indexes" setting to the dwarf plugin which enables a user to force using manual indexing path in lldb (for example as a debugging aid). I have also added a test that verifies that file indexes are used by default. Reviewers: JDevlieghere, clayborg, jingham Subscribers: mgorny, mehdi_amini, aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47629 llvm-svn: 334088
* AppleDWARFIndex: Get function method-ness directly from debug infoPavel Labath2018-06-041-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When searching for methods only, we need to do extra work to make sure the functions we get from the apple tables are indeed methods. Previously we were resolving the DIE into a SymbolContext and then checked whether the enclosing CompilerDeclContext is a class (or struct, or union). This patch changes that to operate on the debug info directly. This should be: - simpler - faster - more consistent with the ManualDWARFIndex (which does the same check, only at indexing time). What we lose this ways is for the language plugin to have a say in what it considers to be a "class", but that's probably more flexibility than we need (and if we really wanted to do that in the future, we could implement a more direct way to consult the plugin about this). This also fixes the find-method-local-struct test, which was failing because we were not able to construct a CompilerDeclContext for a local struct correctly. As a drive-by, I rename the DWARFDIE's IsStructClassOrUnion method to match the name on the CompilerDeclContext class. Reviewers: clayborg, JDevlieghere Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47470 llvm-svn: 333878
* ManualDWARFIndex: Treat DW_TAG_subprogram and DW_TAG_inlined_subroutine the ↵Pavel Labath2018-05-292-1/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | same way Summary: We were treating subprograms and inlined subroutines differently when building the index. The difference was in which indexes were individual tags inserted (subprograms went to all indexes, where as inlined subroutines only into the basename and full name indexes). This seems like an error, because an inlined subroutine can still represent an C++ or an ObjC method. I don't see anything in the subprogram branch which should not apply to an inlined subroutine, so I propose to just treat them identically. This makes searching for an inlined method behave the same way as for the apple index. I write an assembly-based test because I did not want to depend on particular clang inlining behavior (and because I wanted to see how hard would it be). Reviewers: clayborg, JDevlieghere Subscribers: eraman, lldb-commits Differential Revision: https://reviews.llvm.org/D47368 llvm-svn: 333398
* ManualDWARFIndex: Fix misclassification of methods in unionsPavel Labath2018-05-251-0/+31
| | | | | | | Apple index was already treating them as methods. Not doing the same seems like an omission. llvm-svn: 333266
* Improve coverage of the apple-tables testPavel Labath2018-05-212-4/+30
| | | | | | | | | | | After closer examination, it turns out we mis-classify one of the methods only if two of the structs have the same name. Since this was meant to be a basic test, I rename one of the structs in the test so that we have at least some coverage for the apple tables lookup. Instead, I create an XFAILed test which specifically targets the same-name case (and file a bug to track it). llvm-svn: 332833
* Add some apple-tables lookup testsPavel Labath2018-05-214-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Now that we are able to parse MachO files everywhere, we can write some cross-platform tests for handling of apple accelerator tables. This reruns the same lookup tests we have for manual indexes on MachO files which will use the accelerator tables instead. This makes sure we return the same results regardless of the method we used to access the debug info. The tests confirm we return the same results for looking up types, namespaces and variables, but have found an inconsistency in the treatment of function lookup. In the function case we mis-classify the method "foo" declared in the local struct sbar (inside function ffbar). We classify it as a function whereas it really is a method. Preliminary analysis suggests this is because DWARFASTParserClang::GetClangDeclContextForDIE returns null when given the local "struct sbar" DIE. This causes us to get the wrong CompilerDeclContext when we ask for the context of the inner foo, which means CompilerDeclContext::ISStructUnionOrClass returns false. Until this is fixed, I do not include the darwin versions of the "base" and "method" function lookup tests. Reviewers: JDevlieghere, clayborg Subscribers: aprantl, ilya-biryukov, ioeric, lldb-commits Differential Revision: https://reviews.llvm.org/D47064 llvm-svn: 332831
* [DWARF] Align non-accelerated function fullname searching with the ↵Pavel Labath2018-05-091-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* lldb-test symbols: Add ability to do name-based lookupPavel Labath2018-05-036-0/+214
Summary: lldb-test already had the ability to dump all symbol information in a module. This is interesting, but it can be too verbose, and it also does not use the same APIs that lldb uses to query symbol information. The last part is interesting to me now, because I am about to add DWARF v5 debug_names support, which needs to implement these APIs. This patch adds a set of arguments to lldb-test, which modify it's behavior from dumping all symbols to dumping only the requested information: - --find={function,namespace,type,variable} - search for the given kind of objects. - --name - the name to search for. - --regex - whether to treat the "name" as a regular expression. This is not available for all lookup types (we do not have the required APIs for namespaces and types). - --context - specifies the context, which can be used to restrict the search. This argument takes a variable name (which must be defined and be unique), and we then use the context that this variable is defined in as the search context. - --function-flags={auto,full,base,method,selector} - a set of flags to further restrict the search for function symbols. Together, these flags and their combinations cover the main SymbolFile entry points which I will need to modify for the accelerator table support, and so I plan to do most of the regression testing this way. (I've also found this a useful tool for exploration of what the given APIs are supposed to do.) I add a couple of tests to demonstrate the usage of the usage of the various options, and also an xfailed test which demonstrates a bug I found while playing with this. The only requirement for these tests is the presence of lld -- the should run on any platform which is able to build lldb. These tests use c++ code as input, but this isn't a requirement. It is also possible to use IR, assembly or json to create the test module. Reviewers: davide, zturner, asmith, JDevlieghere, clayborg, alexshap Subscribers: mgorny, aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D46318 llvm-svn: 331447
OpenPOWER on IntegriCloud