我可以在堆栈中上下移动调试器上下文吗?

gcb*_*son 6 debugging perl

基本上我正在寻找相当于gdb的"up"和"down"命令的perl.如果我打破子程序bar,我有一个看起来像这样的调用堆栈:

foo
  \
   baz
    \
     bar
Run Code Online (Sandbox Code Playgroud)

我希望能够(没有从bar或返回baz)导航foo框架并通过操纵变量来查看它正在做什么,因为我通常会使用p或的参数x.

dax*_*xim 6

使用该y命令.

$ cat frames.pl
sub bar {
    my $fnord = 42;
    1
}
sub baz { bar }
sub foo {
    my $fnord = 23;
    baz
};
foo;
$ perl -d frames.pl

Loading DB routines from perl5db.pl version 1.37
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

main::(frames.pl:10):   foo;
DB<1> c 3
main::bar(frames.pl:3):     1
DB<2> y 2 fnord
$fnord = 23
DB<3> T
. = main::bar() called from file 'frames.pl' line 5
. = main::baz() called from file 'frames.pl' line 8
. = main::foo() called from file 'frames.pl' line 10
Run Code Online (Sandbox Code Playgroud)

  • 确实很整洁,+1,但是这似乎仍然比 gdb 提供的要少 - 在其他框架中设置词法变量的值,评估包含词法变量的表达式等。我仍然想知道这在 perl 调试器中是否可能...... (2认同)