Cmpsymtbl.pl: Unterschied zwischen den Versionen
aus Metalab Wiki, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Zur Navigation springenZur Suche springen
(Die Seite wurde neu angelegt: „Script to compare the symbol tables of two objects and show missing symbols from the second. Example execution: <pre> ./symbtblcmp.pl objdump tpsession/tpsessio…“) |
Keine Bearbeitungszusammenfassung |
||
Zeile 7: | Zeile 7: | ||
</pre> | </pre> | ||
< | cmpsymtbl.pl | ||
<pre> | |||
#!/usr/bin/perl | #!/usr/bin/perl | ||
Zeile 52: | Zeile 53: | ||
print scalar keys %symtbl2, " in $file2\n"; | print scalar keys %symtbl2, " in $file2\n"; | ||
print "latter missing $missinginfile2 with $matches matching\n"; | print "latter missing $missinginfile2 with $matches matching\n"; | ||
</ | </pre> |
Version vom 13. Oktober 2010, 01:08 Uhr
Script to compare the symbol tables of two objects and show missing symbols from the second. Example execution:
./symbtblcmp.pl objdump tpsession/tpsession-0.1/tpsession/libtpsession.so.0.1.0 \ ~/nokiaqtsdk/Maemo/4.6.2/targets/fremantle-1030/bin/objdump \ ~/nokiaqtsdk/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/lib/libtpsession.so.0.1.0
cmpsymtbl.pl
#!/usr/bin/perl if ($#ARGV < 3) { print "USAGE:\n\t$. <objdump1_path> <master_obj> <objdump2_path> <cmp_object>\n\n" } my $objdump1 = $ARGV[0]; my $file1 = $ARGV[1]; my $objdump2 = $ARGV[2]; my $file2 = $ARGV[3]; my $matches = 0; my $missinginfile2 = 0; my %symtbl2 = (); foreach my $line (`$objdump2 -t $file2`) { if ($line =~ m/^[0-9A-Fa-f]{8}.*\s(\S+)$/) { #print "."; $symtbl2{"$1"} = 0; } } my %symtbl1 = (); my $count = 0; foreach my $line (`$objdump1 -t $file1`) { if ($line =~ m/^[0-9A-Fa-f]{8}.*\s(\S+)$/) { if (exists $symtbl1{"$1"}) { next }; # handle duplicate entries $symtbl1{"$1"} = 0; if (exists $symtbl2{"$1"}) { $matches++; } else { $missinginfile2++; print "missing $1\n"; } } } print "\n"; print `file $file1`; print `file $file2`, "\n"; print scalar keys %symtbl1, " in $file1\n"; print scalar keys %symtbl2, " in $file2\n"; print "latter missing $missinginfile2 with $matches matching\n";