From: Cerion Armour-Brown Date: Fri, 4 Mar 2005 14:20:14 +0000 (+0000) Subject: fix cmd call of switchback, and deal with return err 256 X-Git-Tag: svn/VALGRIND_3_0_1^2~329 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcc594927e0a274e66a15ebf74710632d787b6eb;p=thirdparty%2Fvalgrind.git fix cmd call of switchback, and deal with return err 256 git-svn-id: svn://svn.valgrind.org/vex/trunk@1005 --- diff --git a/VEX/switchback/binary_switchback.pl b/VEX/switchback/binary_switchback.pl index 47b2f0fdb9..1180e20095 100755 --- a/VEX/switchback/binary_switchback.pl +++ b/VEX/switchback/binary_switchback.pl @@ -144,16 +144,24 @@ sub SwitchBack { } my $TMPFILE = ".switchback_output.$n"; - print "=== Calling switchback for basic block $n ===\n"; + print "=== Calling switchback for bb $n ===\n"; - system("$SWITCHBACK $TEST.o 0 $n >& $TMPFILE"); + system("$SWITCHBACK $TEST.o $n >& $TMPFILE"); my $ret = $?; + if ($ret == 256) { + print "Error running switchback - Quitting...\n---\n"; + open(INFILE, "$TMPFILE"); + print ; + close(INFILE); + + unlink($TMPFILE) if (! DEBUG); + exit 0; + } + if ($ret & 127) { print "Ctrl-C pressed - Quitting...\n"; - if (! DEBUG) { - unlink($TMPFILE); - } + unlink($TMPFILE) if (! DEBUG); exit 0; } @@ -174,12 +182,10 @@ sub SwitchBack { my @results = ; close(INFILE); - while (!((shift @results) =~ /^---START---/)) {} + while (@results && !((shift @results) =~ /^---START---/)) {} print @results; - if (! DEBUG) { - unlink($TMPFILE); - } + unlink($TMPFILE) if (! DEBUG); return; } @@ -187,9 +193,7 @@ sub SwitchBack { my @results = ; close(INFILE); - if (! DEBUG) { - unlink($TMPFILE); - } + unlink($TMPFILE) if (! DEBUG); return @results; }