9

I'm trying to track down a segmentation fault that I've been able to isolate to just a few lines of code on different versions of Perl. I use perlbrew to manage my various versions for development and testing, but it doesn't build perl with debugging symbols, so using gdb to analyse the core dump file is pretty useless.

So what's the best way to have perlbrew build with debugging symbols enabled. And if possible I'd like to be able to have it be a separate perl that I could switch to instead of overriding the standard one for the same version.

mpeters
  • 4,737
  • 3
  • 27
  • 41

1 Answers1

13
perlbrew install -v 5.14.2 --as=5.14.2d -DEBUGGING=-g

(--as puts it under a different name, so you can keep your existing builds.)

There's also the following which includes the above and stuff you surely don't need:

perlbrew install -v 5.14.2 --as=5.14.2d -DEBUGGING=both

See INSTALL in the root dir of the Perl distro.

daxim
  • 39,270
  • 4
  • 65
  • 132
ikegami
  • 367,544
  • 15
  • 269
  • 518
  • This seems like just what I was looking for, however it doesn't seem to work. I ran this command `perlbrew install perl-5.8.8 --as='perl-5.8.8-debug' -DEBUGGING=both`. Then to inspect it with gdb I ran `gdb /home/mpeters/perl5/perlbrew/perls/perl-5.8.8-debug/bin/perl` and gdb still says "Reading symbols from /home/mpeters/perl5/perlbrew/perls/perl-5.8.8-debug/bin/perl...(no debugging symbols found)", so obviously I'm still missing something. – mpeters Feb 24 '12 at 15:25
  • `-DEBUGGING=both` might not have existed back then? Check the `INSTALL` file for the right version distro. (`-Doptimise=-g` should work even back then.) You really should mention it when you're using ancient software. (5.8 was first released 10 years ago. 5.8 and 5.10 are no longer supported, and 5.12 is about to be EOLed too.) – ikegami Feb 24 '12 at 16:45
  • Thanks for the hint about the options being version specific. I went with `perlbrew install perl-5.8.8 --as='perl-5.8.8-debug' -Doptimize='-g'` and it worked like a charm. Thanks. – mpeters Mar 01 '12 at 19:32