7

基本上我正在寻找与 gdb 的“up”和“down”命令等效的 perl。如果我在 subroutine 上中断bar,并且我有一个如下所示的调用堆栈:

foo
  \
   baz
    \
     bar

我希望能够(不从baror返回baz)向上导航foo框架并通过操纵变量来查看它在做什么,就像我通常使用por的参数一样x

4

1 回答 1

7

使用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
于 2013-02-10T17:09:01.153 回答