summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/B/disassemble
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/B/disassemble')
-rw-r--r--Master/tlpkg/tlperl/lib/B/disassemble22
1 files changed, 22 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl/lib/B/disassemble b/Master/tlpkg/tlperl/lib/B/disassemble
new file mode 100644
index 00000000000..6530b809502
--- /dev/null
+++ b/Master/tlpkg/tlperl/lib/B/disassemble
@@ -0,0 +1,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);