We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b454ec2 commit fe1a25eCopy full SHA for fe1a25e
scripts/checkstack.pl
@@ -189,5 +189,20 @@ sub arm_push_handling {
189
push @stack, "$intro$total_size\n";
190
}
191
192
-# Sort output by size (last field)
193
-print sort { ($b =~ /:\t*(\d+)$/)[0] <=> ($a =~ /:\t*(\d+)$/)[0] } @stack;
+# Sort output by size (last field) and function name if size is the same
+sub sort_lines {
194
+ my ($a, $b) = @_;
195
+
196
+ my $num_a = $1 if $a =~ /:\t*(\d+)$/;
197
+ my $num_b = $1 if $b =~ /:\t*(\d+)$/;
198
+ my $func_a = $1 if $a =~ / (.*):/;
199
+ my $func_b = $1 if $b =~ / (.*):/;
200
201
+ if ($num_a != $num_b) {
202
+ return $num_b <=> $num_a;
203
+ } else {
204
+ return $func_a cmp $func_b;
205
+ }
206
+}
207
208
+print sort { sort_lines($a, $b) } @stack;
0 commit comments