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

标签 perl debugging

基本上,我正在寻找与 gdb 的“向上”和“向下”命令等效的 perl。如果我中断子程序 bar ,我有一个看起来像这样的调用堆栈:

foo
  \
   baz
    \
     bar
我希望能够(无需从 barbaz 返回)向上导航 foo框架并通过操作变量来查看它在做什么,就像我通常使用 p 的参数一样或 x .

最佳答案

使用 y command .

$ 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

关于perl - 我可以在堆栈中上下移动调试器上下文吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14681472/

相关文章:

debugging - 您可以使用 Ollydbg 1.1 调试 64 位目标应用程序吗?

eclipse - 调试在 Tomcat 上运行的 Spring MVC 应用程序

c - 在 VS 调试器 : any way to hover and see values? 中使用#define

visual-studio - 在 VS2015.3 上启动 ASP.NET Core 应用程序的调试器时出错

regex - Perl 正则表达式命令行问题

perl - 为什么我用 Perl 获取的 HTML 看起来与我在浏览器中看到的不同?

perl - 如何使用 Devel::Declare 注入(inject)多行?

perl - 为什么我的 Perl 源代码显示在浏览器中?

perl - Perl将(s)printf输出附加到字符串

c - 是什么导致 vsprintf 抛出段错误?