summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Added an "attach" alias as promised on the web page.Sean Callanan2012-05-041-0/+6
| | | | llvm-svn: 156223
* Report the command error when we are in "stop on error mode."Jim Ingham2012-04-241-4/+7
| | | | llvm-svn: 155422
* Added a "add-dsym" alias to "target symbols add" to keep gdb converts happy.Greg Clayton2012-03-291-0/+6
| | | | llvm-svn: 153695
* <rdar://problem/10605072>Greg Clayton2012-02-291-2/+23
| | | | | | | | | | | | | Added the ability to override command line commands. In some cases GUI interfaces might want to intercept commands like "quit" or "process launch" (which might cause the process to re-run). They can now do so by overriding/intercepting commands by using functions added to SBCommandInterpreter using a callback function. If the callback function returns true, the command is assumed to be handled. If false is returned the command should be evaluated normally. Adopted this up in the Driver.cpp for intercepting the "quit" command. llvm-svn: 151708
* Add a general mechanism to wait on the debugger for Broadcasters of a given ↵Jim Ingham2012-02-161-1/+10
| | | | | | | | | class/event bit set. Use this to allow the lldb Driver to emit notifications for breakpoint modifications. <rdar://problem/10619974> llvm-svn: 150665
* Switching back to using std::tr1::shared_ptr. We originally switched awayGreg Clayton2012-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | due to RTTI worries since llvm and clang don't use RTTI, but I was able to switch back with no issues as far as I can tell. Once the RTTI issue wasn't an issue, we were looking for a way to properly track weak pointers to objects to solve some of the threading issues we have been running into which naturally led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared pointer from just a pointer, which is also easily solved using the std::tr1::enable_shared_from_this class. The main reason for this move back is so we can start properly having weak references to objects. Currently a lldb_private::Thread class has a refrence to its parent lldb_private::Process. This doesn't work well when we now hand out a SBThread object that contains a shared pointer to a lldb_private::Thread as this SBThread can be held onto by external clients and if they end up using one of these objects we can easily crash. So the next task is to start adopting std::tr1::weak_ptr where ever it makes sense which we can do with lldb_private::Debugger, lldb_private::Target, lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and many more objects now that they are no longer using intrusive ref counted pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive pointers). llvm-svn: 149207
* The "desired result type" code in the expressionSean Callanan2011-12-211-1/+4
| | | | | | | | | | | | | | | | | | | | | | parser has hitherto been an implementation waiting for a use. I have now tied the '-o' option for the expression command -- which indicates that the result is an Objective-C object and needs to be printed -- to the ExpressionParser, which communicates the desired type to Clang. Now, if the result of an expression is determined by an Objective-C method call for which there is no type information, that result is implicitly cast to id if and only if the -o option is passed to the expression command. (Otherwise if there is no explicit cast Clang will issue an error. This behavior is identical to what happened before r146756.) Also added a testcase for -o enabled and disabled. llvm-svn: 147099
* "f" should be an alias for "frame select" not "finish" to match the gdb usage.Jim Ingham2011-12-021-1/+6
| | | | llvm-svn: 145660
* (no commit message)Jim Ingham2011-11-171-1/+1
| | | | llvm-svn: 144874
* Confirm should accept both "Y" and "y" in case somebody confuses the ↵Jim Ingham2011-11-141-3/+3
| | | | | | | | "default answer" indicator for a directive to enter a capital letter. llvm-svn: 144562
* Removed debug printf statements.Greg Clayton2011-11-101-3/+0
| | | | llvm-svn: 144257
* <rdar://problem/10374840>Greg Clayton2011-11-091-3/+49
| | | | | | | Fixed an issue with the gdb format stuff for any aliases that expand to contain a "--". llvm-svn: 144240
* this patch addresses several issues with "command script" subcommands:Enrico Granata2011-11-071-9/+13
| | | | | | | | | | | | a) adds a new --synchronicity (-s) setting for "command script add" that allows the user to decide if scripted commands should run synchronously or asynchronously (which can make a difference in how events are handled) b) clears up several error messages c) adds a new --allow-reload (-r) setting for "command script import" that allows the user to reload a module even if it has already been imported before d) allows filename completion for "command script import" (much like what happens for "target create") e) prevents "command script add" from replacing built-in commands with scripted commands f) changes AddUserCommand() to take an std::string instead of a const char* (for performance reasons) plus, it fixes an issue in "type summary add" command handling which caused several test suite errors llvm-svn: 144035
* Fixed the Xcode project building of LLVM to be a bit more user friendly:Greg Clayton2011-11-041-3/+7
| | | | | | | | | | | | | | | | | | | - If you download and build the sources in the Xcode project, x86_64 builds by default using the "llvm.zip" checkpointed LLVM. - If you delete the "lldb/llvm.zip" and the "lldb/llvm" folder, and build the Xcode project will download the right LLVM sources and build them from scratch - If you have a "lldb/llvm" folder already that contains a "lldb/llvm/lib" directory, we will use the sources you have placed in the LLDB directory. Python can now be disabled for platforms that don't support it. Changed the way the libllvmclang.a files get used. They now all get built into arch specific directories and never get merged into universal binaries as this was causing issues where you would have to go and delete the file if you wanted to build an extra architecture slice. llvm-svn: 143678
* Revert 143359 and modify the test case to not include non-valid c identifier ↵Johnny Chen2011-10-311-0/+7
| | | | | | character. llvm-svn: 143372
* Fix the r143266 check-in which broke TestCommandRegex.py.Johnny Chen2011-10-311-7/+0
| | | | llvm-svn: 143359
* Fixed the "expression" command when it comes to using it with the new GDB formatGreg Clayton2011-10-291-1/+23
| | | | | | | | | | | | | | | | | | command suffix: (lldb) expression/x 3+3 Since "expression" is a raw command that has options, we need to make sure the command gets its options properly terminated with a "--". Also fixed an issue where if you try to use the GDB command suffix on a command that doesn't support the "--gdb-format" command, it will report an appropriate error. For the fix above, you can query an lldb_private::Options object to see if it supports a long option by name. llvm-svn: 143266
* Get a dummy target to allow for calculator mode while processing backticks.Johnny Chen2011-10-291-0/+4
| | | | | | | | | | | | | | This also helps break the infinite loop caused when target is null. So that we can have: $ /Volumes/data/lldb/svn/trunk/build/Debug/lldb (lldb) itob `0x123 - 0x321` 32 v 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0] (lldb) llvm-svn: 143260
* Added the ability to have GDB formats appended to any command so you can doGreg Clayton2011-10-281-60/+111
| | | | | | | | | | | | | | | | | things like: (lldb) x/32xb 0x1000 "x" is an alias to "memory read", so this will actually turn into: (lldb) memory read --gdb-format=32xb 0x1000 This applies to all commands, so the GDB formats will work with "register read", "frame variable", "target variable" and others. All commands that can accept formats, counts and sizes have been modified to support the "--gdb-format" option. llvm-svn: 143230
* Prefix display/undisplay regexp command alises with "_regexp" as per theJason Molenda2011-10-251-6/+6
| | | | | | style of the other regexp command aliases. llvm-svn: 142902
* Simplified the CommandInterpreter::StripFirstWord logic by making it a staticGreg Clayton2011-10-251-55/+52
| | | | | | | | function and having it not require both a bool and a quote char to fill in. We intend to get rid of this functionality when we rewrite the command interpreter for streams eventually, but not for now. llvm-svn: 142888
* Add "di" and "dis" aliases to "disassemble" so they will win over "display".Jim Ingham2011-10-241-0/+10
| | | | llvm-svn: 142834
* Add "display" and "undisplay" aliases for target stop-hook add/delete.Jason Molenda2011-10-221-1/+37
| | | | | | | | A patina of gdb's "display" command, intended mostly for simply monitoring a variable as you step through source code. Formatters do not work, e.g. display/x $pc does not work. llvm-svn: 142710
* Add "stepi" as an alias for thread step-inst in addition to "si".Jason Molenda2011-10-221-0/+10
| | | | | | Add "nexti" an "ni" as aliases for thread step-inst-over. llvm-svn: 142707
* Added the ability to run expressions in any command. Expressions can be Greg Clayton2011-10-141-0/+121
| | | | | | | | | | | | | | | | | inserted in commands by using backticks: (lldb) memory read `$rsp-16` `$rsp+16` (lldb) memory read -c `(int)strlen(argv[0])` `argv[0]` The result of the expression will be inserted into the command as a sort of preprocess stage where this gets done first. We might need to tweak where this preprocess stage goes, but it is very functional already. Added ansi color support to the Debugger::FormatPrompt() so you can use things like "${ansi.fg.blue}" and "${ansi.bold}" many more. This helps in adding colors to your prompts without needing to know the ANSI color code strings. llvm-svn: 141948
* Fix a problem where the stop-hook command 'frame variable g_val' produces ↵Johnny Chen2011-10-051-3/+10
| | | | | | | | | | | | | | nothing when newly created threads were subsequently stopped due to breakpoint hit. The stop-hook mechanism delegates to CommandInterpreter::HandleCommands() to execuet the commands. Make sure the execution context is switched only once at the beginning of HandleCommands() only and don't update the context while looping on each individual command to be executed. rdar://problem/10228156 llvm-svn: 141144
* Add initial implementation of watchpoint commands for list, enable, disable, ↵Johnny Chen2011-09-221-0/+2
| | | | | | | | and delete. Test cases to be added later. llvm-svn: 140322
* Converted the lldb_private::Process over to use the intrusiveGreg Clayton2011-09-221-16/+21
| | | | | | | | | | | | | | | | | | | | shared pointers. Changed the ExecutionContext over to use shared pointers for the target, process, thread and frame since these objects can easily go away at any time and any object that was holding onto an ExecutionContext was running the risk of using a bad object. Now that the shared pointers for target, process, thread and frame are just a single pointer (they all use the instrusive shared pointers) the execution context is much safer and still the same size. Made the shared pointers in the the ExecutionContext class protected and made accessors for all of the various ways to get at the pointers, references, and shared pointers. llvm-svn: 140298
* Don't skip the application specific ~/.lldbinit file when the programGreg Clayton2011-09-111-27/+34
| | | | | | | | | | | | | | | | | | | name is "lldb". So currently when you startup any application and you have not specified that you would like to skip loading init files through the API or from "lldb" options, then LLDB will try and load: "~/.lldbinit-%s" where %s the basename of your program "~/.lldbinit" Then LLDB will load any program specified on the command line and then source the "./.llbinit" file for any temporary debug session specific commands. I want this feature because I have thread and frame formats that do ANSI color codes that I only want to load when running in a terminal which is when I am running the "lldb" command line program. llvm-svn: 139476
* Adding two new options to the 'help' command:Enrico Granata2011-09-091-1/+1
| | | | | | | | | | | --show-aliases (-a) shows aliases for commands, as well as built-in commands --hide-user-defined (-u) hides user defined commands by default 'help' without arguments does not show aliases anymore. to see them, add --show-aliases to have only built-in commands appear, use 'help --hide-user-defined' ; there is currently no way to hide built-in commands from the help output 'help command' is not changed by this commit, and help is shown even if command is an alias and -a is not specified llvm-svn: 139377
* Make ThreadList::GetSelectedThread() select and return the 0th thread if ↵Johnny Chen2011-08-251-7/+0
| | | | | | | | there's no currently selected thread. And update the call sites accordingly. llvm-svn: 138577
* Include lldb/commands as a valid logging type in theJason Molenda2011-08-251-1/+4
| | | | | | | | | | | | 'log list' output. Remove an extraneous \n from one of the lldb/commands log line. Add an lldb/commands log indicating whether the command was successful or not. llvm-svn: 138530
* Changes to Python commands:Enrico Granata2011-08-161-12/+39
| | | | | | | | | | | | - They now have an SBCommandReturnObject instead of an SBStream as third argument - The class CommandObjectPythonFunction has been merged into CommandObjectCommands.cpp - The command to manage them is now: command script with subcommands add, list, delete, clear command alias is returned to its previous functionality - Python commands are now part of an user dictionary, instead of being seen as aliases llvm-svn: 137785
* One-line fix for a possible spurious truncation warningEnrico Granata2011-08-151-1/+2
| | | | llvm-svn: 137640
* Make ValueObject::SetValueFromCString work correctly.Jim Ingham2011-08-121-2/+29
| | | | | | | | | | | | | | | | Also change the SourceInitFile to look for .lldb-<APPNAME> and source that preferentially if it exists. Also made the breakpoint site report its address as well as its breakpoint number when it gets hit and can't find any the associated locations (usually because the breakpoint got disabled or deleted programmatically between the time it was hit and reported.) Changed ThreadPlanCallFunction to initialize the ivar m_func in the initializers of the constructor, rather than waiting to initialize till later on in the function. Fixed a bug where if you make an SBError and the ask it Success, it returns false. Fixed ValueObject::ResolveValue so that it resolves a temporary value, rather than overwriting the one in the value object. llvm-svn: 137536
* Added "command history" command to dump the command history.Jim Ingham2011-07-121-2/+100
| | | | | | | | | | | | | | | | | Also made: (lldb) !<NUM> (lldb) !-<NUM> (lldb) !! work with the history. For added benefit: (lldb) !<NUM><TAB> will insert the command at position <NUM> in the history into the command line to be edited. This is only partial, I still need to sync up editline's history list with the one kept by the interpreter. llvm-svn: 134955
* named summaries:Enrico Granata2011-07-121-1/+1
| | | | | | | | | | | | - a new --name option for "type summary add" lets you give a name to a summary - a new --summary option for "frame variable" lets you bind a named summary to one or more variables ${var%s} now works for printing the value of 0-terminated CStrings type format test case now tests for cascading - this is disabled on GCC because GCC may end up stripping typedef chains, basically breaking cascading new design for the FormatNavigator class new template class CleanUp2 meant to support cleanup routines with 1 additional parameter beyond resource handle llvm-svn: 134943
* new detailed descriptions for type summary add and type format addEnrico Granata2011-07-071-0/+43
| | | | | | | some changes to the help system code for better display of long help text -p and -r flags now also work for type format add llvm-svn: 134574
* Fix header pathsPeter Collingbourne2011-06-231-1/+1
| | | | llvm-svn: 133755
* Committing type format code for Enrico Granata.Greg Clayton2011-06-231-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a new top level command named "type". Currently this command implements three commands: type format add <format> <typename1> [<typename2> ...] type format delete <typename1> [<typename2> ...] type format list [<typename1> [<typename2>] ...] This allows you to specify the default format that will be used to display types when you use "frame variable" or "expression", or the SBValue classes. Examples: // Format uint*_t as hex type format add x uint16_t uint32_t uint64_t // Format intptr_t as a pointer type format add p intptr_t The format characters are the same as "printf" for the most part with many additions. These format character specifiers are also used in many other commands ("frame variable" for one). The current list of format characters include: a - char buffer b - binary B - boolean c - char C - printable char d - signed decimal e - float f - float g - float i - signed decimal I - complex integer o - octal O - OSType p - pointer s - c-string u - unsigned decimal x - hex X - complex float y - bytes Y - bytes with ASCII llvm-svn: 133728
* Add 'batch_mode' to CommandInterpreter. Modify InputReaders toCaroline Tice2011-06-161-1/+2
| | | | | | | | | | not write output (prompts, instructions,etc.) if the CommandInterpreter is in batch_mode. Also, finish updating InputReaders to write to the asynchronous stream, rather than using the Debugger's output file directly. llvm-svn: 133162
* Add ability to recognize/handle quotes around commandsCaroline Tice2011-05-111-14/+61
| | | | | | (e.g. '"target" create' works as well as 'target create'). llvm-svn: 131185
* Replace calls to HandleCommand in lldb core with more appropriateCaroline Tice2011-05-061-26/+158
| | | | | | | direct function calls. As part of this, collect code that processes arguments & options for aliases into a single function. llvm-svn: 131020
* Added new OptionGroup classes for UInt64, UUID, File and Boolean values.Greg Clayton2011-05-031-2/+2
| | | | | | | | | | | | | | | | | | | | | Removed the "image" command and moved it to "target modules". Added an alias for "image" to "target modules". Added some new target commands to be able to add and load modules to a target: (lldb) target modules add <path> (lldb) target modules load [--file <path>] [--slide <offset>] [<sect-name> <sect-load-addr> ...] So you can load individual sections without running a target: (lldb) target modules load --file /usr/lib/libSystem.B.dylib __TEXT 0x7fccc80000 __DATA 0x1234000000 Or you can rigidly slide an entire shared library: (lldb) target modules load --file /usr/lib/libSystem.B.dylib --slid 0x7fccc80000 This should improve bare board debugging when symbol files need to be slid around manually. llvm-svn: 130796
* This patch captures and serializes all output being written by theCaroline Tice2011-05-021-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | command line driver, including the lldb prompt being output by editline, the asynchronous process output & error messages, and asynchronous messages written by target stop-hooks. As part of this it introduces a new Stream class, StreamAsynchronousIO. A StreamAsynchronousIO object is created with a broadcaster, who will eventually broadcast the stream's data for a listener to handle, and an event type indicating what type of event the broadcaster will broadcast. When the Write method is called on a StreamAsynchronousIO object, the data is appended to an internal string. When the Flush method is called on a StreamAsynchronousIO object, it broadcasts it's data string and clears the string. Anything in lldb-core that needs to generate asynchronous output for the end-user should use the StreamAsynchronousIO objects. I have also added a new notification type for InputReaders, to let them know that a asynchronous output has been written. This is to allow the input readers to, for example, refresh their prompts and lines, if desired. I added the case statements to all the input readers to catch this notification, but I haven't added any code for handling them yet (except to the IOChannel input reader). llvm-svn: 130721
* Erase from a string instead of using substr when you don't really need to.Greg Clayton2011-04-221-1/+1
| | | | llvm-svn: 130013
* Fixed some more 'commands' to 'command' change.Johnny Chen2011-04-211-2/+2
| | | | llvm-svn: 129897
* Added the ability for users to create new regex commands.Greg Clayton2011-04-201-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | To do this currently, it must be done in multi-line mode: (lldb) commands regex --help "Help text for command" --syntax "syntax for command" <cmd-name> Any example that would use "f" for "finish" when there are no arguments, and "f <num>" to do a "frame select <num>" would be: (lldb) commands regex f Enter multiple regular expressions in the form s/find/replace/ then terminate with an empty line: s/^$/finish/ s/([0-9]+)/frame select %1/ (lldb) f 11 frame select 12 ... (lldb) f finish ... Also added the string version of the OptionValue as OptionValueString. llvm-svn: 129855
* Centralized a lot of the status information for processes,Greg Clayton2011-04-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | threads, and stack frame down in the lldb_private::Process, lldb_private::Thread, lldb_private::StackFrameList and the lldb_private::StackFrame classes. We had some command line commands that had duplicate versions of the process status output ("thread list" and "process status" for example). Removed the "file" command and placed it where it should have been: "target create". Made an alias for "file" to "target create" so we stay compatible with GDB commands. We can now have multple usable targets in lldb at the same time. This is nice for comparing two runs of a program or debugging more than one binary at the same time. The new command is "target select <target-idx>" and also to see a list of the current targets you can use the new "target list" command. The flow in a debug session can be: (lldb) target create /path/to/exe/a.out (lldb) breakpoint set --name main (lldb) run ... hit breakpoint (lldb) target create /bin/ls (lldb) run /tmp Process 36001 exited with status = 0 (0x00000000) (lldb) target list Current targets: target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped ) * target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited ) (lldb) target select 0 Current targets: * target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped ) target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited ) (lldb) bt * thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1 frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16 frame #1: 0x0000000100000b64 a.out`start + 52 Above we created a target for "a.out" and ran and hit a breakpoint at "main". Then we created a new target for /bin/ls and ran it. Then we listed the targest and selected our original "a.out" program, so we showed two concurent debug sessions going on at the same time. llvm-svn: 129695
* Moved the execution context that was in the Debugger intoGreg Clayton2011-04-121-15/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the CommandInterpreter where it was always being used. Make sure that Modules can track their object file offsets correctly to allow opening of sub object files (like the "__commpage" on darwin). Modified the Platforms to be able to launch processes. The first part of this move is the platform soon will become the entity that launches your program and when it does, it uses a new ProcessLaunchInfo class which encapsulates all process launching settings. This simplifies the internal APIs needed for launching. I want to slowly phase out process launching from the process classes, so for now we can still launch just as we used to, but eventually the platform is the object that should do the launching. Modified the Host::LaunchProcess in the MacOSX Host.mm to correctly be able to launch processes with all of the new eLaunchFlag settings. Modified any code that was manually launching processes to use the Host::LaunchProcess functions. Fixed an issue where lldb_private::Args had implicitly defined copy constructors that could do the wrong thing. This has now been fixed by adding an appropriate copy constructor and assignment operator. Make sure we don't add empty ModuleSP entries to a module list. Fixed the commpage module creation on MacOSX, but we still need to train the MacOSX dynamic loader to not get rid of it when it doesn't have an entry in the all image infos. Abstracted many more calls from in ProcessGDBRemote down into the GDBRemoteCommunicationClient subclass to make the classes cleaner and more efficient. Fixed the default iOS ARM register context to be correct and also added support for targets that don't support the qThreadStopInfo packet by selecting the current thread (only if needed) and then sending a stop reply packet. Debugserver can now start up with a --unix-socket (-u for short) and can then bind to port zero and send the port it bound to to a listening process on the other end. This allows the GDB remote platform to spawn new GDB server instances (debugserver) to allow platform debugging. llvm-svn: 129351
OpenPOWER on IntegriCloud