Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105787
b: refs/heads/master
c: 585e93a
h: refs/heads/master
i:
  105785: 46bbcb5
  105783: e3e950e
v: v3
  • Loading branch information
Eric Sandeen authored and Linus Torvalds committed Jul 25, 2008
1 parent 74d78f3 commit fad5b17
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 545e400619b24b6b17b7f1f1e838e9ff6d036949
refs/heads/master: 585e93ae83b80c874bf4eb50a239027cef5db4af
24 changes: 23 additions & 1 deletion trunk/scripts/checkstack.pl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@
# $& (whole re) matches the complete objdump line with the stack growth
# $1 (first bracket) matches the size of the stack growth
#
# $dre is similar, but for dynamic stack redutions:
# $& (whole re) matches the complete objdump line with the stack growth
# $1 (first bracket) matches the dynamic amount of the stack growth
#
# use anything else and feel the pain ;)
my (@stack, $re, $x, $xs);
my (@stack, $re, $dre, $x, $xs);
{
my $arch = shift;
if ($arch eq "") {
Expand All @@ -46,9 +50,11 @@
} elsif ($arch =~ /^i[3456]86$/) {
#c0105234: 81 ec ac 05 00 00 sub $0x5ac,%esp
$re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%esp$/o;
$dre = qr/^.*[as][du][db] (%.*),\%esp$/o;
} elsif ($arch eq 'x86_64') {
# 2f60: 48 81 ec e8 05 00 00 sub $0x5e8,%rsp
$re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%rsp$/o;
$dre = qr/^.*[as][du][db] (\%.*),\%rsp$/o;
} elsif ($arch eq 'ia64') {
#e0000000044011fc: 01 0f fc 8c adds r12=-384,r12
$re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;
Expand Down Expand Up @@ -141,6 +147,22 @@ ($)
next if ($size < 100);
push @stack, "$intro$size\n";
}
elsif (defined $dre && $line =~ m/$dre/) {
my $size = "Dynamic ($1)";

next if $line !~ m/^($xs*)/;
my $addr = $1;
$addr =~ s/ /0/g;
$addr = "0x$addr";

my $intro = "$addr $func [$file]:";
my $padlen = 56 - length($intro);
while ($padlen > 0) {
$intro .= ' ';
$padlen -= 8;
}
push @stack, "$intro$size\n";
}
}

print sort bysize @stack;

0 comments on commit fad5b17

Please sign in to comment.