summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectExpression.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Bugfixes to the expression parser. Fixes include:Sean Callanan2010-09-131-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - If you put a semicolon at the end of an expression, this no longer causes the expression parser to error out. This was a two-part fix: first, ClangExpressionDeclMap::Materialize now handles an empty struct (such as when there is no return value); second, ASTResultSynthesizer walks backward from the end of the ASTs until it reaches something that's not a NullStmt. - ClangExpressionVariable now properly byte-swaps when printing itself. - ClangUtilityFunction now cleans up after itself when it's done compiling itself. - Utility functions can now use external functions just like user expressions. - If you end your expression with a statement that does not return a value, the expression now runs correctly anyway. Also, added the beginnings of an Objective-C object validator function, which is neither installed nor used as yet. llvm-svn: 113789
* Small help text fixes, to make it more consistent and accurate.Caroline Tice2010-09-071-9/+9
| | | | | | Temporarily remove -l option from 'expr' command (at Sean's request). llvm-svn: 113298
* Stream::Printf doesn't add a newline, so it needs to be added to all the ↵Jim Ingham2010-09-011-4/+4
| | | | | | error messages in CommandObjectExpression::EvaluateExpression. llvm-svn: 112731
* Added support for dynamic sanity checking inSean Callanan2010-09-011-0/+21
| | | | | | | | | | | | | | | | | | | expressions. Values used by the expression are checked by validation functions which cause the program to crash if the values are unsafe. Major changes: - Added IRDynamicChecks.[ch], which contains the core code related to this feature - Modified CommandObjectExpression to install the validator functions into the target process. - Added an accessor to Process that gets/sets the helper functions llvm-svn: 112690
* This is a major refactoring of the expression parser.Sean Callanan2010-08-271-179/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to separate the parser's data from the data belonging to the parser's clients. This allows clients to use the parser to obtain (for example) a JIT compiled function or some DWARF code, and then discard the parser state. Previously, parser state was held in ClangExpression and used liberally by ClangFunction, which inherited from ClangExpression. The main effects of this refactoring are: - reducing ClangExpression to an abstract class that declares methods that any client must expose to the expression parser, - moving the code specific to implementing the "expr" command from ClangExpression and CommandObjectExpression into ClangUserExpression, a new class, - moving the common parser interaction code from ClangExpression into ClangExpressionParser, a new class, and - making ClangFunction rely only on ClangExpressionParser and not depend on the internal implementation of ClangExpression. Side effects include: - the compiler interaction code has been factored out of ClangFunction and is now in an AST pass (ASTStructExtractor), - the header file for ClangFunction is now fully documented, - several bugs that only popped up when Clang was deallocated (which never happened, since the lifetime of the compiler was essentially infinite) are now fixed, and - the developer-only "call" command has been disabled. I have tested the expr command and the Objective-C step-into code, which use ClangUserExpression and ClangFunction, respectively, and verified that they work. Please let me know if you encounter bugs or poor documentation. llvm-svn: 112249
* First step of refactoring variable handling in theSean Callanan2010-08-201-1/+1
| | | | | | | | | | | | | | | expression parser. There shouldn't be four separate classes encapsulating a variable. ClangExpressionVariable is now meant to be the container for all variable information. It has several optional components that hold data for different subsystems. ClangPersistentVariable has been removed; we now use ClangExpressionVariable instead. llvm-svn: 111600
* Modified CommandObjectExpression::EvaluateExpression() so that it takes anJohnny Chen2010-08-131-14/+24
| | | | | | | | | additional (ComandReturnObject *) result parameter (default to NULL) and does the right thing in setting the result status. Also removed used variable ast_context. llvm-svn: 110992
* Documented ClangExpression and made parts of itSean Callanan2010-08-131-4/+4
| | | | | | | more sane (i.e., removed dead arguments, made sensible defaults, etc.) llvm-svn: 110990
* Added automatically generated result variables for eachSean Callanan2010-08-121-64/+17
| | | | | | | | | | | | | | | | | | | | expression. It is now possible to do things like this: (lldb) expr int $i = 5; $i + 1 $0 = (int) 6 (lldb) expr $i + 3 $1 = (int) 8 (lldb) expr $1 + $0 $2 = (int) 14 As a bonus, this allowed us to move printing of expression results into the ClangPersistentVariable class. This code needs a bit of refactoring -- in particular, ClangExpressionDeclMap has eaten one too many bacteria and needs to undergo mitosis -- but the infrastructure appears to be holding up nicely. llvm-svn: 110896
* Added support for persistent variables to theSean Callanan2010-08-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | expression parser. It is now possible to type: (lldb) expr int $i = 5; $i + 1 (int) 6 (lldb) expr $i + 2 (int) 7 The skeleton for automatic result variables is also implemented. The changes affect: - the process, which now contains a ClangPersistentVariables object that holds persistent variables associated with it - the expression parser, which now uses the persistent variables during variable lookup - TaggedASTType, where I loaded some commonly used tags into a header so that they are interchangeable between different clients of the class llvm-svn: 110777
* Removed the -i option from the expr command, andSean Callanan2010-08-061-139/+90
| | | | | | | | | | | | made IR-based expression evaluation the default. Also added a new class to hold persistent variables. The class is empty as yet while I write up a design document for what it will do. Also the place where it is currently created (by the Expression command) is certainly wrong. llvm-svn: 110415
* Fixed expression result printing to have the expression result type be in Greg Clayton2010-07-291-1/+1
| | | | | | | | | | | | | parens and to have a space before the value. Before: (lldb) expr 3 + 1 int4 (lldb) expr 3 + 1 (int) 4 llvm-svn: 109793
* Added logging:Sean Callanan2010-07-231-0/+11
| | | | | | | | | | - When we JIT an expression, we print the disassembly of the generated code - When we put the structure into the target, we print the individual entries in the structure byte for byte. llvm-svn: 109278
* Fix a typo.Stephen Wilson2010-07-231-1/+1
| | | | llvm-svn: 109271
* Added extensive logging of the code that is actually goingSean Callanan2010-07-231-1/+14
| | | | | | | | | | | | to be executed by the inferior. This required explicit support from RecordingMemoryManager for finding the address range belonging to a particular function. Also fixed a bug in DisassemblerLLVM where the disassembler assumed there was an AddressRange available even when it was NULL. llvm-svn: 109209
* Modified TaggedASTType to inherit from ClangASTTypeSean Callanan2010-07-231-88/+119
| | | | | | | | | | | | | and moved it to its own header file for cleanliness. Added more logging to ClangFunction so that we can diagnose crashes in the executing expression. Added code to extract the result of the expression from the struct that is passed to the JIT-compiled code. llvm-svn: 109199
* Change over to using the definitions for mach-o types and defines to theGreg Clayton2010-07-211-18/+24
| | | | | | | | | | | defines that are in "llvm/Support/MachO.h". This should allow ObjectFileMachO and ObjectContainerUniversalMachO to be able to be cross compiled in Linux. Also did some cleanup on the ASTType by renaming it to ClangASTType and renaming the header file. Moved a lot of "AST * + opaque clang type *" functionality from lldb_private::Type over into ClangASTType. llvm-svn: 109046
* Added functionality to dematerialize values that wereSean Callanan2010-07-201-3/+2
| | | | | | | | | | | | | | used by the JIT compiled expression, including the result of the expression. Also added a new class, ASTType, which encapsulates an opaque Clang type and its associated AST context. Refactored ClangExpressionDeclMap to use ASTTypes, significantly reducing the possibility of mixups of types from different AST contexts. llvm-svn: 108965
* Wrote the code that looks at a context to seeSean Callanan2010-07-161-1/+15
| | | | | | | if the variables in that context allow a particular JIT compiled expression to run in that context. llvm-svn: 108485
* Fixes to the IR generator in the expression parserSean Callanan2010-07-141-107/+143
| | | | | | | | to correctly unfold constant-folded global variables. Also added code to JIT the expression. Simple expressions are now JIT compiled successfully. llvm-svn: 108380
* Added the skeleton of an IR transformer that willSean Callanan2010-07-031-1/+19
| | | | | | | | | | prepare IR for execution in the target. Wired the expression command to use this IR transformer when conversion to DWARF fails, and wired conversion to DWARF to always fail (well, we don't generate any DWARF...) llvm-svn: 107559
* Added a SemaConsumer that transforms the ASTs forSean Callanan2010-07-011-1/+1
| | | | | | | | | an expression, adding code to put the value of the last expression (if there is one) into a variable and write the address of that variable to a global pointer. llvm-svn: 107419
* Added function name types to allow us to set breakpoints by name moreGreg Clayton2010-06-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | intelligently. The four name types we currently have are: eFunctionNameTypeFull = (1 << 1), // The function name. // For C this is the same as just the name of the function // For C++ this is the demangled version of the mangled name. // For ObjC this is the full function signature with the + or // - and the square brackets and the class and selector eFunctionNameTypeBase = (1 << 2), // The function name only, no namespaces or arguments and no class // methods or selectors will be searched. eFunctionNameTypeMethod = (1 << 3), // Find function by method name (C++) with no namespace or arguments eFunctionNameTypeSelector = (1 << 4) // Find function by selector name (ObjC) names this allows much more flexibility when setting breakoints: (lldb) breakpoint set --name main --basename (lldb) breakpoint set --name main --fullname (lldb) breakpoint set --name main --method (lldb) breakpoint set --name main --selector The default: (lldb) breakpoint set --name main will inspect the name "main" and look for any parens, or if the name starts with "-[" or "+[" and if any are found then a full name search will happen. Else a basename search will be the default. Fixed some command option structures so not all options are required when they shouldn't be. Cleaned up the breakpoint output summary. Made the "image lookup --address <addr>" output much more verbose so it shows all the important symbol context results. Added a GetDescription method to many of the SymbolContext objects for the more verbose output. llvm-svn: 107075
* Extensive code cleanup of the expression command.Sean Callanan2010-06-241-266/+159
| | | | | | | | | | | - Rationalized EvaluateExpression to remove a lot of nesting; also added comments to make it easy to find what's happening where - Made ExecuteRawCommandString subcontract out to EvaluateExpression - Minor logging improvements llvm-svn: 106703
* Added the temporary -i option to expr, whichSean Callanan2010-06-231-8/+31
| | | | | | | | switches the expression parsing over to use the LLVM IR as opposed to Clang ASTs. Right now, that functionality only logs. llvm-svn: 106695
* Very large changes that were needed in order to allow multiple connectionsGreg Clayton2010-06-231-22/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to the debugger from GUI windows. Previously there was one global debugger instance that could be accessed that had its own command interpreter and current state (current target/process/thread/frame). When a GUI debugger was attached, if it opened more than one window that each had a console window, there were issues where the last one to setup the global debugger object won and got control of the debugger. To avoid this we now create instances of the lldb_private::Debugger that each has its own state: - target list for targets the debugger instance owns - current process/thread/frame - its own command interpreter - its own input, output and error file handles to avoid conflicts - its own input reader stack So now clients should call: SBDebugger::Initialize(); // (static function) SBDebugger debugger (SBDebugger::Create()); // Use which ever file handles you wish debugger.SetErrorFileHandle (stderr, false); debugger.SetOutputFileHandle (stdout, false); debugger.SetInputFileHandle (stdin, true); // main loop SBDebugger::Terminate(); // (static function) SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to ensure nothing gets destroyed too early when multiple clients might be attached. Cleaned up the command interpreter and the CommandObject and all subclasses to take more appropriate arguments. llvm-svn: 106615
* Move Args.{cpp,h} and Options.{cpp,h} to Interpreter where they really belong.Jim Ingham2010-06-151-1/+1
| | | | llvm-svn: 106034
* Change the Options parser over to use a mask rather than an ordinal for ↵Jim Ingham2010-06-151-3/+3
| | | | | | | | | option sets. Fixed the Disassemble arguments so you can't specify start address or name in multiple ways. Fixed the command line input so you can specify the filename without "-f" even if you use other options. llvm-svn: 106020
* Initial checkin of lldb code from internal Apple repo.Chris Lattner2010-06-081-0/+554
llvm-svn: 105619
OpenPOWER on IntegriCloud