http://www.perlmonks.org?node_id=707148


in reply to segmentation fault

The suggestion elsewhere to use Devel::Trace is a good one.

Otherwise, you need to isolate what is causing the segmentation fault.

You might get some useful information by running perl under gdb and getting a backtrace:

box> gdb perl yourscript.pl gdb> r ...your program runs and then stops with a segmentation fault ...dropping you back to gdb... gdb> bt

the displayed backtrace is perl's call stack, it might give some information as to where perl is dying.

You might also have success by trying to find the minimum amount of code needed to cause the segfault. Try commenting out about 1/2 of the module loads (you can use =pod and =cut to comment out a block of code) and do a binary search. Even with a thousand modules, that would only take approx 10 steps.

Replies are listed 'Best First'.
Re^2: segmentation fault
by betterworld (Curate) on Aug 27, 2008 at 13:51 UTC
    box> gdb perl yourscript.pl gdb> r

    I think "yourscript.pl" shoud be after "r", not after "gdb perl".

      Thanks, you're right.

      I blame too much time spent in the perl debugger recently.