[Lldb-commits] [lldb] r234554 - Fix a problem where 'process launch' was not correctly re-quoting arguments for the inferior process when handing them down for the actual launch

Enrico Granata egranata at apple.com
Thu Apr 9 18:55:57 PDT 2015


Author: enrico
Date: Thu Apr  9 20:55:57 2015
New Revision: 234554

URL: http://llvm.org/viewvc/llvm-project?rev=234554&view=rev
Log:
Fix a problem where 'process launch' was not correctly re-quoting arguments for the inferior process when handing them down for the actual launch

This covers most of rdar://20490076, but leaves one corner case still open - namely the case where we try to have arguments of the form foo\ bar (unquoted, but slashed) go through argdumper


Added:
    lldb/trunk/test/functionalities/launch_with_shellexpand/foo bar
Modified:
    lldb/trunk/source/Interpreter/Args.cpp
    lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py

Modified: lldb/trunk/source/Interpreter/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=234554&r1=234553&r2=234554&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Args.cpp (original)
+++ lldb/trunk/source/Interpreter/Args.cpp Thu Apr  9 20:55:57 2015
@@ -412,7 +412,8 @@ Args::AppendArguments (const Args &rhs)
 {
     const size_t rhs_argc = rhs.GetArgumentCount();
     for (size_t i=0; i<rhs_argc; ++i)
-        AppendArgument(rhs.GetArgumentAtIndex(i));
+        AppendArgument(rhs.GetArgumentAtIndex(i),
+                       rhs.GetArgumentQuoteCharAtIndex(i));
 }
 
 void

Modified: lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py?rev=234554&r1=234553&r2=234554&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py (original)
+++ lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py Thu Apr  9 20:55:57 2015
@@ -63,6 +63,27 @@ class LaunchWithShellExpandTestCase(Test
         self.expect("frame variable argv[4]", substrs=['file4.txy'])
         self.expect("frame variable argv[5]", substrs=['file5.tyx'], matching=False)
 
+        self.runCmd("process kill")
+
+        self.runCmd('process launch -X true -w %s -- "foo bar"' % (os.getcwd()))
+        
+        process = self.process()
+
+        self.assertTrue(process.GetState() == lldb.eStateStopped,
+                        STOPPED_DUE_TO_BREAKPOINT)
+
+        thread = process.GetThreadAtIndex (0)
+
+        self.assertTrue (thread.IsValid(),
+                         "Process stopped at 'main' should have a valid thread");
+
+        stop_reason = thread.GetStopReason()
+        
+        self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
+                         "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint");
+        
+        self.expect("frame variable argv[1]", substrs=['foo bar'])
+
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Added: lldb/trunk/test/functionalities/launch_with_shellexpand/foo bar
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/launch_with_shellexpand/foo%20bar?rev=234554&view=auto
==============================================================================
    (empty)





More information about the lldb-commits mailing list