aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/decodecode32
1 files changed, 22 insertions, 10 deletions
diff --git a/scripts/decodecode b/scripts/decodecode
index 235d3938529d..4b00647814bc 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -7,7 +7,7 @@
7# AFLAGS=--32 decodecode < 386.oops 7# AFLAGS=--32 decodecode < 386.oops
8 8
9cleanup() { 9cleanup() {
10 rm -f $T $T.s $T.o 10 rm -f $T $T.s $T.o $T.oo $T.aa $T.aaa
11 exit 1 11 exit 1
12} 12}
13 13
@@ -44,21 +44,33 @@ if [ $marker -eq 0 ]; then
44 marker=`expr index "$code" "\("` 44 marker=`expr index "$code" "\("`
45fi 45fi
46 46
47touch $T.oo
47if [ $marker -ne 0 ]; then 48if [ $marker -ne 0 ]; then
48 beforemark=`echo "$code" | cut -c-$((${marker} - 1))` 49 echo All code >> $T.oo
50 echo ======== >> $T.oo
51 beforemark=`echo "$code"`
49 echo -n " .byte 0x" > $T.s 52 echo -n " .byte 0x" > $T.s
50 echo $beforemark | sed -e 's/ /,0x/g' >> $T.s 53 echo $beforemark | sed -e 's/ /,0x/g' | sed -e 's/<//g' | sed -e 's/>//g' >> $T.s
51 as $AFLAGS -o $T.o $T.s 54 as $AFLAGS -o $T.o $T.s &> /dev/null
52 objdump -S $T.o 55 objdump -S $T.o | grep -v "/tmp" | grep -v "Disassembly" | grep -v "\.text" | grep -v "^$" &> $T.ooo
53 rm $T.o $T.s 56 cat $T.ooo >> $T.oo
57 rm -f $T.o $T.s $T.ooo
54 58
55# and fix code at-and-after marker 59# and fix code at-and-after marker
56 code=`echo "$code" | cut -c$((${marker} + 1))-` 60 code=`echo "$code" | cut -c$((${marker} + 1))-`
57fi 61fi
58 62echo Code starting with the faulting instruction > $T.aa
63echo =========================================== >> $T.aa
59code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g'` 64code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g'`
60echo -n " .byte 0x" > $T.s 65echo -n " .byte 0x" > $T.s
61echo $code >> $T.s 66echo $code >> $T.s
62as $AFLAGS -o $T.o $T.s 67as $AFLAGS -o $T.o $T.s &> /dev/null
63objdump -S $T.o 68objdump -S $T.o | grep -v "Disassembly" | grep -v "/tmp" | grep -v "\.text" | grep -v "^$" &> $T.aaa
64rm $T $T.s $T.o 69cat $T.aaa >> $T.aa
70
71faultline=`cat $T.aaa | head -1 | cut -d":" -f2`
72
73cat $T.oo | sed -e "s/\($faultline\)/\*\1 <-- trapping instruction/g"
74echo
75cat $T.aa
76cleanup