summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Very large changes that were needed in order to allow multiple connectionsGreg Clayton2010-06-231-67/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove an include of the deleted CommandObjectStatus.h.Jim Ingham2010-06-181-1/+0
| | | | llvm-svn: 106297
* Move the "status" command to "process status" since that's where it belongs. ↵Jim Ingham2010-06-181-1/+0
| | | | | | | | Also make it print "running" if invoked when the current process is running. llvm-svn: 106265
* Move Args.{cpp,h} and Options.{cpp,h} to Interpreter where they really belong.Jim Ingham2010-06-151-1/+1
| | | | llvm-svn: 106034
* Fix include paths; please check that this works on Mac.Eli Friedman2010-06-131-34/+34
| | | | llvm-svn: 105906
* Fix include path.Eli Friedman2010-06-091-1/+1
| | | | llvm-svn: 105757
* Initial checkin of lldb code from internal Apple repo.Chris Lattner2010-06-081-0/+1300
llvm-svn: 105619
OpenPOWER on IntegriCloud