Fixed the time command code (once again) so that it conforms to proper
Borne syntax.
Added code that generates stack traces using gdb-64 when on Sparc.


git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@7101 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/RunSafely.sh b/RunSafely.sh
index 8875f2e..b756d6a 100755
--- a/RunSafely.sh
+++ b/RunSafely.sh
@@ -27,6 +27,18 @@
 ulimit -c unlimited
 
 #
+# If we are on a sun4u machine (UltraSparc), then the code we're generating
+# is 64 bit code.  In that case, use gdb-64 instead of gdb.
+#
+myarch=`uname -m`
+if [ "$myarch" = "sun4u" ]
+then
+	GDB="gdb-64"
+else
+	GDB=gdb
+fi
+
+#
 # Run the command, timing its execution.
 # The standard output and standard error of $PROGRAM should go in $OUTFILE,
 # and the standard error of time should go in $OUTFILE.time.
@@ -36,7 +48,7 @@
 # we tell time to launch a shell which in turn executes $PROGRAM with the
 # necessary I/O redirection.
 #
-(time sh -c "$PROGRAM $* >& $OUTFILE < $INFILE") >& $OUTFILE.time
+(time sh -c "$PROGRAM $* > $OUTFILE 2>&1 < $INFILE") > $OUTFILE.time 2>&1
 
 if test $? -eq 0
 then
@@ -47,7 +59,7 @@
 then
     corefile=`ls core* | head -1`
     echo "where" > StackTrace.$$
-    gdb -q -batch --command=StackTrace.$$ --core=$corefile $PROGRAM < /dev/null
+    $GDB -q -batch --command=StackTrace.$$ --core=$corefile $PROGRAM < /dev/null
     rm -f StackTrace.$$ $corefile
 fi