summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression
Commit message (Collapse)AuthorAgeFilesLines
...
* Pulled in a new revision of LLVM/Clang and addedSean Callanan2011-11-194-8/+10
| | | | | | | | | | | | | several patches. These patches fix a problem where templated types were not being completed the first time they were used, and fix a variety of minor issues I discovered while fixing that problem. One of the previous local patches was resolved in the most recent Clang, so I removed it. The others will be removed in due course. llvm-svn: 144984
* This commit completes the rearchitecting of ClangASTSourceSean Callanan2011-11-183-40/+95
| | | | | | | | | | | | | | | | | | | | | 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
* I made the ClangASTImporter owned by the targetSean Callanan2011-11-161-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rather than individually on behalf of each ASTContext. This allows the ASTImporter to know about all containers of types, which will let it be smarter about forwarding information about type origins. That means that the following sequence of steps will be possible (after a few more changes): - Import a type from a Module's ASTContext into an expression parser ASTContext, tracking its origin information -- this works now. - Because the result of the expression uses that type, import it from the expression parser ASTContext into the Target's scratch AST context, forwarding the origin information -- this needs to be added. - For a later expression that uses the result, import the type from the Target's scratch AST context, still forwarding origin information -- this also needs to be added. - Use the intact origin information to complete the type as needed -- this works now if the origin information is present. To this end, I made the following changes: - ASTImporter top-level copy functions now require both a source and a destination AST context parameter. - The ASTImporter now knows how to purge records related to an ASTContext that is going away. - The Target now owns and creates the ASTImporter whenever the main executable changes or (in the absence of a main executable) on demand. llvm-svn: 144802
* 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
* Two fixes for Objetive-C methods that return structSean Callanan2011-11-162-3/+78
| | | | | | | | | | types. First, I added handling for the memset intrinsic in the IR, which is used to zero out the returned struct. Second, I fixed the object-checking instrumentation to objc_msgSend_stret, and generally tightened up how the object-checking functions get inserted. llvm-svn: 144741
* Eliminated a compile warning by removing dyn_castSean Callanan2011-11-151-1/+1
| | | | | | where isa is good enough. llvm-svn: 144704
* Fixed a bug where the variable-resolution codeSean Callanan2011-11-151-0/+3
| | | | | | | would occasionally try to resolve the placeholder variable used for static data allocation. llvm-svn: 144677
* Pulled in a new version of LLVM/Clang to solve a varietySean Callanan2011-11-155-49/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixed Objective-C method lookup for methods withSean Callanan2011-11-141-1/+1
| | | | | | | | a single argument. We assumed that the : was omitted from the selector name, but actually Clang adds the : in the one-argument case. llvm-svn: 144544
* <rdar://problem/10338439>Greg Clayton2011-11-132-71/+342
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Updated LLVM/Clang to pull in a fix for Objective-CSean Callanan2011-11-111-2/+67
| | | | | | | | | | interfaces. This allows us to pull in Objective-C method types on demand, which is also now implemented. Also added a minor fix to prevent multiple-definition errors for "Class" and "id". llvm-svn: 144405
* Added a function to ClangASTSource to service Sean Callanan2011-11-091-2/+48
| | | | | | | | | | | lookups for Objective-C methods by selector. Right now all it does is print log information. Also improved the logging for imported TagDecls to indicate whether or not the definition for the imported TagDecl is complete. llvm-svn: 144203
* Do a better job of detecting when a breakpoint command has set the target ↵Jim Ingham2011-11-081-0/+6
| | | | | | | | running again (except you have to ignore cases where the breakpoint runs expressions, those don't count as really "running again"). llvm-svn: 144064
* Added a language parameter to the expression parser,Sean Callanan2011-11-072-12/+46
| | | | | | | | | | | which will in the future allow expressions to be compiled as C, C++, and Objective-C instead of the current default Objective-C++. This feature requires some additional support from Clang -- specifically, it requires reference types in the parser regardless of language -- so it is not yet exposed to the user. llvm-svn: 144042
* Additional logging to track original versions ofSean Callanan2011-11-071-1/+2
| | | | | | imported variables. llvm-svn: 144041
* Updated LLVM/Clang to pick up a fix for imports ofSean Callanan2011-11-041-1/+1
| | | | | | | | | | | | | | | C++ vtables, fixing a record layout problem in the expression parser. Also fixed various problems with the generation and unpacking of llvm.zip given our new better handling of multiple architectures in the LLVM build. (And added a log message that will hopefully catch record layout problems in the future.) llvm-svn: 143741
* Occasionally LLDB runs into contexts where theSean Callanan2011-11-041-3/+54
| | | | | | | | | | | | target is stopped in a C++ or Objective-C method but the "self" pointer's valid range actually doesn't cover the current location. Before, that was confusing Clang to the point where it crashed; now, we sanity-check and fall back to pretending we're in a C function if "self" or "this" isn't available. llvm-svn: 143676
* 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 functionality to call Objective-C class methodsSean Callanan2011-11-011-1/+70
| | | | | | | | | | | | correctly, and added a testcase to check that it works. The main problem here is that Objective-C class method selectors are external references stored in a special data structure in the LLVM IR module for an expression. I just had to extract them and ensure that the real class object locations were properly resolved. llvm-svn: 143520
* 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
* Minor logging changes: added logging right beforeSean Callanan2011-11-012-4/+23
| | | | | | | the expression makes it to the JIT, and made some logging only appear in verbose mode. llvm-svn: 143467
* Enhanced the ObjC DynamicCheckerFunction to test for "object responds to ↵Jim Ingham2011-11-011-0/+19
| | | | | | | | | | | | | | selector" as well as "object borked"... Also made the error when the checker fails reflect this fact rather than report a crash at 0x0. Also a little cleanup: - StopInfoMachException had a redundant copy of the description string. - ThreadPlanCallFunction had a redundant copy of the thread, and had a copy of the process that it didn't really need. llvm-svn: 143419
* warnings: Fix a bunch of -Wreorder problems.Daniel Dunbar2011-10-313-6/+6
| | | | llvm-svn: 143381
* The IRDynamicChecks subsystem was not properlySean Callanan2011-10-312-1/+33
| | | | | | | | detecting Objective-C method calls because the "lldb.call.realName" metadata was no longer being correctly installed. I fixed this problem. llvm-svn: 143371
* Cloned FindExternalVisibleDecls fromSean Callanan2011-10-292-162/+246
| | | | | | | | | | 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-292-171/+141
| | | | | | functions from ClangExpressionDeclMap to ClangASTSource. llvm-svn: 143276
* I moved the responsibility for interacting with theSean Callanan2011-10-294-121/+113
| | | | | | | | | | | | 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-283-49/+48
| | | | | | | | | | | | | | | | | 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
* Disabled lookups for the Objective-C builtin type "id;"Sean Callanan2011-10-271-21/+26
| | | | | | the compiler should pick this type up automatically. llvm-svn: 143094
* Added an extra parameter to the object-checkerSean Callanan2011-10-271-6/+34
| | | | | | | | functions in the Objective-C language runtime that is set to the selector that is being passed to the object. llvm-svn: 143083
* Extended the IR interpreter to handle the variablesSean Callanan2011-10-262-42/+123
| | | | | | | | | | | | | | | | | | | | "_cmd", "this", and "self". These variables are handled differently from all other external variables used by the expression. Other variables are used indirectly through the $__lldb_arg operand; only _cmd, this, and self are passed directly through the ABI. There are two modifications: - I added a function to ClangExpressionDeclMap that retrives the value of one of these variables by name; and - I made IRInterpreter fetch these values when needed, and ensured that the proper level of indirection is used. llvm-svn: 143065
* Fixed a problem where local variables conflict withSean Callanan2011-10-251-0/+1
| | | | | | | | | types of the same name. If a local variable with the given name is found (and we are not searching a specific namespace) we stop right then and there and report it. llvm-svn: 142962
* Improved handling of static data in the expressionSean Callanan2011-10-252-33/+139
| | | | | | | | | | | | | | | | | | | | | | | parser. Now expression like the following work as expected: - (lldb) expr struct { int a; int b; } $blah = { 10, 20 } <no result> (lldb) expr $blah (<anonymous struct at Parse:6:5>) $blah = { (int) a = 10 (int) b = 20 } - Now the IRForTarget subsystem knows how to handle static initializers of various composite types. Also removed an unnecessary parameter from ClangExpressionDeclMap::GetFunctionInfo. llvm-svn: 142936
* Fixed our handling of const functions, compensatingSean Callanan2011-10-251-13/+8
| | | | | | | | | | for debug information that occasionally gets the const-ness of member functions wrong. We used to demangle the name, add "const," and remangle it; now we handle the mangled name directly, which is more robust. llvm-svn: 142933
* Added template support when parsing DWARF into types. We can now use STLGreg Clayton2011-10-221-5/+30
| | | | | | classes in the expression parser. llvm-svn: 142717
* Made the expression parser handle persistent variablesSean Callanan2011-10-221-2/+4
| | | | | | correctly even after the process has quit. llvm-svn: 142712
* Enabled dedicated debugger support in Clang, meaningSean Callanan2011-10-211-1/+1
| | | | | | | that Objective-C methods returning types incompatible with "id" can be properly cast. llvm-svn: 142702
* Implemented an extension to the namespace map thatSean Callanan2011-10-211-1/+101
| | | | | | | | permits a namespace map to be created and populated when the namespace is imported, not just when it is requested via FindExternalVisibleDecls(). llvm-svn: 142690
* Made the IR interpreter more robust in the presenceSean Callanan2011-10-213-24/+151
| | | | | | | | | of arbitrary pointers, allowing direct dereferences of literal addresses. Also disabled special-cased generation of certain expression results (especially casts), substituting the IR interpreter. llvm-svn: 142638
* Modified the ASTDumper to return a "const char *" instead of a copy of theGreg Clayton2011-10-202-28/+36
| | | | | | | | | | std::string and modified all places that used the std::string it returned to use the "const char *". Also modified the expression parser to not crash when a function type fails to copy into the expression AST context. llvm-svn: 142561
* Removed some debug support I accidentallySean Callanan2011-10-181-3/+0
| | | | | | committed. llvm-svn: 142376
* Improved logging, replacing the old ASTDumper (whichSean Callanan2011-10-182-545/+87
| | | | | | | | | | we never used) with a much simpler class that wraps the relevant dump functions in Clang. This class also knows to disable external lookups on DeclContexts being dumped so it should be safe to print incomplete Decls. llvm-svn: 142359
* Improved expression logging. Now all calls toSean Callanan2011-10-143-53/+82
| | | | | | | | | | | | | FindExternalVisibleDecls and FindExternalLexicalDecls are marked and given unique IDs, so that all logging done as part of their execution can be traced back to the proper call. Also there was some logging that really wasn't helpful in most cases so I disabled it unless verbose logging (log enable -v lldb expr) is enabled. llvm-svn: 141987
* Improved logging for FindExternalLexicalDecls toSean Callanan2011-10-141-4/+14
| | | | | | | | make it easier to track down which members belong to which structs (and which call to FindExternalLexicalDecls is doing the reporting). llvm-svn: 141930
OpenPOWER on IntegriCloud