develooper Front page | perl.perl5.porters | Postings from August 2018

Full pathnames for Perl dtrace/systemtap loading/loaded file probes?

From:
William Cohen
Date:
August 22, 2018 18:23
Subject:
Full pathnames for Perl dtrace/systemtap loading/loaded file probes?
Message ID:
8af8d0b2-a600-ae85-f58b-7eb4152af063@redhat.com
Hi,

I have been working on extending a systemtap script monitoring which
executables and libraries run on the system (also_ran.stp) to handle
interpreted languages such as Ruby and Perl.  Monitoring the Ruby
modules pulled in by a Ruby program can by accomplished by adding the
following probe handler:

# trace any ruby executable files loaded
probe ruby.find.require.entry? { arr[user_string_quoted($arg2)]++ }


According to "perldoc dtrace" the loaded-file(FILENAME) dtrace
provider which maps to the systemtap probe point perl.loaded.file
should provide the desired information about which Perl files are
being pulled in due to "use", "require", or "do" statements.  The
following systemtap one-liner demonstrates the information that
that tracepoint provides:

$ stap -e 'probe begin {printf("started \n\n")} probe perl.loaded.file {printf("%s: %s\n", pn(), filename)}'
started 

perl.loaded.file: strict.pm
perl.loaded.file: warnings/register.pm
perl.loaded.file: warnings.pm
perl.loaded.file: vars.pm
perl.loaded.file: base.pm
perl.loaded.file: Exporter.pm
perl.loaded.file: XSLoader.pm
perl.loaded.file: Tk/Event.pm
perl.loaded.file: Carp.pm
perl.loaded.file: Symbol.pm
perl.loaded.file: Tk/Event/IO.pm
perl.loaded.file: AutoLoader.pm
perl.loaded.file: /usr/lib64/perl5/vendor_perl/auto/Tk/autosplit.ix
perl.loaded.file: Config.pm
perl.loaded.file: DynaLoader.pm

Some paths are not not fully qualified, for example warnings.pm above
appears to refers to /usr/share/perl5/warnings.pm.  Is there some way
that perl file tracepoints could provide the full path names?

-Will



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About