in reply to Perl segfaults: Why?
(gdb) bt #0 Perl_do_tell (my_perl=0x9c01008, gv=0x0) at doio.c:1038 #1 0x080fac6a in Perl_pp_tell (my_perl=0x9c01008) at pp_sys.c:2077 #2 0x080b20f9 in Perl_runops_standard (my_perl=0x9c01008) at run.c:38 #3 0x080b0560 in perl_run (my_perl=0x9c01008) at perl.c:2391 #4 0x08063ebd in main (argc=3, argv=0xbfff4dd4, env=0xbfff4de4) at perlmain.c:113
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl segfaults: Why?
by ikegami (Patriarch) on Sep 15, 2009 at 19:52 UTC | |
I don't see how passing NULL to do_tell (as shown in your stack trace) would cause any problems. The line where the segfault occurs in your strack trace explicitly checks if gv is NULL before using it. Could this be a compiler optimisation problem? I could confirm that if I saw the assembler code for that function on a machine where it crashes. As an aside, I discovered that Perl will treat a number passed to tell as the name of a glob.
(And not just when it's a constant. It's just easier to see there.) That means the following are all equivalent:
| [reply] [d/l] [select] |
by almut (Canon) on Sep 15, 2009 at 20:52 UTC | |
... if I saw the assembler code for that function on a machine where it crashes. Here's the objdump of the respective routine of libperl.so.5.10.0 (x86-64, compiled with gcc-4.3.2) on Ubuntu (where it does crash):
Update: AFAICT (which might not be all that far :) — I stopped doing assembly around ten years ago), the "if (gv " has not been optimised away:
| [reply] [d/l] [select] |
by almut (Canon) on Sep 16, 2009 at 03:35 UTC | |
A bit of further debugging shows that it's segfaulting at this instruction
presumably because register rsi (+ offset 0xc) is pointing to some junk address. AFAICT, this instruction is supposed to check some part of the thread context (whatever the macro pTHX_ expands to) - i.e. a value on the stack. My guess would be that the calling routine has left rsi and/or the stack in an inconsistent state (due to some bug while handling the unexpected tell parameter?)... but I haven't checked this any further, yet. | [reply] [d/l] [select] |
|
Re^2: Perl segfaults: Why?
by bv (Friar) on Sep 15, 2009 at 16:59 UTC | |
I got the segfault on Ubuntu 9.04 and Debian squeeze. How does one go about checking the source code for different versions of Perl to see if it changed?
print pack("A25",pack("V*",map{1919242272+$_}(34481450,-49737472,6228,0,-285028276,6979,-1380265972)))
| [reply] [d/l] |
by ikegami (Patriarch) on Sep 15, 2009 at 17:11 UTC | |
As per perlrepository, the Perl source code is found at http://perl5.git.perl.org/perl.git. Finding the bug/fix might require a lot of digging, though.
| [reply] |