diff options
-rw-r--r-- | scripts/decodecode | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/decodecode b/scripts/decodecode index 1e1a8f620c47..235d3938529d 100644 --- a/scripts/decodecode +++ b/scripts/decodecode | |||
@@ -6,7 +6,19 @@ | |||
6 | # e.g., to decode an i386 oops on an x86_64 system, use: | 6 | # e.g., to decode an i386 oops on an x86_64 system, use: |
7 | # AFLAGS=--32 decodecode < 386.oops | 7 | # AFLAGS=--32 decodecode < 386.oops |
8 | 8 | ||
9 | T=`mktemp` | 9 | cleanup() { |
10 | rm -f $T $T.s $T.o | ||
11 | exit 1 | ||
12 | } | ||
13 | |||
14 | die() { | ||
15 | echo "$@" | ||
16 | exit 1 | ||
17 | } | ||
18 | |||
19 | trap cleanup EXIT | ||
20 | |||
21 | T=`mktemp` || die "cannot create temp file" | ||
10 | code= | 22 | code= |
11 | 23 | ||
12 | while read i ; do | 24 | while read i ; do |
@@ -20,6 +32,7 @@ esac | |||
20 | done | 32 | done |
21 | 33 | ||
22 | if [ -z "$code" ]; then | 34 | if [ -z "$code" ]; then |
35 | rm $T | ||
23 | exit | 36 | exit |
24 | fi | 37 | fi |
25 | 38 | ||
@@ -48,4 +61,4 @@ echo -n " .byte 0x" > $T.s | |||
48 | echo $code >> $T.s | 61 | echo $code >> $T.s |
49 | as $AFLAGS -o $T.o $T.s | 62 | as $AFLAGS -o $T.o $T.s |
50 | objdump -S $T.o | 63 | objdump -S $T.o |
51 | rm $T.o $T.s | 64 | rm $T $T.s $T.o |