Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
396 B

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