All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hui Zhu <hui.zhu@windriver.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	ozan@pardus.org.tr, Matthew Wilcox <willy@linux.intel.com>,
	linux-kernel@vger.kernel.org, teawater@gmail.com
Subject: [PATCH] markup_oops.pl: fix get "No matching code found" when first line of range is the faulting instruction
Date: Thu, 28 Jan 2010 14:58:02 +0800	[thread overview]
Message-ID: <4B61357A.5080001@windriver.com> (raw)

Sorry guys, the prev mail for this patch is ugly.
I make a new mail for it.

I got a "No matching code found" when I use markup_oops.pl parse a error in a x8664 module.

cat e.c
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>


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;
}

So I make a patch change this part to:
	}
	if ($state == 1) {
And this is another part is not OK too:
if ($center == 0) {
The first line $center will be 0, so I change the default value and decide to:
my $center  = -1;
if ($center == -1) {

Thanks,
Hui

Signed-off-by: Hui Zhu <teawater@gmail.com>

---
 scripts/markup_oops.pl |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/scripts/markup_oops.pl
+++ b/scripts/markup_oops.pl
@@ -214,7 +214,7 @@ if ($module ne "") {
 
 my $counter = 0;
 my $state   = 0;
-my $center  = 0;
+my $center  = -1;
 my @lines;
 my @reglines;
 
@@ -246,7 +246,8 @@ while (<FILE>) {
 				$state = 1;
 			}
 		}
-	} else {
+	}
+	if ($state == 1) {
 		if ($line =~ /^([a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]+)\:/) {
 			my $val = $1;
 			if (!InRange($val, $target)) {
@@ -269,7 +270,7 @@ if ($counter == 0) {
 	exit;
 }
 
-if ($center == 0) {
+if ($center == -1) {
 	print "No matching code found \n";
 	exit;
 }

             reply	other threads:[~2010-01-28  6:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-28  6:58 Hui Zhu [this message]
2010-01-28 18:12 ` [PATCH] markup_oops.pl: fix get "No matching code found" when first line of range is the faulting instruction Sam Ravnborg
2010-01-29  4:03   ` Hui Zhu
     [not found]     ` <1264739206.10856.8.camel@Joe-Laptop.home>
2010-01-29  5:45       ` Hui Zhu
2010-01-29 13:31         ` Michal Marek
2010-01-29 13:13   ` Michal Marek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B61357A.5080001@windriver.com \
    --to=hui.zhu@windriver.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ozan@pardus.org.tr \
    --cc=sam@ravnborg.org \
    --cc=teawater@gmail.com \
    --cc=willy@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.