Improve command line handling, don't read stdin
Reading stdin is confusing as it means running the script without any arguments and with no input redirection just seems to do nothing. (OTOH, who would use this script except seasoned hackers who know how command-line tools typically work... oh well.) Change-Id: I00b4f70b07b6515b52a22b4ec4e048cc84c1dc83
This commit is contained in:
parent
848e1ca01a
commit
bc4c2098a6
@ -17,7 +17,7 @@ sub HELP_MESSAGE {
|
|||||||
print <<EOS
|
print <<EOS
|
||||||
This program parses a linker map file, especially one produced when linking an iOS executable.
|
This program parses a linker map file, especially one produced when linking an iOS executable.
|
||||||
|
|
||||||
Input is read from a command-line argument or from standard input.
|
Input is read from a map file provided as command-line argument
|
||||||
|
|
||||||
By default a list of libraries used and the size of code and data
|
By default a list of libraries used and the size of code and data
|
||||||
linked in from each library is printed, in reverse order of size.
|
linked in from each library is printed, in reverse order of size.
|
||||||
@ -31,14 +31,20 @@ The following options are available:
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
die "The -f switch makes sense only if -s is also used" if (defined($args{'f'}) && !defined($args{'s'}));
|
die "The -f switch makes sense only if -s is also used\n" if defined($args{'f'}) && !defined($args{'s'});
|
||||||
|
|
||||||
|
die "Please provide one map file name\n" if !defined($ARGV[0]);
|
||||||
|
|
||||||
|
die "Just one argument please\n" if defined($ARGV[1]);
|
||||||
|
|
||||||
my $state = 0;
|
my $state = 0;
|
||||||
my %libofnumber;
|
my %libofnumber;
|
||||||
my %sizeoflib;
|
my %sizeoflib;
|
||||||
my %sizeofsym;
|
my %sizeofsym;
|
||||||
|
|
||||||
while (<>) {
|
open(INPUT, '<', $ARGV[0]) || die "Could not open $ARGV[0]: $!\n";
|
||||||
|
|
||||||
|
while (<INPUT>) {
|
||||||
if ($state == 0 && m!^# Object files:!) {
|
if ($state == 0 && m!^# Object files:!) {
|
||||||
$state = 1;
|
$state = 1;
|
||||||
} elsif ($state == 1 && m!^\[ *([0-9]+)\] .*/([-_a-z0-9]+\.a)\(.*!i) {
|
} elsif ($state == 1 && m!^\[ *([0-9]+)\] .*/([-_a-z0-9]+\.a)\(.*!i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user