Uses remote working directory for stdout redirect.

Better chance of working on Windows.


http://reviews.llvm.org/D7221

Files:
  source/Commands/CommandObjectPlatform.cpp
  test/types/AbstractBase.py

Index: source/Commands/CommandObjectPlatform.cpp
===================================================================
--- source/Commands/CommandObjectPlatform.cpp
+++ source/Commands/CommandObjectPlatform.cpp
@@ -2281,19 +2281,16 @@
     LoadSubCommand ("connect", CommandObjectSP (new 
CommandObjectPlatformConnect (interpreter)));
     LoadSubCommand ("disconnect", CommandObjectSP (new 
CommandObjectPlatformDisconnect (interpreter)));
     LoadSubCommand ("settings", CommandObjectSP (new 
CommandObjectPlatformSettings (interpreter)));
-#ifdef LLDB_CONFIGURATION_DEBUG
     LoadSubCommand ("mkdir", CommandObjectSP (new CommandObjectPlatformMkDir 
(interpreter)));
     LoadSubCommand ("file", CommandObjectSP (new CommandObjectPlatformFile 
(interpreter)));
     LoadSubCommand ("get-file", CommandObjectSP (new 
CommandObjectPlatformGetFile (interpreter)));
     LoadSubCommand ("get-size", CommandObjectSP (new 
CommandObjectPlatformGetSize (interpreter)));
     LoadSubCommand ("put-file", CommandObjectSP (new 
CommandObjectPlatformPutFile (interpreter)));
-#endif
     LoadSubCommand ("process", CommandObjectSP (new 
CommandObjectPlatformProcess (interpreter)));
     LoadSubCommand ("shell", CommandObjectSP (new CommandObjectPlatformShell 
(interpreter)));
     LoadSubCommand ("target-install", CommandObjectSP (new 
CommandObjectPlatformInstall (interpreter)));
 }
 
-
 //----------------------------------------------------------------------
 // Destructor
 //----------------------------------------------------------------------
Index: test/types/AbstractBase.py
===================================================================
--- test/types/AbstractBase.py
+++ test/types/AbstractBase.py
@@ -50,7 +50,7 @@
     #         True: build dSYM file                                            
#
     #         False: build DWARF map                                           
#
     # bc -> blockCaptured (defaulted to False)                                 
#
-    #         True: testing vars of various basic types from isnide a block    
#
+    #         True: testing vars of various basic types from inside a block    
#
     #         False: testing vars of various basic types from a function       
#
     # qd -> quotedDisplay (defaulted to False)                                 
#
     #         True: the output from 'frame var' or 'expr var' contains a pair  
#
@@ -88,7 +88,17 @@
 
         # First, capture the golden output emitted by the oracle, i.e., the
         # series of printf statements.
