Skip to content

Commit

Permalink
scripts/checkstack.pl: Add argument to print stacks greather than value.
Browse files Browse the repository at this point in the history
Add arguments support to print stacks which are greater than
argument value only.

Co-developed-by: Vaneet Narang <[email protected]>
Signed-off-by: Vaneet Narang <[email protected]>
Signed-off-by: Maninder Singh <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
maninder42 authored and masahir0y committed May 25, 2020
1 parent 677f141 commit 572220a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/checkstack.pl
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,19 @@
# $1 (first bracket) matches the dynamic amount of the stack growth
#
# use anything else and feel the pain ;)
my (@stack, $re, $dre, $x, $xs, $funcre);
my (@stack, $re, $dre, $x, $xs, $funcre, $min_stack);
{
my $arch = shift;
if ($arch eq "") {
$arch = `uname -m`;
chomp($arch);
}

$min_stack = shift;
if ($min_stack eq "" || $min_stack !~ /^\d+$/) {
$min_stack = 100;
}

$x = "[0-9a-f]"; # hex character
$xs = "[0-9a-f ]"; # hex character or space
$funcre = qr/^$x* <(.*)>:$/;
Expand Down Expand Up @@ -117,7 +122,7 @@
if ($line =~ m/$funcre/) {
$func = $1;
next if $line !~ m/^($xs*)/;
if ($total_size > 100) {
if ($total_size > $min_stack) {
push @stack, "$intro$total_size\n";
}

Expand Down Expand Up @@ -162,7 +167,7 @@
$total_size += $size;
}
}
if ($total_size > 100) {
if ($total_size > $min_stack) {
push @stack, "$intro$total_size\n";
}

Expand Down

0 comments on commit 572220a

Please sign in to comment.