Kaydet (Commit) 57435706 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Add -f option to filter in symbols from some libraries only

You can specify a regular expression for the -f option, typically
several library names combined with the '|' operator, as in:

bin/ios-mapfile-statistics -s -f 'libswlo|libsclo' <workdir/TiledLibreOffice.map|c++filt

Change-Id: I917fc392a41ed28c6b19ec5c2c16384d1186a532
üst 1900ac0b
...@@ -6,7 +6,9 @@ use Getopt::Std; ...@@ -6,7 +6,9 @@ use Getopt::Std;
my %args; my %args;
getopts('s', \%args); getopts('f:s', \%args);
die "The -f switch makes sense only if -s is also used" if (defined($args{'f'}) && !defined($args{'s'}));
my $state = 0; my $state = 0;
my %libofnumber; my %libofnumber;
...@@ -23,10 +25,13 @@ while (<>) { ...@@ -23,10 +25,13 @@ while (<>) {
} elsif ($state == 2 && m!^# Address\s+Size\s+File\s+Name!) { } elsif ($state == 2 && m!^# Address\s+Size\s+File\s+Name!) {
$state = 3; $state = 3;
} elsif ($state == 3 && m!^0x[0-9A-F]+\s+(0x[0-9A-F]+)\s+\[ *([0-9]+)\] (.*)!) { } elsif ($state == 3 && m!^0x[0-9A-F]+\s+(0x[0-9A-F]+)\s+\[ *([0-9]+)\] (.*)!) {
if (defined($libofnumber{$2})) { my ($size,$libnum,$symbol) = ($1, $2, $3);
$sizeoflib{$libofnumber{$2}} += hex($1); if (defined($libofnumber{$libnum})) {
$sizeoflib{$libofnumber{$libnum}} += hex($size);
if (!defined($args{'f'}) || $libofnumber{$libnum} =~ /$args{'f'}/) {
$sizeofsym{$symbol} = hex($size);
}
} }
$sizeofsym{$3} = hex($1);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment