summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionDeclMap.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Modified the expression parser's class wrapper toSean Callanan2013-02-011-16/+57
| | | | | | | | | | | | | | | | | | | | | | | | | support reporting "this" as a templated class. The expression parser wraps expressions in C++ methods as methods with the signature $__lldb_class::$__lldb_expr(...) and previously responded to clang's queries about $__lldb_class with the type of *this. This didn't work if *this was a ClassTemplateSpecializationDecl because ClassTemplateSpecializationDecls can't be the result of simple name queries. Instead what we do now is respond that $__lldb_class is a typedef and that the target of the typedef is the (potentially templated) type of *this. That is much more robust. Thanks to John McCall for key insights. <rdar://problem/10987183> llvm-svn: 174153
* Extended LLDB to handle blocks capturing 'self'Sean Callanan2013-01-191-5/+9
| | | | | | | | | | | | | | | in an Objective-C class method. Before, errors of the form error: cannot find interface declaration for '$__lldb_objc_class' would appear when running any expression when the current frame is a block that captures 'self' from an Objective-C class method. <rdar://problem/12905561> llvm-svn: 172880
* Made the expression handle variables withSean Callanan2013-01-181-38/+151
| | | | | | | | | | | DW_AT_const_value instead of a location. Also added a testcase covering "frame variable," "expr" using the IR interpreter, and "expr" using the LLVM JIT. <rdar://problem/12978195> llvm-svn: 172848
* ClangExpressionVariable previously was not capable ofSean Callanan2013-01-151-84/+117
| | | | | | | | | | | | | | | | handling multiple clients. However, occasionally an expression must be run in the service of another expression, and in this case two parsers need to access the same list of persistent variables. To allow this, persistent variables now provide state for multiple parsers, and parsers must allocate, access, and deallocate this state by providing their own ID (at the moment, simply the value of the "this" pointer). <rdar://problem/12914539> llvm-svn: 172573
* Fix a parser_type to get created with the right AST, and also make variables ↵Greg Clayton2012-12-141-2/+2
| | | | | | made from symbols to not be "void * const", but just "void *". llvm-svn: 170165
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-4/+4
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* <rdar://problem/12106825>Greg Clayton2012-11-271-18/+62
| | | | | | Allow the expression parser to see more than just data symbols. We now accept any symbol that has an address. We take precautions to only accept symbols by their mangled or demangled names only if the demangled name was not synthesized. If the demangled name is synthesized, then we now mark symbols accordingly and only compare against the mangled original name. llvm-svn: 168668
* In cases where the Objective-C ivar symbols are stripped out,Sean Callanan2012-11-151-3/+14
| | | | | | | | | | | | | | | | | expressions that refer to ivars will not work because Clang emits IR that refers to them to get the ivar offsets. However, it is possible to search the runtime for these values. I have added support for reading the relevant tables to the Objective-C runtime, and extended ClangExpressionDeclMap to query that information if and only if it doesn't find the symbols in the binary. Also added a testcase. <rdar://problem/12628122> llvm-svn: 168018
* Make blocks that capture their containing method's object pointer look like ↵Jim Ingham2012-10-301-71/+151
| | | | | | | | | | methods of the containing class so that direct ivar access will work in the expression parser. <rdar://problem/9797999> llvm-svn: 167061
* Path from Ashok Thirumurthi:Greg Clayton2012-10-301-2/+7
| | | | | | | | | | | | The attached patch adds eValueTypeVector to lldb_private::Value. The nested struct Vector is patterned after RegisterValue::m_data.buffer. This change to Value allows ClangExpressionDeclMap::LookupDecl to return vector register data for consumption by InterpreterStackFrame::ResolveValue. Note that ResolveValue was tweaked slightly to allocate enough memory for vector registers. An immediate result of this patch is that "expr $xmm0" generates the same results on Linux as on the Mac, which is good enough for TestRegisters.py. In addition, the log of m_memory.PrintData(data_region.m_base, data_region.m_extent) shows that the register content has been resolved successfully. On the other hand, the output is glaringly empty: runCmd: expr $xmm0 output: (unsigned char __attribute__((ext_vector_type(16)))) $0 = {} Expecting sub string: vector_type Matched llvm-svn: 167033
* This is the first phase of supporting the DW_AT_object_pointer tag. I ↵Jim Ingham2012-10-271-1/+2
| | | | | | | | | | expanded the decl metadata so it could hold this information, and then used it to look up unfound names in the object pointer if it exists. This gets "frame var" to work for unqualified references to ivars captured in blocks. But the expression parser is ignoring this information still. llvm-svn: 166860
* Bunch of cleanups for warnings found by the llvm static analyzer.Jim Ingham2012-10-121-5/+7
| | | | llvm-svn: 165808
* Ran the sources through the compiler with -Wshadow warningsJason Molenda2012-10-041-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | enabled after we'd found a few bugs that were caused by shadowed local variables; the most important issue this turned up was a common mistake of trying to obtain a mutex lock for the scope of a code block by doing Mutex::Locker(m_map_mutex); This doesn't assign the lock object to a local variable; it is a temporary that has its dtor called immediately. Instead, Mutex::Locker locker(m_map_mutex); does what is intended. For some reason -Wshadow happened to highlight these as shadowed variables. I also fixed a few obivous and easy shadowed variable issues across the code base but there are a couple dozen more that should be fixed when someone has a free minute. <rdar://problem/12437585> llvm-svn: 165269
* Brought LLDB top-of-tree into sync with LLVM/ClangSean Callanan2012-09-241-0/+1
| | | | | | | | | | | | | top-of-tree. Removed all local patches and llvm.zip. The intent is that fron now on top-of-tree will always build against LLVM/Clang top-of-tree, and that problems building will be resolved as they occur. Stable release branches of LLDB can be constructed as needed and linked to specific release branches of LLVM/Clang. llvm-svn: 164563
* Fixed a problem where persistent variables didSean Callanan2012-09-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | not correctly store the contents of Objective-C classes. This was due to a combination of factors: 1) Types were only being completed if we were looking inside them for specific ivars (using FindExternalVisibleDeclsByName). We now look the complete type up at every FindExternalLexicalDecls. 2) Even if the types were completed properly, ValueObjectConstResult overrode the type of every ValueObject using the complete type for its class from the debug information. Superclasses of complete classes are not guaranteed to be complete. Although "frame variable" uses the debug information, the expression parser does now piece together complete types at every level (as described in Bullet 1), so I provided a way for the expression parser to prevent overriding. 3) Type sizes were being miscomputed by ClangASTContext. It ignored the ISA pointer and only counted fields. We now correctly count the ISA in the size of an object. <rdar://problem/12315386> llvm-svn: 164333
* Show the size of what we are dematerializing in the output log for "lldb expr".Greg Clayton2012-09-201-1/+1
| | | | llvm-svn: 164327
* Some more typing-related fixes.Filipe Cabecinhas2012-09-111-1/+1
| | | | llvm-svn: 163641
* Fixed a crash when incomplete expression variablesSean Callanan2012-08-161-0/+6
| | | | | | | | are materialized. <rdar://problem/12105013> llvm-svn: 162046
* Add explicit casts to bool in "shared pointer is valid" constructs that ↵Jim Ingham2012-08-111-1/+1
| | | | | | return bool. llvm-svn: 161719
* Removed explicit NULL checks for shared pointersSean Callanan2012-08-091-1/+1
| | | | | | | | | and instead made us use implicit casts to bool. This generated a warning in C++11. <rdar://problem/11930775> llvm-svn: 161559
* Fixed the expression parser to ignore C++ andSean Callanan2012-07-281-2/+18
| | | | | | | | | | Objective-C method names when looking for functions in the top level or a namespace. Method names should only be found via FindExternalLexicalDecls. <rdar://problem/11711679> llvm-svn: 160907
* <rdar://problem/11870357>Greg Clayton2012-07-141-11/+13
| | | | | | Allow "frame variable" to find ivars without the need for "this->" or "self->". llvm-svn: 160211
* Updated the object-pointer lookup logic to fixSean Callanan2012-05-211-13/+30
| | | | | | Objective-C "self," which is not a regular pointer. llvm-svn: 157214
* Fixed a nasty bug where JIT expressions didn't workSean Callanan2012-05-211-11/+33
| | | | | | | when stopped in a const method. Also updated our testsuite to ensure that JIT is forced in this case. llvm-svn: 157208
* Make sure frozen_sp for a ClangExpressionVariableSean Callanan2012-04-121-1/+2
| | | | | | is non-NULL before asking for its name. llvm-svn: 154593
* Disabling blocks support because of rdar://problem/11024417 - This is ↵Enrico Granata2012-03-301-1/+2
| | | | | | hopefully just a temporary countermeasure llvm-svn: 153758
* <rdar://problem/11082392>Greg Clayton2012-03-301-1/+1
| | | | | | | | | | | | | | | | | | | Fixed an issue that could cause circular type parsing that will assert and kill LLDB. Prior to this fix the DWARF parser would always create class types and not start their definitions (for both C++ and ObjC classes) until we were asked to complete the class later. When we had cases like: class A { class B { }; }; We would alway try to complete A before specifying "A" as the decl context for B. Turns out we can just start the definition and still not complete the class since we can check the TagDecl::isCompleteDefinition() function. This only works for C++ types. This means we will not be pulling in the full definition of parent classes all the time and should help with our memory consumption and also reduce the amount of debug info we have to parse. I also reduced redundant code that was checking in a lldb::clang_type_t was a possible C++ dynamic type since it was still completing the type, just to see if it was dynamic. This was fixed in another function that was checking for a type being dynamic as an ObjC or a C++ type, but there was dedicated fucntion for C++ that we missed. llvm-svn: 153713
* Added some hardening to make sure that we don'tSean Callanan2012-03-211-0/+3
| | | | | | use QualType contents unchecked. llvm-svn: 153201
* Strengthened LLDB's completion of object types.Sean Callanan2012-03-151-0/+8
| | | | | | | | | | | | | | Now when LLDB reports a variable, it has a complete type. Similarly, when it reports members of a struct, it completes their types. Also, when it creates the result variable for an expression, it ensures that variable's type is complete. This ensures compliance with Clang's expectations, preventing potential crashes. llvm-svn: 152771
* Updated the revision of LLVM/Clang used by LLDB.Sean Callanan2012-03-081-2/+0
| | | | | | | | | | | | | | | This takes two important changes: - Calling blocks is now supported. You need to cast their return values, but that works fine. - We now can correctly run JIT-compiled expressions that use floating-point numbers. Also, we have taken a fix that allows us to ignore access control in Objective-C as in C++. llvm-svn: 152286
* <rdar://problem/10997402>Greg Clayton2012-03-071-7/+5
| | | | | | | | | | | This fix really needed to happen as a previous fix I had submitted for calculating symbol sizes made many symbols appear to have zero size since the function that was calculating the symbol size was calling another function that would cause the calculation to happen again. This resulted in some symbols having zero size when they shouldn't. This could then cause infinite stack traces and many other side affects. llvm-svn: 152244
* Added support for calling blocks from expressions,Sean Callanan2012-03-061-0/+42
| | | | | | | but gated by an #ifdef until we roll LLVM/Clang to bring in the necessary parser support. llvm-svn: 152149
* Don't return bare symbols when asked to searchSean Callanan2012-03-061-2/+2
| | | | | | inside a namespace. This bypasses local variables. llvm-svn: 152144
* Made sure to store the type for "this" when in aSean Callanan2012-03-051-0/+12
| | | | | | C++ method. llvm-svn: 152064
* Extended the IR interpreter to support symbolsSean Callanan2012-02-281-4/+16
| | | | | | that have valid load addresses. llvm-svn: 151636
* Ignore the constness of the object pointer whenSean Callanan2012-02-181-3/+10
| | | | | | fetching it. llvm-svn: 150861
* Stop finding bare symbols when we're explicitlySean Callanan2012-02-151-1/+4
| | | | | | told to look in a namespace. llvm-svn: 150590
* Previoously the expression parser had to rely on theSean Callanan2012-02-151-2/+29
| | | | | | | | | JIT when printing the values of registers (e.g., "expr $pc"). Now the expression parser can do this in the IR interpreter without running code in the inferior process. llvm-svn: 150554
* Extended function lookup to allow the user toSean Callanan2012-02-101-0/+3
| | | | | | | | | indicate whether inline functions are desired. This allows the expression parser, for instance, to filter out inlined functions when looking for functions it can call. llvm-svn: 150279
* Fixed a bunch of ownership problems with the expressionSean Callanan2012-02-101-115/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | parser. Specifically: - ClangUserExpression now keeps weak pointers to the structures it needs and then locks them when needed. This ensures that they continue to be valid without leaking memory if the ClangUserExpression is long lived. - ClangExpressionDeclMap, instead of keeping a pointer to an ExecutionContext, now contains an ExecutionContext. This prevents bugs if the pointer or its contents somehow become stale. It also no longer requires that ExecutionContexts be passed into any function except its initialization function, since it can count on the ExecutionContext still being around. There's a lot of room for improvement (specifically, ClangExpressionDeclMap should also use weak pointers insetad of shared pointers) but this is an important first step that codifies assumptions that already existed in the code. llvm-svn: 150217
* Added support to the expression parser for readingSean Callanan2012-02-081-17/+40
| | | | | | variables that are only available in symbols. llvm-svn: 150103
* Fixed ClangExpressionDeclMap to use the debugSean Callanan2012-02-081-45/+50
| | | | | | | | | | | information about the current frame rather than the debug information about "this" and "self" when determining the types of those pointers. This allows expressions to work in frames that don't have valid "this" and "self" pointers, working around poor debug information. llvm-svn: 150051
* I have brought LLDB up-to-date with top of treeSean Callanan2012-02-041-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LLVM/Clang. This brings in several fixes, including: - Improvements in the Just-In-Time compiler's allocation of memory: the JIT now allocates memory in chunks of sections, improving its ability to generate relocations. I have revamped the RecordingMemoryManager to reflect these changes, as well as to get the memory allocation and data copying out fo the ClangExpressionParser code. Jim Grosbach wrote the updates to the JIT on the LLVM side. - A new ExternalASTSource interface to allow LLDB to report accurate structure layout information to Clang. Previously we could only report the sizes of fields, not their offsets. This meant that if data structures included field alignment directives, we could not communicate the necessary alignment to Clang and accesses to the data would fail. Now we can (and I have update the relevant test case). Thanks to Doug Gregor for implementing the Clang side of this fix. - The way Objective-C interfaces are completed by Clang has been made consistent with RecordDecls; with help from Doug Gregor and Greg Clayton I have ensured that this still works. - I have eliminated all local LLVM and Clang patches, committing the ones that are still relevant to LLVM and Clang as needed. I have tested the changes extensively locally, but please let me know if they cause any trouble for you. llvm-svn: 149775
* http://llvm.org/bugs/show_bug.cgi?id=11618Johnny Chen2012-01-061-7/+0
| | | | | | | | lldb::SBValue::AddressOf does not work on dereferenced registers in synthetic children provider Patch submitted by Enrico Granata. llvm-svn: 147637
* http://llvm.org/bugs/show_bug.cgi?id=11588Johnny Chen2011-12-161-2/+12
| | | | | | | | | | | | | valobj.AddressOf() returns None when an address is expected in a SyntheticChildrenProvider Patch from Enrico Granata: The problem was that the frozen object created by the expression parser was a copy of the contents of the StgClosure, rather than a pointer to it. Thus, the expression parser was correctly computing the result of the arithmetic&cast operation along with its address, but only saving it in the live object. This meant that the frozen copy acted as an address-less variable, hence the problem. The fix attached to this email lets the expression parser store the "live address" in the frozen copy of the address when the object is built without a valid address of its own. Doing so, along with delegating ValueObjectConstResult to calculate its own address when necessary, solves the issue. I have also added a new test case to check for regressions in this area, and checked that existing test cases pass correctly. llvm-svn: 146768
* Updated Clang to take an enhancement to the waySean Callanan2011-12-161-3/+3
| | | | | | | | | | | | | | we handle Objective-C method calls. Currently, LLDB treats the result of an Objective-C method as unknown if the type information doesn't have the method's signature. Now Clang can cast the result to id if it isn't explicitly cast. I also added a test case for this, as well as a fix for a type import problem that this feature exposed. llvm-svn: 146756
* Fixed a problem where if a frame was present theSean Callanan2011-12-101-1/+3
| | | | | | | expression parser would never try getting typed variables from the target. llvm-svn: 146317
* Two fixes for file variables:Sean Callanan2011-12-101-6/+8
| | | | | | | | | | | | | | | | | - Even if a frame isn't present, we always try to use FindGlobalVariable to find variables. Instead of using frame->TrackGlobalVariable() to promote the VariableSP into a ValueObject, we now simply use ValueObjectVariable. - When requesting the value of a variable, we allow returning of the "live version" of the variable -- that is, the variable in the target instead of a pointer to its freeze dried version in LLDB -- even if there is no process present. llvm-svn: 146315
* Fixed a potential crasher if the frame is notSean Callanan2011-12-071-1/+1
| | | | | | | | avalable when a global variable is looked up. In ClangExpressionDeclMap, a frame should usually be available. llvm-svn: 146066
* As part of the work to make Objective-C type informationSean Callanan2011-12-061-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | from symbols more accessible, I have added a second map to the ClangASTImporter: the ObjCInterfaceMetaMap. This map keeps track of all type definitions found for a particular Objective-C interface, allowing the ClangASTSource to refer to all possible sources when looking for method definitions. There is a bug in lookup that I still need to figure out, but after that we should be able to report full method information for Objective-C classes shown in symbols. Also fixed some errors I ran into when enabling the maps for the persistent type store. The persistent type store previously did not use the ClangASTImporter to import types, instead using ASTImporters that got allocated each time a type needed copying. To support the requirements of the persistent type store -- namely, that types must be copied, completed, and then completely severed from their origin in the parser's AST context (which will go away) -- I added a new function called DeportType which severs all these connections. llvm-svn: 145914
OpenPOWER on IntegriCloud