Kicking the little puppies

Back to index...
First published
Tue Feb 3 18:17:29 2009
Last changed
Tue Feb 3 18:23:17 2009

Stuck in Perl? (Part 2)

Your perl code being stuck again, still alive and you need a backtrace? Here's how to get it, in case you have Carp loaded:

  [lkundrak@trurl ~]$ cat lala.pl 
  sub a { <>; }
  sub b { a (); }
  sub c { b (); }
  c ();
  [lkundrak@trurl ~]$ perl5.11.0 -MCarp lala.pl &
  [1] 31236
  [lkundrak@trurl ~]$ gdb -p $!
  GNU gdb Fedora (6.8-27.el5)
  ...
  0x00110402 in __kernel_vsyscall ()
  (gdb) call Perl_call_pv(my_perl, "carp", 0)
   at lala.pl line 1
          main::a() called at lala.pl line 2
          main::b() called at lala.pl line 3
          main::c() called at lala.pl line 4
  $1 = 1
  (gdb) 

You'll need perl-debuginfo installed for this. In case you're running in mod_perl or some other embedded interpreter, replace my_perl with your perl interpreter instance.


Source code to the entries and scripts that format this site are available on github. Text of journal entries is licensed under CC-BY-SA license.

Mail questions, comments and pizza to lkundrak@v3.sk