[Lldb-commits] [lldb] r169753 - /lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp

Greg Clayton gclayton at apple.com
Mon Dec 10 11:43:43 PST 2012


Author: gclayton
Date: Mon Dec 10 13:43:43 2012
New Revision: 169753

URL: http://llvm.org/viewvc/llvm-project?rev=169753&view=rev
Log:
<rdar://problem/12827031>

Fix the OptionValueFileSpec option value to correctly get the file path when trailing spaces are on the path. The "settings set" command uses the OptionValueFileSpec class to set file paths and if extra spaces are at the end it will include those in the paths. Now we chop up the value send to to OptionValueFileSpec::SetValueFromCString(...) function with "lldb_private::Args" and give an appropriate error if more than one path is used. It also allows for quotes to be used when specifying the path.


Modified:
    lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp

Modified: lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp?rev=169753&r1=169752&r2=169753&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp Mon Dec 10 13:43:43 2012
@@ -94,8 +94,17 @@
     case eVarSetOperationAssign:
         if (value_cstr && value_cstr[0])
         {
-            m_value_was_set = true;
-            m_current_value.SetFile(value_cstr, value_cstr[0] == '~');
+            Args args(value_cstr);
+            if (args.GetArgumentCount() == 1)
+            {
+                const char *path = args.GetArgumentAtIndex(0);
+                m_value_was_set = true;
+                m_current_value.SetFile(path, true);
+            }
+            else
+            {
+                error.SetErrorString("please supply a single path argument for this file or quote the path if it contains spaces");
+            }
         }
         else
         {





More information about the lldb-commits mailing list