summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionDeclMap.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Extended the IR interpreter to handle the variablesSean Callanan2011-10-261-7/+45
| | | | | | | | | | | | | | | | | | | | "_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-251-2/+0
| | | | | | | | | | | | | | | | | | | | | | | 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
* Made the expression parser handle persistent variablesSean Callanan2011-10-221-2/+4
| | | | | | correctly even after the process has quit. llvm-svn: 142712
* 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-211-1/+27
| | | | | | | | | 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-201-26/+33
| | | | | | | | | | 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-181-64/+26
| | | | | | | | | | 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-141-50/+79
| | | | | | | | | | | | | 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
* Cleaned up a few functions that never get used.Sean Callanan2011-10-131-17/+0
| | | | | | | | | | | | | | Specifically, the expression parser used to use functions attached to SymbolContext to do lookups, but nowadays it searches a ModuleList or Module directly instead. These functions had no remaining clients so I removed them to prevent bit rot. I also removed a stray callback function from ClangExpressionDeclMap. llvm-svn: 141899
* Enabled the namespace-specific search functionality,Sean Callanan2011-10-131-4/+4
| | | | | | | | | | | | | which had previously been commented out while I tested it. It's not fully working yet, but it doesn't break our testsuite and it's an important piece of functionality. Also added some logging to SymbolFileDWARF to help diagnose entities that are found in a symbol file, but do not reside in the expected namespace. llvm-svn: 141894
* Moved the list of found namespaces into the searchSean Callanan2011-10-131-38/+65
| | | | | | | | | | | | | | | | | | | | | | context object. Having it populated and registered within a single FindExternalVisibleDecls call worked fine when there was only one call (i.e., when we were just looking in the global namespace). However, now FindExternalVisibleDecls is called for nested namespaces as well, which means that it is called not once but many times (once per module in which the parent namespace appears). This means that the namespace mapping is built up across many calls to the inferior FindExternalVisibleDecls, so I moved it into a data structure (the search context) that is shared by all calls. I also added some logging to make it easier to see what is happening during a namespace search, and cleaned up some existing logging. llvm-svn: 141888
* Removed namespace qualification from symbol queries.Sean Callanan2011-10-131-14/+6
| | | | llvm-svn: 141866
* Completed the glue that passes a ClangNamespaceDecl *Sean Callanan2011-10-131-1/+1
| | | | | | | | down through Module and SymbolVendor into SymbolFile. Added checks to SymbolFileDWARF that restrict symbol searches when a namespace is passed in. llvm-svn: 141847
* Now that we know the values are going to stick around,Sean Callanan2011-10-131-48/+9
| | | | | | | | | | | we don't need to look them up again when materializing. Switched over the materialization mechanism (for JIT expressions) and the lookup mechanism (for interpreted expressions) to use the VariableSP/Symbol that were found during parsing. llvm-svn: 141839
* Extended the lifetime of Clang parser objects to theSean Callanan2011-10-121-1/+9
| | | | | | | | | | | | | lifetime of ClangExpressionDeclMap. This allows ClangExpressionVariables found during parsing to be queried for their containing namespaces during expression execution. Other clients (like ClangFunction) explicitly delete this state, so they should not result in any memory leaks. llvm-svn: 141821
* Refactoring in preparation for having multipleSean Callanan2011-10-121-14/+12
| | | | | | | | | | | | | | calls to the FindExternalVisibleDecls function. FindExternalVisibleDecls was recording whether it had found generic function symbols in variables that were local to the function. Now, however, multiple calls occur in response to one request from Clang, since we may be searching across namespaces. To support that, I moved the local variables into a bitfield in NameSearchContext. llvm-svn: 141808
* Made the expression parser's type search call theSean Callanan2011-10-121-26/+24
| | | | | | proper namespace-aware APIs. llvm-svn: 141797
* Added support to ClagnExpressionDeclMap for findingSean Callanan2011-10-121-6/+27
| | | | | | data symbols in namespaces. llvm-svn: 141792
* Changed FindExternalVisibleDecls() to use the moduleSean Callanan2011-10-121-6/+19
| | | | | | | level FindFunctions() where appropriate and not use SymbolContext::FindFunctionsByName(). llvm-svn: 141789
* Made FindGlobalVariable() optionally search a specificSean Callanan2011-10-121-11/+15
| | | | | | | | module and namespace. Also made it use FindGlobalVariables() instead of the more heavyweight GetVariablesForVariableExpressionPath(). llvm-svn: 141783
* Added ClangNamespaceDecl * parameters to severalSean Callanan2011-10-121-1/+1
| | | | | | | core Module functions that the expression parser will soon be using. llvm-svn: 141766
* Cleanups in preparation for making FindExternalVisibleDeclsSean Callanan2011-10-121-228/+169
| | | | | | | | look in individual modules rather than globally. Also some whitespace fixes. llvm-svn: 141765
* Implemented a namespace map that allows searchingSean Callanan2011-10-121-29/+133
| | | | | | | | | | | | | | | | | | of namespaces (only in the modules where they've been found) for entities inside those namespaces. For each NamespaceDecl that has been imported into the parser, we maintain a map containing [ModuleSP, ClangNamespaceDecl] pairs in the ASTImporter. This map has one entry for each module in which the namespace has been found. When we later scan for an entity inside a namespace, we search only the modules in which that namespace was found. Also made a small whitespace fix in ClangExpressionParser.cpp. llvm-svn: 141748
* Fix the last testsuite regression from the apple-names stuff.Jim Ingham2011-10-081-1/+2
| | | | llvm-svn: 141468
* Updated LLVM/Clang to pull in the latest ARM disassembler.Sean Callanan2011-10-071-0/+4
| | | | | | | | This involved minor changes to the way we report Objective-C methods, as well as cosmetic changes and added parameters for a variety of Clang APIs. llvm-svn: 141437
* Converted the lldb_private::Process over to use the intrusiveGreg Clayton2011-09-221-112/+177
| | | | | | | | | | | | | | | | | | | | shared pointers. Changed the ExecutionContext over to use shared pointers for the target, process, thread and frame since these objects can easily go away at any time and any object that was holding onto an ExecutionContext was running the risk of using a bad object. Now that the shared pointers for target, process, thread and frame are just a single pointer (they all use the instrusive shared pointers) the execution context is much safer and still the same size. Made the shared pointers in the the ExecutionContext class protected and made accessors for all of the various ways to get at the pointers, references, and shared pointers. llvm-svn: 140298
* Fixed a problem with the IR interpreter that causedSean Callanan2011-09-221-7/+18
| | | | | | | | | | | | it to generate result variables that were not bound to their underlying data. This allowed the SBValue class to use the interpreter (if possible). Also made sure that any result variables that point to stack allocations in the stack frame of the interpreted expressions do not get live data. llvm-svn: 140285
* Change Error::SetErrorStringWithFormat() prototype to use anJason Molenda2011-09-201-1/+1
| | | | | | | | | __attribute__ format so the compiler knows that this method takes printf style formatter arguments and checks that it's being used correctly. Fix a couple dozen incorrect SetErrorStringWithFormat() calls throughout the sources. llvm-svn: 140115
* Adopt the intrusive pointers in:Greg Clayton2011-09-171-2/+8
| | | | | | | | | | | | lldb_private::Breakpoint lldb_private::BreakpointLocations lldb_private::BreakpointSite lldb_private::Debugger lldb_private::StackFrame lldb_private::Thread lldb_private::Target llvm-svn: 139985
* Fixed a problem where the symbol context was notSean Callanan2011-09-151-0/+3
| | | | | | | being initialized properly in the absence of a process. llvm-svn: 139823
* This patch modifies the expression parser to allow itSean Callanan2011-09-151-38/+410
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to execute expressions even in the absence of a process. This allows expressions to run in situations where the target cannot run -- e.g., to perform calculations based on type information, or to inspect a binary's static data. This modification touches the following files: lldb-private-enumerations.h Introduce a new enum specifying the policy for processing an expression. Some expressions should always be JITted, for example if they are functions that will be used over and over again. Some expressions should always be interpreted, for example if the target is unsafe to run. For most, it is acceptable to JIT them, but interpretation is preferable when possible. Target.[h,cpp] Have EvaluateExpression now accept the new enum. ClangExpressionDeclMap.[cpp,h] Add support for the IR interpreter and also make the ClangExpressionDeclMap more robust in the absence of a process. ClangFunction.[cpp,h] Add support for the new enum. IRInterpreter.[cpp,h] New implementation. ClangUserExpression.[cpp,h] Add support for the new enum, and for running expressions in the absence of a process. ClangExpression.h Remove references to the old DWARF-based method of evaluating expressions, because it has been superseded for now. ClangUtilityFunction.[cpp,h] Add support for the new enum. ClangExpressionParser.[cpp,h] Add support for the new enum, remove references to DWARF, and add support for checking whether the expression could be evaluated statically. IRForTarget.[h,cpp] Add support for the new enum, and add utility functions to support the interpreter. IRToDWARF.cpp Removed CommandObjectExpression.cpp Remove references to the obsolete -i option. Process.cpp Modify calls to ClangUserExpression::Evaluate to pass the correct enum (for dlopen/dlclose) SBValue.cpp Add support for the new enum. SBFrame.cpp Add support for he new enum. BreakpointOptions.cpp Add support for the new enum. llvm-svn: 139772
* Fixed some incorrect return values.Greg Clayton2011-09-131-2/+2
| | | | llvm-svn: 139582
* Added support for persistent types to theSean Callanan2011-08-231-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expression parser. You can use a persistent type like this: (lldb) expr struct $foo { int a; int b; }; (lldb) struct $foo i; i.a = 2; i.b = 3; i ($foo) $0 = { (int) a = 2 (int) b = 3 } typedefs work similarly. This patch affects the following files: test/expression_command/persistent_types/* A test case for persistent types, in particular structs and typedefs. ClangForward.h Added TypeDecl, needed to declare some functions in ASTResultSynthesizer.h ClangPersistentVariables.[h,cpp] Added a list of persistent types to the persistent variable store. ASTResultSynthesizer.[h,cpp] Made the AST result synthesizer iterate across TypeDecls in the expression, and record any persistent types found. Also made a minor documentation fix. ClangUserExpression.[h,cpp] Extended the user expression class to keep the state needed to report the persistent variable store for the target to the AST result synthesizers. Also introduced a new error code for expressions that executed normally but did not return a result. CommandObjectExpression.cpp Improved output for expressions (like declarations of new persistent types) that don't return a result. This is no longer treated as an error. llvm-svn: 138383
* Fixed a performance problem where functions wereSean Callanan2011-08-161-4/+18
| | | | | | | | | being searched for in too heavyweight a way. Now, when asking for the address of a function, the expression parser just asks for a corresponding data symbol. llvm-svn: 137731
* Fixed LLDB's handling of ElaboratedTypes, which wasSean Callanan2011-08-111-7/+2
| | | | | | | causing problems with printing the values of persistent variables with struct types. llvm-svn: 137392
* Check log shared pointer before using it.Johnny Chen2011-08-091-1/+2
| | | | llvm-svn: 137169
* Made the expression parser use the StackFrame'sSean Callanan2011-08-061-34/+20
| | | | | | | variable search API rather than rolling its own, fixing one of our testcases. llvm-svn: 137004
* This is an overhaul of the expression parser codeSean Callanan2011-08-051-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | that detects what context the current expression is meant to execute in. LLDB now properly consults the method declaration in the debug information rather than trying to hunt down the "this" or "self" pointer by name, which can be misleading. Other fixes include: - LLDB now properly detects that it is inside an inlined C++ member function. - LLDB now allows access to non-const members when in const code. - The functions in SymbolFile that locate the DeclContext containing a DIE have been renamed to reflect what they actually do. I have added new functions that find the DeclContext for the DIE itself. I have also introduced testcases for C++ and Objective-C. llvm-svn: 136999
* Added checking to make sure that the target has aSean Callanan2011-08-011-2/+8
| | | | | | scratch AST context before attempting to parse. llvm-svn: 136631
* This change brings in the latest LLVM/Clang, andSean Callanan2011-07-301-95/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | completes the support in the LLDB expression parser for incomplete types. Clang now imports types lazily, and we complete those types as necessary. Changes include: - ClangASTSource now supports three APIs which it passes to ClangExpressionDeclMap. CompleteType completes a TagDecl or an ObjCInterfaceDecl when needed; FindExternalVisibleDecls finds named entities that are visible in the expression's scope; and FindExternalLexicalDecls performs a (potentially restricted) search for entities inside a lexical scope like a namespace. These changes mean that entities in namespaces should work normally. - The SymbolFileDWARF code for searching a context for a specific name is now more general, and can search arbitrary contexts. - We are continuing to adapt our calls into LLVM from interfaces that take start and end iterators when accepting multiple items to interfaces that use ArrayRef. - I have cleaned up some code, especially our use of namespaces. This change is neutral for our testsuite and greatly improves correctness for large programs (like Clang) with complicated type systems. It should also lay the groundwork for improving the expression parser's performance as we are lazier and lazier about providing type information. llvm-svn: 136555
* Patch by Matt Johnson to silence G++ warnings!Johnny Chen2011-07-191-2/+2
| | | | | | | | Used hand merge to apply the diffs. I did not apply the diffs for FormatManager.h and the diffs for memberwise initialization for ValueObject.cpp because they changed since. I will ask my colleague to apply them later. llvm-svn: 135508
* remove errant parenthesis.Jim Ingham2011-07-081-1/+1
| | | | llvm-svn: 134717
* Fixed a few issues where typedefs weren't passing through to the correctGreg Clayton2011-07-081-0/+1
| | | | | | | | | recursive function. Also fixed ClangASTContext::IsPointerType to correctly NULL out the pointee handle if a valid one is provided. llvm-svn: 134715
* Audited the expression parser to find uninitializedSean Callanan2011-07-081-8/+8
| | | | | | | | | pointers. Some of the spots are obviously initialized later, but it's better just to NULL the pointers out at initialization to make the code more robust when exposed to later changes. llvm-svn: 134670
* Added checks to the expresssion parser which makeSean Callanan2011-07-071-1/+13
| | | | | | | | | searching for variables and symbols in the target more robust. These checks prevent variables from being reported as existing if they cannot actually be evaluated in the current context. llvm-svn: 134656
OpenPOWER on IntegriCloud