NAME
Binutils::Objdump - Perl interface to Binutils objdump
SYNOPSIS
use Binutils::Objdump;
# Standard using of objdump. Print the whole information.
objdumpopt(@ARGV);
print objdump();
# Now for the block 'SYMBOL TABLE', will be called
# mysymtab subroutine, which will get all lines for this block.
sub mysymtab {
print "SymTab:\n";
print join "\n", @_;
}
objdumpwrap("SYMBOL TABLE" => \&mysymtab);
objdump();
DESCRIPTION
objdump displays information about one or more object files. The options control what particular information to display. This information is mostly useful to programmers who are working on the compilation tools, as opposed to programmers who just want their program to compile and work.
This module provides wrappers for the objdump output information parts, specified by special labels. To each part correspond a special wrapper, which can be extended by your own.
The script odasm
is an example of disassembler based on Binutils::Objdump module.
Functions
- objdumppath([$path])
-
Sets the new path to objdump if
$path
defined. Returns current path to the objdump executeable file. By default this path will be defined automatically, but if you have another location for it, you may change it. - objdumpopt([$optstr])
-
Builds a new string of options if
$optstr
defined. Returns options for objdump in string format.For example, options can be taken from
@ARGV
. - objdump([@objfules])
-
Executes
objdump
with string of optionsobjdumpopt()
and object files@objfiles
, that have to be examinated. Returns the whole information about one or more object files.By default, if none of object files will not be set, will be used default object file a.out from the current location.
- objdumpwrap($label, \&wrapper)
-
Defines a special wrapper
\&wrapper
for the correspond labelLABEL
. Notice, that default wrapper will not be replaced, and so, can be used.When a label appears, the following lines will be saved till the next matched label. Then this lines will be passed to appropriate wrappers. Be carefull with default labels (if some label includes another, they will be merged).
- objdump_dynamic_symtab()
-
Default wrapper for dynamic symbol table. Returns lines.
- objdump_section_headers()
-
Default wrapper for summary information from the section headers of the object file. Returns lines.
- objdump_symtab()
-
Default wrapper for symbol table entries of the file. Returns lines.
- objdump_dynamic_reloc_info()
-
Default wrapper for dynamic relocation entries of the file. Returns lines.
- objdump_sec_contents($section)
-
Default wrapper for contents of section
$section
. Returns lines for correspond section. - objdump_sec_disasm($section)
-
Default wrapper for disassembly of section
$section
. Returns lines for correspond section.
Exports
By default will be exported objdump
, objdumpopt
and objdumpwrap
. The following tags can be used to selectively import functions defined in this module:
:ALL objdump() objdumpopt() objdumppath() objdumpwrap()
objdump_dynamic_reloc_info() objdump_symtab() objdump_section_headers()
objdump_dynamic_symtab() objdump_sec_contents() objdump_sec_disasm()
AUTHORS
Alexander Sviridenko, <oleks.sviridenko@gmail.com>
Slade Maurer, <slade@computer.org>
COPYRIGHT
The Binutils::Objdump module is Copyright (c) 2009, 2011 Slade Maurer, Alexander Sviridenko. All rights reserved.
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl 5.10.0 README file.