summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionDeclMap.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* <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
* Added new symbol types for Objective C classes, metaclasses, and ivars. EachGreg Clayton2011-12-031-0/+3
| | | | | | | | object file can correctly make these symbols which will abstract us from the file format and ABI and we can then ask for the objective C class symbol for a class and find out which object file it was defined in. llvm-svn: 145744
* Modified clients of ClangASTImporter to be more robustSean Callanan2011-12-011-0/+45
| | | | | | | | | | in the face of failures to import types, since blithely passing on NULL types can sometimes lead to trouble. Also eliminated a use of getAs and replaced it with dyn_cast, which is more robust. llvm-svn: 145628
* Made symbol lookup in the expression parser moreSean Callanan2011-12-011-6/+6
| | | | | | | | | | | | | | robust: - Now a client can specify what kind of symbols are needed; notably, this allows looking up Objective-C class symbols specifically. - In the class of symbols being looked up, if one is non-NULL and others are NULL, LLDB now prefers the non-NULL one. llvm-svn: 145554
* Modified ClangExpressionDeclMap to use existingSean Callanan2011-11-291-8/+6
| | | | | | | | ValueObjects when creating variables referring to live data rather than constructing ValueObjectConstResults. llvm-svn: 145437
* This commit completes the rearchitecting of ClangASTSourceSean Callanan2011-11-181-17/+47
| | | | | | | | | | | | | | | | | | | | | to allow variables in the persistent variable store to know how to complete themselves from debug information. That fixes a variety of bugs during dematerialization of expression results and also makes persistent variable and result variables ($foo, $4, ...) more useful. I have also added logging improvements that make it much easier to figure out how types are moving from place to place, and made some checking a little more aggressive. The commit includes patches to Clang which are currently being integrated into Clang proper; once these fixes are in Clang top-of-tree, these patches will be removed. The patches don't fix API; rather, they fix some internal bugs in Clang's ASTImporter that were exposed when LLDB was moving types from place to place multiple times. llvm-svn: 144969
* Fixed a crash when we merrily went on to try to logSean Callanan2011-11-161-0/+2
| | | | | | information about a nonexistent function declaration. llvm-svn: 144744
* Pulled in a new version of LLVM/Clang to solve a varietySean Callanan2011-11-151-30/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of problems with Objective-C object completion. To go along with the LLVM/Clang-side fixes, we have a variety of Objective-C improvements. Fixes include: - It is now possible to run expressions when stopped in an Objective-C class method and have "self" act just like "self" would act in the class method itself (i.e., [self classMethod] works without casting the return type if debug info is present). To accomplish this, the expression masquerades as a class method added by a category. - Objective-C objects can now provide methods and properties and methods to Clang on demand (i.e., the ASTImporter sets hasExternalVisibleDecls on Objective-C interface objects). - Objective-C built-in types, which had long been a bone of contention (should we be using "id"? "id*"?), are now fetched correctly using accessor functions on ClangASTContext. We inhibit searches for them in the debug information. There are also a variety of logging fixes, and I made two changes to the test suite: - Enabled a test case for Objective-C properties in the current translation unit. - Added a test case for calling Objective-C class methods when stopped in a class method. llvm-svn: 144607
* <rdar://problem/10338439>Greg Clayton2011-11-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the actual fix for the above radar where global variables that weren't initialized were not being shown correctly when leaving the DWARF in the .o files. Global variables that aren't intialized have symbols in the .o files that specify they are undefined and external to the .o file, yet document the size of the variable. This allows the compiler to emit a single copy, but makes it harder for our DWARF in .o files with the executable having a debug map because the symbol for the global in the .o file doesn't exist in a section that we can assign a fixed up linked address to, and also the DWARF contains an invalid address in the "DW_OP_addr" location (always zero). This means that the DWARF is incorrect and actually maps all such global varaibles to the first file address in the .o file which is usually the first function. So we can fix this in either of two ways: make a new fake section in the .o file so that we have a file address in the .o file that we can relink, or fix the the variable as it is created in the .o file DWARF parser and actually give it the file address from the executable. Each variable contains a SymbolContextScope, or a single pointer that helps us to recreate where the variables came from (which module, file, function, etc). This context helps us to resolve any file addresses that might be in the location description of the variable by pointing us to which file the file address comes from, so we can just replace the SymbolContextScope and also fix up the location, which we would have had to do for the other case as well, and update the file address. Now globals display correctly. The above changes made it possible to determine if a variable is a global or static variable when parsing DWARF. The DWARF emits a DW_TAG_variable tag for each variable (local, global, or static), yet DWARF provides no way for us to classify these variables into these categories. We can now detect when a variable has a simple address expressions as its location and this will help us classify these correctly. While making the above changes I also noticed that we had two symbol types: eSymbolTypeExtern and eSymbolTypeUndefined which mean essentially the same thing: the symbol is not defined in the current object file. Symbol objects also have a bit that specifies if a symbol is externally visible, so I got rid of the eSymbolTypeExtern symbol type and moved all code locations that used it to use the eSymbolTypeUndefined type. llvm-svn: 144489
* Additional logging to track original versions ofSean Callanan2011-11-071-1/+2
| | | | | | imported variables. llvm-svn: 144041
* Fixed a problem where the "this" pointer didn'tSean Callanan2011-11-031-0/+17
| | | | | | have the correct value in the IRInterpreter. llvm-svn: 143663
* Fixed the function that gets values for theSean Callanan2011-11-021-1/+20
| | | | | | | | IRInterpreter to get the value, not the location, of references. The location of a reference has type T&&, which is meaningless to Clang. llvm-svn: 143592
* Updated LLVM/Clang to pull in an MCJIT fix thatSean Callanan2011-11-021-1/+1
| | | | | | | | | | allows us to set __attribute__ ((used)) on expressions that masquerade as methods. When we are stopped in classes in anonymous namespaces, this fix (and enabling __attribute__ ((used)) on the method) will allow expressions to run. llvm-svn: 143560
* Sometimes the debug information includes artifically-Sean Callanan2011-11-021-1/+3
| | | | | | | | | | | | | generated special member functions (constructors, destructors, etc.) for classes that don't really have them. We needed to mark these as artificial to reflect the debug information; this bug does that for constructors and destructors. The "etc." case (certain assignment operators, mostly) remains to be fixed. llvm-svn: 143526
* Added the capability (turned off for now) to mark aSean Callanan2011-11-011-8/+10
| | | | | | | | | | | | | | | | method as __attribute__ ((used)) when adding it to a class. This functionality is useful when stopped in anonymous namespaces: expressions attached to classes in anonymous namespaces are typically elided by Clang's CodeGen because they have no namespaces are intended not to be externally visible. __attribute__ ((used)) forces CodeGen to emit the function. Right now, __attribute__ ((used)) causes the JIT not to emit the function, so we're not enabling it until we fix that. llvm-svn: 143469
* Cloned FindExternalVisibleDecls fromSean Callanan2011-10-291-157/+25
| | | | | | | | | | ClangExpressionDeclMap to ClangASTSource, and moved all general type and namespace lookups into ClangASTSource. Now ClangASTSource is ready to complete types given nothing more than a target and an AST context. llvm-svn: 143292
* Moved FindExternalLexicalDecls and a few smallerSean Callanan2011-10-291-159/+0
| | | | | | functions from ClangExpressionDeclMap to ClangASTSource. llvm-svn: 143276
* I moved the responsibility for interacting with theSean Callanan2011-10-291-119/+12
| | | | | | | | | | | | AST importer on completing namespace mappings from ClangExpressionDeclMap to ClangASTSource. ClangASTSource now contains a TargetSP which it uses to lookup namespaces in all of a target's modules. I will use the TargetSP in the future to look up globals. llvm-svn: 143275
* As part of a general refactoring of ClangASTSource toSean Callanan2011-10-281-18/+22
| | | | | | | | | | | | | | | | | allow it to complete types on behalf of any AST context (including the "scratch" AST context associated with the target), I scrapped its role as intermediary between the Clang parser and ClangExpressionDeclMap, and instead made ClangExpressionDeclMap inherit from ClangASTSource. After this, I will migrate the functions that complete types and perform namespace lookups from ClangExpressionDeclMap to ClangASTSource. Ultimately ClangExpressionDeclMap's only responsiblity will be to look up variables and ensure that they are materialized and dematerialized correctly. llvm-svn: 143253
* Added a bunch of logging to CompleteType for TagDeclsSean Callanan2011-10-281-2/+37
| | | | | | and ObjCInterfaceDecls. llvm-svn: 143181
* Changed the way the expression parser handles variablesSean Callanan2011-10-271-19/+89
| | | | | | | | | | | | | | of reference types. Previously, such variables were materialized as references to those references, which caused undesried behavior in Clang and was useless anyway (the benefit of using references to variables is that it allows expressions to modify variables in place, but for references that's not required). Now we just materialize the references directly, which fixes a variety of expressions that use references. llvm-svn: 143137
* Liberalized the "id" check a little; now "id" canSean Callanan2011-10-271-3/+5
| | | | | | be found in namespaces. llvm-svn: 143096
OpenPOWER on IntegriCloud