summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't limit StreamTee to just two streams. It now can containGreg Clayton2011-02-201-25/+24
| | | | | | | | | | | | | | | | | | | | | | | | | N streams by making the stream a vector of stream shared pointers that is protected by a mutex. Streams can be get/set by index which allows indexes to be defined as stream indentifiers. If a stream is set at index 3 and there are now streams in the collection, then empty stream objects are inserted to ensure that stream at index 3 has a valid stream. There is also an append method that allows a stream to be pushed onto the stack. This will allow our streams to be very flexible in where the output goes. Modified the CommandReturnObject to use the new StreamTee functionality. This class now defines two StreamTee indexes: 0 for the stream string stream, and 1 for the immediate stream. This is used both on the output and error streams. Added the ability to get argument types as strings or as descriptions. This is exported through the SBCommandInterpreter API to allow external access. Modified the Driver class to use the newly exported argument names from SBCommandInterpreter::GetArgumentTypeAsCString(). llvm-svn: 126067
* - Changed all the places where CommandObjectReturn was exporting a ↵Jim Ingham2011-02-191-2/+4
| | | | | | | | | | | | | | | | StreamString to just exporting a Stream, and then added GetOutputData & GetErrorData to get the accumulated data. - Added a StreamTee that will tee output to two provided lldb::StreamSP's. - Made the CommandObjectReturn use this so you can Tee the results immediately to the debuggers output file, as well as saving up the results to return when the command is done executing. - HandleCommands now uses this so that if you have a set of commands that continue the target you will see the commands come out as they are processed. - The Driver now uses this to output the command results as you go, which makes the interface more reactive seeming. llvm-svn: 126015
* Added new target instance settings for execution settings:Greg Clayton2011-02-181-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Targets can now specify some additional parameters for when we debug executables that can help with plug-in selection: target.execution-level = auto | user | kernel target.execution-mode = auto | dynamic | static target.execution-os-type = auto | none | halted | live On some systems, the binaries that are created are the same wether you use them to debug a kernel, or a user space program. Many times inspecting an object file can reveal what an executable should be. For these cases we can now be a little more complete by specifying wether to detect all of these things automatically (inspect the main executable file and select a plug-in accordingly), or manually to force the selection of certain plug-ins. To do this we now allow the specficifation of wether one is debugging a user space program (target.execution-level = user) or a kernel program (target.execution-level = kernel). We can also specify if we want to debug a program where shared libraries are dynamically loaded using a DynamicLoader plug-in (target.execution-mode = dynamic), or wether we will treat all symbol files as already linked at the correct address (target.execution-mode = static). We can also specify if the inferior we are debugging is being debugged on a bare board (target.execution-os-type = none), or debugging an OS where we have a JTAG or other direct connection to the inferior stops the entire OS (target.execution-os-type = halted), or if we are debugging a program on something that has live debug services (target.execution-os-type = live). For the "target.execution-os-type = halted" mode, we will need to create ProcessHelper plug-ins that allow us to extract the process/thread and other OS information by reading/writing memory. This should allow LLDB to be used for a wide variety of debugging tasks and handle them all correctly. llvm-svn: 125815
* Factor all the code that does "Execute a list of lldb command interpreter ↵Jim Ingham2011-02-181-21/+189
| | | | | | commands" into a single function in the Interpreter, and then use that in all the places that used to do this by hand. llvm-svn: 125807
* Use Host::File in lldb_private::StreamFile and other places to cleanup hostGreg Clayton2011-02-091-16/+18
| | | | | | layer a bit more. llvm-svn: 125149
* Make sure the confirmation input reader calls fflush after writing its output.Caroline Tice2011-02-021-0/+7
| | | | | | (<rdar://problem/8946573>) llvm-svn: 124711
* Endian patch from Kirk Beitz that allows better cross platform building.Greg Clayton2011-02-011-0/+1
| | | | llvm-svn: 124643
* A few of the issue I have been trying to track down and fix have been due toGreg Clayton2011-01-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the way LLDB lazily gets complete definitions for types within the debug info. When we run across a class/struct/union definition in the DWARF, we will only parse the full definition if we need to. This works fine for top level types that are assigned directly to variables and arguments, but when we have a variable with a class, lets say "A" for this example, that has a member: "B *m_b". Initially we don't need to hunt down a definition for this class unless we are ever asked to do something with it ("expr m_b->getDecl()" for example). With my previous approach to lazy type completion, we would be able to take a "A *a" and get a complete type for it, but we wouldn't be able to then do an "a->m_b->getDecl()" unless we always expanded all types within a class prior to handing out the type. Expanding everything is very costly and it would be great if there were a better way. A few months ago I worked with the llvm/clang folks to have the ExternalASTSource class be able to complete classes if there weren't completed yet: class ExternalASTSource { .... virtual void CompleteType (clang::TagDecl *Tag); virtual void CompleteType (clang::ObjCInterfaceDecl *Class); }; This was great, because we can now have the class that is producing the AST (SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources and the object that creates the forward declaration types can now also complete them anywhere within the clang type system. This patch makes a few major changes: - lldb_private::Module classes now own the AST context. Previously the TypeList objects did. - The DWARF parsers now sign up as an external AST sources so they can complete types. - All of the pure clang type system wrapper code we have in LLDB (ClangASTContext, ClangASTType, and more) can now be iterating through children of any type, and if a class/union/struct type (clang::RecordType or ObjC interface) is found that is incomplete, we can ask the AST to get the definition. - The SymbolFileDWARFDebugMap class now will create and use a single AST that all child SymbolFileDWARF classes will share (much like what happens when we have a complete linked DWARF for an executable). We will need to modify some of the ClangUserExpression code to take more advantage of this completion ability in the near future. Meanwhile we should be better off now that we can be accessing any children of variables through pointers and always be able to resolve the clang type if needed. llvm-svn: 123613
* Split up the Python script interpreter code to allow multiple script ↵Caroline Tice2011-01-141-8/+19
| | | | | | | | | | | interpreter objects to exist within the same process (one script interpreter object per debugger object). The python script interpreter objects are all using the same global Python script interpreter; they use separate dictionaries to keep their data separate, and mutex's to prevent any object attempting to use the global Python interpreter when another object is already using it. llvm-svn: 123415
* Spelling changes applied from lldb_spelling.diffs from Bruce Mitchener.Greg Clayton2011-01-081-1/+1
| | | | | | Thanks Bruce! llvm-svn: 123083
* Add a simple command: 'version' to the command interpreter, and an accompanyingJohnny Chen2010-12-231-0/+2
| | | | | | test case test_help_version(). llvm-svn: 122515
* Fix the completion of "fr " and the like.Jim Ingham2010-12-141-0/+17
| | | | llvm-svn: 121785
* Fix small bugs:Caroline Tice2010-12-141-2/+42
| | | | | | | | | | | - Make sure cmd_obj & cmd_obj_sp contain a valid objects before attempting to dereference, in CommandObjectCommandsAlias::Execute and CommandInterpreter::HandleCommand. - Modify CommandInterpreter::GetCommandSPExact to properly handle multi-word command inputs. llvm-svn: 121779
* Fix bug where using incomplete strings for command names causesCaroline Tice2010-12-111-1/+10
| | | | | | | lldb to crash (because of attempt to look for full names when full names were not used). llvm-svn: 121607
* Modify HandleCommand to not do any argument processing until it has ↵Caroline Tice2010-12-091-155/+323
| | | | | | | | | | | | | | | | determined whether or not the command should take raw input, then handle & dispatch the arguments appropriately. Also change the 'alias' command to be a command that takes raw input. This is necessary to allow aliases to be created for other commands that take raw input and might want to include raw input in the alias itself. Fix a bug in the aliasing mechanism when creating aliases for commands with 3-or-more words. Raw input should now be properly handled by all the command and alias mechanisms. llvm-svn: 121423
* - Fix alias-building & resolving to properly handle optional arguments for ↵Caroline Tice2010-12-071-17/+124
| | | | | | | | | | | | | | | | | | command options. - Add logging for command resolution ('log enable lldb commands') - Fix alias resolution to properly handle commands that take raw input (resolve the alias, but don't muck up the raw arguments). Net result: Among other things, 'expr' command can now take strings with escaped characters and not have the command handling & alias resolution code muck up the escaped characters. E.g. 'expr printf ("\n\n\tHello there!")' should now work properly. Not working yet: Creating aliases with raw input for commands that take raw input. Working on that. e.g. 'command alias print_hi expr printf ("\n\tHi!")' does not work yet. llvm-svn: 121171
* Add the ability to catch and do the right thing with Interrupts (often ↵Caroline Tice2010-11-191-0/+6
| | | | | | | | control-c) and end-of-file (often control-d). llvm-svn: 119837
* Modified lldb_private::SymboleFile to be able to override where its TypeListGreg Clayton2010-11-101-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | comes from by using a virtual function to provide it from the Module's SymbolVendor by default. This allows the DWARF parser, when being used to parse DWARF in .o files with a parent DWARF + debug map parser, to get its type list from the DWARF + debug map parser so when we go and find full definitions for types (that might come from other .o files), we can use the type list from the debug map parser. Otherwise we ended up mixing clang types from one .o file (say a const pointer to a forward declaration "class A") with the a full type from another .o file. This causes expression parsing, when copying the clang types from those parsed by the DWARF parser into the expression AST, to fail -- for good reason. Now all types are created in the same list. Also added host support for crash description strings that can be set before doing a piece of work. On MacOSX, this ties in with CrashReporter support that allows a string to be dispalyed when the app crashes and allows LLDB.framework to print a description string in the crash log. Right now this is hookup up the the CommandInterpreter::HandleCommand() where each command notes that it is about to be executed, so if we crash while trying to do this command, we should be able to see the command that caused LLDB to exit. For all other platforms, this is a nop. llvm-svn: 118672
* Added a top level Timer to the interpreter execute command. Also added an ↵Jim Ingham2010-11-041-0/+2
| | | | | | | | | | option to pass the depth to "log timer enable". That allows you to time just command execution with: log timer enable 1 <command> log timer dump llvm-svn: 118267
* Cleaned up the API logging a lot more to reduce redundant information and Greg Clayton2010-10-311-2/+5
| | | | | | | | | keep the file size a bit smaller. Exposed SBValue::GetExpressionPath() so SBValue users can get an expression path for their values. llvm-svn: 117851
* Changed "run" to alias "process launch --".Jim Ingham2010-10-221-4/+7
| | | | | | Added "po" alias for "expression -o --" llvm-svn: 117125
* Fixed an issue where we were resolving paths when we should have been.Greg Clayton2010-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So the issue here was that we have lldb_private::FileSpec that by default was always resolving a path when using the: FileSpec::FileSpec (const char *path); and in the: void FileSpec::SetFile(const char *pathname, bool resolve = true); This isn't what we want in many many cases. One example is you have "/tmp" on your file system which is really "/private/tmp". You compile code in that directory and end up with debug info that mentions "/tmp/file.c". Then you type: (lldb) breakpoint set --file file.c --line 5 If your current working directory is "/tmp", then "file.c" would be turned into "/private/tmp/file.c" which won't match anything in the debug info. Also, it should have been just a FileSpec with no directory and a filename of "file.c" which could (and should) potentially match any instances of "file.c" in the debug info. So I removed the constructor that just takes a path: FileSpec::FileSpec (const char *path); // REMOVED You must now use the other constructor that has a "bool resolve" parameter that you must always supply: FileSpec::FileSpec (const char *path, bool resolve); I also removed the default parameter to SetFile(): void FileSpec::SetFile(const char *pathname, bool resolve); And fixed all of the code to use the right settings. llvm-svn: 116944
* Fix small mistake in previous commit (fixing aliases for commands thatCaroline Tice2010-10-181-1/+1
| | | | | | take raw input). llvm-svn: 116760
* Fix bug where aliases for commands that take raw input were notCaroline Tice2010-10-181-0/+11
| | | | | | executing properly. llvm-svn: 116735
* Add an initial version of test that exercise the lldb commands: 'process signal'Johnny Chen2010-10-141-6/+1
| | | | | | | | | | | | and 'process handle'. The test suite would like to control the asynch/sync execution of the interpreter during the middle of the test method, so the CommandInterpreter::SetSynchronous(bool value) is modified to allow the mode to be changed more than once. In practice, it would be advisable to control the process and to set the async/sync mode from a single thread, too. llvm-svn: 116467
* Fix some memory leaks.Caroline Tice2010-10-121-12/+9
| | | | | | | Add call to lldb.SBDebugger.Initialize() to lldb.py, so it automatically gets called when the lldb Python module gets loaded. llvm-svn: 116345
* Added a "--no-lldbinit" option (-n for short (which magically matchesGreg Clayton2010-10-111-1/+6
| | | | | | | what gdb uses)) so we can tell our "lldb" driver program to not automatically parse any .lldbinit files. llvm-svn: 116179
* Add an "auto-confirm" setting to the debugger so you can turn off the ↵Jim Ingham2010-10-041-1/+4
| | | | | | confirmations if you want to. llvm-svn: 115572
* Modify existing commands with arguments to use the new argument mechanismCaroline Tice2010-10-041-1/+1
| | | | | | (for standardized argument names, argument help, etc.) llvm-svn: 115570
* Add a "Confirm" function to the CommandInterpreter so you can confirm ↵Jim Ingham2010-10-041-0/+93
| | | | | | potentially dangerous operations in a generic way. llvm-svn: 115546
* Add UserSettings to Target class, making Target settingsCaroline Tice2010-09-201-20/+3
| | | | | | | | | | | | | | | | | | the parent of Process settings; add 'default-arch' as a class-wide setting for Target. Replace lldb::GetDefaultArchitecture with Target::GetDefaultArchitecture & Target::SetDefaultArchitecture. Add 'use-external-editor' as user setting to Debugger class & update code appropriately. Add Error parameter to methods that get user settings, for easier reporting of bad requests. Fix various other minor related bugs. Fix test cases to work with new changes. llvm-svn: 114352
* Fixed the way set/show variables were being accessed to being natively Greg Clayton2010-09-181-25/+18
| | | | | | | | | | | | | | | | | | accessed by the objects that own the settings. The previous approach wasn't very usable and made for a lot of unnecessary code just to access variables that were already owned by the objects. While I fixed those things, I saw that CommandObject objects should really have a reference to their command interpreter so they can access the terminal with if they want to output usaage. Fixed up all CommandObjects to take an interpreter and cleaned up the API to not need the interpreter to be passed in. Fixed the disassemble command to output the usage if no options are passed down and arguments are passed (all disassebmle variants take options, there are no "args only"). llvm-svn: 114252
* Added default more aliases to ease gdb converts:Greg Clayton2010-09-161-1/+3
| | | | | | | | "b" is now aliased to "regexp-break" "p" is now aliased to "frame variable" "print" is now aliased to "frame variable" llvm-svn: 114092
* Clean up help text.Caroline Tice2010-09-131-1/+1
| | | | llvm-svn: 113738
* Make all debugger-level user settable variables into instance variables.Caroline Tice2010-09-091-7/+12
| | | | | | | Make get/set variable at the debugger level always set the particular debugger's instance variables rather than the default variables. llvm-svn: 113474
* Small help text fixes, to make it more consistent and accurate.Caroline Tice2010-09-071-1/+1
| | | | | | Temporarily remove -l option from 'expr' command (at Sean's request). llvm-svn: 113298
* This is a very large commit that completely re-does the way lldbCaroline Tice2010-09-041-194/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | handles user settable internal variables (the equivalent of set/show variables in gdb). In addition to the basic infrastructure (most of which is defined in UserSettingsController.{h,cpp}, there are examples of two classes that have been set up to contain user settable variables (the Debugger and Process classes). The 'settings' command has been modified to be a command-subcommand structure, and the 'set', 'show' and 'append' commands have been moved into this sub-commabnd structure. The old StateVariable class has been completely replaced by this, and the state variable dictionary has been removed from the Command Interpreter. Places that formerly accessed the state variable mechanism have been modified to access the variables in this new structure instead (checking the term-width; getting/checking the prompt; etc.) Variables are attached to classes; there are two basic "flavors" of variables that can be set: "global" variables (static/class-wide), and "instance" variables (one per instance of the class). The whole thing has been set up so that any global or instance variable can be set at any time (e.g. on start up, in your .lldbinit file), whether or not any instances actually exist (there's a whole pending and default values mechanism to help deal with that). llvm-svn: 113041
* Delete the vestigal "select", "info" and "delete" commands.Jim Ingham2010-09-031-7/+0
| | | | | | Also move "Carbon.framework" to the right place. llvm-svn: 112993
* Move "variable list" to "frame variable"Jim Ingham2010-09-021-2/+0
| | | | llvm-svn: 112782
* Added the ability to disable ASLR (Address Space Layout Randomization). ASLRGreg Clayton2010-08-311-0/+13
| | | | | | | | is disabled by default, and can be enabled using: (lldb) set disable-aslr 0 llvm-svn: 112616
* This is a major refactoring of the expression parser.Sean Callanan2010-08-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Changed the StackID to store its start PC address as a load address instead of Greg Clayton2010-08-261-19/+13
| | | | | | | | a section offset address. Fixed up some very inefficient STL code. llvm-svn: 112230
* Updated help text to refer to "commands alias"Sean Callanan2010-08-091-1/+1
| | | | | | | instead of "alias." Also fixed a bunch of indentation in the help for "commands alias." llvm-svn: 110585
* The unix "source" command maps to "command source" in lldb. :-)Johnny Chen2010-07-281-1/+1
| | | | llvm-svn: 109673
* Remove includes for removed files...Jim Ingham2010-07-071-2/+0
| | | | llvm-svn: 107753
* Fix GetRepeatCommand so it works with multi-word commands.Jim Ingham2010-07-071-27/+25
| | | | | | | | Move the "source", "alias", and "unalias" commands to "commands *". Move "source-file" to "source list". Added a "source info" command but it isn't implemented yet. llvm-svn: 107751
* Added a "GetRepeatCommand" to the command object. The Interpreter uses thisJim Ingham2010-07-061-4/+19
| | | | | | | | instead of the last history item to provide a command for the "empty" command. Use this in the source-file command to make <RETURN> continue the listing rather than relist the first listing... llvm-svn: 107736
* Hide the logic for command resolution for commands, aliases & user commands ↵Jim Ingham2010-07-061-47/+74
| | | | | | | | | | | | behind a single interface so everybody does it the same way. Add an "exact" lookup for internal uses. Fix up a few little cases where we weren't reporting command lookup errors correctly. Added "b" as an alias for "breakpoint" so it doesn't collide with "bt". llvm-svn: 107718
* Add a source file completer to the CommandCompleters.Jim Ingham2010-06-301-3/+13
| | | | | | | | Add a way for the completers to say whether the completed argument should have a space inserted after is or not. Added the file name completer to the "file" command. llvm-svn: 107247
* Fix a bug in handling command resolution for non-exact matches. Now we will ↵Jim Ingham2010-06-241-4/+4
| | | | | | correctly give help options when there are both aliases & real commands matching the current input string. llvm-svn: 106782
OpenPOWER on IntegriCloud