I wrote a custom debugger as described in perldebguts. There's something wrong with my debugger code, though, so I want to step through my DB::DB()
and DB::sub()
routines line-by-line to isolate the problem.
I suppose I can do this by setting $^D
to 1<<30
, since the documentation says:
When the execution of your program reaches a point that can hold a breakpoint, the
DB::DB()
subroutine is called if any of the variables$DB::trace
,$DB::single
, or$DB::signal
is true. These variables are not localizable. This feature is disabled when executing insideDB::DB()
, including functions called from it unless$^D & (1<<30)
is true.When execution of the program reaches a subroutine call, a call to
&DB::sub (args)
is made instead, with$DB::sub
holding the name of the called subroutine. (This doesn't happen if the subroutine was compiled in the DB package.)
(emphasis added)
People on the IRC #perl-help channel said that with $^D & (1<<30)
I may be able to debug my debugger but they didn't know any details beyond that.
How can I trace the execution of my DB::DB()
and DB::sub()
subroutines step-by-step?
UPD According to the answer below. When set $^D |= (1<<30)
flag this allows me to debug debugger commands which is defined outside of DB
namespace, but that is not an answer for question: How to disable that feature when executing inside DB::DB?
1 Answers
Answers 1
This is my custom debugger Devel::DebugHooks which I want to debug.
When I run this expression from debugger $^D|=(1<<30)
and after that run debugger command, like vars 2 $x
, this will allow me to debug code which is called from DB:: namespace.
This feature is disabled when executing inside DB::DB(), including functions called from it unless
$^D & (1<<30)
is true
This sentence from DOC just makes confusion.
The feature is NOT disabled when executing inside DB::DB()
unless $^D & (1<<30)
is true.
This feature is disabled only for functions called from DB::DB()
when $^D & (1<<30)
is true
0 comments:
Post a Comment