aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkstack.pl24
1 files changed, 23 insertions, 1 deletions
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index 340ad6920511..358f96c75b43 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -26,8 +26,12 @@
26# $& (whole re) matches the complete objdump line with the stack growth 26# $& (whole re) matches the complete objdump line with the stack growth
27# $1 (first bracket) matches the size of the stack growth 27# $1 (first bracket) matches the size of the stack growth
28# 28#
29# $dre is similar, but for dynamic stack redutions:
30# $& (whole re) matches the complete objdump line with the stack growth
31# $1 (first bracket) matches the dynamic amount of the stack growth
32#
29# use anything else and feel the pain ;) 33# use anything else and feel the pain ;)
30my (@stack, $re, $x, $xs); 34my (@stack, $re, $dre, $x, $xs);
31{ 35{
32 my $arch = shift; 36 my $arch = shift;
33 if ($arch eq "") { 37 if ($arch eq "") {
@@ -46,9 +50,11 @@ my (@stack, $re, $x, $xs);
46 } elsif ($arch =~ /^i[3456]86$/) { 50 } elsif ($arch =~ /^i[3456]86$/) {
47 #c0105234: 81 ec ac 05 00 00 sub $0x5ac,%esp 51 #c0105234: 81 ec ac 05 00 00 sub $0x5ac,%esp
48 $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%esp$/o; 52 $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%esp$/o;
53 $dre = qr/^.*[as][du][db] (%.*),\%esp$/o;
49 } elsif ($arch eq 'x86_64') { 54 } elsif ($arch eq 'x86_64') {
50 # 2f60: 48 81 ec e8 05 00 00 sub $0x5e8,%rsp 55 # 2f60: 48 81 ec e8 05 00 00 sub $0x5e8,%rsp
51 $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%rsp$/o; 56 $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%rsp$/o;
57 $dre = qr/^.*[as][du][db] (\%.*),\%rsp$/o;
52 } elsif ($arch eq 'ia64') { 58 } elsif ($arch eq 'ia64') {
53 #e0000000044011fc: 01 0f fc 8c adds r12=-384,r12 59 #e0000000044011fc: 01 0f fc 8c adds r12=-384,r12
54 $re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o; 60 $re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;
@@ -141,6 +147,22 @@ while (my $line = <STDIN>) {
141 next if ($size < 100); 147 next if ($size < 100);
142 push @stack, "$intro$size\n"; 148 push @stack, "$intro$size\n";
143 } 149 }
150 elsif (defined $dre && $line =~ m/$dre/) {
151 my $size = "Dynamic ($1)";
152
153 next if $line !~ m/^($xs*)/;
154 my $addr = $1;
155 $addr =~ s/ /0/g;
156 $addr = "0x$addr";
157
158 my $intro = "$addr $func [$file]:";
159 my $padlen = 56 - length($intro);
160 while ($padlen > 0) {
161 $intro .= ' ';
162 $padlen -= 8;
163 }
164 push @stack, "$intro$size\n";
165 }
144} 166}
145 167
146print sort bysize @stack; 168print sort bysize @stack;