diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-06-01 11:55:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-06-01 11:55:52 -0400 |
commit | 1f73897861b8ef0be64ff4b801f8d6f830f683b5 (patch) | |
tree | b4bae8f12e1422113910d8cb00a19d010dc4a52f /scripts/decodecode | |
parent | b904d7131d116900524bd36ec170dcd97846bfd3 (diff) | |
parent | 64ffc9ff424c65adcffe7d590018cc75e2d5d42a (diff) |
Merge branch 'for-35' of git://repo.or.cz/linux-kbuild
* 'for-35' of git://repo.or.cz/linux-kbuild: (81 commits)
kbuild: Revert part of e8d400a to resolve a conflict
kbuild: Fix checking of scm-identifier variable
gconfig: add support to show hidden options that have prompts
menuconfig: add support to show hidden options which have prompts
gconfig: remove show_debug option
gconfig: remove dbg_print_ptype() and dbg_print_stype()
kconfig: fix zconfdump()
kconfig: some small fixes
add random binaries to .gitignore
kbuild: Include gen_initramfs_list.sh and the file list in the .d file
kconfig: recalc symbol value before showing search results
.gitignore: ignore *.lzo files
headerdep: perlcritic warning
scripts/Makefile.lib: Align the output of LZO
kbuild: Generate modules.builtin in make modules_install
Revert "kbuild: specify absolute paths for cscope"
kbuild: Do not unnecessarily regenerate modules.builtin
headers_install: use local file handles
headers_check: fix perl warnings
export_report: fix perl warnings
...
Diffstat (limited to 'scripts/decodecode')
-rwxr-xr-x | scripts/decodecode | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/scripts/decodecode b/scripts/decodecode index 4b00647814bc..8b30cc36744f 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 $T.oo $T.aa $T.aaa | 10 | rm -f $T $T.s $T.o $T.oo $T.aa $T.dis |
11 | exit 1 | 11 | exit 1 |
12 | } | 12 | } |
13 | 13 | ||
@@ -39,6 +39,29 @@ fi | |||
39 | echo $code | 39 | echo $code |
40 | code=`echo $code | sed -e 's/.*Code: //'` | 40 | code=`echo $code | sed -e 's/.*Code: //'` |
41 | 41 | ||
42 | width=`expr index "$code" ' '` | ||
43 | width=$[($width-1)/2] | ||
44 | case $width in | ||
45 | 1) type=byte ;; | ||
46 | 2) type=2byte ;; | ||
47 | 4) type=4byte ;; | ||
48 | esac | ||
49 | |||
50 | disas() { | ||
51 | ${CROSS_COMPILE}as $AFLAGS -o $1.o $1.s &> /dev/null | ||
52 | |||
53 | if [ "$ARCH" == "arm" ]; then | ||
54 | if [ $width == 2 ]; then | ||
55 | OBJDUMPFLAGS="-M force-thumb" | ||
56 | fi | ||
57 | |||
58 | ${CROSS_COMPILE}strip $1.o | ||
59 | fi | ||
60 | |||
61 | ${CROSS_COMPILE}objdump $OBJDUMPFLAGS -S $1.o | \ | ||
62 | grep -v "/tmp\|Disassembly\|\.text\|^$" &> $1.dis | ||
63 | } | ||
64 | |||
42 | marker=`expr index "$code" "\<"` | 65 | marker=`expr index "$code" "\<"` |
43 | if [ $marker -eq 0 ]; then | 66 | if [ $marker -eq 0 ]; then |
44 | marker=`expr index "$code" "\("` | 67 | marker=`expr index "$code" "\("` |
@@ -49,26 +72,25 @@ if [ $marker -ne 0 ]; then | |||
49 | echo All code >> $T.oo | 72 | echo All code >> $T.oo |
50 | echo ======== >> $T.oo | 73 | echo ======== >> $T.oo |
51 | beforemark=`echo "$code"` | 74 | beforemark=`echo "$code"` |
52 | echo -n " .byte 0x" > $T.s | 75 | echo -n " .$type 0x" > $T.s |
53 | echo $beforemark | sed -e 's/ /,0x/g' | sed -e 's/<//g' | sed -e 's/>//g' >> $T.s | 76 | echo $beforemark | sed -e 's/ /,0x/g; s/[<>()]//g' >> $T.s |
54 | as $AFLAGS -o $T.o $T.s &> /dev/null | 77 | disas $T |
55 | objdump -S $T.o | grep -v "/tmp" | grep -v "Disassembly" | grep -v "\.text" | grep -v "^$" &> $T.ooo | 78 | cat $T.dis >> $T.oo |
56 | cat $T.ooo >> $T.oo | 79 | rm -f $T.o $T.s $T.dis |
57 | rm -f $T.o $T.s $T.ooo | ||
58 | 80 | ||
59 | # and fix code at-and-after marker | 81 | # and fix code at-and-after marker |
60 | code=`echo "$code" | cut -c$((${marker} + 1))-` | 82 | code=`echo "$code" | cut -c$((${marker} + 1))-` |
61 | fi | 83 | fi |
62 | echo Code starting with the faulting instruction > $T.aa | 84 | echo Code starting with the faulting instruction > $T.aa |
63 | echo =========================================== >> $T.aa | 85 | echo =========================================== >> $T.aa |
64 | code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g'` | 86 | code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g; s/[>)]$//'` |
65 | echo -n " .byte 0x" > $T.s | 87 | echo -n " .$type 0x" > $T.s |
66 | echo $code >> $T.s | 88 | echo $code >> $T.s |
67 | as $AFLAGS -o $T.o $T.s &> /dev/null | 89 | disas $T |
68 | objdump -S $T.o | grep -v "Disassembly" | grep -v "/tmp" | grep -v "\.text" | grep -v "^$" &> $T.aaa | 90 | cat $T.dis >> $T.aa |
69 | cat $T.aaa >> $T.aa | ||
70 | 91 | ||
71 | faultline=`cat $T.aaa | head -1 | cut -d":" -f2` | 92 | faultline=`cat $T.dis | head -1 | cut -d":" -f2` |
93 | faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'` | ||
72 | 94 | ||
73 | cat $T.oo | sed -e "s/\($faultline\)/\*\1 <-- trapping instruction/g" | 95 | cat $T.oo | sed -e "s/\($faultline\)/\*\1 <-- trapping instruction/g" |
74 | echo | 96 | echo |