aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectCommands.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone1-1951/+1631
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
2016-08-26Tables of command options in LLDB benefit from hand-formatting to make itKate Stone1-22/+34
easier to scan a set of options with a relatively large number of positional arguments. This commit standardizes their formatting throughout LLDB and applies surrounding directives to exempt them from being formatted by clang-format. These kinds of exemptions should be rare cases that benefit significantly from alternative formatting. They also imply a long-term obligation to maintain their format since the automated tools will not do so. llvm-svn: 279882
2016-08-11Decoupled Options from CommandInterpreter.Todd Fiala1-37/+43
Options used to store a reference to the CommandInterpreter instance in the base Options class. This made it impossible to parse options independent of a CommandInterpreter. This change removes the reference from the base class. Instead, it modifies the options-parsing-related methods to take an ExecutionContext pointer, which the options may inspect if they need to do so. Closes https://reviews.llvm.org/D23416 Reviewers: clayborg, jingham llvm-svn: 278440
2016-07-14LLDB help content has accumulated over time without a recent attempt toKate Stone1-41/+31
review it for consistency, accuracy, and clarity. These changes attempt to address all of the above while keeping the text relatively terse. <rdar://problem/24868841> llvm-svn: 275485
2016-04-08Cleanups to command alias to refer to itself as 'command alias' and not ↵Enrico Granata1-5/+17
allow to make aliases starting with a - as that isn't really supported, and is most often a mistake (trying to pass options) llvm-svn: 265820
2016-03-31Add --help and --long-help options to 'command alias' such that one can now ↵Enrico Granata1-7/+155
specify a help string for an alias as they are defining it llvm-svn: 264980
2016-03-22Make it so that a command alias can actually remove the help/long help from ↵Enrico Granata1-3/+3
its parent command by setting itself to an empty help string llvm-svn: 264108
2016-03-08A few more improvements on the way to the command alias refactoringEnrico Granata1-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
2016-03-08Move ProcessAliasOptionsArgs to be a static on CommandAlias; it wasn't using ↵Enrico Granata1-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
2016-03-08Change the way command aliases are stored. Go from a model where a map holds ↵Enrico Granata1-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
2016-02-29When 'help' cannot find a command, produce additional help text that also ↵Enrico Granata1-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
2016-02-22Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in ↵Eugene Zelenko1-263/+192
source/Commands/CommandObjectCommands.cpp; other minor fixes. llvm-svn: 261593
2015-10-07commands: Use override instead of virtual.Bruce Mitchener1-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
2015-07-14Fixed line wrapping for the "long help" content in LLDB commands. Content ↵Kate Stone1-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
2015-06-17Correct type in for loop to remove signedness warningEd Maste1-1/+1
llvm-svn: 239918
2015-06-16Enable 'command script import' to accept multiple modules to import in one ↵Enrico Granata1-26/+29
invocation Fixes rdar://21388472 llvm-svn: 239839
2015-05-29Don't #include "lldb-python.h" from anywhere.Zachary Turner1-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
2015-05-27Add support for custom commands to set flags on themselvesEnrico Granata1-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
2015-03-17Remove ScriptInterpreterObject.Zachary Turner1-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
2015-03-13If creating a Python command via a class, the help text is handled directly ↵Enrico Granata1-1/+1
by the class object, no need for setting it manually via the cmdline llvm-svn: 232228
2015-03-13Add support for Python object commands to return custom short and long help ↵Enrico Granata1-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
2015-03-13Bulk of the infrastructure work to allow script commands to be backed by ↵Enrico Granata1-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
2015-02-20Refactor OptionValue::SetValueFromCString to use llvm::StringRefPavel Labath1-6/+6
Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7676 llvm-svn: 230005
2015-01-09Fixed an issue where you couldn't delete a user defined regex, python, or ↵Greg Clayton1-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
2014-11-18More override warning cleanup.Eric Christopher1-3/+3
llvm-svn: 222271
2014-11-18Patch from dawn@burble.org to make the --silent-run do what it says, not the ↵Jim Ingham1-3/+3
opposite of what it says. llvm-svn: 222243
2014-11-18Have CommandObjectCommandsAddRegex inherit from IOHandlerDelegateMultiline ↵Greg Clayton1-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
2014-11-17Complete rewrite of interactive editing support for single- and multi-line ↵Kate Stone1-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
2014-10-11Rework the way we pass "run multiple command" options to the various API's thatJim Ingham1-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
2014-10-01Allow Python commands to optionally take an SBExecutionContext argument in ↵Enrico Granata1-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
2014-09-15Add a --help (-h) option to "command script add" that enables users to ↵Enrico Granata1-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
2014-07-09Make sure the "command regex add" has a unique name for editline history ↵Greg Clayton1-1/+1
purposes. llvm-svn: 212644
2014-07-09Revert "Fix broken tests due to new error output."Zachary Turner1-17/+17
This reverts commit ec7c94f8e6860968d384b578e5564a9c55c80b4a and re-enables OptionValidators. llvm-svn: 212627
2014-07-08Fix broken tests due to new error output.Todd Fiala1-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
2014-07-03Adds the notion of an OptionValidator.Zachary Turner1-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
2014-07-01Fix typos.Bruce Mitchener1-1/+1
llvm-svn: 212132
2014-05-08lldb TOT is dropping the last entry for multi-line IOHandlers that use the ↵Greg Clayton1-1/+1
IOHandlerDelegateMultiline. <rdar://problem/16844164> llvm-svn: 208336
2014-05-02"DONE" is being left in multi-line results when it shouldn't for non ↵Greg Clayton1-1/+1
terminal input. <rdar://problem/16790579> llvm-svn: 207818
2014-03-07Allow line numbers to be shown in multi-line expressions.Greg Clayton1-2/+3
llvm-svn: 203185
2014-02-05Fixed output to display correctly for "command source" by fixing the correct ↵Greg Clayton1-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
2014-02-05Fixed an issue where "command source" would not do the right thing:Greg Clayton1-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
2014-01-27Merging the iohandler branch back into main. Greg Clayton1-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
2013-09-05Add OptionParser.hVirgile Bello1-12/+12
llvm-svn: 190063
2013-08-27Remove need of <functional> for CommandObjectCommands.Virgile Bello1-3/+3
llvm-svn: 189365
2013-07-09Add silent option to command source.Michael Sartain1-1/+9
Patch from Matthew Sorrels llvm-svn: 185983
2013-07-03Revert commits that cause broken builds on GCC buildbotsDaniel Malea1-3/+1
- build fails due to PyCallable template definition inside an extern "C" scope This commit reverts 185240, 184893 and 184608. llvm-svn: 185560
2013-06-26<rdar://problem/14266578>Enrico Granata1-3/+1
"command source" was not properly setting the stop-on-error option llvm-svn: 184899
2013-06-25<rdar://problem/14266411>Enrico Granata1-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
2013-06-17Renaming the "--wipe" option to "command history" to "--clear" (-C) for ↵Enrico Granata1-8/+8
coherence with the rest of the LLDB command-line interface llvm-svn: 184147
2013-06-17<rdar://problem/14134716>Enrico Granata1-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