diff options
| author | Ilia K <ki.stfu@gmail.com> | 2015-04-14 14:12:22 +0000 |
|---|---|---|
| committer | Ilia K <ki.stfu@gmail.com> | 2015-04-14 14:12:22 +0000 |
| commit | bc929b80dc5a1a7112015854ed3301c56203adbb (patch) | |
| tree | cf47be9798027508f4a4a017709f868be7794f1f | |
| parent | 225542713b0d5e1c42055e0e77bc56c140100d75 (diff) | |
| download | llvm-bc929b80dc5a1a7112015854ed3301c56203adbb.zip llvm-bc929b80dc5a1a7112015854ed3301c56203adbb.tar.gz llvm-bc929b80dc5a1a7112015854ed3301c56203adbb.tar.bz2 | |
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
| -rw-r--r-- | lldb/test/tools/lldb-mi/syntax/TestMiSyntax.py | 10 | ||||
| -rw-r--r-- | lldb/tools/lldb-mi/MIDriver.cpp | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lldb/test/tools/lldb-mi/syntax/TestMiSyntax.py b/lldb/test/tools/lldb-mi/syntax/TestMiSyntax.py index 692082d..d1e5cf5 100644 --- a/lldb/test/tools/lldb-mi/syntax/TestMiSyntax.py +++ b/lldb/test/tools/lldb-mi/syntax/TestMiSyntax.py @@ -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 diff --git a/lldb/tools/lldb-mi/MIDriver.cpp b/lldb/tools/lldb-mi/MIDriver.cpp index 21182af..0aba650 100644 --- a/lldb/tools/lldb-mi/MIDriver.cpp +++ b/lldb/tools/lldb-mi/MIDriver.cpp @@ -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() |
