[Pdx-pm] Debugging Inline C programs...

Eric Wilhelm ewilhelm at sbcglobal.net
Thu Feb 24 07:27:48 PST 2005


# The following was supposedly scribed by
# Nick Wehr
# on Thursday 24 February 2005 02:20 am:

Sorry to leave you hanging on the inline-perl list.

>I've been looking all over the man pages for some information on
> debugging C code from within Inline.  I've been using if (DEBUG)
> lines all over tracking down my problem code...  is there an easier
> way to do this?

To be portable:
------------------------
/*#define DEBUG_PRINT*/

#ifdef DEBUG_PRINT
#define dbg_p(x) printf x
#else
#define dbg_p(x)
#endif

...
 free(p);
 dbg_p(("p free... DESTROY complete\n"));
...
------------------------

> Can I [cross fingers] somehow use a debugger?  If 
> not, what have you guys done to make this task less painful.

Hmm.  How do you use a debugger on XS code?  If you know that, you're 
halfway there.  Then you just have to get Inline to not 
CLEAN_AFTER_BUILD.  As far as automagic c-level debugging support from 
within Inline, I don't think there's anything (though perldoc Inline::C 
makes some reference to an OPTIMIZE => '-g' setting for use with gdb.)

--Eric
-- 
"Matter will be damaged in direct proportion to its value." 
                                        -- Murphy's Constant
---------------------------------------------
    http://scratchcomputing.com
---------------------------------------------


More information about the Pdx-pm-list mailing list