repo.or.cz
/
git
/
jnareb-git.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Start anew
[git/jnareb-git.git]
/
lib
/
perl5
/
5.6.1
/
B
/
disassemble
blob
6530b809502f888954eca5b4c2483e9362e057b2
1
use B::Disassembler qw(disassemble_fh);
2
use FileHandle;
3
4
my $fh;
5
if (@ARGV == 0) {
6
$fh = \*STDIN;
7
} elsif (@ARGV == 1) {
8
$fh = new FileHandle "<$ARGV[0]";
9
} else {
10
die "Usage: disassemble [filename]\n";
11
}
12
13
sub print_insn {
14
my ($insn, $arg) = @_;
15
if (defined($arg)) {
16
printf "%s %s\n", $insn, $arg;
17
} else {
18
print $insn, "\n";
19
}
20
}
21
22
disassemble_fh($fh, \&print_insn);