Call perl5db or trepan.pl from re.pl
[email protected] (Rocky Bernstein) Sat, 7 Jan 2012 23:42:42 -0500
| Newsgroups | perl.debugger |
|---|---|
| Message-ID | <CANCp2gYHDOE2VEPuWvdb0No2CR4kTfdLfSmAOhYVHwoW=hV97Q@mail.gmail.com> |
--e89a8ff24e8b9673d004b5fce954
Content-Type: text/plain; charset=ISO-8859-1
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.
--e89a8ff24e8b9673d004b5fce954--