K
kj
This is a question for those familiar with the Perl internals.
I'd like to debug some Perl code that invokes functions written in
C. I have versions of Perl and the relevant modules that have been
compiled with the appropriate debugging flags, so that, in principle
I could run perl under a C debugger (in my case gdb). The only
obstacle is that I have no idea of where to set breakpoints. More
specifically, I need a strategy for setting a conditional breakpoint
in Perl's internals roughly corresponding to setting a perldb
breakpoint at a particular line in a Perl script.
E.g. suppose I have a Perl script foo.pl whose lines 100 through
102 are
100 my $x = 1;
101 my $y = function_implemented_in_C($x, $y);
102 my $z = $x + $y;
If I were running this script under perldb, I could set a breakpoint
at line 101 (b 101), but I would not be able to step into the
function call at that line, because this function is not written
in Perl; hitting s at this point would put me on line 102, just as
if I had hit n. So I have to run this under gdb instead, and I
need a way to tell gdb to stop at the same stage in the running of
the C program as the one arrived at upon hitting the breakpoint at
line 101 when running foo.pl under perldb.
Any pointers on how I can do this this would be much appreciated.
Thanks!
kj
I'd like to debug some Perl code that invokes functions written in
C. I have versions of Perl and the relevant modules that have been
compiled with the appropriate debugging flags, so that, in principle
I could run perl under a C debugger (in my case gdb). The only
obstacle is that I have no idea of where to set breakpoints. More
specifically, I need a strategy for setting a conditional breakpoint
in Perl's internals roughly corresponding to setting a perldb
breakpoint at a particular line in a Perl script.
E.g. suppose I have a Perl script foo.pl whose lines 100 through
102 are
100 my $x = 1;
101 my $y = function_implemented_in_C($x, $y);
102 my $z = $x + $y;
If I were running this script under perldb, I could set a breakpoint
at line 101 (b 101), but I would not be able to step into the
function call at that line, because this function is not written
in Perl; hitting s at this point would put me on line 102, just as
if I had hit n. So I have to run this under gdb instead, and I
need a way to tell gdb to stop at the same stage in the running of
the C program as the one arrived at upon hitting the breakpoint at
line 101 when running foo.pl under perldb.
Any pointers on how I can do this this would be much appreciated.
Thanks!
kj