diff options
author | Greg Clayton <gclayton@apple.com> | 2013-03-06 02:19:38 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-03-06 02:19:38 +0000 |
commit | 21c895e3d50399c696867f904915accc38bbecce (patch) | |
tree | 93ea4e51337688ccd25fee41cd8850bfc4e680d9 | |
parent | ff2a3ad81b8e39802a4e5bd61a8e2b848b73737f (diff) | |
download | bcm5719-llvm-21c895e3d50399c696867f904915accc38bbecce.tar.gz bcm5719-llvm-21c895e3d50399c696867f904915accc38bbecce.zip |
Now that "settings set" will strip leading and trailing spaces, we need a way to be able to specify string values that contain spaces. So now settings setting <property> <value>" can have a <value> that is quoted:
settings set prompt "(lldb2) "
llvm-svn: 176545
-rw-r--r-- | lldb/source/Interpreter/OptionValueString.cpp | 22 | ||||
-rw-r--r-- | lldb/test/functionalities/abbreviation/TestAbbreviations.py | 2 | ||||
-rw-r--r-- | lldb/test/functionalities/abbreviation/change_prompt.lldb | 3 |
3 files changed, 24 insertions, 3 deletions
diff --git a/lldb/source/Interpreter/OptionValueString.cpp b/lldb/source/Interpreter/OptionValueString.cpp index 91a980340ad..df047bd9899 100644 --- a/lldb/source/Interpreter/OptionValueString.cpp +++ b/lldb/source/Interpreter/OptionValueString.cpp @@ -55,6 +55,28 @@ OptionValueString::SetValueFromCString (const char *value_cstr, VarSetOperationType op) { Error error; + + std::string value_str_no_quotes; + if (value_cstr) + { + switch (value_cstr[0]) + { + case '"': + case '\'': + { + size_t len = strlen(value_cstr); + if (len <= 1 || value_cstr[len-1] != value_cstr[0]) + { + error.SetErrorString("mismatched quotes"); + return error; + } + value_str_no_quotes.assign (value_cstr + 1, len - 2); + value_cstr = value_str_no_quotes.c_str(); + } + break; + } + } + switch (op) { case eVarSetOperationInvalid: diff --git a/lldb/test/functionalities/abbreviation/TestAbbreviations.py b/lldb/test/functionalities/abbreviation/TestAbbreviations.py index e621738f3d3..e9247cce5c0 100644 --- a/lldb/test/functionalities/abbreviation/TestAbbreviations.py +++ b/lldb/test/functionalities/abbreviation/TestAbbreviations.py @@ -62,7 +62,7 @@ class AbbreviationsTestCase(TestBase): self.expect("lo li", startstr = "Logging categories for ") - self.runCmd("se se prompt Sycamore> ") + self.runCmd("se se prompt 'Sycamore> '") self.expect("se sh prompt", startstr = 'prompt (string) = "Sycamore> "') diff --git a/lldb/test/functionalities/abbreviation/change_prompt.lldb b/lldb/test/functionalities/abbreviation/change_prompt.lldb index 13e47ae95a7..116db1d7117 100644 --- a/lldb/test/functionalities/abbreviation/change_prompt.lldb +++ b/lldb/test/functionalities/abbreviation/change_prompt.lldb @@ -1,2 +1 @@ -settings set prompt [with-three-trailing-spaces] - +settings set prompt "[with-three-trailing-spaces] "
\ No newline at end of file |