-        self.runCmd('process launch -o "%s"'%(self.golden_filename))
+
+        if lldb.remote_platform:
+            # process launch -o requires a path that is valid on the target
+            self.assertNotEqual(None, lldb.remote_platform_working_dir)
+            remote_path = 
'"{work}/lldb-stdout-redirect.txt"'.format(work=lldb.remote_platform_working_dir)
+            self.runCmd('process launch -o 
{remote}'.format(remote=remote_path))
+            # copy remote_path to local host
+            self.runCmd('platform get-file {remote} "{local}"'.format(
+                remote=remote_path, local=self.golden_filename))
+        else:
+            self.runCmd('process launch -o 
"{local}"'.format(local=self.golden_filename))
         with open(self.golden_filename) as f:
             go = f.read()
 
@@ -169,7 +179,19 @@
 
         # First, capture the golden output emitted by the oracle, i.e., the
         # series of printf statements.
-        self.runCmd('process launch -o "%s"'%(self.golden_filename))
+
+        # process launch command output redirect always goes to host the 
process is running on
+        if lldb.remote_platform:
+            # process launch -o requires a path that is valid on the target
+            self.assertNotEqual(None, lldb.remote_platform_working_dir)
+            remote_path = 
'"{work}/lldb-stdout-redirect.txt"'.format(work=lldb.remote_platform_working_dir)
+            self.runCmd('process launch -o 
{remote}'.format(remote=remote_path))
+            # copy remote_path to local host
+            self.runCmd('platform get-file {remote} "{local}"'.format(
+                remote=remote_path, local=self.golden_filename))
+        else:
+            self.runCmd('process launch -o 
"{local}"'.format(local=self.golden_filename))
+
         with open(self.golden_filename) as f:
             go = f.read()

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: source/Commands/CommandObjectPlatform.cpp
===================================================================
--- source/Commands/CommandObjectPlatform.cpp
+++ source/Commands/CommandObjectPlatform.cpp
@@ -2281,19 +2281,16 @@
     LoadSubCommand ("connect", CommandObjectSP (new CommandObjectPlatformConnect (interpreter)));
     LoadSubCommand ("disconnect", CommandObjectSP (new CommandObjectPlatformDisconnect (interpreter)));
     LoadSubCommand ("settings", CommandObjectSP (new CommandObjectPlatformSettings (interpreter)));
-#ifdef LLDB_CONFIGURATION_DEBUG
     LoadSubCommand ("mkdir", CommandObjectSP (new CommandObjectPlatformMkDir (interpreter)));
     LoadSubCommand ("file", CommandObjectSP (new CommandObjectPlatformFile (interpreter)));
     LoadSubCommand ("get-file", CommandObjectSP (new CommandObjectPlatformGetFile (interpreter)));
     LoadSubCommand ("get-size", CommandObjectSP (new CommandObjectPlatformGetSize (interpreter)));
     LoadSubCommand ("put-file", CommandObjectSP (new CommandObjectPlatformPutFile (interpreter)));
-#endif
     LoadSubCommand ("process", CommandObjectSP (new CommandObjectPlatformProcess (interpreter)));
     LoadSubCommand ("shell", CommandObjectSP (new CommandObjectPlatformShell (interpreter)));
     LoadSubCommand ("target-install", CommandObjectSP (new CommandObjectPlatformInstall (interpreter)));
 }
 
-
 //----------------------------------------------------------------------
 // Destructor
 //----------------------------------------------------------------------
Index: test/types/AbstractBase.py
===================================================================
--- test/types/AbstractBase.py
+++ test/types/AbstractBase.py
@@ -50,7 +50,7 @@
     #         True: build dSYM file                                            #
     #         False: build DWARF map                                           #
     # bc -> blockCaptured (defaulted to False)                                 #
-    #         True: testing vars of various basic types from isnide a block    #
+    #         True: testing vars of various basic types from inside a block    #
     #         False: testing vars of various basic types from a function       #
     # qd -> quotedDisplay (defaulted to False)                                 #
     #         True: the output from 'frame var' or 'expr var' contains a pair  #
@@ -88,7 +88,17 @@
 
         # First, capture the golden output emitted by the oracle, i.e., the
         # series of printf statements.
-        self.runCmd('process launch -o "%s"'%(self.golden_filename))
+
+        if lldb.remote_platform:
+            # process launch -o requires a path that is valid on the target
+            self.assertNotEqual(None, lldb.remote_platform_working_dir)
+            remote_path = '"{work}/lldb-stdout-redirect.txt"'.format(work=lldb.remote_platform_working_dir)
+            self.runCmd('process launch -o {remote}'.format(remote=remote_path))
+            # copy remote_path to local host
+            self.runCmd('platform get-file {remote} "{local}"'.format(
+                remote=remote_path, local=self.golden_filename))
+        else:
+            self.runCmd('process launch -o "{local}"'.format(local=self.golden_filename))
         with open(self.golden_filename) as f:
             go = f.read()
 
@@ -169,7 +179,19 @@
 
         # First, capture the golden output emitted by the oracle, i.e., the
         # series of printf statements.
-        self.runCmd('process launch -o "%s"'%(self.golden_filename))
+
+        # process launch command output redirect always goes to host the process is running on
+        if lldb.remote_platform:
+            # process launch -o requires a path that is valid on the target
+            self.assertNotEqual(None, lldb.remote_platform_working_dir)
+            remote_path = '"{work}/lldb-stdout-redirect.txt"'.format(work=lldb.remote_platform_working_dir)
+            self.runCmd('process launch -o {remote}'.format(remote=remote_path))
+            # copy remote_path to local host
+            self.runCmd('platform get-file {remote} "{local}"'.format(
+                remote=remote_path, local=self.golden_filename))
+        else:
+            self.runCmd('process launch -o "{local}"'.format(local=self.golden_filename))
+
         with open(self.golden_filename) as f:
             go = f.read()
 
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to