diff options
author | Pavel Labath <labath@google.com> | 2015-03-02 12:46:22 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2015-03-02 12:46:22 +0000 |
commit | 00b7f95b122372d57b7d3f00ae435512024bb45e (patch) | |
tree | de21220b268ac58be38145b2e315040481b43080 /lldb/source/Commands | |
parent | 2689d78909e115573d85075b5030b8acd1d14c75 (diff) | |
download | bcm5719-llvm-00b7f95b122372d57b7d3f00ae435512024bb45e.tar.gz bcm5719-llvm-00b7f95b122372d57b7d3f00ae435512024bb45e.zip |
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
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectPlatform.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectWatchpoint.cpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index e87399f97ba..c07d9f3b9b9 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -487,7 +487,7 @@ CommandObjectExpression::DoExecute if (end_options) { - Args args (command, end_options - command); + Args args (llvm::StringRef(command, end_options - command)); if (!ParseOptions (args, result)) return false; diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index 959c5cd1d0d..293adcf8669 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -2142,7 +2142,7 @@ public: if (end_options) { - Args args (raw_command_line, end_options - raw_command_line); + Args args (llvm::StringRef(raw_command_line, end_options - raw_command_line)); if (!ParseOptions (args, result)) return false; } diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index bef59ca30b3..6f15c09c3f1 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -1211,7 +1211,7 @@ protected: if (end_options) { - Args args (raw_command, end_options - raw_command); + Args args (llvm::StringRef(raw_command, end_options - raw_command)); if (!ParseOptions (args, result)) return false; |