perl – 如何调试自定义调试器?

我写了一个自定义调试器,如
perldebguts所述.但是我的调试器代码有问题,所以我想逐行遍历我的DB :: DB()和DB :: sub()例程来隔离问题.

我想我可以通过将$^D设置为1<<<<<<<<<<<<<<<<<<<<<<<<<

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 inside DB::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.)

(重点补充)

IRC#perl-help频道的人说用$^ D& (1<<<<<<<<<<<<<<<<<<<<<<<<<<< 30) 如何逐步跟踪DB :: DB()和DB :: sub()子例程的执行情况? UPD
根据下面的答案.当设置$^ D | =(1<<<< 30)标志时,这允许我调试在DB命名空间之外定义的调试器命令,但这不是问题的答案:如何在执行DB ::内部时禁用该功能D B?

最佳答案 这是我想要调试的自定义调试器
Devel::DebugHooks.

当我从调试器运行这个表达式时,$^ D | =(1<<<<<<<<<<<<<<<<<<<<<<<<<<<<

This feature is disabled when executing inside DB::DB(), including functions called from it unless $^D & (1<<30) is true

来自DOC的这句话只会令人困惑.
在DB :: DB()内部执行时,该功能未被禁用,除非$^ D& (1 << <30)是真的.
当$^ D& amp;&amp ;; (1 << <30)是真的

点赞