Hi Aaron,
> Is there any (short) answer to this that you want to reveal to those of us
> not lucky enough to be going to TPC? Thanks!
The question has been asked, "Anyone know how to get the Perl debugger to
step into C?"
My solution (and the topic of my BOF) is to have a hybrid debugger which
knows about both the Perl Debugger and GDB. Here's the shortest useful answer
I know how to give:
Precondition: use Inline C;
Abstract:
You need to compile your extension with debugging enabled. Currently
Inline::C doesn't support the OPTIMIZE flag, so use CCFLAGS instead. Then
invoke your script using gdb. You can set breakpoints on the C functions, get
a meaningful traceback if you segfault, and other useful things -- even if
perl isn't compiled with debugging!
Tutorial:
1. Compile with debugging:
use ExtUtils::Embed;
use Inline C => Config => CCFLAGS => join ' ', ccflags(), "-g";
use Inline C;
__END__
__C__
#define NORMALIZE_AVERAGE 0
int some_func(int avg) {
return avg/NORMALIZED_AVERAGE;
}
2. Invoke your script under gdb:
a) Set breakpoints on C subroutines:
$ gdb perl
> break some_func
> run [args] script.pl [args]
b) Run as usual, letting gdb catch segfaults and show you a backtrace:
$ gdb perl
$ run [args] script.pl [args]
3. That's it!
To get the perl debugger to "jump into C", just pass the '-d' flag to the run
command. I'll show a short demo of this method on the BOF to prove there's
nothing new happening. My creation is really only a small wrapper around both
debuggers which pretends to be one debugger, but really just brings one or
the other to the foreground.
Good luck!
Neil