[llvm-commits] CVS: llvm/lib/System/Unix/Program.inc

Reid Spencer reid at x10sys.com
Thu Dec 22 12:00:27 PST 2005



Changes in directory llvm/lib/System/Unix:

Program.inc updated: 1.15 -> 1.16
---
Log message:

For PR351: http://llvm.cs.uiuc.edu/PR351 :
* Allow the ExecuteAndWait to return negative values if a signal is 
  detected as the reason for the child termination. This is needed to 
  support bugpoint detecting bad things in its child processes.


---
Diffs of the changes:  (+12 -7)

 Program.inc |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)


Index: llvm/lib/System/Unix/Program.inc
diff -u llvm/lib/System/Unix/Program.inc:1.15 llvm/lib/System/Unix/Program.inc:1.16
--- llvm/lib/System/Unix/Program.inc:1.15	Thu Jul  7 18:21:43 2005
+++ llvm/lib/System/Unix/Program.inc	Thu Dec 22 14:00:16 2005
@@ -209,17 +209,22 @@
     sigaction(SIGALRM, &Old, 0);
   }
 
-  // If the program exited normally with a zero exit status, return success!
+  // Return the proper exit status. 0=success, >0 is programs' exit status,
+  // <0 means a signal was returned, -9999999 means the program dumped core.
+  int result = 0;
   if (WIFEXITED (status))
-    return WEXITSTATUS(status);
+    result = WEXITSTATUS(status);
   else if (WIFSIGNALED(status))
-    return 1;
-    
+    result = 0 - WTERMSIG(status);
+#ifdef WCOREDUMP
+  if (WCOREDUMP(status))
+    result |= 0x01000000;
+#endif
+  return result;
 #else
-  throw std::string(
-    "Program::ExecuteAndWait not implemented on this platform!\n");
+  return -99;
 #endif
-  return 0;
+    
 }
 
 }






More information about the llvm-commits mailing list