Parse::nm - Run and parse 'nm' command output with filter callbacks
Class interface:
use Parse::nm; Parse::nm->run(options => [ qw(-e) ], filters => [ { name => qr/\.\w+/, type => 'T', action => sub { print "$_[0]\n" } }, ], files => 't.o', );
Object interface:
use Parse::nm; my $pnm = Parse::nm->new(options => ..., filters => ...); $pnm->run(files => 'file1.o'); $pnm->run(files => 'file2.o'); $str = "TestFunc T 0 0 \n"; $pnm->parse(\$str);
Builds an object with the default options.
Parse 'nm -P'-style data coming from a filehandle.
Note that if your Perl is compiled with PerlIO (this is the default since 5.8.0), you can easily parse a string by opening a string reference to it.
open($fh, '<', \$str); Parse::nm->parse($fh, %options);
Run nm and parse its output.
nm
Command-line options given to nm to run it. The -P (POSIX-style output) is always given. -A (show input file) is currently incompatible.
-P
-A
List of files to give to nm for parsing.
A regexp that must match the name of the symbol.
Don't use ^ or $: this is not supported.
^
$
A regexp that must match the type of the symbol. Types are single ASCII letter. See the nm man page of your operating system for more information.
A callback that will be triggered for each line where both name and type match.
name
type
http://www.opengroup.org/onlinepubs/009695399/utilities/nm.html
Binutils::Objdump
OK.
Work in progress (patches welcome).
Parse::nm can not work on OpenBSD (at least up to 4.6) because 'nm' doesn't have a POSIX-compatible mode.
http://www.openbsd.org/cgi-bin/man.cgi?query=nm&apropos=0&sektion=0&manpath=OpenBSD+4.6&arch=i386&format=html#STANDARDS
Olivier Mengué, dolmen@cpan.org
dolmen@cpan.org
Copyright © 2010-2011 Olivier Mengué.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.0 or, at your option, any later version of Perl 5 you may have available.
To install Parse::nm, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::nm
CPAN shell
perl -MCPAN -e shell install Parse::nm
For more information on module installation, please visit the detailed CPAN module installation guide.