in reply to How can I debug perl-xs code?
I would echo the comments you already have about the debugger flag. Another thing I have found with XS is that I have had trouble getting perl to run in the debugger (admittedly this is mostly when I am messing with interrupts and with modules linked to dynamic libraries). A trick that I have found usefull is to temporarily insert an infinite loop at the start of my C code:
int temp_val; temp_val = 100; /* An infinite loop that usually won't be optimised away */ while(temp_val > 0) { temp_val--; if(temp_val < 50) temp_val = 100; }
Then start up the perl script, it will go into the infinite loop. Use
ps auxto get its process number. Start gdb with
gdb `which perl` <Process Number>And get out of the infinite loop with
set temp_val=-1000Now you have a gdb session with all the correct libraries loaded stopped at the start of your routine.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How can I debug perl-xs code?
by EverLast (Scribe) on Feb 05, 2004 at 10:33 UTC | |
|
Re: Re: How can I debug perl-xs code?
by flyingmoose (Priest) on Feb 04, 2004 at 23:33 UTC | |
|
Re: Re: How can I debug perl-xs code?
by pijush (Scribe) on Feb 05, 2004 at 10:56 UTC |