aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2008-12-01 17:21:06 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-12-03 16:36:39 -0500
commit846442c8ddc02e378e7b981f0928449ed1ff1e1f (patch)
tree83702fac4a39ecc8182557e771ca96dab83f6a1f /scripts
parentc39dd50240b97bfe4fcc49b41e1fe56675afcb94 (diff)
scripts: improve the decodecode script
kerneloops.org has been using an improved "decodecode" script, specifically it has a special marker that shows which line in the assembly the oops happened at, like this: 20: 83 e0 03 and $0x3,%eax 23: 09 d8 or %ebx,%eax 25: 85 db test %ebx,%ebx 27: 89 02 mov %eax,(%edx) 29: 74 0f je 0x3a 2b:* 3b 73 04 cmp 0x4(%ebx),%esi <-- trapping instruction 2e: 75 05 jne 0x35 30: 89 53 04 mov %edx,0x4(%ebx) 33: eb 07 jmp 0x3c 35: 89 53 08 mov %edx,0x8(%ebx) this patch updates the kernel copy to also have this functionality. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Reviewed-by: WANG Cong <wangcong@zeuux.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-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