The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::Stacktrace - Stack trace

VERSION

version 0.09

SYNOPSIS

perl-stacktrace [option] pid

  -m      Prints a gdb script
  -v      Verbose debugging
  -c      Additionally, prints C stacktrace
  --help  Show this help

  --exec  exec() into gdb

DESCRIPTION

perl-stacktrace prints Perl stack traces of Perl threads for a given Perl process. For each Perl frame, the full file name and line number are printed.

For example, a stack dump of a running perl program:

$ ps x | grep cpan
24077 pts/12   T      0:01 /usr/local/bin/perl /usr/local/bin/cpan
24093 pts/12   S+     0:00 grep cpan

$ perl-stacktrace 24077
0x00d73416 in __kernel_vsyscall ()
/usr/local/bin/cpan:11
/usr/local/lib/perl5/5.12.2/App/Cpan.pm:364
/usr/local/lib/perl5/5.12.2/App/Cpan.pm:295
/usr/local/lib/perl5/5.12.2/CPAN.pm:339
/usr/local/lib/perl5/5.12.2/Term/ReadLine.pm:198

API

There exists an internal API

new

This accepts the following parameters by applying them through Getopt::Long. This is actually just a front for the script perl-stacktrace's command line handling.

App::Stacktrace->new(
    $pid,       # The process to attach to
    'm',        # Dump the generated script
    'v',        # Verbose
    'exec',     # exec() into gdb
    '--noexec', # system() into gdb
);

run

Runs the app program as configured by the ->new(...) method.

$obj = App::Stacktrace->new( ... );
$obj->run;