22 lines
623 B
Perl
Executable File
22 lines
623 B
Perl
Executable File
#!/usr/local/bin/perl
|
|
|
|
foreach $f (@ARGV) {
|
|
open(FILE, $f) || die("Cannot open $f");
|
|
seek(FILE, -28, 2);
|
|
$code_size = do read_int();
|
|
$data_size = do read_int();
|
|
$symbol_size = do read_int();
|
|
$debug_size = do read_int();
|
|
read(FILE, $magic, 12);
|
|
print $f, ":\n" if ($#ARGV > 0);
|
|
printf ("\tcode: %d data: %d symbols: %d debug: %d\n",
|
|
$code_size, $data_size, $symbol_size, $debug_size);
|
|
close(FILE);
|
|
}
|
|
|
|
sub read_int {
|
|
read(FILE, $buff, 4) == 4 || die("Truncated bytecode file $f");
|
|
@int = unpack("C4", $buff);
|
|
return ($int[0] << 24) + ($int[1] << 16) + ($int[2] << 8) + $int[3];
|
|
}
|