我正在尝试调试从 Perl 获得的段错误。
我在用着:
- Perl 5.8.8
- 网络::SSH2 0.45
- Libssh2 1.4.2
- Openssl 0.9.8x(但我对 1.0.1c 也有同样的问题)
当我打电话时会出现问题:
my $ssh = Net::SSH2->new();
我已经用 Perl 调试器perl -d
(
my $self = $class->_new;
段错误后的输出没有帮助:
zsh: segmentation fault perl -d ./test.pl
运行strace
结束于:
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 +++
现在我被困住了。接下来我该怎么做?我如何深入挖掘以找出问题所在?
我唯一不能改变的是我必须使用 Perl 5.8.8(我在这件事上别无选择)。
gdb
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)
所以,帮不上什么忙...
同样,我真正的问题是“下一步是什么?”