On 27 Feb 2008, at 17:10, Joe McMahon wrote:
On Feb 27, 2008, at 5:47 AM, Andy Armstrong wrote:
I can monkeypatch Test::Builder so that it does something when it
passes those test numbers but is there any way I can instruct the
debugger to stop when it returns to the caller rather than as soon
as $DB::single == 1? I don't want the breakpoint to leave me in the
guts of Test::Builder.
The patch should be in DB::sub. since that's where the debugger gets
control before and after subroutine calls.
Looks to be that the best place is at the two lines (yes, the code
there is duplicated, or almost so - bleah) with the comment "Pop the
single-step value off the stack." This is after the code has
returned control to the debugger, so at that point you can check
Test::Builder->new->current_test and to see if you've hit the test
you want yet, $DB::sub to make sure you're not in a Test:: module,
and then set $DB::single to 1 to stop execution at that point.
OK, that sounds good - I'll investigate further, thanks.
It'd be nice to have an array of coderefs to call at this point to
decide what to do, but then you'd have to manage the fact that
DB::sub would get called again when the coderef was called to see if
we should stop, and I can't think that one out casually without
breakfast.
That would indeed be nice :)
--
Andy Armstrong, Hexten