optree debugger?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Working on the fixes for the B::C perl compiler I wondered why nobody so
far considered writing an B::Debugger, an optree debugger.
I need that to debug my various B compiler modules, which I hate to
debug on the C level, gdb or insight.

It's pretty simple hooking into the CHECK or INIT block and setting up a
simple read-eval-print loop there. And well, you have got an interactive

So I started writing one. First as XS module, then as PM module.
It doesn't work yet, but I wondered if someone knows more, why and how
and esp. why not.

If not, I want to reserve this namespace B::Debugger for me and upload
it to CPAN.

rurban at cpan.org

The idea is like this:

use B qw(main_start); use Devel::Hook;
sub init_debugger_loop {
   debugger_walkoptree(main_root, \&debugger_prompt, main_root);
   Devel::Hook->push_INIT_hook( \&init_debugger_loop );

$ perl -MB::Debugger program.pl
   B::Debugger 0.01 - optree debugger. h for help
   > h
   n     next op         op <n>  inspect op
   c <n> continue          next  next op
   b <n> break at step     type  type
   l     list              flags flags of current op
   x ..  execute         [SAHPICG]V<n> inspect n-th global variable
   h     help            F,Flags   B::Flags of current op
   q     quit            C,Concise B::Concise of current op
   > b 1
   breakpoint 1 added
   > l
<should B::OP::debug list the next ops>
   > c
<should break at next op, starting with op 0>
   > q

Site Timeline