I'd run:
strace perl -c mythrename.pl
And capture the output. If it wasn't obvious what when wrong based on the
last thing before the segfault, then I'd grep out all of the file opens
(system libraries and such), and look at all those files to see if any
had changed recently.
Great suggestion. I'd never heard of strace but it looks like the
quickest way to track down what was happening. The output ends as
follows
stat64("/usr/lib/perl/5.8/auto/IO/IO.so", {st_mode=S_IFREG|0644,
st_size=15580, ...}) = 0
stat64("/usr/lib/perl/5.8/auto/IO/IO.bs", {st_mode=S_IFREG|0644,
st_size=0, ...}) = 0
open("/usr/lib/perl/5.8/auto/IO/IO.so", O_RDONLY) = 9
read(9, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000\22\0"...,
512) = 512
fstat64(9, {st_mode=S_IFREG|0644, st_size=15580, ...}) = 0
mmap2(NULL, 18548, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 9,
0) = 0xb7c09000
mmap2(0xb7c0d000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_DENYWRITE, 9, 0x3) = 0xb7c0d000
close(9) = 0
brk(0x83e5000) = 0x83e5000
read(8, "sage: $io->stat()\';\n stat($_["..., 4096) = 3496
read(8, "", 4096) = 0
close(8) = 0
stat64("/etc/perl/Socket.pmc", 0xbf9eb05c) = -1 ENOENT (No such file
or directory)
stat64("/etc/perl/Socket.pm", 0xbf9eaf6c) = -1 ENOENT (No such file or
directory)
stat64("/usr/local/lib/perl/5.8.8/Socket.pmc", 0xbf9eb05c) = -1 ENOENT
(No such file or directory)
stat64("/usr/local/lib/perl/5.8.8/Socket.pm", 0xbf9eaf6c) = -1 ENOENT
(No such file or directory)
stat64("/usr/local/share/perl/5.8.8/Socket.pmc", 0xbf9eb05c) = -1
ENOENT (No such file or directory)
stat64("/usr/local/share/perl/5.8.8/Socket.pm", 0xbf9eaf6c) = -1
ENOENT (No such file or directory)
stat64("/usr/lib/perl5/Socket.pmc", 0xbf9eb05c) = -1 ENOENT (No such
file or directory)
stat64("/usr/lib/perl5/Socket.pm", 0xbf9eaf6c) = -1 ENOENT (No such
file or directory)
stat64("/usr/share/perl5/Socket.pmc", 0xbf9eb05c) = -1 ENOENT (No such
file or directory)
stat64("/usr/share/perl5/Socket.pm", 0xbf9eaf6c) = -1 ENOENT (No such
file or directory)
stat64("/usr/lib/perl/5.8/Socket.pmc", 0xbf9eb05c) = -1 ENOENT (No
such file or directory)
stat64("/usr/lib/perl/5.8/Socket.pm", {st_mode=S_IFREG|0644,
st_size=3514, ...}) = 0
open("/usr/lib/perl/5.8/Socket.pm", O_RDONLY|O_LARGEFILE) = 8
ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbf9ead78) = -1 ENOTTY
(Inappropriate ioctl for device)
_llseek(8, 0, [0], SEEK_CUR) = 0
read(8, "package Socket;\n\nour($VERSION, @"..., 4096) = 3514
read(8, "", 4096) = 0
close(8) = 0
stat64("/usr/lib/perl/5.8/auto/Socket/Socket.so", {st_mode=S_IFREG|
0644, st_size=19676, ...}) = 0
stat64("/usr/lib/perl/5.8/auto/Socket/Socket.bs", {st_mode=S_IFREG|
0644, st_size=0, ...}) = 0
open("/usr/lib/perl/5.8/auto/Socket/Socket.so", O_RDONLY) = 8
read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\16"...,
512) = 512
fstat64(8, {st_mode=S_IFREG|0644, st_size=19676, ...}) = 0
mmap2(NULL, 22644, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8,
0) = 0xb7c03000
mmap2(0xb7c08000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_DENYWRITE, 8, 0x4) = 0xb7c08000
close(8) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Process 18883 detached
Does this mean that the segfault occurred as a result of the close(8)
call - or at least that close() was the last system call prior to the
fault?
Or would the segfault have happened while executing the next call
which is not shown? (From the man page it looks as though strace will
trap signals and still print the failing call after a signal
occurs ... but I'm not sure I'm reading it correctly.)
James