I had the convincing idea of a better B::Debugger, so I stood up and began to write Od.
Like this:
==================
This module is used as debugging replacement to C
Debugging is done in two steps, first you store a optree dump in the CHECK stage into C
Then you load the dump into the INIT stage and continue.
perl -d -MOd=Backend[,OPTIONS] foo.dump
Loads the stored optree after the CHECK stage, sets up the PL_main_root to point to the loaded optree dump and starts the debugger as specified via -d.
==================
But than the nasty head of Storable and B appeared. B::OP's are a tree of linked pointers. So I needed a walkoptree which stores all visited OPs into the Storable stream.
Like
CHECK {
eval 'require Storable';
Storable->import 'store_fd';
$fh = open '>', '].$dump.[';
my $t = new Od::Tree;
walkoptree_slow(main_root, 'visit');
close $fh;
}
But then what to do in the 2nd thaw stage?
B objects cannot be written to! All pointers are read-only.
Storable hooks? Will fail on thaw.
Setting up a dummy B package just for debugging makes no sense, as I want to debug the compiler which runs through a real B optree.
Oh my, so I gave up on this idea.
The current B::Debugger just has a simple read-eval op loop, but nothing like perl5db. And I cannot step through the CHECK stage, through a compiler module.