bahamat
bahamat

Reputation: 758

Debugging a segfault in Perl

I'm trying to debug a segfault I'm getting from Perl.

I'm using:

The problem happens when I call:

my $ssh = Net::SSH2->new();

I've run it with the Perl debugger (perl -d) and stepped through into Net::SSH2 and it segfaults at the line:

my $self = $class->_new;

The output after the segfault is unhelpful:

zsh: segmentation fault  perl -d ./test.pl

Running with strace ends with:

open("<snip>/perl/lib/perl5.8/Linux-2.6c2.5-x86_64-64int/Net/SSH2/Listener.pm", O_RDONLY) = 4
ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffb9cdc920) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(4, 0, SEEK_CUR)                   = 0
read(4, "package Net::SSH2::Listener;\n\nus"..., 4096) = 804
lseek(4, 90, SEEK_SET)                  = 90
lseek(4, 0, SEEK_CUR)                   = 90
close(4)                                = 0
read(3, "", 4096)                       = 0
close(3)                                = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

Now I'm stuck. What do I do next? How do I dig deeper to find out what is wrong?

The only thing I can't change is that I must use Perl 5.8.8 (I have no choice in the matter).


gdb output from method suggestd by PSIAlt:

Program received signal SIGSEGV, Segmentation fault.
0x000000379ea141dc in __longjmp () from /lib64/ld-linux-x86-64.so.2
(gdb) bt
#0  0x000000379ea141dc in __longjmp () from /lib64/ld-linux-x86-64.so.2
#1  0x0101f58e4fc7bacc in ?? ()
Cannot access memory at address 0x101f58e475b223b
(gdb) 

So, not much help...

Again, my real question is "what next?"

Upvotes: 3

Views: 5014

Answers (1)

salva
salva

Reputation: 10244

It works for me under Ubuntu 12.10 x86_64, perl 5.8.8 (as compiled by perlbrew), libssh2 1.4.2, openssl 1.0.1c and Net::SSH2 0.46.

Under Unix/Linux, Net::OpenSSH is probably a better choice. It can even emulate most of Net::SSH2 API through Net::OpenSSH::Compat.

Upvotes: 1

Related Questions