llvm-project/lldb/source/Commands
Pavel Labath 00b7f95b12 Fix handling of backslashes in Args parsing
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
2015-03-02 12:46:22 +00:00
..
CMakeLists.txt Merging the iohandler branch back into main. 2014-01-27 23:43:24 +00:00
CommandCompletions.cpp Add the ability to set breakpoints with conditions, commands, etc, 2014-12-06 01:28:03 +00:00
CommandObjectApropos.cpp Apropos should search user commands as well as built-in commands. 2013-05-17 01:30:37 +00:00
CommandObjectApropos.h Make raw & parsed commands subclasses of CommandObject rather than having the raw version implement an 2012-06-08 21:56:10 +00:00
CommandObjectArgs.cpp Revert "Fix broken tests due to new error output." 2014-07-09 16:31:49 +00:00
CommandObjectArgs.h Make raw & parsed commands subclasses of CommandObject rather than having the raw version implement an 2012-06-08 21:56:10 +00:00
CommandObjectBreakpoint.cpp Refactor OptionValue::SetValueFromCString to use llvm::StringRef 2015-02-20 11:14:59 +00:00
CommandObjectBreakpoint.h Add the ability to tag one or more breakpoints with a name. These 2014-12-16 23:40:14 +00:00
CommandObjectBreakpointCommand.cpp Add the ability to tag one or more breakpoints with a name. These 2014-12-16 23:40:14 +00:00
CommandObjectBreakpointCommand.h Merging the iohandler branch back into main. 2014-01-27 23:43:24 +00:00
CommandObjectCommands.cpp Refactor OptionValue::SetValueFromCString to use llvm::StringRef 2015-02-20 11:14:59 +00:00
CommandObjectCommands.h
CommandObjectDisassemble.cpp Moved Args::StringToXIntYZ to StringConvert::ToXIntYZ 2015-01-15 20:08:35 +00:00
CommandObjectDisassemble.h Change the disassemble option to specify the architecture from '-a' 2013-04-11 03:14:01 +00:00
CommandObjectExpression.cpp Fix handling of backslashes in Args parsing 2015-03-02 12:46:22 +00:00
CommandObjectExpression.h Allow a multi-line expression to follow expression commands with options when there is no expression following the option terminating “—“. 2014-03-13 23:42:30 +00:00
CommandObjectFrame.cpp Introduce the notion of "runtime support values" 2015-02-11 02:35:39 +00:00
CommandObjectFrame.h
CommandObjectGUI.cpp Typing "gui" will crash programs that don't give LLDB a real terminal. 2015-01-14 19:45:21 +00:00
CommandObjectGUI.h Merging the iohandler branch back into main. 2014-01-27 23:43:24 +00:00
CommandObjectHelp.cpp Fix build after r226068: cannot initialize 'int' with 'nullptr_t' 2015-01-15 02:07:28 +00:00
CommandObjectHelp.h Three related changes to help: 2015-01-15 00:52:41 +00:00
CommandObjectLog.cpp Moved Args::StringToXIntYZ to StringConvert::ToXIntYZ 2015-01-15 20:08:35 +00:00
CommandObjectLog.h
CommandObjectMemory.cpp Refactor OptionValue::SetValueFromCString to use llvm::StringRef 2015-02-20 11:14:59 +00:00
CommandObjectMemory.h
CommandObjectMultiword.cpp If you try to auto-complete "target symbols<TAB>" you get "target symbolsadd" instead of "target symbols ". 2015-02-25 00:32:43 +00:00
CommandObjectPlatform.cpp Fix handling of backslashes in Args parsing 2015-03-02 12:46:22 +00:00
CommandObjectPlatform.h
CommandObjectPlugin.cpp Fixed internal code to not link against and code from "lldb/API/*". 2013-12-02 19:35:49 +00:00
CommandObjectPlugin.h Implementing plugins that provide commands. 2012-09-28 23:57:51 +00:00
CommandObjectProcess.cpp Fix Arg0 argument after r229110. The problem was that Arg0ValueChangedCallback isn't twitching when Arg0 was updated, therefore target was launched with empty 1st argument or without it at all. In this patch I update Arg0 by hand. 2015-02-13 17:07:55 +00:00
CommandObjectProcess.h
CommandObjectQuit.cpp sanitise sign comparisons 2014-04-02 03:51:35 +00:00
CommandObjectQuit.h <rdar://problem/12786725> 2013-01-17 21:36:19 +00:00
CommandObjectRegister.cpp Revert "Fix broken tests due to new error output." 2014-07-09 16:31:49 +00:00
CommandObjectRegister.h
CommandObjectSettings.cpp Handle trailing spaces on "settings set" command more correctly 2015-02-16 13:13:39 +00:00
CommandObjectSettings.h Make raw & parsed commands subclasses of CommandObject rather than having the raw version implement an 2012-06-08 21:56:10 +00:00
CommandObjectSource.cpp Change the default disassembly format again. First attempt at 2015-02-13 23:24:21 +00:00
CommandObjectSource.h
CommandObjectSyntax.cpp Break out of the command word parsing loop if we hit 2014-10-17 02:10:33 +00:00
CommandObjectSyntax.h Make raw & parsed commands subclasses of CommandObject rather than having the raw version implement an 2012-06-08 21:56:10 +00:00
CommandObjectTarget.cpp Introduce the notion of "runtime support values" 2015-02-11 02:35:39 +00:00
CommandObjectTarget.h
CommandObjectThread.cpp Add a "-a/--address" option to "thread until". You can specify one or more line numbers (as arguments) 2015-02-06 02:10:56 +00:00
CommandObjectThread.h
CommandObjectType.cpp Add commands 2014-12-05 20:59:08 +00:00
CommandObjectType.h
CommandObjectVersion.cpp Huge change to clean up types. 2013-07-11 22:46:58 +00:00
CommandObjectVersion.h Huge change to clean up types. 2013-07-11 22:46:58 +00:00
CommandObjectWatchpoint.cpp Fix handling of backslashes in Args parsing 2015-03-02 12:46:22 +00:00
CommandObjectWatchpoint.h Use the "last created watchpoint" rather than asserting on watchpoint commands passing no watchpoint ID. 2013-07-02 02:09:46 +00:00
CommandObjectWatchpointCommand.cpp Rework the way we pass "run multiple command" options to the various API's that 2014-10-11 00:38:27 +00:00
CommandObjectWatchpointCommand.h Merging the iohandler branch back into main. 2014-01-27 23:43:24 +00:00
Makefile Fix a few more clang (3.2) warnings on Linux: 2012-12-07 22:21:08 +00:00