History

checkstack: fix printed address

All addresses printed by checkstack have an extra incorrect 0 appended at the end. This was introduced with commit 677f1410e058 ("scripts/checkstack.pl: don't display $dre as different entity"): since then the address is taken from the line which contains the function name, instead of the line which contains stack consumption. E.g. on s390: 0000000000100a30 <do_one_initcall>: ... 100a44: e3 f0 ff 70 ff 71 lay %r15,-144(%r15) So the used regex which matches spaces and hexadecimal numbers to extract an address now matches a different substring. Subsequently replacing spaces with 0 appends a zero at the and, instead of replacing leading spaces. Fix this by using the proper regex, and simplify the code a bit.

Heiko Carstens committed 2 years ago

Commit ee34db31 parent f42ce5f1 file · +2 −6Browse files

Showing the changes to scripts/checkstack.pl (1 of 1 file). Show all

Unified · Split

scripts/checkstack.pl+2−6
@@ -139,15 +139,11 @@ $total_size = 0; · 138 unmodified lines
139while (my $line = <STDIN>) {139while (my $line = <STDIN>) {
140 if ($line =~ m/$funcre/) {140 if ($line =~ m/$funcre/) {
141 $func = $1;141 $func = $1;
142 next if $line !~ m/^($xs*)/;142 next if $line !~ m/^($x*)/;
143 if ($total_size > $min_stack) {143 if ($total_size > $min_stack) {
144 push @stack, "$intro$total_size\n";144 push @stack, "$intro$total_size\n";
145 }145 }
146 146 $addr = "0x$1";
147 $addr = $1;
148 $addr =~ s/ /0/g;
149 $addr = "0x$addr";
150
151 $intro = "$addr $func [$file]:";147 $intro = "$addr $func [$file]:";
152 my $padlen = 56 - length($intro);148 my $padlen = 56 - length($intro);
153 while ($padlen > 0) {149 while ($padlen > 0) {