I recently I've written Devel::REPL plugins to call a trepan or perl5db
debugger from
re.pl via Enbugger.
If there are other plugins for this, I'd be interested to compare.
https://github.com/rocky/Perl-Devel-Trepan-Shell has the code.
In my repl.rc load the plugins:
$_REPL->load_plugin('Trepan');
$_REPL->load_plugin('Perl5db');
Then to get into the debugger
%trepan your-code-here
or
%perl5db some-other-code-here
More could be done to better show return values, and there are some
weirdnesses in the trepan plugin when
re.pl
is exited, but overall it works.
- - -
I was looking at perl5db code and noticed that numeric value of @dbline is
its COP reference. (In
trepan.pl "info program" now shows this when it is
available). I thought this would be a win for being able to more precisely
indicate where you are and to set breakpoints within lines which have
multiple statements on them.
Such an example line might be:
if ($x) { $y--; if ($y) { $z += 1 } else { $z -= 1 }; } else { $z = 10 };
If you disassemble via B::Concise, you'll see several COPs for this line.
However the @dbline entry for that line always seems to be the first COP
rather than the one that called DB::DB.