Created
November 23, 2016 14:06
-
-
Save dgryski/99ac147faf2891c9816d3f4f925c4e6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
my $bin=$ARGV[0]; | |
my @line = split /\s+/, `nm $bin |grep runtime.buildVersion`; | |
my $addr = hex($line[0]); | |
my $end = $addr + 16; | |
@line = split /\s+/, `objdump -s --start-addr=$addr --stop-addr=$end $bin |grep '^ '`; | |
($addr, $end) = (unpack("V", pack("H*", $line[2])), unpack("V", pack("H*", $line[4]))); | |
$end += $addr; | |
@line = split /\s+/, `objdump -s --start-addr=$addr --stop-addr=$end $bin |grep '^ '`; | |
print $line[$#line], "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For Mac users this doesn't work out of the box, you need to install
binutils
with homebrew and replacenm
andobjdump
withgnm
andgobjdump
.