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/
Signed-off-by: Patrick Boettcher <[email protected]>
----
diff --git a/tools/checkstack.pl b/tools/checkstack.pl
index 14ee68e..e0af9c7 100755
--- a/tools/checkstack.pl
+++ b/tools/checkstack.pl
@@ -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
Signed-off-by: Patrick Boettcher <[email protected]>
----
diff --git a/tools/checkstack.pl b/tools/checkstack.pl
index e0af9c7..4fed8c7 100755
--- a/tools/checkstack.pl
+++ b/tools/checkstack.pl
@@ -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);
}
}
On Mon, Nov 23, 2009 at 12:01:00PM +0100, Patrick Boettcher wrote:
> 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.
> 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.
--
Live like a child, think like the god.
From: Patrick Boettcher <[email protected]>
Date: Mon, 23 Nov 2009 12:01:00 +0100 (CET)
> 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.
The limit is just an oversight as far as I can tell, your sparc
regex fix looks fine to me, thanks!
Acked-by: David S. Miller <[email protected]>