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/"'"
  ```

llvm-svn: 234888
This commit is contained in:
Ilia K 2015-04-14 14:12:22 +00:00
parent 225542713b
commit bc929b80dc
2 changed files with 6 additions and 6 deletions

View File

@ -40,15 +40,15 @@ class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
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

View File

@ -417,7 +417,7 @@ CMIDriver::ParseArgs(const int argc, const char *argv[], FILE *vpStdOut, bool &v
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()