summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-122-4/+11
| | | | | | | | | | | | | 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
* Fix preprocessor warnings for no newline at the end of the source files.Greg Clayton2011-10-121-1/+1
| | | | llvm-svn: 141755
* Implemented a namespace map that allows searchingSean Callanan2011-10-123-31/+135
| | | | | | | | | | | | | | | | | | 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
* Fixed a memory leak of ASTResultSynthesizers,Sean Callanan2011-10-081-4/+7
| | | | | | by attaching them to the ClangExpressionParser. llvm-svn: 141452
* Updated LLVM/Clang to pull in the latest ARM disassembler.Sean Callanan2011-10-075-25/+29
| | | | | | | | 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
* Factored out handling of the source code for anSean Callanan2011-09-262-50/+105
| | | | | | | | | | expression into a separate class. This class encapsulates wrapping the function as needed. I am also moving from using booleans to indicate what the expression's language should be to using lldb::LanguageType instead. llvm-svn: 140545
* Converted the lldb_private::Process over to use the intrusiveGreg Clayton2011-09-227-196/+301
| | | | | | | | | | | | | | | | | | | | 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-222-8/+24
| | | | | | | | | | | | 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
* Fixed a problem where expressions would attempt toSean Callanan2011-09-202-28/+26
| | | | | | | | allocate memory in a process that did not support expression execution. Also improved detection of whether or not a process can execute expressions. llvm-svn: 140202
* Update declarations for all functions/methods that accept printf-styleJason Molenda2011-09-205-17/+17
| | | | | | | | stdarg formats to use __attribute__ format so the compiler can flag incorrect uses. Fix all incorrect uses. Most of these are innocuous, a few were resulting in crashes. llvm-svn: 140185
* Change Error::SetErrorStringWithFormat() prototype to use anJason Molenda2011-09-202-2/+2
| | | | | | | | | __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
* Convert lldb::ModuleSP to use an instrusive ref counted pointer.Greg Clayton2011-09-171-0/+1
| | | | | | | | | We had some cases where getting the shared pointer for a module from the global module list was causing a performance issue when debugging with DWARF in .o files. Now that the module uses intrusive ref counts, we can easily convert any pointer to a shared pointer. llvm-svn: 139983
* 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
* Fixed a problem where the expression parser wouldSean Callanan2011-09-151-0/+3
| | | | | | | attempt to obtain information from the process even in cases where the process isn't available. llvm-svn: 139803
* This patch modifies the expression parser to allow itSean Callanan2011-09-158-430/+1965
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Huge memory and performance improvements in the DWARF parser.Greg Clayton2011-09-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | Address ranges are now split up into two different tables: - one in DWARFDebugInfo that is compile unit specific - one in each DWARFCompileUnit that has exact function DIE offsets This helps keep the size of the aranges down since the main table will get uniqued and sorted and have consecutive ranges merged. We then only parse the compile unit one on demand once we have determined that a compile unit contains the address in question. We also now use the .debug_aranges section if there is one instead of always indexing the DWARF manually. NameToDIE now uses a UniqueCStringMap<dw_offset> map instead of a std::map. std::map is very bulky as each node has 3 pointers and the key and value types. This gets our NameToDIE entry down to 12 bytes each instead of 48 which saves us a lot of memory when we have very large DWARF. DWARFDebugAranges now has a smaller footprint for each range it contains to save on memory. llvm-svn: 139557
* Added the ability for DWARF locations to use the ABI plug-ins to resolveGreg Clayton2011-09-021-12/+100
| | | | | | | | register names when dumping variable locations and location lists. Also did some cleanup where "int" types were being used for "lldb::RegisterKind" values. llvm-svn: 138988
* Fixed a bug where the target for an expression wasSean Callanan2011-08-241-4/+4
| | | | | | | | not set if the containing function could not be found. This caused LLDB to crash later in expression parsing. llvm-svn: 138499
* Added support for persistent types to theSean Callanan2011-08-235-6/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* We were leaking a stack frame in StackFrameList in Thread.cpp which couldGreg Clayton2011-08-121-4/+2
| | | | | | | | | | cause extra shared pointer references to one or more modules to be leaked. This would cause many object files to stay around the life of LLDB, so after a recompile and rexecution, we would keep adding more and more memory. After fixing the leak, we found many cases where leaked stack frames were still being used and causing crashes in the test suite. These are now all resolved. llvm-svn: 137516
* 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
* Fixed a problem that prevented access to membersSean Callanan2011-08-101-10/+36
| | | | | | | | | | | of string literals ("hello"[2]). Also fixed a problem in which empty string literals were not being compiled correctly ((int)printf("") would print garbage). Added a testcase that covers both. llvm-svn: 137247
* While tracking down memory consumption issue a few things were needed: the Greg Clayton2011-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ability to dump more information about modules in "target modules list". We can now dump the shared pointer reference count for modules, the pointer to the module itself (in case performance tools can help track down who has references to said pointer), and the modification time. Added "target delete [target-idx ...]" to be able to delete targets when they are no longer needed. This will help track down memory usage issues and help to resolve when module ref counts keep getting incremented. If the command gets no arguments, the currently selected target will be deleted. If any arguments are given, they must all be valid target indexes (use the "target list" command to get the current target indexes). Took care of a bunch of "no newline at end of file" warnings. TimeValue objects can now dump their time to a lldb_private::Stream object. Modified the "target modules list --global" command to not error out if there are no targets since it doesn't require a target. Fixed an issue in the MacOSX DYLD dynamic loader plug-in where if a shared library was updated on disk, we would keep using the older one, even if it was updated. Don't allow the ModuleList::GetSharedModule(...) to return an empty module. Previously we could specify a valid path on disc to a module, and specify an architecture that wasn't contained in that module and get a shared pointer to a module that wouldn't be able to return an object file or a symbol file. We now make sure an object file can be extracted prior to adding the shared pointer to the module to get added to the shared list. llvm-svn: 137196
* Check log shared pointer before using it.Johnny Chen2011-08-091-3/+8
| | | | llvm-svn: 137173
* Check log shared pointer before using it.Johnny Chen2011-08-091-1/+2
| | | | llvm-svn: 137169
* Add EvaluateWithError static method. Fix a bug in handling constant ↵Jim Ingham2011-08-091-1/+13
| | | | | | expressions - we weren't setting the result even though the expression evaluation succeeded... llvm-svn: 137077
* 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-052-28/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixed a problem that caused LLDB to fail to executeSean Callanan2011-08-042-193/+161
| | | | | | | | | | | | | | | | | | | | expressions that used function pointers. The problem was that IRForTarget previously only scanned the IR for the expression for call instructions; if a function was used in another context, it was ignored. Now LLDB scans the Module for functions that are only declared (not also defined -- so these are externals); it then constructs function pointers for these functions and substitutes them wherever the function is used. Also made some changes so that "expr main" works just as well as "expr &main"; they end up being the same code, but LLDB was generating the result variable in different ways. llvm-svn: 136928
* Improved the expression parser's detection of theSean Callanan2011-08-031-3/+7
| | | | | | | | | | | | current context. Previously, if there was a variable called "self" available, the expression parser assumed it was inside a method. But class methods in Objective-C also take a "self" parameter, of DWARF type "id". We now detect this properly, and only assume we're in an instance method if "self" is a pointer to an Objective-C object. llvm-svn: 136784
* Fixed a problem in the expression parser that Sean Callanan2011-08-011-1/+28
| | | | | | | | | | | | | | caused functions that were cast as part of the call to have that cast ignored once their addresses were resolved. Notably, in the case of objc_msgSend(), if the function was cast from something returning i8* to something returning i8, the expression parser was discarding the cast as part of its resolution. This caused crashes later on. llvm-svn: 136648
* Added checking to make sure that the target has aSean Callanan2011-08-013-4/+18
| | | | | | scratch AST context before attempting to parse. llvm-svn: 136631
* Fixed a bug where named constants were beingSean Callanan2011-08-011-2/+17
| | | | | | | | | | | | | | treated as externals, causing problems when we tried to look their locations up in the debug info. For example: expr char c[] = "foo"; c[0] would terminate when trying to find c in the debug information, despite the fact that c was defined inside the expression. llvm-svn: 136629
OpenPOWER on IntegriCloud