blob: 6530b809502f888954eca5b4c2483e9362e057b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
use B::Disassembler qw(disassemble_fh);
use FileHandle;
my $fh;
if (@ARGV == 0) {
$fh = \*STDIN;
} elsif (@ARGV == 1) {
$fh = new FileHandle "<$ARGV[0]";
} else {
die "Usage: disassemble [filename]\n";
}
sub print_insn {
my ($insn, $arg) = @_;
if (defined($arg)) {
printf "%s %s\n", $insn, $arg;
} else {
print $insn, "\n";
}
}
disassemble_fh($fh, \&print_insn);
|