X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=scripts%2Fcheckstack.pl;h=f7844f6aa487a8c77fc08ff0edf11a8e0ab20d16;hb=refs%2Fheads%2Fvserver;hp=dd2db95d466db1de53465e38770a8305bdd513d2;hpb=6a77f38946aaee1cd85eeec6cf4229b204c15071;p=linux-2.6.git diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl index dd2db95d4..f7844f6aa 100644 --- a/scripts/checkstack.pl +++ b/scripts/checkstack.pl @@ -9,6 +9,7 @@ # Mips port by Juan Quintela # IA64 port via Andreas Dilger # Arm port by Holger Schurig +# sh64 port by Paul Mundt # Random bits by Matt Mackall # M68k port by Geert Uytterhoeven and Andreas Schwab # @@ -61,9 +62,17 @@ my (@stack, $re, $x, $xs); } elsif ($arch eq 'ppc64') { #XXX $re = qr/.*stdu.*r1,-($x{1,8})\(r1\)/o; + } elsif ($arch eq 'powerpc') { + $re = qr/.*st[dw]u.*r1,-($x{1,8})\(r1\)/o; } elsif ($arch =~ /^s390x?$/) { # 11160: a7 fb ff 60 aghi %r15,-160 $re = qr/.*ag?hi.*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})/o; + } elsif ($arch =~ /^sh64$/) { + #XXX: we only check for the immediate case presently, + # though we will want to check for the movi/sub + # pair for larger users. -- PFM. + #a00048e0: d4fc40f0 addi.l r15,-240,r15 + $re = qr/.*addi\.l.*r15,-(([0-9]{2}|[3-9])[0-9]{2}),r15/o; } else { print("wrong or unknown architecture\n"); exit @@ -72,8 +81,8 @@ my (@stack, $re, $x, $xs); sub bysize($) { my ($asize, $bsize); - ($asize = $a) =~ s/.* +(.*)$/$1/; - ($bsize = $b) =~ s/.* +(.*)$/$1/; + ($asize = $a) =~ s/.*: *(.*)$/$1/; + ($bsize = $b) =~ s/.*: *(.*)$/$1/; $bsize <=> $asize } @@ -82,26 +91,37 @@ sub bysize($) { # my $funcre = qr/^$x* <(.*)>:$/; my $func; +my $file, $lastslash; + while (my $line = ) { if ($line =~ m/$funcre/) { $func = $1; } - if ($line =~ m/$re/) { + elsif ($line =~ m/(.*):\s*file format/) { + $file = $1; + $file =~ s/\.ko//; + $lastslash = rindex($file, "/"); + if ($lastslash != -1) { + $file = substr($file, $lastslash + 1); + } + } + elsif ($line =~ m/$re/) { my $size = $1; $size = hex($size) if ($size =~ /^0x/); - if ($size > 0x80000000) { + if ($size > 0xf0000000) { $size = - $size; $size += 0x80000000; $size += 0x80000000; } + next if ($size > 0x10000000); next if $line !~ m/^($xs*)/; my $addr = $1; $addr =~ s/ /0/g; $addr = "0x$addr"; - my $intro = "$addr $func:"; + my $intro = "$addr $func [$file]:"; my $padlen = 56 - length($intro); while ($padlen > 0) { $intro .= ' ';