summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionDeclMap.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* <rdar://problem/13893094>Greg Clayton2013-05-171-7/+1
| | | | | | Show variables that were in the debug info but optimized out. Also display a good error message when one of these variables get used in an expression. llvm-svn: 182066
* Fixed a few obvious errors pointed out by the static analyzer.Jim Ingham2013-05-151-1/+1
| | | | llvm-svn: 181911
* Fixed a problem where the expression parser wouldSean Callanan2013-04-301-1/+1
| | | | | | | | | | give up if it couldn't find the address for the first symbol it found with a particular name and type. <rdar://problem/13748253> llvm-svn: 180764
* Fixed a crash when we tried dyn_cast<>ing aSean Callanan2013-04-271-0/+3
| | | | | | | | null pointer. <rdar://problem/13745684> llvm-svn: 180663
* Hardening to avoid null-pointer crashes in theSean Callanan2013-04-261-0/+6
| | | | | | | | presence of malformed class types. <rdar://problem/13740646> llvm-svn: 180645
* Fixed a problem where the expression parser wouldSean Callanan2013-04-241-4/+13
| | | | | | | | | | | | | | not find multiple functions with the same name but different types. Now we keep track of what types we've already reported for a function and only elide functions if we've already reported a conflicting one. Also added a test case. <rdar://problem/11367837> llvm-svn: 180167
* Removed 2800+ lines of code that no longer do anythingSean Callanan2013-04-191-1126/+0
| | | | | | | now that the IR interpreter and the JIT share the same materialization codepaths. llvm-svn: 179842
* After discussing with Chris Lattner, we require C++11, so lets get rid of ↵Greg Clayton2013-04-181-6/+6
| | | | | | the macros and just use C++11. llvm-svn: 179805
* This commit changes the way LLDB executes userSean Callanan2013-04-181-8/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expressions. Previously, ClangUserExpression assumed that if there was a constant result for an expression then it could be determined during parsing. In particular, the IRInterpreter ran while parser state (in particular, ClangExpressionDeclMap) was present. This approach is flawed, because the IRInterpreter actually is capable of using external variables, and hence the result might be different each run. Until now, we papered over this flaw by re-parsing the expression each time we ran it. I have rewritten the IRInterpreter to be completely independent of the ClangExpressionDeclMap. Instead of special-casing external variable lookup, which ties the IRInterpreter closely to LLDB, we now interpret the exact same IR that the JIT would see. This IR assumes that materialization has occurred; hence the recent implementation of the Materializer, which does not require parser state (in the form of ClangExpressionDeclMap) to be present. Materialization, interpretation, and dematerialization are now all independent of parsing. This means that in theory we can parse expressions once and run them many times. I have three outstanding tasks before shutting this down: - First, I will ensure that all of this works with core files. Core files have a Process but do not allow allocating memory, which currently confuses materialization. - Second, I will make expression breakpoint conditions remember their ClangUserExpression and re-use it. - Third, I will tear out all the redundant code (for example, materialization logic in ClangExpressionDeclMap) that is no longer used. While implementing this fix, I also found a bug in IRForTarget's handling of floating-point constants. This should be fixed. llvm-svn: 179801
* Since we use C++11, we should switch over to using std::unique_ptr when ↵Greg Clayton2013-04-181-6/+6
| | | | | | | | C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++. Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro. llvm-svn: 179779
* Updated the IRInterpreter to work with anSean Callanan2013-04-171-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IRMemoryMap rather than through its own memory abstraction. This considerably simplifies the code, and makes it possible to run the IRInterpreter multiple times on an already-parsed expression in the absence of a ClangExpressionDeclMap. Changes include: - ClangExpressionDeclMap's interface methods for the IRInterpreter now take IRMemoryMap arguments. They are not long for this world, however, since the IRInterpreter will soon be working with materialized variables. - As mentioned above, removed the Memory class from the IR interpreter altogether. It had a few functions that remain useful, such as keeping track of Values that have been placed in memory, so I moved those into methods on InterpreterStackFrame. - Changed IRInterpreter to work with lldb::addr_t rather than Memory::Region as its primary currency. - Fixed a bug in the IRMemoryMap where it did not report correct address byte size and byte order if no process was present, because it was using Target::GetDefaultArchitecture() rather than Target::GetArchitecture(). - Made IRMemoryMap methods clear the Errors they receive before running. Having to do this by hand is just annoying. The testsuite seems happy with these changes, but please let me know if you see problems (especially in use cases without a process). llvm-svn: 179675
* Flipped the big switch: LLDB now uses the new Sean Callanan2013-04-161-864/+65
| | | | | | | | | | | | | | | | | | | | | | | | Materializer for all expressions that need to run in the target. This includes the following changes: - Removed a bunch of (de-)materialization code from ClangExpressionDeclMap and assumed the presence of a Materializer where we previously had a fallback. - Ensured that an IRMemoryMap is passed into ClangExpressionDeclMap::Materialize(). - Fixed object ownership on LLVMContext; it is now owned by the IRExecutionUnit, since the Module and the ExecutionEngine both depend on its existence. - Fixed a few bugs in IRMemoryMap and the Materializer that showed up during testing. llvm-svn: 179649
* Replicated the materialization logic for persistentSean Callanan2013-04-121-1/+6
| | | | | | | | variables in the Materializer. We don't use this code yet, but will soon once the other materializers are online. llvm-svn: 179390
* Hand over the job of laying out the argument structureSean Callanan2013-04-111-4/+22
| | | | | | | | | | to the Materializer. Materialization is still done by the ClangExpressionDeclMap; this will be the next thing to move. Also fixed a layout bug that this uncovered. llvm-svn: 179318
* Changed the way ClangExpressionDeclMap registersSean Callanan2013-04-111-18/+30
| | | | | | | | entities with the new Materializer so that it only registers those entities that actually need to be placed in the struct. llvm-svn: 179253
* Added a Materializer class that containsSean Callanan2013-04-111-2/+24
| | | | | | | | | | information about each variable that needs to be materialized for an expression to work. The next step is to migrate all materialization code from ClangExpressionDeclMap to Materializer, and to use it for variable materialization. llvm-svn: 179245
* Hardening so we won't crash if an Objective-C interfaceSean Callanan2013-04-091-0/+3
| | | | | | | | doesn't have a corresponding type. <rdar://problem/13596142> llvm-svn: 179130
* <rdar://problem/13506727> Greg Clayton2013-04-031-1/+1
| | | | | | | | | | | | Symbol table function names should support lookups like symbols with debug info. To fix this I: - Gutted the way FindFunctions is used, there used to be way too much smarts only in the DWARF plug-in - Made it more efficient by chopping the name up once and using simpler queries so that SymbolFile and Symtab plug-ins don't need to do as much - Filter the results at a higher level - Make the lldb_private::Symtab able to chop up C++ mangled names and make as much sense out of them as possible and also be able to search by basename, fullname, method name, and selector name. llvm-svn: 178608
* <rdar://problem/13521159>Greg Clayton2013-03-271-21/+21
| | | | | | | | LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down. All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down. llvm-svn: 178191
* Fixed handling of function pointers in the IRSean Callanan2013-03-191-2/+30
| | | | | | | interpreter. They now have correct values, even when the process is not running. llvm-svn: 177372
* Switch from CreateTypeSourceInfo, which allocatesSean Callanan2013-03-121-1/+1
| | | | | | | | | | uninitialized memory, to getTrivialTypeSourceInfo, which initializes its memory, when creating trivial TypeSourceInfos. <rdar://problem/13332253> llvm-svn: 176899
* Misc. clang build warning fixes.Matt Kopec2013-03-121-1/+1
| | | | llvm-svn: 176879
* Added very lightweight, statically-allocatedSean Callanan2013-03-081-1/+10
| | | | | | | | | | | | counters for a variety of metrics associated with expression parsing. This should give some idea of how much work the expression parser is doing on Clang's behalf, and help with hopefully reducing that load over time. <rdar://problem/13210748> Audit type search/import for expressions llvm-svn: 176714
* Add support for non-register scalar values in DoMaterializeOneVariable.Andrew Kaylor2013-03-061-120/+173
| | | | llvm-svn: 176574
* Add GNU indirect function support in expressions for Linux.Matt Kopec2013-02-271-15/+46
| | | | llvm-svn: 176206
* <rdar://problem/13265297> Greg Clayton2013-02-231-2/+2
| | | | | | StackFrame assumes m_sc is additive, but m_sc can lose its target. So now the SymbolContext::Clear() method takes a bool that indicates if the target should be cleared. Modified all existing code to properly set the bool argument. llvm-svn: 175953
* Fix clang warnings related to python macro redefinition and printf format ↵Matt Kopec2013-02-211-1/+1
| | | | | | specifiers. llvm-svn: 175829
* Hardening in case a thread's frames are missing.Sean Callanan2013-02-211-1/+1
| | | | | | <rdar://problem/13254824> llvm-svn: 175806
* Fixed the way the ClangExpressionDeclMap looksSean Callanan2013-02-121-4/+11
| | | | | | | | | | | | up variables in the current stack frame to avoid mutual recursion between the expression parser and the synthetic child providers. Variables should only be looked up in a very simple way, using no synthetic anything. <rdar://problem/13173454> llvm-svn: 174947
* 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
OpenPOWER on IntegriCloud