diff options
author | Tor Lillqvist <tml@collabora.com> | 2014-04-25 10:20:49 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2014-04-25 10:24:12 +0300 |
commit | 5743570619ee2ef1350b88f708f21cd3ec38bac2 (patch) | |
tree | 8c99d8ecdc8e38d57a0a6c21921dd05dcf35a759 /bin | |
parent | 1900ac0b853eb3ae55c495da078410709004f433 (diff) |
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
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ios-mapfile-statistics | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bin/ios-mapfile-statistics b/bin/ios-mapfile-statistics index 2e16ed72f940..4e1f803dee09 100755 --- a/bin/ios-mapfile-statistics +++ b/bin/ios-mapfile-statistics @@ -6,7 +6,9 @@ use Getopt::Std; 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 %libofnumber; @@ -23,10 +25,13 @@ while (<>) { } elsif ($state == 2 && m!^# Address\s+Size\s+File\s+Name!) { $state = 3; } elsif ($state == 3 && m!^0x[0-9A-F]+\s+(0x[0-9A-F]+)\s+\[ *([0-9]+)\] (.*)!) { - if (defined($libofnumber{$2})) { - $sizeoflib{$libofnumber{$2}} += hex($1); + my ($size,$libnum,$symbol) = ($1, $2, $3); + 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); } } |