# New Ticket Created by  Will Coleda 
# Please include the string:  [perl #46757]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=46757 >


Getting a segfault on osx/86 in tcl's t/cmd_array.t test.

Thanks to chromatic's new gcdebug core, I can force the segfault to  
happen on feather (where gdb doesn't behave as oddly as it does on my  
box.)

Here's what I did:

gdb ../../parrot --runcore=gcdebug tcl.pbc t/cmd_array.t

wait. eventually get a stack trace. per chromatic, set a conditional  
breakpoint on pmc_new so I could see when this particular pmc was  
being created (it's the last one before the segfault) and re-run; The  
bt at the last pmc_new before then, followed by the segfault, is:*

Breakpoint 4, pmc_new (interp=0x804e008, base_type=84) at src/pmc.c:73
73          return pmc;
#0  pmc_new (interp=0x804e008, base_type=84) at src/pmc.c:73
#1  0xb5d9fc74 in Parrot_TclString_nci_get_list (interp=0x804e008,
     pmc=0x82f0098, str=0x821ac60) at ./tclstring.pmc:23
#2  0xb7c400d9 in pcf_P_JOS (interp=0x804e008, self=0x81c55c0) at src/ 
nci.c:382
#3  0xb7d86a16 in Parrot_NCI_invoke (interp=0x804e008, pmc=0x81c55c0,
     next=0xb5d0e784) at ./src/pmc/nci.pmc:168
#4  0xb7bd9754 in Parrot_callmethodcc_p_sc (cur_opcode=0xb5d0e778,
     interp=0x804e008) at src/ops/object.ops:69
#5  0xb7c65e9b in runops_gc_debug_core (interp=0x804e008, pc=0xb5d0e778)
     at src/runops_cores.c:231
#6  0xb7c36908 in runops_int (interp=0x804e008, offset=3)
     at src/interpreter.c:859
#7  0xb7c372fe in runops (interp=0x804e008, offs=3) at src/ 
inter_run.c:105
#8  0xb7c3754c in runops_args (interp=0x804e008, sub=0x8196230,  
obj=0x8091730,
     meth_unused=0x0, sig=0xb7e486d6 "vP",
     ap=0xbfe1070c "?`\031\bH\a?\020??x?\021\b?`\031\b0b\031\b4\017?H 
\a?QN?\b?\004\b\002") at src/inter_run.c:221
#9  0xb7c37658 in Parrot_runops_fromc_args (interp=0x804e008,  
sub=0x8196230,
     sig=0xb7e486d6 "vP") at src/inter_run.c:300
#10 0xb7c20dbe in Parrot_runcode (interp=0x804e008, argc=2,  
argv=0xbfe1089c)
     at src/embed.c:832
#11 0xb7e24e51 in imcc_run_pbc (interp=0x804e008, obj_file=0,  
output_file=0x0,
     argc=2, argv=0xbfe1089c) at compilers/imcc/main.c:667
#12 0xb7e25748 in imcc_run (interp=0x804e008, sourcefile=0xbfe10bb3  
"tcl.pbc",
     argc=2, argv=0xbfe1089c) at compilers/imcc/main.c:897
#13 0x0804892d in main (argc=2, argv=0xbfe1089c) at src/main.c:62

Program received signal SIGSEGV, Segmentation fault.
0xb5d9ffa9 in Parrot_TclString_nci_get_list (interp=0x804e008,  
pmc=0x82f0098,
     str=0x821ac60) at ./tclstring.pmc:123
123             retval->vtable->push_pmc(INTERP, retval, P0);




So, the issue seems to be in TclString's get_list; retval is toast  
(well, it's vtable is) by line 123, but it was only created on line  
23 (first line of the sub), and then not referenced at all until the  
segfault.


What's happening between line 23 & 123 that could be causing the  
retval PMC to be collected? (where did we even have a chance for it  
to be collected, and then, why was it? I'm clearly using it, I  
haven't left the scope of this function yet... do I have to pin it  
somehow?)


* in retrospect, this seems to have been a waste of time: the error  
was accessing a pmc in the same function it was created in; This  
trick seems to be more useful if you don't know exactly where your  
PMC came from.

--
Will "Coke" Coleda
[EMAIL PROTECTED]


Reply via email to