Using perlbrew to build a perl with debugging symbols
Asked Answered
D

1

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.

Dromond answered 16/2, 2012 at 22:37 Comment(0)
E
14
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.

Export answered 16/2, 2012 at 22:39 Comment(3)
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.Dromond
-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.)Export
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.Dromond

© 2022 - 2024 — McMap. All rights reserved.