I changed the XS declaration to a SV * and changed,

   RETVAL = (char *)fmt_get_fld_location(fmt, fld);

   to  RETVAL = (SV *)fmt_get_fld_location(fmt, fld)

...and in gdb I could see more, 

(gdb) n
1197                IV tmp = SvIV((SV*)SvRV(ST(1)));
(gdb) n
419             RETVAL = (SV *)fmt_get_fld_location(fmt, fld);
(gdb) n
1205            ST(0) = RETVAL;
(gdb) p RETVAL
No symbol "RETVAL" in current context.
(gdb) n
1206            sv_2mortal(ST(0));
(gdb) p ST(0)
$6 = (SV *) 0x600ea0
(gdb) p *ST(0)
$7 = {sv_any = 0x0, sv_refcnt = 2147482504, sv_flags = 8388608}


      ...shouldn't sv_any not be null?

(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x0000000000473459 in Perl_sv_2mortal ()


On Thu, 2006-07-13 at 17:15 -0500, Scott T. Hildreth wrote:
> Posting again, didn't see it show up on the list.
> 
> ..I've seen the strlen() seg fault problem by searching, 
> just no solutions.  The string returned in RETVAL is null terminated, 
> so I don't understand.  
> 
> 
> On Thu, 2006-07-13 at 14:56 -0500, Scott T. Hildreth wrote:
> > ...we are installing 64bit Suse boxes.  I normally compile our own Perl,
> > leaving the vendor Perl alone.  I don't think this will help with this 
> > problem though (unless I compile as 32 bit).  The following XS code
> > fails in libc - strlen(),
> > 
> > =============================================================================
> > 
> > 1180    {
> > (gdb) n
> > 1181        dXSARGS;
> > (gdb) n
> > 1182        if (items != 2)
> > (gdb) n
> > 1188            dXSTARG;
> > (gdb) n
> > 1190            if (sv_derived_from(ST(0), "FMTPtr")) {
> > (gdb) n
> > 1191                IV tmp = SvIV((SV*)SvRV(ST(0)));
> > (gdb) n
> > 1197            if (sv_derived_from(ST(1), "FMT_FLDPtr")) {
> > (gdb) n
> > 1198                IV tmp = SvIV((SV*)SvRV(ST(1)));
> > (gdb) n
> > 419             RETVAL = (char *)fmt_get_fld_location(fmt, fld);
> > (gdb) p tmp
> > $4 = 11516288
> > (gdb) n 
> > 1206            sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
> > (gdb) p RETVAL
> > No symbol "RETVAL" in current context.
> > (gdb) s
> > 419             RETVAL = (char *)fmt_get_fld_location(fmt, fld);
> > (gdb) s
> > 1206            sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
> > (gdb) s
> > 
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x00002ad1795286d0 in strlen () from /lib64/libc.so.6
> > 
> > =================================================================================
> > 
> > ...at first I thought it was the threaded-64 bit Perls, but it seg
> > faults  on a non-threaded version as well.  It runs fine on a 32 bit 
> > server.  
> > 
> > I am really hopping someone has run into this, any help would be much
> > appreciated.
> > 
> > 
> >                                       STH
> > 
> > 
> > 
> >  
-- 
Scott T. Hildreth <[EMAIL PROTECTED]>

Reply via email to