X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=scripts%2Fcheckstack.pl;h=1afff6658a7d2a657333ff8815486b998b5c16bd;hb=e1f38e2cea199ef2b8e117506fef8abbecbaae5e;hp=f7e8e93ff30d32266c5faf4aa0688ce75b2a651e;hpb=89d49841e9e7a90b04b036b7dbe7521b55edbe24;p=safe%2Fjmp%2Flinux-2.6 diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl index f7e8e93..1afff66 100755 --- a/scripts/checkstack.pl +++ b/scripts/checkstack.pl @@ -14,12 +14,15 @@ # M68k port by Geert Uytterhoeven and Andreas Schwab # AVR32 port by Haavard Skinnemoen # PARISC port by Kyle McMartin +# sparc port by Martin Habets # # Usage: # objdump -d vmlinux | scripts/checkstack.pl [arch] # # TODO : Port to all architectures (one regex per arch) +use strict; + # check for arch # # $re is used for two matches: @@ -94,25 +97,20 @@ my (@stack, $re, $dre, $x, $xs); } elsif ($arch =~ /^blackfin$/) { # 0: 00 e8 38 01 LINK 0x4e0; $re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o; + } elsif ($arch eq 'sparc' || $arch eq 'sparc64') { + # f0019d10: 9d e3 bf 90 save %sp, -112, %sp + $re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o; } else { print("wrong or unknown architecture \"$arch\"\n"); exit } } -sub bysize($) { - my ($asize, $bsize); - ($asize = $a) =~ s/.*: *(.*)$/$1/; - ($bsize = $b) =~ s/.*: *(.*)$/$1/; - $bsize <=> $asize -} - # # main() # my $funcre = qr/^$x* <(.*)>:$/; -my $func; -my $file, $lastslash; +my ($func, $file, $lastslash); while (my $line = ) { if ($line =~ m/$funcre/) { @@ -169,4 +167,6 @@ while (my $line = ) { } } -print sort bysize @stack; +# Sort output by size (last field) +print sort { ($b =~ /:\t*(\d+)$/)[0] <=> ($a =~ /:\t*(\d+)$/)[0] } @stack; +