[Lldb-commits] [lldb] r160130 - in /lldb/trunk: source/Host/macosx/Host.mm test/functionalities/process_launch/TestProcessLaunch.py

Filipe Cabecinhas me at filcab.net
Thu Jul 12 07:09:25 PDT 2012


Author: filcab
Date: Thu Jul 12 09:09:25 2012
New Revision: 160130

URL: http://llvm.org/viewvc/llvm-project?rev=160130&view=rev
Log:
Provide more information when process launch can't change directory to the
path passed with -w

Test this functionality.

Modified:
    lldb/trunk/source/Host/macosx/Host.mm
    lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=160130&r1=160129&r2=160130&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Thu Jul 12 09:09:25 2012
@@ -1532,7 +1532,16 @@
     if (working_dir)
     {
         // No more thread specific current working directory
-        __pthread_chdir (working_dir);
+        if (__pthread_chdir (working_dir) < 0) {
+            if (errno == ENOENT) {
+                error.SetErrorStringWithFormat("No such file or directory: %s", working_dir);
+            } else if (errno == ENOTDIR) {
+                error.SetErrorStringWithFormat("Path doesn't name a directory: %s", working_dir);
+            } else {
+                error.SetErrorStringWithFormat("An unknown error occurred when changing directory for process execution.");
+            }
+            return error;
+        }
     }
     
     const size_t num_file_actions = launch_info.GetNumFileActions ();

Modified: lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py?rev=160130&r1=160129&r2=160130&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py (original)
+++ lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py Thu Jul 12 09:09:25 2012
@@ -48,7 +48,7 @@
             pass
 
         launch_command = "process launch -i " + in_file + " -o " + out_file + " -e " + err_file
-        
+
         self.expect (launch_command,
                      patterns = [ "Process .* launched: .*a.out" ])
 
@@ -69,7 +69,7 @@
                 success = False
                 err_msg = err_msg + "    ERROR: stdout file does not contain correct output.\n"
                 out_f.close();
-            
+
         # Try to delete the 'stdout' file
         try:
             os.remove (out_file)
@@ -139,6 +139,15 @@
         except OSError:
             pass
 
+        # Check that we get an error when we have a nonexisting path
+        launch_command = "process launch -w %s -o %s -e %s" % (my_working_dir_path + 'z',
+                                                               out_file_path,
+                                                               err_file_path)
+
+        self.expect(launch_command, error=True,
+                startstr = "error: No such file or directory: %sz" % my_working_dir_path)
+
+        # Really launch the process
         launch_command = "process launch -w %s -o %s -e %s" % (my_working_dir_path,
                                                                out_file_path,
                                                                err_file_path)
@@ -164,7 +173,7 @@
                 success = False
                 err_msg = err_msg + "The current working directory was not set correctly.\n"
                 out_f.close();
-            
+
         # Try to delete the 'stdout' and 'stderr' files
         try:
             os.remove(out_file_path)





More information about the lldb-commits mailing list