summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/IRForTarget.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Cleanup of IRForTarget. Removed some relics ofSean Callanan2013-06-271-80/+0
| | | | | | | the time when the IRInterpreter ran inside IRForTarget. llvm-svn: 185088
* Sort out a number of mismatched integer types in order to cut down the ↵Andy Gibbs2013-06-191-2/+2
| | | | | | number of compiler warnings. llvm-svn: 184333
* Fix crash (in optimized builds) due to invalid metadata operandDaniel Malea2013-06-031-6/+4
| | | | | | | | | - ConstantDataArray is not a valid MDNode operand - encode function-name strings in metadata by wrapping in an MDString instead - should resolve reported by http://llvm-jenkins.debian.net/job/llvm-toolchain-quantal-binaries/architecture=amd64,distribution=quantal/173/ llvm-svn: 183153
* Fixed IRForTarget to handle Objective-C messagesSean Callanan2013-04-241-0/+10
| | | | | | | | sent to "super". <rdar://problem/13042260> llvm-svn: 180217
* Fixed expression parser handling of empty strings.Sean Callanan2013-04-241-0/+5
| | | | | | <rdar://problem/12977827> llvm-svn: 180215
* Be sure to print out the fully mangled name when we are unable to find a ↵Greg Clayton2013-04-231-0/+4
| | | | | | function to call so we can easily look for this symbol if needed. llvm-svn: 180151
* This commit changes the way LLDB executes userSean Callanan2013-04-181-127/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Made the IRInterpreter's methods static, sinceSean Callanan2013-04-171-5/+1
| | | | | | it doesn't actually hold any important state. llvm-svn: 179702
* Made the IRInterpreter be able to operate withoutSean Callanan2013-04-171-1/+1
| | | | | | | | | a ClangExpressionDeclMap. Any functions that require value resolution etc. fail if the ClangExpressionDeclMap isn't present - which is exactly what is desired. llvm-svn: 179695
* Modified the IRInterpreter to take an IRMemoryMap.Sean Callanan2013-04-161-0/+2
| | | | | | | | It doesn't use it yet; the next step is to make it use the IRMemoryMap instead of its own conjured-up Memory class. llvm-svn: 179650
* Handle C++ static variables in the expressionSean Callanan2013-04-111-0/+2
| | | | | | | | parser. <rdar://problem/13631469> llvm-svn: 179304
* <rdar://problem/13521159>Greg Clayton2013-03-271-34/+25
| | | | | | | | 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
* If there are multiple uses of an Objective-CSean Callanan2013-03-231-8/+12
| | | | | | | | | class symbol in the same expression, handle all of them instead of just the first one. <rdar://problem/13440133> llvm-svn: 177794
* Refactored the expression parser so that the IRSean Callanan2013-03-191-27/+33
| | | | | | | | | | | | | | | | | | | | | | | | | and the JITted code are managed by a standalone class that handles memory management itself. I have removed RecordingMemoryManager and ProcessDataAllocator, which filled similar roles and had confusing ownership, with a common class called IRExecutionUnit. The IRExecutionUnit manages all allocations ever made for an expression and frees them when it goes away. It also contains the code generator and can vend the Module for an expression to other clases. The end goal here is to make the output of the expression parser re-usable; that is, to avoid re-parsing when re-parsing isn't necessary. I've also cleaned up some code and used weak pointers in more places. Please let me know if you see any leaks; I checked myself as well but I might have missed a case. llvm-svn: 177364
* <rdar://problem/13421412>Greg Clayton2013-03-141-4/+4
| | | | | | Many "byte size" members and variables were using a mixture of uint32_t and size_t. Switching over to using uint64_t everywhere. llvm-svn: 177091
* Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate to reflect theChandler Carruth2013-01-021-7/+7
| | | | | | | | | migration in r171366. I don't know anything about lldb, but a force run of the build bot indicated it would need this patch. I'll try to watch the build bot to get it green. llvm-svn: 171374
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-7/+7
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* Missing “if (log)” on a log printf.Jim Ingham2012-11-261-3/+4
| | | | llvm-svn: 168602
* Fixed a problem where we mistook normal resultSean Callanan2012-11-021-2/+2
| | | | | | | variables for guard variables because the current class or method named contained the letters "GV". llvm-svn: 167327
* Bunch of cleanups for warnings found by the llvm static analyzer.Jim Ingham2012-10-121-6/+12
| | | | llvm-svn: 165808
* Fixed the IR interaction layer to deal with aSean Callanan2012-10-111-12/+7
| | | | | | change in the LLDB target data API. llvm-svn: 165754
* Add in the first iteration of support for llvm/clang/lldb to allow variable ↵Micah Villmow2012-10-111-8/+14
| | | | | | per address space pointer sizes to be optimized correctly. llvm-svn: 165726
* Move TargetData to DataLayout.Micah Villmow2012-10-081-2/+2
| | | | llvm-svn: 165396
* Brought LLDB top-of-tree into sync with LLVM/ClangSean Callanan2012-09-241-2/+59
| | | | | | | | | | | | | 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
* Changed the IRForTarget pass to ensure that allSean Callanan2012-07-271-0/+5
| | | | | | | | | | | | | | sel_getName() calls are generated for all Objective-C selectors before static literals are moved to the static allocation. This prevents errors of the form Internal error [IRForTarget]: Couldn't change a static reference to an Objective-C selector to a dynamic reference <rdar://problem/11331906> llvm-svn: 160887
* Added a fix that allows newly-constructed objectsSean Callanan2012-07-211-0/+55
| | | | | | | | | | | | | | to returned by expressions, by removing the __cxa_atexit call that would normally cause these objects to be destroyed. This also prevents many errors of the form Couldn't rewrite one of the arguments of a function call error: Couldn't materialize struct: Structure hasn't been laid out yet <rdar://problem/11309402> llvm-svn: 160596
* <rdar://problem/10998370>Greg Clayton2012-07-181-9/+17
| | | | | | | | Improved the error message when we can find a function in the current program by printing the demangled name. Also added the ability to create lldb_private::Mangled instances with a ConstString when we already have a ConstString for a mangled or demangled name. Also added the ability to call SetValue with a ConstString and also without a boolean to indicate if the string is mangled where we will now auto-detect if the string is mangled. llvm-svn: 160450
* Fixed a potential crash if a metadata categorySean Callanan2012-07-041-1/+1
| | | | | | | | we write into doesn't already exist. <rdar://problem/11775508> llvm-svn: 159700
* Minor fixes for ARM/iOS targets:Sean Callanan2012-06-081-0/+14
| | | | | | | | | | - On iOS, we select the "apcs-gnu" ABI to match what libraries expect. - Literals are now allocated at their preferred alignment, eliminating many alignment crashes. llvm-svn: 158236
* Made the IR interpreter move all floats, not just "wide"Sean Callanan2012-04-261-1/+1
| | | | | | | | | | ones, to its own constant pool. This reflects the fact that the LLVM code generators for different targets move floats to their constant pools under varying conditions, and the JIT cannot (yet) be relied upon to relocate references to its constant pool correctly. llvm-svn: 155660
* Fixed a crasher that occurs when an expressionSean Callanan2012-04-241-1/+2
| | | | | | | | | | | doesn't return a result. If that expression can't be run in the current context (for example, if it uses a function and there is no running process) then we used to try to destroy the nonexistent result variable. We now only destroy the result variable if we actually made one. llvm-svn: 155455
* Brought LLVM/Clang up to top of tree. The onlySean Callanan2012-02-091-10/+16
| | | | | | | | change (besides logging) is that now string literals in the IR are ConstantDataArrays instead of ConstantArrays. llvm-svn: 150142
* I have brought LLDB up-to-date with top of treeSean Callanan2012-02-041-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LLVM/Clang. This brings in several fixes, including: - Improvements in the Just-In-Time compiler's allocation of memory: the JIT now allocates memory in chunks of sections, improving its ability to generate relocations. I have revamped the RecordingMemoryManager to reflect these changes, as well as to get the memory allocation and data copying out fo the ClangExpressionParser code. Jim Grosbach wrote the updates to the JIT on the LLVM side. - A new ExternalASTSource interface to allow LLDB to report accurate structure layout information to Clang. Previously we could only report the sizes of fields, not their offsets. This meant that if data structures included field alignment directives, we could not communicate the necessary alignment to Clang and accesses to the data would fail. Now we can (and I have update the relevant test case). Thanks to Doug Gregor for implementing the Clang side of this fix. - The way Objective-C interfaces are completed by Clang has been made consistent with RecordDecls; with help from Doug Gregor and Greg Clayton I have ensured that this still works. - I have eliminated all local LLVM and Clang patches, committing the ones that are still relevant to LLVM and Clang as needed. I have tested the changes extensively locally, but please let me know if they cause any trouble for you. llvm-svn: 149775
* Added a mechanism for the IR interpreter to returnSean Callanan2012-01-241-4/+3
| | | | | | | | | an error along with its boolean result. The expression parser reports this error if the interpreter fails and the expression could not be run in the target. llvm-svn: 148870
* Added checking to prevent a rare crash when gettingSean Callanan2011-12-221-5/+13
| | | | | | the name for an external variable in the IR. llvm-svn: 147178
* Made IRForTarget error out correctly when it can'tSean Callanan2011-12-211-1/+2
| | | | | | complete the result type, preventing crashes later. llvm-svn: 147107
* This commit is the result of a general audit ofSean Callanan2011-12-141-2/+2
| | | | | | | | | | | | | | the expression parser to locate instances where dyn_cast<>() and isa<>() are used on types, and replace them with getAs<>() as appropriate. The difference is that dyn_cast<>() and isa<>() are essentially LLVM/Clang's equivalent of RTTI -- that is, they try to downcast the object and return NULL if they cannot -- but getAs<>() can traverse typedefs to perform a semantic cast. llvm-svn: 146537
* Added the ability to dereference an Objective-C objectSean Callanan2011-12-081-6/+17
| | | | | | | | | | | | | pointer to make the result of an expression. LLDB now dumps the ivars of the Objective-C object and all of its parents. This just required fixing a bug where we didn't distinguish between Objective-C object pointers and regular C-style pointers. Also added a testcase to verify that this continues to work. llvm-svn: 146164
* Added the ability for clients to grab a set of symbol table indexes and thenGreg Clayton2011-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add them to a fast lookup map. lldb_private::Symtab now export the following public typedefs: namespace lldb_private { class Symtab { typedef std::vector<uint32_t> IndexCollection; typedef UniqueCStringMap<uint32_t> NameToIndexMap; }; } Clients can then find symbols by name and or type and end up with a Symtab::IndexCollection that is filled with indexes. These indexes can then be put into a name to index lookup map and control if the mangled and demangled names get added to the map: bool add_demangled = true; bool add_mangled = true; Symtab::NameToIndexMap name_to_index; symtab->AppendSymbolNamesToMap (indexes, add_demangled, add_mangled, name_to_index). This can be repeated as many times as needed to get a lookup table that you are happy with, and then this can be sorted: name_to_index.Sort(); Now name lookups can be done using a subset of the symbols you extracted from the symbol table. This is currently being used to extract objective C types from object files when there is no debug info in SymbolFileSymtab. Cleaned up how the objective C types were being vended to be more efficient and fixed some errors in the regular expression that was being used. llvm-svn: 145777
* Made symbol lookup in the expression parser moreSean Callanan2011-12-011-2/+2
| | | | | | | | | | | | | | robust: - Now a client can specify what kind of symbols are needed; notably, this allows looking up Objective-C class symbols specifically. - In the class of symbols being looked up, if one is non-NULL and others are NULL, LLDB now prefers the non-NULL one. llvm-svn: 145554
* Pulled in a new revision of LLVM/Clang and addedSean Callanan2011-11-191-3/+3
| | | | | | | | | | | | | 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-181-9/+25
| | | | | | | | | | | | | | | | | | | | | 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
* Two fixes for Objetive-C methods that return structSean Callanan2011-11-161-0/+6
| | | | | | | | | | 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
* 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
* 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
* Minor logging changes: added logging right beforeSean Callanan2011-11-011-2/+2
| | | | | | | the expression makes it to the JIT, and made some logging only appear in verbose mode. llvm-svn: 143467
* The IRDynamicChecks subsystem was not properlySean Callanan2011-10-311-0/+32
| | | | | | | | detecting Objective-C method calls because the "lldb.call.realName" metadata was no longer being correctly installed. I fixed this problem. llvm-svn: 143371
* Improved handling of static data in the expressionSean Callanan2011-10-251-31/+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
* 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 IR interpreter more robust in the presenceSean Callanan2011-10-211-4/+4
| | | | | | | | | 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
OpenPOWER on IntegriCloud