summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectCommands.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make it so that a command alias can actually remove the help/long help from ↵Enrico Granata2016-03-221-3/+3
| | | | | | its parent command by setting itself to an empty help string llvm-svn: 264108
* A few more improvements on the way to the command alias refactoringEnrico Granata2016-03-081-37/+34
| | | | | | | | - move alias help generation to CommandAlias, out of CommandInterpreter - make alias creation use argument strings instead of OptionArgVectorSP; the former is a more reasonable currency than the latter - remove m_is_alias from CommandObject, it wasn't actually being used llvm-svn: 262912
* Move ProcessAliasOptionsArgs to be a static on CommandAlias; it wasn't using ↵Enrico Granata2016-03-081-5/+3
| | | | | | | | any instance data on the CommandInterpreter anyway This small step removes one piece of alias machinery from the CommandInterpreter into the CommandAlias llvm-svn: 262901
* Change the way command aliases are stored. Go from a model where a map holds ↵Enrico Granata2016-03-081-19/+3
| | | | | | | | | | | the alias -> underlying command binding and another map holds the alias -> options, to a model where one single map holds the alias -> (all useful data) combination Right now, obviously, this is just the pair of (CommandObjectSP,OptionArgVectorSP), so NFC This is step one of a larger - and tricky - refactoring which will turn command aliases into interesting objects instead of passive storage that the command interpreter does smart things to This refactoring, in turn, will allow us to do interesting things with aliases, such as intelligent and customizable help llvm-svn: 262900
* When 'help' cannot find a command, produce additional help text that also ↵Enrico Granata2016-02-291-2/+11
| | | | | | | | | | | | | | | | | | points the user to the apropos and type lookup commands This is useful in cases such as, e.g. (lldb) help NSString (the user meant type lookup) or (lldb) help kill (the user is looking for process kill) Fixes rdar://24868537 llvm-svn: 262271
* Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in ↵Eugene Zelenko2016-02-221-263/+192
| | | | | | source/Commands/CommandObjectCommands.cpp; other minor fixes. llvm-svn: 261593
* commands: Use override instead of virtual.Bruce Mitchener2015-10-071-89/+82
| | | | | | | | | | | | | | | | | Summary: This removes all uses of virtual on functions where override could be used, including on destructors. It also adds override where virtual was previously missing. Reviewers: clayborg, labath Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13503 llvm-svn: 249564
* Fixed line wrapping for the "long help" content in LLDB commands. Content ↵Kate Stone2015-07-141-79/+92
| | | | | | | | | | is now dynamically wrapped for the column width of the current terminal. Lines that begin with whitespace will be indented identically on subsequent lines to maintain formatting. Existing commands supplying this type of help content have been reworked to take advantage of the changes. In addition to formatting changes, content was changes for accuracy and clarity purposes. <rdar://problem/21269977> llvm-svn: 242122
* Correct type in for loop to remove signedness warningEd Maste2015-06-171-1/+1
| | | | llvm-svn: 239918
* Enable 'command script import' to accept multiple modules to import in one ↵Enrico Granata2015-06-161-26/+29
| | | | | | | | invocation Fixes rdar://21388472 llvm-svn: 239839
* Don't #include "lldb-python.h" from anywhere.Zachary Turner2015-05-291-2/+0
| | | | | | | | | | | | | Since interaction with the python interpreter is moving towards being more isolated, we won't be able to include this header from normal files anymore, all includes of it should be localized to the python library which will live under source/bindings/API/Python after a future patch. None of the files that were including this header actually depended on it anyway, so it was just a dead include in every single instance. llvm-svn: 238581
* Add support for custom commands to set flags on themselvesEnrico Granata2015-05-271-0/+2
| | | | | | | | | This works for Python commands defined via a class (implement get_flags on your class) and C++ plugin commands (which can call SBCommand::GetFlags()/SetFlags()) Flags allow features such as not letting the command run if there's no target, or if the process is not stopped, ... Commands could always check for these things themselves, but having these accessible via flags makes custom commands more consistent with built-in ones llvm-svn: 238286
* Remove ScriptInterpreterObject.Zachary Turner2015-03-171-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This removes ScriptInterpreterObject from the codebase completely. Places that used to rely on ScriptInterpreterObject now use StructuredData::Object and its derived classes. To support this, a new type of StructuredData object is introduced, called StructuredData::Generic, which stores a void*. Internally within the python library, StructuredPythonObject subclasses this StructuredData::Generic class so that it can addref and decref the python object on construction and destruction. Additionally, all of the classes in PythonDataObjects.h such as PythonList, PythonDictionary, etc now provide a method to create an instance of the corresponding StructuredData type. For example, there is PythonDictionary::CreateStructuredDictionary. To eliminate dependencies on PythonDataObjects for external callers, all ScriptInterpreter methods now return only StructuredData classes The rest of the changes in this CL are focused on fixing up users of PythonDataObjects classes to use the new StructuredData classes. llvm-svn: 232534
* If creating a Python command via a class, the help text is handled directly ↵Enrico Granata2015-03-131-1/+1
| | | | | | by the class object, no need for setting it manually via the cmdline llvm-svn: 232228
* Add support for Python object commands to return custom short and long help ↵Enrico Granata2015-03-131-1/+33
| | | | | | | | | | | | | by implementing def get_short_help(self) def get_long_help(self) methods on the command object Also, add a test case for this feature llvm-svn: 232224
* Bulk of the infrastructure work to allow script commands to be backed by ↵Enrico Granata2015-03-131-13/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | object instances in addition to free functions This works by creating a command backed by a class whose interface should - at least - include def __init__(self, debugger, session_dict) def __call__(self, args, return_obj, exe_ctx) What works: - adding a command via command script add --class - calling a thusly created command What is missing: - support for custom help - test cases The missing parts will follow over the next couple of days This is an improvement over the existing system as: a) it provides an obvious location for commands to provide help strings (i.e. methods) b) it allows commands to store state in an obvious fashion c) it allows us to easily add features to script commands over time (option parsing and subcommands registration, I am looking at you :-) llvm-svn: 232136
* Refactor OptionValue::SetValueFromCString to use llvm::StringRefPavel Labath2015-02-201-6/+6
| | | | | | | | | | Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7676 llvm-svn: 230005
* Fixed an issue where you couldn't delete a user defined regex, python, or ↵Greg Clayton2015-01-091-9/+91
| | | | | | | | | | | multi-word command by adding a new "command delete" command. This new command will delete user defined regular commands, but not aliases. We still have "command unalias" to remove aliases as they are currently in different buckets. Appropriate error messages are displayed to inform the user when "command unalias" is used on removable user defined commands that points users to the "command delete" command. Added a test to verify we can remove user defined commands and also verify that "command unalias" fails when used on a user defined command. <rdar://problem/18248300> llvm-svn: 225535
* More override warning cleanup.Eric Christopher2014-11-181-3/+3
| | | | llvm-svn: 222271
* Patch from dawn@burble.org to make the --silent-run do what it says, not the ↵Jim Ingham2014-11-181-3/+3
| | | | | | opposite of what it says. llvm-svn: 222243
* Have CommandObjectCommandsAddRegex inherit from IOHandlerDelegateMultiline ↵Greg Clayton2014-11-181-58/+16
| | | | | | | | | | | | so it will not immediately terminate after the first regular expression in "command regex <name>" commands. Fixed the prompt to not include non-printable characters as it was hosing up the prompt when you ran "command regex foo" and entered multi-line editing mode. Fixed error strings to include more complete descriptions when bad regular expressions are entered. Removed the old IOHandlerLinesUpdated function as it is no longer needed (inheriting from IOHandlerDelegateMultiline takes care of what this function used to do). llvm-svn: 222207
* Complete rewrite of interactive editing support for single- and multi-line ↵Kate Stone2014-11-171-0/+4
| | | | | | | | | | | | | | | | | | | input. Improvements include: * Use of libedit's wide character support, which is imperfect but a distinct improvement over ASCII-only * Fallback for ASCII editing path * Support for a "faint" prompt clearly distinguished from input * Breaking lines and insert new lines in the middle of a batch by simply pressing return * Joining lines with forward and backward character deletion * Detection of paste to suppress automatic formatting and statement completion tests * Correctly reformatting when lines grow or shrink to occupy different numbers of rows * Saving multi-line history, and correctly preserving the "tip" of history during editing * Displaying visible ^C and ^D indications when interrupting input or sending EOF * Fledgling VI support for multi-line editing * General correctness and reliability improvements llvm-svn: 222163
* Rework the way we pass "run multiple command" options to the various API's thatJim Ingham2014-10-111-11/+9
| | | | | | | | | | | | | | | do that (RunCommandInterpreter, HandleCommands, HandleCommandsFromFile) to gather the options into an options class. Also expose that to the SB API's. Change the way the "-o" options to the lldb driver are processed so: 1) They are run synchronously - didn't really make any sense to run the asynchronously. 2) The stop on error 3) "quit" in one of the -o commands will not quit lldb - not the command interpreter that was running the -o commands. I added an entry to the run options to stop-on-crash, but I haven't implemented that yet. llvm-svn: 219553
* Allow Python commands to optionally take an SBExecutionContext argument in ↵Enrico Granata2014-10-011-1/+2
| | | | | | case they need to handle 'where they want to act' separately from the notion of 'currently-selected entity' that is associated to the debugger. Do this in an (hopefully) non-breaking way by running an argcount check before passing in the new argument. Update the test case to also check for this new feature. www update to follow llvm-svn: 218834
* Add a --help (-h) option to "command script add" that enables users to ↵Enrico Granata2014-09-151-4/+25
| | | | | | | | | | | | | define a one-liner short help for their command Also, in case they don't define any, change the default from "Run Python function <blah>" into "For more information run help <blah>" The core issue here is that Python only allows one docstring per function, so we can't really attach both a short and a long help to the same command easily There are alternatives but this is not a pressing enough concern to go through the motions quite yet Fixes rdar://18322737 llvm-svn: 217795
* Make sure the "command regex add" has a unique name for editline history ↵Greg Clayton2014-07-091-1/+1
| | | | | | purposes. llvm-svn: 212644
* Revert "Fix broken tests due to new error output."Zachary Turner2014-07-091-17/+17
| | | | | | | This reverts commit ec7c94f8e6860968d384b578e5564a9c55c80b4a and re-enables OptionValidators. llvm-svn: 212627
* Fix broken tests due to new error output.Todd Fiala2014-07-081-17/+17
| | | | | | | | | | | This reverses out the options validators changes. We'll get these back in once the changes to the output can be resolved. Restores broken tests on FreeBSD, Linux, MacOSX. Changes reverted: r212500, r212317, r212290. llvm-svn: 212543
* Adds the notion of an OptionValidator.Zachary Turner2014-07-031-17/+17
| | | | | | | | | | | | | | | | | | The purpose of the OptionValidator is to determine, based on some arbitrary set of conditions, whether or not a command option is valid for a given debugger state. An example of this might be to selectively disable or enable certain command options that don't apply to a particular platform. This patch contains no functional change, and does not actually make use of an OptionValidator for any purpose yet. A follow-up patch will begin to add the logic and users of OptionValidator. Reviewed by: Greg Clayton, Jim Ingham Differential Revision: http://reviews.llvm.org/D4369 llvm-svn: 212290
* Fix typos.Bruce Mitchener2014-07-011-1/+1
| | | | llvm-svn: 212132
* lldb TOT is dropping the last entry for multi-line IOHandlers that use the ↵Greg Clayton2014-05-081-1/+1
| | | | | | | | IOHandlerDelegateMultiline. <rdar://problem/16844164> llvm-svn: 208336
* "DONE" is being left in multi-line results when it shouldn't for non ↵Greg Clayton2014-05-021-1/+1
| | | | | | | | terminal input. <rdar://problem/16790579> llvm-svn: 207818
* Allow line numbers to be shown in multi-line expressions.Greg Clayton2014-03-071-2/+3
| | | | llvm-svn: 203185
* Fixed output to display correctly for "command source" by fixing the correct ↵Greg Clayton2014-02-051-2/+0
| | | | | | | | | | flags being set. Also emit the "Executing commands" message so it properly only comes out when desired and so it comes out in the right place. <rdar://problem/15992208> llvm-svn: 200875
* Fixed an issue where "command source" would not do the right thing:Greg Clayton2014-02-051-26/+45
| | | | | | | - empty lines in init files would repeat previous command and cause errors to be displayed - all options to control showing the command, its output, if it should stop on error or continue, weren't being obeyed. llvm-svn: 200860
* Merging the iohandler branch back into main. Greg Clayton2014-01-271-250/+200
| | | | | | | | | | | | The many many benefits include: 1 - Input/Output/Error streams are now handled as real streams not a push style input 2 - auto completion in python embedded interpreter 3 - multi-line input for "script" and "expression" commands now allow you to edit previous/next lines using up and down arrow keys and this makes multi-line input actually a viable thing to use 4 - it is now possible to use curses to drive LLDB (please try the "gui" command) We will need to deal with and fix any buildbot failures and tests and arise now that input/output and error are correctly hooked up in all cases. llvm-svn: 200263
* Add OptionParser.hVirgile Bello2013-09-051-12/+12
| | | | llvm-svn: 190063
* Remove need of <functional> for CommandObjectCommands.Virgile Bello2013-08-271-3/+3
| | | | llvm-svn: 189365
* Add silent option to command source.Michael Sartain2013-07-091-1/+9
| | | | | | Patch from Matthew Sorrels llvm-svn: 185983
* Revert commits that cause broken builds on GCC buildbotsDaniel Malea2013-07-031-3/+1
| | | | | | | | - build fails due to PyCallable template definition inside an extern "C" scope This commit reverts 185240, 184893 and 184608. llvm-svn: 185560
* <rdar://problem/14266578>Enrico Granata2013-06-261-3/+1
| | | | | | "command source" was not properly setting the stop-on-error option llvm-svn: 184899
* <rdar://problem/14266411>Enrico Granata2013-06-251-1/+3
| | | | | | | | | | | | The semi-unofficial way of returning a status from a Python command was to return a string (e.g. return "no such variable was found") that LLDB would pick as a clue of an error having happened This checkin changes that: - SBCommandReturnObject now exports a SetError() call, which can take an SBError or a plain C-string - script commands now drop any return value and expect the SBCommandReturnObject ("return object") to be filled in appropriately - if you do nothing, a success will be assumed If your commands were relying on returning a value and having LLDB pick that up as an error, please change your commands to SetError() through the return object or expect changes in behavior llvm-svn: 184893
* Renaming the "--wipe" option to "command history" to "--clear" (-C) for ↵Enrico Granata2013-06-171-8/+8
| | | | | | coherence with the rest of the LLDB command-line interface llvm-svn: 184147
* <rdar://problem/14134716>Enrico Granata2013-06-171-24/+106
| | | | | | | | | | | | This is a rewrite of the command history facility of LLDB It takes the history management out of the CommandInterpreter into its own CommandHistory class It reimplements the command history command to allow more combinations of options to work correctly (e.g. com hist -c 1 -s 5) It adds a new --wipe (-w) option to command history to allow clearing the history on demand It extends the lldbtest runCmd: and expect: methods to allow adding commands to history if need be It adds a test case for the reimplemented facility llvm-svn: 184140
* <rdar://problem/12876503>Enrico Granata2013-06-111-6/+9
| | | | | | | Adding a new setting interpreter.stop-command-source-on-error that dictates a default behavior for whether command source should stop upon hitting an error You can still override the setting for each individual invocation with the usual -e setting llvm-svn: 183719
* <rdar://problem/11109316>Enrico Granata2013-05-311-2/+2
| | | | | | | | | | | | | | | | | command script import now does reloads - for real If you invoke command script import foo and it detects that foo has already been imported, it will - invoke reload(foo) to reload the module in Python - re-invoke foo.__lldb_init_module This second step is necessary to ensure that LLDB does not keep cached copies of any formatter, command, ... that the module is providing Usual caveats with Python imports persist. Among these: - if you have objects lurking around, reloading the module won't magically update them to reflect changes - if module A imports module B, reloading A won't reload B These are Python-specific issues independent of LLDB that would require more extensive design work The --allow-reload (-r) option is maintained for compatibility with existing scripts, but is clearly documented as redundant - reloading is always enabled whether you use it or not llvm-svn: 182977
* <rdar://problem/13831149>Enrico Granata2013-05-091-0/+7
| | | | | | | | Recursive commands invocations are not currently supported by our CommandInterpreter CommandScriptImport can actually be made to invoke itself recursively, so we need to work around that by clearing the m_exe_ctx This is a short-term workaround, a more interesting solution would be to actually make sure recursive command invocations work properly llvm-svn: 181537
* After discussing with Chris Lattner, we require C++11, so lets get rid of ↵Greg Clayton2013-04-181-1/+1
| | | | | | the macros and just use C++11. llvm-svn: 179805
* Since we use C++11, we should switch over to using std::unique_ptr when ↵Greg Clayton2013-04-181-1/+1
| | | | | | | | C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++. Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro. llvm-svn: 179779
* <rdar://problem/13069948>Greg Clayton2013-01-251-3/+3
| | | | | | | | | | | | Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary. So I defined a new "lldb::offset_t" which should be used for all file offsets. After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed. Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections. llvm-svn: 173463
OpenPOWER on IntegriCloud