Basically I'm looking for the perl equivalent of gdb's "up" and "down" commands. If I break on subroutine bar
, and I have a call stack that looks like this:
foo
\
baz
\
bar
I'd like to be able to (without returning from bar
or baz
) navigate up the foo
frame and see what it was doing by manipulating variables as I ordinarily would using arguments to p
or x
.
The call stack is a list of all the active functions that have been called to get to the current point of execution. The call stack includes an entry for each function called, as well as which line of code will be returned to when the function returns.
To open the Call Stack window in Visual Studio, from the Debug menu, choose Windows>Call Stack. To set the local context to a particular row in the stack trace display, select and hold (or double click) the first column of the row.
Use the 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With