diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2008-12-01 17:21:06 -0500 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2008-12-03 16:36:39 -0500 |
commit | 846442c8ddc02e378e7b981f0928449ed1ff1e1f (patch) | |
tree | 83702fac4a39ecc8182557e771ca96dab83f6a1f /scripts | |
parent | c39dd50240b97bfe4fcc49b41e1fe56675afcb94 (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-x | scripts/decodecode | 32 |
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 | ||
9 | cleanup() { | 9 | cleanup() { |
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" "\("` |
45 | fi | 45 | fi |
46 | 46 | ||
47 | touch $T.oo | ||
47 | if [ $marker -ne 0 ]; then | 48 | if [ $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))-` |
57 | fi | 61 | fi |
58 | 62 | echo Code starting with the faulting instruction > $T.aa | |
63 | echo =========================================== >> $T.aa | ||
59 | code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g'` | 64 | code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g'` |
60 | echo -n " .byte 0x" > $T.s | 65 | echo -n " .byte 0x" > $T.s |
61 | echo $code >> $T.s | 66 | echo $code >> $T.s |
62 | as $AFLAGS -o $T.o $T.s | 67 | as $AFLAGS -o $T.o $T.s &> /dev/null |
63 | objdump -S $T.o | 68 | objdump -S $T.o | grep -v "Disassembly" | grep -v "/tmp" | grep -v "\.text" | grep -v "^$" &> $T.aaa |
64 | rm $T $T.s $T.o | 69 | cat $T.aaa >> $T.aa |
70 | |||
71 | faultline=`cat $T.aaa | head -1 | cut -d":" -f2` | ||
72 | |||
73 | cat $T.oo | sed -e "s/\($faultline\)/\*\1 <-- trapping instruction/g" | ||
74 | echo | ||
75 | cat $T.aa | ||
76 | cleanup | ||