Well I compiled the module with -g.  I am testing with 'perl -d -e0',
just loading the module and stepping into it.  When it started to hang, 
I attached to the process with gdb.  About all I could do was get a back
trace.  I probably really need to compile a version of perl with -g,
right?  Would it help to show the *.c produced by xsupp?

On Fri, 2005-03-25 at 14:21 -0600, Scott T. Hildreth wrote:
> On Fri, 2005-03-25 at 14:03 -0500, muppet wrote:
> > Scott T. Hildreth said:
> > > I am trying to call a function (from a structure that has a function
> > > pointer) from my XS code.  It will return a char * that I will put on
> > > the stack.   When it gets to the code where the code is called, perl
> > > just hangs.  I've tried,
> > >
> > >       directives->get()  // get is declared as a func ptr in the struct.
> > >       (char *)(*directives->get)()
> > 
> > both of these syntaxes are valid, as the * (and the parens it necessitates) 
> > is
> > optional:
> > 
> >    char * try1 = (*directives->get) ();
> >    char * try2 = directives->get ();
> > 
> > >       *(*directives->get)()'
> 
>      Here is what I actually have in the code,
> 
>         } else {
>                 PUSHs(sv_2mortal( newSVpv(pfmt->directive[i],
> strlen(pfmt->directive[i])) ));
> 
>                 directive = fmt_find_directive(pfmt->directive[i]);
> 
>                 fprintf(stderr, "\n\n%s : %d\n\n", directive->str,
> directive->define_file_type);
> 
>                 val =  (*directive->get)();
> 
>                 if (val == NULL) {
>                     PUSHs(&PL_sv_undef);
>                 } else {
>                     PUSHs(sv_2mortal( newSVpv(val, strlen(val)) ));
>                 }
> 
> > 
> > this is not a good idea, as it immediately dereferences the returned value.
> > 
> > i suspect your hang is only marginally related.  what does gdb tell you?
> 
>   I have not used gdb with the XS, how would I do that?   Do I need to
> compile a perl with -g & then put -g in the Makefile.PL ?   
> 
>                                   Thanks. 
> > 
> > 
> > 
> > 
-- 
Scott T. Hildreth <[EMAIL PROTECTED]>

Reply via email to