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:
parent
225542713b
commit
bc929b80dc
|
@ -40,15 +40,15 @@ class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
|
||||||
def test_lldbmi_specialchars(self):
|
def test_lldbmi_specialchars(self):
|
||||||
"""Test that 'lldb-mi --interpreter' handles complicated strings."""
|
"""Test that 'lldb-mi --interpreter' handles complicated strings."""
|
||||||
|
|
||||||
self.spawnLldbMi(args = None)
|
# Create an alias for myexe
|
||||||
|
|
||||||
# Create alias for myexe
|
|
||||||
complicated_myexe = "C--mpl-x file's`s @#$%^&*()_+-={}[]| name"
|
complicated_myexe = "C--mpl-x file's`s @#$%^&*()_+-={}[]| name"
|
||||||
os.symlink(self.myexe, complicated_myexe)
|
os.symlink(self.myexe, complicated_myexe)
|
||||||
self.addTearDownHook(lambda: os.unlink(complicated_myexe))
|
self.addTearDownHook(lambda: os.unlink(complicated_myexe))
|
||||||
|
|
||||||
# Try to load executable with complicated filename
|
self.spawnLldbMi(args = "\"%s\"" % complicated_myexe)
|
||||||
self.runCmd("-file-exec-and-symbols \"%s\"" % complicated_myexe)
|
|
||||||
|
# Test that the executable was loaded
|
||||||
|
self.expect("-file-exec-and-symbols \"%s\"" % complicated_myexe, exactly = True)
|
||||||
self.expect("\^done")
|
self.expect("\^done")
|
||||||
|
|
||||||
# Check that it was loaded correctly
|
# Check that it was loaded correctly
|
||||||
|
|
|
@ -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))
|
if (argFile.IsFilePath(strArg) || CMICmdArgValString(true, false, true).IsStringArg(strArg))
|
||||||
{
|
{
|
||||||
bHaveExecutableFileNamePath = true;
|
bHaveExecutableFileNamePath = true;
|
||||||
m_strCmdLineArgExecuteableFileNamePath = argFile.GetFileNamePath(strArg);
|
m_strCmdLineArgExecuteableFileNamePath = strArg;
|
||||||
m_bHaveExecutableFileNamePathOnCmdLine = true;
|
m_bHaveExecutableFileNamePathOnCmdLine = true;
|
||||||
}
|
}
|
||||||
// This argument is also check for in CMIDriverMgr::ParseArgs()
|
// This argument is also check for in CMIDriverMgr::ParseArgs()
|
||||||
|
|
Loading…
Reference in New Issue