summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionDeclMap.cpp
Commit message (Collapse)AuthorAgeFilesLines
* sweep up -Wformat warnings from gccSaleem Abdulrasool2014-04-041-38/+36
| | | | | | | This is a purely mechanical change explicitly casting any parameters for printf style conversion. This cleans up the warnings emitted by gcc 4.8 on Linux. llvm-svn: 205607
* cleanup unreferenced functionsSaleem Abdulrasool2014-03-201-37/+37
| | | | | | | | | | | | | This is a mechanical cleanup of unused functions. In the case where the functions are referenced (in comment form), I've simply commented out the functions. A second pass to clean that up is warranted. The functions which are otherwise unused have been removed. Some of these were introduced in the initial commit and not in use prior to that point! NFC llvm-svn: 204310
* Emit a warning diagnostic if a symbol was promotedSean Callanan2014-02-191-0/+4
| | | | | | | | | to a variable. This helps people figure out what happened if they tried to do something to the variable and it didn't work because we gave it the default type of void*. llvm-svn: 201737
* Fixed the AST importer to ensure that base classesSean Callanan2013-12-201-0/+2
| | | | | | | | | | | | | of Objective-C classes are completed, and that variables of Objective-C types have their types completed when the variables are reported. This fixes a long-standing issue where ivars did not show up correctly on 32-bit OS X. <rdar://problem/12184093> llvm-svn: 197775
* Roll back the changes I made in r193907 which created a new FrameJason Molenda2013-11-041-7/+7
| | | | | | | | | | pure virtual base class and made StackFrame a subclass of that. As I started to build on top of that arrangement today, I found that it wasn't working out like I intended. Instead I'll try sticking with the single StackFrame class -- there's too much code duplication to make a more complicated class hierarchy sensible I think. llvm-svn: 193983
* Add a new base class, Frame. It is a pure virtual function whichJason Molenda2013-11-021-7/+7
| | | | | | | | | | | | | | | | | | | | | defines a protocol that all subclasses will implement. StackFrame is currently the only subclass and the methods that Frame vends are nearly identical to StackFrame's old methods. Update all callers to use Frame*/Frame& instead of pointers to StackFrames. This is almost entirely a mechanical change that touches a lot of the code base so I'm committing it alone. No new functionality is added with this patch, no new subclasses of Frame exist yet. I'll probably need to tweak some of the separation, possibly moving some of StackFrame's methods up in to Frame, but this is a good starting point. <rdar://problem/15314068> llvm-svn: 193907
* <rdar://problem/14496092>Greg Clayton2013-10-311-5/+18
| | | | | | Fixes from code review by Jim Ingham that reinstate preferring an external vs non-external symbol when finding function addresses. llvm-svn: 193761
* <rdar://problem/14496092>Greg Clayton2013-10-301-22/+41
| | | | | | Fixed the expression parser to be able to iterate across all function name matches that it finds when it is looking for the address of a function that the IR is looking for. Also taught it to deal with reexported symbols. llvm-svn: 193716
* Fixes to get LLDB building on Windows again.Deepak Panickal2013-10-221-2/+2
| | | | llvm-svn: 193159
* <rdar://problem/14496092>Greg Clayton2013-10-211-16/+66
| | | | | | | | Fixed an issue with reexported symbols on MacOSX by adding support for symbols re-exporting symbols. There is now a new symbol type eSymbolTypeReExported which contains a new name for the re-exported symbol and the new shared library. These symbols are only used when a symbol is re-exported as a symbol under a different name. Modified the expression parser to be able to deal with finding the re-exported symbols and track down the actual symbol it refers to. llvm-svn: 193101
* Remove a spurious comment.Jim Ingham2013-09-051-1/+0
| | | | llvm-svn: 190027
* clean up about 22 warnings messagesMichael Sartain2013-08-071-1/+1
| | | | llvm-svn: 187900
* Actually use the return value we get back whenSean Callanan2013-07-151-15/+10
| | | | | | | | | creating a persistent variable, rather than making a (potentially expensive) lookup by name. <rdar://problem/14337653> llvm-svn: 186337
* Huge change to clean up types.Greg Clayton2013-07-111-205/+143
| | | | | | | | A long time ago we start with clang types that were created by the symbol files and there were many functions in lldb_private::ClangASTContext that helped. Later we create ClangASTType which contains a clang::ASTContext and an opauque QualType, but we didn't switch over to fully using it. There were a lot of places where we would pass around a raw clang_type_t and also pass along a clang::ASTContext separately. This left room for error. This checkin change all type code over to use ClangASTType everywhere and I cleaned up the interfaces quite a bit. Any code that was in ClangASTContext that was type related, was moved over into ClangASTType. All code that used these types was switched over to use all of the new goodness. llvm-svn: 186130
* Cleanup on the unified section list changes. Main changes are:Greg Clayton2013-07-101-7/+2
| | | | | | | | | | | | | | | - ObjectFile::GetSymtab() and ObjectFile::ClearSymtab() no longer takes any flags - Module coordinates with the object files and contain a unified section list so that object file and symbol file can share sections when they need to, yet contain their own sections. Other cleanups: - Fixed Symbol::GetByteSize() to not have the symbol table compute the byte sizes on the fly - Modified the ObjectFileMachO class to compute symbol sizes all at once efficiently - Modified the Symtab class to store a file address lookup table for more efficient lookups - Removed Section::Finalize() and SectionList::Finalize() as they did nothing - Improved performance of the detection of symbol files that have debug maps by excluding stripped files and core files, debug files, object files and stubs - Added the ability to tell if an ObjectFile has been stripped with ObjectFile::IsStripped() (used this for the above performance improvement) llvm-svn: 185990
* <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
OpenPOWER on IntegriCloud