Re: Subject: Re: make checkstack on m68k

From: Jörn Engel
Date: Thu Jun 17 2004 - 13:47:57 EST


On Thu, 17 June 2004 18:43:18 +1000, Finn Thain wrote:
> To: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>,
> Linux/m68k <linux-m68k@xxxxxxxxxxxxxxxxxxxx>,
> Matt Mackall <mpm@xxxxxxxxxxx>,
> Linux Kernel Development <linux-kernel@xxxxxxxxxxxxxxx>

Who are you replying to again? ;)

> Jörn Engel wrote:
>
> > On Wed, 16 June 2004 18:51:03 +0200, Geert Uytterhoeven wrote:
> > >
> > > @@ -40,6 +40,11 @@
> > > } elsif ($arch =~ /^ia64$/) {
> > > #e0000000044011fc: 01 0f fc 8c adds r12=-384,r12
> > > $re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;
> > > + } elsif ($arch =~ /^m68k$/) {
> > > + #2b6c: 4e56 fb70 linkw %fp,#-1168
> > > + #$re = qr/.*linkw %fp,#-([0-9]{1,4})/o;
> > > + #1df770: defc ffe4 addaw #-28,%sp
> > > + $re = qr/.*addaw #-([0-9]{1,4}),%sp/o;
> >
> > For i386 I used a really ugly hack, but this needs someone with better
> > perl skills. Matt, can you find a nice regex? If it adds more
> > brackets, that's fine. We'll just add empty brackets to the other
> > regexes and use $2 instead of $1 or so.
>
> There is no nice way to do this in perl in a single regex and have the
> result always in $1 or always in $2. So you would test for undef in one
> and use the other. But then the other arch regexes that capture more than
> one cluster would need to be rewritten to use (?: ) syntax to get
> clustering without capturing (see man perlre) so as to leave $2 undefined.
>
> A list of regexes for each arch would be nice. But should probably be
> left until needed. Following is probably the simplest way. The regexes
> remain understandable to mortals since they don't do fancy stuff. And the
> other archs don't need to be touched.

It's not as ugly as my hack. Can I get a success report from m68k?
Thanks!

> --- linux-2.6.7/Makefile 2004-06-16 13:06:15.000000000 +0200
> +++ linux-m68k-2.6.7/Makefile 2004-06-16 18:27:13.000000000 +0200
> @@ -1070,7 +1070,7 @@ endif #ifeq ($(mixed-targets),1)
> .PHONY: checkstack
> checkstack:
> $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
> - $(PERL) scripts/checkstack.pl $(ARCH)
> + $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
>
> # FIXME Should go into a make.lib or something
> # ===========================================================================
> --- linux-2.6.7/scripts/checkstack.pl Thu Jun 17 18:06:18 2004
> +++ linux-m68k-2.6.7/scripts/checkstack.pl Thu Jun 17 18:09:21 2004
> @@ -12,7 +12,7 @@
> # Random bits by Matt Mackall <mpm@xxxxxxxxxxx>
> #
> # Usage:
> -# objdump -d vmlinux | stackcheck_ppc.pl [arch]
> +# objdump -d vmlinux | stackcheck.pl [arch]
> #
> # TODO : Port to all architectures (one regex per arch)
>
> @@ -40,6 +40,11 @@
> } elsif ($arch =~ /^ia64$/) {
> #e0000000044011fc: 01 0f fc 8c adds r12=-384,r12
> $re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;
> + } elsif ($arch =~ /^m68k$/) {
> + #2b6c: 4e56 fb70 linkw %fp,#-1168
> + $re = qr/.*linkw %fp,#-([0-9]{1,4})/o;
> + #1df770: defc ffe4 addaw #-28,%sp
> + $re_2 = qr/.*addaw #-([0-9]{1,4}),%sp/o;
> } elsif ($arch =~ /^mips64$/) {
> #8800402c: 67bdfff0 daddiu sp,sp,-16
> $re = qr/.*daddiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
> @@ -75,7 +80,7 @@
> if ($line =~ m/$funcre/) {
> $func = $1;
> }
> - if ($line =~ m/$re/) {
> + if ($line =~ m/$re/ or (defined($re_2) && $line =~ m/$re_2/)) {
> my $size = $1;
> $size = hex($size) if ($size =~ /^0x/);

Jörn

--
When in doubt, punt. When somebody actually complains, go back and fix it...
The 90% solution is a good thing.
-- Rob Landley
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/