The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Parse::Readelf - handle readelf's output with a class

SYNOPSIS

  use Parse::Readelf;

  my $readelf_data = new Parse::Readelf($executable);
  $readelf_data->print_structure_layout($re_identifier, 1);

ABSTRACT

Parse::Readelf parses (some of) the output of readelf and stores its interesting details in some objects to ease access.

At the moment only a very limited access to the structure layout of data types and variables is supported.

DESCRIPTION

Normally an object of this class is constructed with the file name of an object file to be parsed. Upon construction the file is analysed and all relevant information about its debug info section is stored inside of the object or one of its subobjects. This information can be accessed afterwards using a bunch of getter methods, see "METHODS" for details.

This is BETA software, use at your own risk.

at the moment only information regarding the binary arrangement of variables (Structure Layout) is supported (and that is regularly used at my company, so the worst bugs should by found by now). Other data is ignored for now.

Currently only output for Dwarf version 2 is supported. Please contact the author for other versions and provide some example readelf outputs.

EXPORT

Nothing is exported by default as it's normally not needed to modify the following variable:

This module exports nothing directly, it should be accessed via its methods only.

@structure_layout_types

is a list of the types that can be printed in a structure layout. Its elements are basically the tag identifieres from readelf's output without the prefix DW_TAG_.

new - get readelf's output into an object

    $readelf_data = new Parse::Readelf($file_name);

example:

    $readelf_data1 = new Parse::Readelf('program');
    $readelf_data2 = new Parse::Readelf('module.o');

parameters:

    $file_name          name of executable or object file

description:

    This method parses the output of several C<readelf> commands and
    stores its interesting details internally to be accessed later by
    getter methods described below.

returns:

    The method returns the blessed Parse::Readelf object or an
    exception in case of an error.
    $readelf_data->print_structure_layout($re_name [, $print_location]);

example:

    $readelf_data->print_structure_layout('_t$');
    $readelf_data->print_structure_layout('_t$', 1);

parameters:

    $re_name            reg. exp. matching name of variable or data type
    $print_location     optional flag to print location with every definition

description:

    This method prints the structure layout of one or more variables
    or data types that match the regular expression for their name.
    If the optional parameter $print_location is true, each line also
    contains source location information, if availablble.

returns:

    nothing

KNOWN BUGS

Did I mentioned that this is Beta code?

Only Dwarf version 2 is supported. Please contact the author for other versions and provide some example readelf outputs.

This has only be tested in a Unix like environment, namely Linux and Solaris.

SEE ALSO

Parse::Readelf::Debug::Info, Parse::Readelf::Debug::Line and the readelf man page

AUTHOR

Thomas Dorner, <dorner (AT) cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2007-2013 by Thomas Dorner

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.1 or, at your option, any later version of Perl 5 you may have available.