diff options
author | Hui Zhu <hui.zhu@windriver.com> | 2010-01-28 01:58:02 -0500 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-02-02 08:33:56 -0500 |
commit | 0139f1d9539395ca341e17060ae26f44f5f31434 (patch) | |
tree | 7e09135e69126119f50a50f3dfcf961fc38790af /scripts/markup_oops.pl | |
parent | 94a47083522ec4bcfc03134ebe908f1bfb393057 (diff) |
markup_oops.pl: fix for faulting instruction in the first line of a range
I got a "No matching code found" when I use markup_oops.pl parse a error
in a x86_64 module.
cat e.c
int init_module(void)
{
char *buf = 0;
buf[0] = 3;
return 0;
}
void cleanup_module(void)
{
//char *buf = 0;
//buf[0] = 3;
}
MODULE_AUTHOR("Hui Zhu");
MODULE_LICENSE("GPL");
0000000000000000 <init_module>:
init_module():
/home/teawater/study/kernel/stack2core/example/e.c:10
0: c6 04 25 00 00 00 00 movb $0x3,0x0
7: 03
/home/teawater/study/kernel/stack2core/example/e.c:13
8: 31 c0 xor %eax,%eax
a: c3 retq
b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
0000000000000010 <cleanup_module>:
cleanup_module():
/home/teawater/study/kernel/stack2core/example/e.c:20
10: f3 c3 repz retq
12: 90 nop
13: 90 nop
Disassembly of section .modinfo:
This is because the faulting instruction "movb $0x3,0x0" is the first
line of the range.
In the markup_oops.pl:
main::(./scripts/markup_oops.pl:245):
245: if (InRange($1, $target)) {
DB<2> p $line
ffffffffa001b000: c6 04 25 00 00 00 00 movb $0x3,0x0
DB<3> p $counter
0
It just set $center in next loop. So it cannot get the $center.
And even if $center is set to the right value 0.
if ($center == 0) {
print "No matching code found \n";
exit;
}
The first line $center will be 0, so I change the default value to -1.
Signed-off-by: Hui Zhu <teawater@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/markup_oops.pl')
-rw-r--r-- | scripts/markup_oops.pl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index ce3e40b01e48..4a95539c807a 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl | |||
@@ -204,7 +204,7 @@ if ($module ne "") { | |||
204 | 204 | ||
205 | my $counter = 0; | 205 | my $counter = 0; |
206 | my $state = 0; | 206 | my $state = 0; |
207 | my $center = 0; | 207 | my $center = -1; |
208 | my @lines; | 208 | my @lines; |
209 | my @reglines; | 209 | my @reglines; |
210 | 210 | ||
@@ -236,7 +236,8 @@ while (<FILE>) { | |||
236 | $state = 1; | 236 | $state = 1; |
237 | } | 237 | } |
238 | } | 238 | } |
239 | } else { | 239 | } |
240 | if ($state == 1) { | ||
240 | if ($line =~ /^([a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]+)\:/) { | 241 | if ($line =~ /^([a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]+)\:/) { |
241 | my $val = $1; | 242 | my $val = $1; |
242 | if (!InRange($val, $target)) { | 243 | if (!InRange($val, $target)) { |
@@ -259,7 +260,7 @@ if ($counter == 0) { | |||
259 | exit; | 260 | exit; |
260 | } | 261 | } |
261 | 262 | ||
262 | if ($center == 0) { | 263 | if ($center == -1) { |
263 | print "No matching code found \n"; | 264 | print "No matching code found \n"; |
264 | exit; | 265 | exit; |
265 | } | 266 | } |