PATCH [0/2] - CHECKSTACK: sparc-stack-size and formatting
Hi,
I shamelessly stole the checkstack-script for a project of mine and now want to contribute what I changed:
1) CHECKSTACK: sparc: fix regex to match all stacksizes
2) CHECKSTACK: simplify text-formatting for displaying the stacksize
For 1): as there are no comments in the script as to why the regex was limiting the detection of stacksizes to less 300 bytes and if I understood it correctly, to a maximum of 1000, I simply removed it.
best regards,
--
Patrick Boettcher - Kernel Labs
http://www.kernellabs.com/
PATCH [1/2] - CHECKSTACK: sparc: fix regex to match all stacksize
----
tools/checkstack.pl +1 -1
@@ -97,7 +97,7 @@ my (@stack, $re, $dre, $x, $xs); $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; + $re = qr/.*save.*%sp, -(\d*), %sp/o; } else { print("wrong or unknown architecture \"$arch\"\n"); exit
PATCH [2/2] - CHECKSTACK: simplify text-formatting for displaying the stacksize
In reply to Patrick Boettcher----
tools/checkstack.pl +3 -14
@@ -139,7 +139,7 @@ while (my $line = <STDIN>) { $size += 0x80000000; $size += 0x80000000; } - next if ($size > 0x10000000); + next if ($size > 0x10000000) || ($size < 100); next if $line !~ m/^($xs*)/; my $addr = $1;
@@ -147,13 +147,7 @@ while (my $line = <STDIN>) { $addr = "0x$addr"; my $intro = "$addr $func [$file]:"; - my $padlen = 56 - length($intro); - while ($padlen > 0) { - $intro .= ' '; - $padlen -= 8; - } - next if ($size < 100); - push @stack, "$intro$size\n"; + push @stack, sprintf("%-64s %d\n", $intro, $size); } elsif (defined $dre && $line =~ m/$dre/) { my $size = "Dynamic ($1)";
@@ -164,12 +158,7 @@ while (my $line = <STDIN>) { $addr = "0x$addr"; my $intro = "$addr $func [$file]:"; - my $padlen = 56 - length($intro); - while ($padlen > 0) { - $intro .= ' '; - $padlen -= 8; - } - push @stack, "$intro$size\n"; + push @stack, sprintf("%-64s %d\n", $intro, $size); } }
Quoted 6 lines · Patrick Boettcher
Hi,
I shamelessly stole the checkstack-script for a project of mine and now want to contribute what I changed:
1) CHECKSTACK: sparc: fix regex to match all stacksizes
Please Cc sparc people for this, he should be David Miller, I think.
Quoted 5 lines
2) CHECKSTACK: simplify text-formatting for displaying the stacksize
For 1): as there are no comments in the script as to why the regex was limiting the detection of stacksizes to less 300 bytes and if I understood it correctly, to a maximum of 1000, I simply removed it.
Please don't do this, write your change log for each patch please.
Signature · 1 line
Live like a child, think like the god.
David Miller
Acked-byFrom: Patrick Boettcher <[email protected]>
Date: Mon, 23 Nov 2009 12:01:00 +0100 (CET)
Quoted 9 lines
I shamelessly stole the checkstack-script for a project of mine and now want to contribute what I changed:
1) CHECKSTACK: sparc: fix regex to match all stacksizes
2) CHECKSTACK: simplify text-formatting for displaying the stacksizeFor 1): as there are no comments in the script as to why the regex was limiting the detection of stacksizes to less 300 bytes and if I understood it correctly, to a maximum of 1000, I simply removed it.
The limit is just an oversight as far as I can tell, your sparc regex fix looks fine to me, thanks!