[Lldb-commits] [lldb] r234888 - Fix handling of the executable arg which contains spaces (MI)

Ilia K ki.stfu at gmail.com
Tue Apr 14 07:12:22 PDT 2015


Author: ki.stfu
Date: Tue Apr 14 09:12:22 2015
New Revision: 234888

URL: http://llvm.org/viewvc/llvm-project?rev=234888&view=rev
Log:
Fix handling of the executable arg which contains spaces (MI)

* Don't use the CMICmdArgValFile::GetFileNamePath for the CMIDriver::m_strCmdLineArgExecuteableFileNamePath
  because it wraps path with spaces into quotes what is already being done in CMIDriver::LocalDebugSessionStartupExecuteCommands
* Improve the MiSyntaxTestCase.test_lldbmi_specialchars test to catch this error
  ```
    $ bin/lldb-mi "~/p/ hello"
    (gdb)
    -file-exec-and-symbols "\"~/p/ hello\""
    ^error,msg="Command 'file-exec-and-symbols'. Target binary '\"~/p/ hello\"' is invalid. error: unable to find executable for '/"~/p/ hello/"'"
  ```


Modified:
    lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py
    lldb/trunk/tools/lldb-mi/MIDriver.cpp

Modified: lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py?rev=234888&r1=234887&r2=234888&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py (original)
+++ lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py Tue Apr 14 09:12:22 2015
@@ -40,15 +40,15 @@ class MiSyntaxTestCase(lldbmi_testcase.M
     def test_lldbmi_specialchars(self):
         """Test that 'lldb-mi --interpreter' handles complicated strings."""
 
-        self.spawnLldbMi(args = None)
-
-        # Create alias for myexe
+        # Create an alias for myexe
         complicated_myexe = "C--mpl-x file's`s @#$%^&*()_+-={}[]| name"
         os.symlink(self.myexe, complicated_myexe)
         self.addTearDownHook(lambda: os.unlink(complicated_myexe))
 
-        # Try to load executable with complicated filename
-        self.runCmd("-file-exec-and-symbols \"%s\"" % complicated_myexe)
+        self.spawnLldbMi(args = "\"%s\"" % complicated_myexe)
+
+        # Test that the executable was loaded
+        self.expect("-file-exec-and-symbols \"%s\"" % complicated_myexe, exactly = True)
         self.expect("\^done")
 
         # Check that it was loaded correctly

Modified: lldb/trunk/tools/lldb-mi/MIDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriver.cpp?rev=234888&r1=234887&r2=234888&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriver.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriver.cpp Tue Apr 14 09:12:22 2015
@@ -417,7 +417,7 @@ CMIDriver::ParseArgs(const int argc, con
             if (argFile.IsFilePath(strArg) || CMICmdArgValString(true, false, true).IsStringArg(strArg))
             {
                 bHaveExecutableFileNamePath = true;
-                m_strCmdLineArgExecuteableFileNamePath = argFile.GetFileNamePath(strArg);
+                m_strCmdLineArgExecuteableFileNamePath = strArg;
                 m_bHaveExecutableFileNamePathOnCmdLine = true;
             }
             // This argument is also check for in CMIDriverMgr::ParseArgs()





More information about the lldb-commits mailing list