[Chicago-talk] [Fwd: Re: 64 bit problems - XS wrappers]
Scott T. Hildreth
shild at sbcglobal.net
Fri Jul 14 14:11:20 PDT 2006
Anybody on the list run into this problem?
-------- Forwarded Message --------
From: Scott T. Hildreth <shildret at scotth.emsphone.com>
Reply-To: shildreth at allantgroup.com
To: Perl-Xs <perl-xs at perl.org>
Subject: Re: 64 bit problems - XS wrappers
Date: Thu, 13 Jul 2006 18:49:14 -0500
On Thu, 2006-07-13 at 18:32 -0500, Scott T. Hildreth wrote:
> 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)
...okay this doesn't tell me anything. I got the same result on
for another function call, which does not seg fault. It also returns a
(char *) and works. I'm stumped. If I step into the function I see the
null string is created and the returned. I don't know how to see if it
is in the RETVAL
> $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 <shild at sbcglobal.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060714/50a1b01b/attachment.html
More information about the Chicago-talk
mailing list