summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-3085/+2869
| | | | | | | | | | | | | | | | | | | | | | | *** 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
* Delete Host/windows/win32.hZachary Turner2016-08-091-3/+3
| | | | | | | | | | | | | | | | | | | It's always hard to remember when to include this file, and when you do include it it's hard to remember what preprocessor check it needs to be behind, and then you further have to remember whether it's windows.h or win32.h which you need to include. This patch changes the name to PosixApi.h, which is more appropriately named, and makes it independent of any preprocessor setting. There's still the issue of people not knowing when to include this, because there's not a well-defined set of things it exposes other than "whatever is missing on Windows", but at least this should make it less painful to fix when problems arise. This patch depends on LLVM revision r278170. llvm-svn: 278177
* LLDB help content has accumulated over time without a recent attempt toKate Stone2016-07-141-119/+96
| | | | | | | | | 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
* Fix an issue where one could not define a Python command with the same name ↵Enrico Granata2016-07-111-2/+7
| | | | | | as an existing alias (or rather, one could but the results of invoking the command were far from satisfactory) llvm-svn: 275080
* Fix an issue where the apropos command would not print fully qualified ↵Enrico Granata2016-05-021-1/+1
| | | | | | | | command names for nested command objects rdar://problem/26020072 llvm-svn: 268309
* Add a --element-count option to the expression commandEnrico Granata2016-04-251-0/+2
| | | | | | | | | | | | | This option evaluates an expression and, if the result is of pointer type, treats it as if it was an array of that many elements and displays such elements This has a couple subtle points but is mostly as straightforward as it sounds Add a parray N <expr> alias for this new mode Also, extend the --object-description mode to do the moral equivalent of the above but display each element in --object-description mode Add a poarray N <expr> alias for this llvm-svn: 267372
* Fix a bug where LLDB would crash if 'apropos <anything>' was used after ↵Enrico Granata2016-04-201-1/+1
| | | | | | spawning an inferior process llvm-svn: 266911
* Add help for our regular expression commands when aliasedEnrico Granata2016-04-081-16/+12
| | | | llvm-svn: 265819
* Change 'apropos' such that it doesn't look into the "long help/syntax" ↵Enrico Granata2016-03-231-41/+50
| | | | | | | | | | strings for commands This solves issues such as 'apropos foo' returning valid matches just because syntax examples happen to use 'foo' as a placeholder token Fixes rdar://9043025 llvm-svn: 264123
* Make it so that a command alias can actually remove the help/long help from ↵Enrico Granata2016-03-221-4/+8
| | | | | | its parent command by setting itself to an empty help string llvm-svn: 264108
* Fix a bug caused by my alias refactoring where, if an alias was defined in ↵Enrico Granata2016-03-221-2/+3
| | | | | | terms of another alias, trying to run the nested command would actually cause a crash in the command interpreter llvm-svn: 264096
* Use Enrico's new CommandAlias to give better help to the "sif" command.Jim Ingham2016-03-191-1/+7
| | | | llvm-svn: 263865
* Workaround the fact that "b" is now a separate command object from ↵Enrico Granata2016-03-151-5/+5
| | | | | | | | | | "_regexp-break", and thus "help b" doesn't show the possible syntaxes It would be nice to have a longer-term plan for how to handle help for regular expression commands, since their syntax is highly irregular. I can see a few options (*), but for now this is a reasonable stop-gag measure for the most blatant regression. (*) the simplest is, of course, to detect a regex command and inherit the syntax for any aliases thereof; it would be nice if this also didn't show the underlying regex command name when the alias is used llvm-svn: 263523
* Lots of progress on the CommandAlias refactoringEnrico Granata2016-03-141-4/+5
| | | | | | | | | This cleans things up such CommandAlias essentially can work as its own object; the aliases still live in a separate map, but are now just full-fledged CommandObjectSPs This patch also cleans up help generation for aliases, allows aliases to vend their own help, and adds a tweak such that "dash-dash aliases", such as po, don't show the list of options for their underlying command, since those can't be provided anyway I plan to fix up a few more things here, and then add a test case and proclaim victory llvm-svn: 263499
* More of the alias refactoring work! CommandAlias is now a CommandObjectEnrico Granata2016-03-141-14/+13
| | | | llvm-svn: 263468
* Last round of preliminary cleanup in my refactoring of aliases.Enrico Granata2016-03-091-98/+3
| | | | | | | | | | | | | | The next step is to actually turn CommandAlias into a full-blown CommandObject citizen. This is tricky given the current architecture of the CommandInterpreter but I think I have found a reasonable path forward. The current plan is to make class CommandAlias : public CommandObject, and have all the several GetCommand calls not actually traverse through the alias to the underlying command object The only times that an alias will be traversed are: a) execution; when time comes to run an alias, I will just grab the underlying command and options, and make the interpreter execute that according to its current algorithm b) subcommand traversal; if one has an alias to a multiword command, grabbing a subcommand will see through to the subcommand Other operations, e.g. command listing, command names, command helps, ..., will all use the alias directly. This will, in turn, lead to the removal of the separate alias dictionary, and just mix user commands and aliases in one map llvm-svn: 262986
* Move CommandAlias to its own file; alsoEnrico Granata2016-03-081-17/+17
| | | | | | Store std::unique_ptr<CommandAlias> instead of instances llvm-svn: 262958
* Use c_str() instead of GetCString() to fix build Ewan Crawford2016-03-081-1/+1
| | | | llvm-svn: 262920
* This is actually a FileSpec, so use .GetCString() insteadEnrico Granata2016-03-081-1/+1
| | | | llvm-svn: 262914
* Use .c_str() here to unbreak the Linux buildEnrico Granata2016-03-081-1/+1
| | | | llvm-svn: 262913
* A few more improvements on the way to the command alias refactoringEnrico Granata2016-03-081-104/+96
| | | | | | | | - 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
* Turn GetAliasOptions() into GetAlias()Enrico Granata2016-03-081-7/+14
| | | | | | | Eventually, there will be more things that CommandAlias contains, and I don't want accessors for each of them on the CommandIntepreter Eventually, we also won't pass around copies of CommandAlias, but that's for a later patch llvm-svn: 262909
* Attempt to fix the Ubuntu buildbot by making FindLongestCommandWord a free ↵Enrico Granata2016-03-081-16/+0
| | | | | | template function in lldb_private llvm-svn: 262905
* Unbreak linux build broken by r262901Jason Molenda2016-03-081-1/+1
| | | | llvm-svn: 262904
* Move ProcessAliasOptionsArgs to be a static on CommandAlias; it wasn't using ↵Enrico Granata2016-03-081-58/+58
| | | | | | | | 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-103/+80
| | | | | | | | | | | 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
* Change over the broadcaster/listener process to hold shared or weak pointersJim Ingham2016-03-071-1/+1
| | | | | | | | | | | | | | to each other. This should remove some infrequent teardown crashes when the listener is not the debugger's listener. Processes now need to take a ListenerSP, not a Listener&. This required changing over the Process plugin class constructors to take a ListenerSP, instead of a Listener&. Other than that there should be no functional change. <rdar://problem/24580184> CrashTracer: [USER] Xcode at …ework: lldb_private::Listener::BroadcasterWillDestruct + 39 llvm-svn: 262863
* Clear alias argument vector for 'p' alias.Chaoren Lin2016-02-261-0/+2
| | | | | | | | | | | | Summary: This fixes the 'p' command which should be aliased to 'expresion --'. Reviewers: jingham Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D17634 llvm-svn: 261969
* Add the "block" keyword to "thread step-in -e", and an alias that uses it: ↵Jim Ingham2016-02-261-2/+8
| | | | | | | | | "sif <target function>" - i.e. step-into-function to allow you to step through a complex calling sequence into a particular function that may span multiple lines. Also some test cases for this and the --step-target feature. llvm-svn: 261953
* Fix all of the unannotated switch cases to annotate the fall through or do ↵Greg Clayton2016-02-261-0/+1
| | | | | | the right thing and break. llvm-svn: 261950
* This patch stops lldb from loading a .lldbinit file from the currentJason Molenda2016-02-191-5/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | working directory by default -- a typical security problem that we need to be more conservative about. It adds a new target setting, target.load-cwd-lldbinit which may be true (always read $cwd/.lldbinit), false (never read $cwd/.lldbinit) or warn (warn if there is a $cwd/.lldbinit and don't read it). The default is set to warn. If this is met with unhappiness, we can look at changing the default to true (to match current behavior) on a different platform. This does not affect reading of ~/.lldbinit - that will still be read, as before. If you run lldb in your home directory, it will not warn about the presence of a .lldbinit file there. I had to add two SB API - SBHostOS::GetUserHomeDirectory and SBFileSpec::AppendPathComponent - for the lldb driver code to be able to get the home directory path in an OS neutral manner. The warning text is There is a .lldbinit file in the current directory which is not being read. To silence this warning without sourcing in the local .lldbinit, add the following to the lldbinit file in your home directory: settings set target.load-cwd-lldbinit false To allow lldb to source .lldbinit files in the current working directory, set the value of this variable to true. Only do so if you understand and accept the security risk. <rdar://problem/24199163> llvm-svn: 261280
* Per Jim's suggestion, move checks that we're not mixing and matching ↵Enrico Granata2016-02-061-1/+9
| | | | | | | | Debuggers and Commands deeper in the bowels of LLDB NFC llvm-svn: 259972
* Fix a glitch in the Driver's batch mode when used with "attach". Jim Ingham2016-01-081-1/+4
| | | | | | | | | | | | | | Batch mode is supposed to stop execution and return control to the user when an exceptional stop occurs (crash, signal or instrumentation). But attach always stops with a SIGSTOP on OSX (maybe on Linux too?) which would short circuit the rest of the commands given. This change allows a command result object to indicate that it expected to leave the process stopped with an exceptional stop reason, and it is okay for batch mode to keep going. <rdar://problem/22243143> llvm-svn: 257120
* Added the concept of a Read-Eval-Print-Loop to LLDB.Sean Callanan2015-10-191-1/+10
| | | | | | | | | | | | | | | | A REPL takes over the command line and typically treats input as source code. REPLs can also do code completion. The REPL class allows its subclasses to implement the language-specific functionality without having to know about the IOHandler-specific internals. Also added a PluginManager-based way of getting to a REPL given a language and a target. Also brought in some utility code and expression options that are useful for REPLs, such as line offsets for expressions, ANSI terminal coloring of errors, and a few IOHandler convenience functions. llvm-svn: 250753
* Move the "run" alias from process launch --shell to process launch ↵Enrico Granata2015-09-221-0/+8
| | | | | | | | | | --shell-expand-args when building on OS X The argdumper-based launching is more friendly to System Integrity Protection, and will work on older releases of OS X as well Leave non-Apple builds alone llvm-svn: 248338
* Fix tab completion for command arguments containing spacesTamas Berghammer2015-09-021-3/+3
| | | | | | | | | | | If a command argument contains a space then it have to be escaped with backslash signs so the argument parsing logic can parse it properly. This CL fixes the tab completion code for the arguments to create complitions with correctly escaped strings. Differential revision: http://reviews.llvm.org/D12531 llvm-svn: 246639
* Convert the ScriptInterpreter system to a plugin-based one.Zachary Turner2015-07-301-65/+28
| | | | | | | | | | | | | | | | | | | | | | | Previously embedded interpreters were handled as ad-hoc source files compiled into source/Interpreter. This made it hard to disable a specific interpreter, or to add support for other interpreters and allow the developer to choose which interpreter(s) were enabled for a particular build. This patch converts script interpreters over to a plugin-based system. Script interpreters now live in source/Plugins/ScriptInterpreter, and the canonical LLDB interpreter, ScriptInterpreterPython, is moved there as well. Any new code interfacing with the Python C API must live in this location from here on out. Additionally, generic code should never need to reference or make assumptions about the presence of a specific interpreter going forward. Differential Revision: http://reviews.llvm.org/D11431 Reviewed By: Greg Clayton llvm-svn: 243681
* Add UNUSED_IF_ASSERT_DISABLED and apply it.Bruce Mitchener2015-07-241-2/+1
| | | | | | | | | | | | | | | Summary: This replaces (void)x; usages where they x was subsequently involved in an assertion with this macro to make the intent more clear. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11451 llvm-svn: 243074
* Add new bugreport command to lldbTamas Berghammer2015-07-021-0/+2
| | | | | | | | | | | The new command add functionality to print out domain specific information for reporting a bug. Currently the only supported domain is stack unwinding (with "bugreport unwind") but adding new domains is fairly easy. Differential revision: http://reviews.llvm.org/D10868 llvm-svn: 241252
* Fix a variety of typos.Bruce Mitchener2015-06-181-3/+3
| | | | | | No functional change. llvm-svn: 239995
* 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
* Fixed a ton of gcc compile warningsVince Harron2015-05-131-3/+3
| | | | | | | | | | Removed some unused variables, added some consts, changed some casts to const_cast. I don't think any of these changes are very controversial. Differential Revision: http://reviews.llvm.org/D9674 llvm-svn: 237218
* Add language command and LanguageRuntime plugin changes to allow vending of ↵Colin Riley2015-05-041-0/+2
| | | | | | | | command objects. Differential Revision: http://reviews.llvm.org/D9402 llvm-svn: 236443
* Factor resolution of abbreviations and aliases so that they can be tested ↵Adrian McCarthy2015-04-231-201/+221
| | | | | | directly. http://reviews.llvm.org/D9033 llvm-svn: 235633
* Fix check for options in "command alias"Ted Woodward2015-04-061-3/+3
| | | | | | | | | | | | | | | | | Summary: "command alias" can add invalid options to the command. "command alias start process launch -s" will add an extra argument, "<no-argument>" to the alias, so it runs "process launch -s <no-argument>", which launches the process with args that include "<no-argument>". This patch changes the text compare of the variable value with "<OptionParser::eNoArgument>" to a compare of variable value_type with OptionParser::eNoArgument. It also moves the previous test inside the if, so it won't add a trailing space if there is no argument. Reviewers: clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8844 llvm-svn: 234244
* Turn off 'quit' confirmation in lldb-miIlia K2015-03-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: # Turn off interpreter.prompt-on-quit on startup (MI) # Add CommandInterpreter::SetPromptOnQuit # Add SBCommandInterpreter::GetPromptOnQuit/SetPromptOnQuit All tests pass on OS X. Test Plan: ``` -file-exec-and-symbols ~/p/hello -break-insert -f main -exec-run -interpreter-exec console quit ``` Reviewers: abidh, clayborg Reviewed By: abidh, clayborg Subscribers: lldb-commits, clayborg, abidh Differential Revision: http://reviews.llvm.org/D8444 llvm-svn: 233034
* Fix broadcasters for interpreter and process:Ilia K2015-03-171-1/+1
| | | | | | | | # Fix CommandInterpreter.Broadcaster name (it should be the same as CommandInterpreter::GetStaticBroadcasterClass()) # Prevent the same error in Process.Broadcaster # Fix SBCommandInterpreter::GetBroadcasterClass (it should call CommandInterpreter::GetStaticBroadcasterClass(), was Communication::GetStaticBroadcasterClass()) llvm-svn: 232500
* Help for _regexp-break wasn't very clear. Added more detailed explanations ↵Greg Clayton2015-03-071-2/+8
| | | | | | | | of all things that can be typed by the _regexp-break command. <rdar://problem/12281058> llvm-svn: 231537
* Further reduce header footprint of Debugger.h.Zachary Turner2015-03-041-0/+2
| | | | llvm-svn: 231202
* Fix handling of backslashes in Args parsingPavel Labath2015-03-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Presently Args::SetCommandString allows quotes to be escaped with backslash. However, the backslash itself is not removed from the argument, nor there is a way to escape the backslash itself. This leads to surprising results: "a b" c" -> 'a b', 'c' # Here we actually have an unterminated quote, but that is ignored "a b\" c" -> 'a b\" c' # We try to escape the quote. That works but the backslash is not removed. "a b\\" c" -> 'a b\\" c' # Escaping the backslash has no effect. This change changes quote handling to be more shell-like: - single quotes and backquotes are literal and there is no way to escape the closing quote or anything else inside; - inside double quotes you can use backslash to escape the closing quote and another backslash - outside any quotes, you can use backslash to escape quotes, spaces and itself. This makes the parsing more consistent with what the user is familiar and increases the probability that pasting the command line from shell to the "process launch" command "just work". Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7855 llvm-svn: 230955
OpenPOWER on IntegriCloud