in reply to
debugging perl module written in C
Here is how I usually debug XSS code (not with Komodo, though):
- Recompile the C code with CFLAGS=-g -O0 to have debugging symbols in the resultant library that will be loaded from Perl. -O0 will remove optmization, this makes it easier to step through the code.
- Edit the Perl code and put a dump() somewhere before the offending XSS function is called. This will make your Perl exit immediately when calling this function and dump a core. Note that you must have core files enabled (on UNIX, you achieve this by issuing ulimit -c unlimited).
- Fire up a debugger (I recommend the venerable gdb) and read in the core
Now, you have all the symbols read in by gdb, so you can start placing breakpoints whereever you want.
(gdb) core core
(gdb) file /usr/bin/perl
Reading symbols from /usr/bin/perl...(no debugging symbols found)...do
(gdb) set args a.pl
Starting program: /usr/bin/perl a.pl
- After placing the breakpoints, remove the dump() from your Perl code, rerun and wow, your debugger will stop at your breakpoint.
Two final notes are in order here. First, I haven't tested this on Windows, but something along these lines should work there too. Second, the above method will allow you to step through only the XSS code but not the Perl code. I don't quite know any methods to simultaneously debug C and Perl code at the same time.