Hi Dustin and all,

I expanded the SvSTASH macro somewhat just so I could see exactly what is going on.

SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
  if (ptr && (flags & SWIG_SHADOW)) {
    SV *self;
    SV *obj=newSV(0);
    HV *hash=newHV();
    HV *stash;
    sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);

    // macros expanded
    SV* rv = ((XRV*)  SvANY(obj))->xrv_rv;
    std::cout << "rv:" << rv << std::endl;
    std::cout << "rv_any: " << rv->sv_any << std::endl;

    void* myany = rv->sv_any;
    XPVMG* vmg = (XPVMG*) myany;
    std::cout << "xmg_st: " << vmg->xmg_stash << std::endl;   

    //end macro expansion


So everything is fine until vmg->xmg_stash. The vmg struct is not NULL, however all of it's members are!

Does anyone have any idea how this struct gets populated? Perhaps this question is more suited for a Perl users group?

Many many thanks to anyone with ideas!


On Thu, May 22, 2008 at 3:44 PM, Dustin J. Mitchell <dustin@zmanda.com> wrote:
On Thu, May 22, 2008 at 2:48 PM, Barry Andrews <titanandrews@gmail.com> wrote:
> What I know for sure is happening is this call stash=SvSTASH(SvRV(obj)); in
> SWIG_Perl_MakePtr is returning NULL and thus causing the crash in the
> hv_fetch call. When I do a dump, i.e. Perl_sv_dump(SvRV(obj)); it gives me

The only thing I can think of -- and I'm new to perl innards, so this
may be completely off base -- is that the package
"sPerl::StringVector" doesn't exist yet, and thus has no stash.


Storage Software Engineer