Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

rurban (7989)

  {rurban} {at} {}

cygwin maintainer for perl, parrot, clisp, postgresql, ... and some perl modules (perl-libwin32, perl-Win32-GUI). Has also some hairy CPAN packages: B::C, B::Generate, C::DynaLib, B::Debugger ...

Journal of rurban (7989)

Thursday December 10, 2009
12:50 PM

B Debugger thoughts

[ #40001 ]

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, the Perl Compiler frontend.

Debugging is done in two steps, first you store a optree dump in the CHECK stage into C, or the dumpfile specified with the C option, and the Compiler backend is never called.

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.

    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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.