BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:

I'm calling a (standard) module, that is mostly a .pm wrapper around an XS module. The XS code is detecting an error condition and croaking.

The problem is, the traceback from croak stops at the Perl wrapper, and leaves me no clues as to where in my code I am passing bad data.

Is there anyway of persuading croak to give me full traceback? Preferably without digging around in the XS module or having to wait for a perlbug to be actioned to get a patch?


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.
  • Comment on Getting full traceback from (someone elses) XS routine

Replies are listed 'Best First'.
Re: Getting full traceback from (someone elses) XS routine
by borisz (Canon) on Feb 15, 2005 at 01:49 UTC
    I have one more idea ;-)
    PERLDB_OPTS="NonStop AutoTrace LineInfo=lines frame=1" perl -d your_sc +ript.pl
    If you are lucky, the last lines hint you to the calling location. Hopefully the lines file is flushed if your script croak. I do not know.
    Boris
Re: Getting full traceback from (someone elses) XS routine
by borisz (Canon) on Feb 15, 2005 at 00:51 UTC
    I'm sure you tried this already. Perhaps it make a difference:
    perl -MCarp=verbose your_script.pl
    Boris

      I hadn't, but have now. Unfortunately, the croak that's failing to be forthcoming is being called in the XS code, which appears to be unaffected by the verbose setting of the Carp package.

      I'm not even sure that the XS version of croak and the Carp version are the same or even vaguely related?


      Examine what is said, not who speaks.
      Silence betokens consent.
      Love the truth but pardon error.

        In XS, croak() is pretty much the same as die in Perl code. It indeed has nothing to do with Carp.

        - tye        

        You are right, I just thought on the wrong croak. sorry.
        Boris