aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/markup_oops.pl
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2009-02-15 05:30:55 -0500
committerSam Ravnborg <sam@ravnborg.org>2009-02-15 06:50:10 -0500
commit11df65c3c6f7fdc837a5be8787d31011e8bb93c1 (patch)
tree83447de3b35d2c211ccae7046b8ca8365a948776 /scripts/markup_oops.pl
parentc19ef7fd8e534c870166213e9e30de9c44b34a76 (diff)
scripts: add x86 64 bit support to the markup_oops.pl script
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/markup_oops.pl')
-rw-r--r--scripts/markup_oops.pl59
1 files changed, 55 insertions, 4 deletions
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl
index bb2046891c9..528492bcba5 100644
--- a/scripts/markup_oops.pl
+++ b/scripts/markup_oops.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl -w 1#!/usr/bin/perl
2 2
3use File::Basename; 3use File::Basename;
4 4
@@ -29,7 +29,7 @@ my $filename = $vmlinux_name;
29my $target = "0"; 29my $target = "0";
30my $function; 30my $function;
31my $module = ""; 31my $module = "";
32my $func_offset; 32my $func_offset = 0;
33my $vmaoffset = 0; 33my $vmaoffset = 0;
34 34
35my %regs; 35my %regs;
@@ -49,6 +49,39 @@ sub parse_x86_regs
49 $regs{"%edi"} = $2; 49 $regs{"%edi"} = $2;
50 $regs{"%esp"} = $4; 50 $regs{"%esp"} = $4;
51 } 51 }
52 if ($line =~ /RAX: ([0-9a-f]+) RBX: ([0-9a-f]+) RCX: ([0-9a-f]+)/) {
53 $regs{"%eax"} = $1;
54 $regs{"%ebx"} = $2;
55 $regs{"%ecx"} = $3;
56 }
57 if ($line =~ /RDX: ([0-9a-f]+) RSI: ([0-9a-f]+) RDI: ([0-9a-f]+)/) {
58 $regs{"%edx"} = $1;
59 $regs{"%esi"} = $2;
60 $regs{"%edi"} = $3;
61 }
62 if ($line =~ /RBP: ([0-9a-f]+) R08: ([0-9a-f]+) R09: ([0-9a-f]+)/) {
63 $regs{"%r08"} = $2;
64 $regs{"%r09"} = $3;
65 }
66 if ($line =~ /R10: ([0-9a-f]+) R11: ([0-9a-f]+) R12: ([0-9a-f]+)/) {
67 $regs{"%r10"} = $1;
68 $regs{"%r11"} = $2;
69 $regs{"%r12"} = $3;
70 }
71 if ($line =~ /R13: ([0-9a-f]+) R14: ([0-9a-f]+) R15: ([0-9a-f]+)/) {
72 $regs{"%r13"} = $1;
73 $regs{"%r14"} = $2;
74 $regs{"%r15"} = $3;
75 }
76}
77
78sub reg_name
79{
80 my ($reg) = @_;
81 $reg =~ s/r(.)x/e\1x/;
82 $reg =~ s/r(.)i/e\1i/;
83 $reg =~ s/r(.)p/e\1p/;
84 return $reg;
52} 85}
53 86
54sub process_x86_regs 87sub process_x86_regs
@@ -83,10 +116,18 @@ sub process_x86_regs
83 } 116 }
84 117
85 foreach $reg (keys(%regs)) { 118 foreach $reg (keys(%regs)) {
119 my $clobberprime = reg_name($clobber);
120 my $lastwordprime = reg_name($lastword);
86 my $val = $regs{$reg}; 121 my $val = $regs{$reg};
122 if ($val =~ /^[0]+$/) {
123 $val = "0";
124 } else {
125 $val =~ s/^0*//;
126 }
127
87 # first check if we're clobbering this register; if we do 128 # first check if we're clobbering this register; if we do
88 # we print it with a =>, and then delete its value 129 # we print it with a =>, and then delete its value
89 if ($clobber =~ /$reg/) { 130 if ($clobber =~ /$reg/ || $clobberprime =~ /$reg/) {
90 if (length($val) > 0) { 131 if (length($val) > 0) {
91 $str = $str . " $reg => $val "; 132 $str = $str . " $reg => $val ";
92 } 133 }
@@ -94,7 +135,7 @@ sub process_x86_regs
94 $val = ""; 135 $val = "";
95 } 136 }
96 # now check if we're reading this register 137 # now check if we're reading this register
97 if ($lastword =~ /$reg/) { 138 if ($lastword =~ /$reg/ || $lastwordprime =~ /$reg/) {
98 if (length($val) > 0) { 139 if (length($val) > 0) {
99 $str = $str . " $reg = $val "; 140 $str = $str . " $reg = $val ";
100 } 141 }
@@ -109,15 +150,25 @@ while (<STDIN>) {
109 if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) { 150 if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) {
110 $target = $1; 151 $target = $1;
111 } 152 }
153 if ($line =~ /RIP: 0010:\[\<([a-z0-9]+)\>\]/) {
154 $target = $1;
155 }
112 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { 156 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) {
113 $function = $1; 157 $function = $1;
114 $func_offset = $2; 158 $func_offset = $2;
115 } 159 }
160 if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) {
161 $function = $1;
162 $func_offset = $2;
163 }
116 164
117 # check if it's a module 165 # check if it's a module
118 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { 166 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) {
119 $module = $3; 167 $module = $3;
120 } 168 }
169 if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) {
170 $module = $3;
171 }
121 parse_x86_regs($line); 172 parse_x86_regs($line);
122} 173}
123 174