| 1 | # Copyright (C) 2011-2012, 2014-2015 Rocky Bernstein <rocky@cpan.org> | ||||||||||||||
| 2 | 12 | ▶ | use warnings; no warnings 'redefine'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | |||||||||||||||
| 4 | 12 | ▶ | use rlib '../../../..'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | package Devel::Trepan::CmdProcessor::Command::Down; | ||||||||||||||
| 7 | 12 | ▶ | use if !@ISA, Devel::Trepan::CmdProcessor::Command ; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | |||||||||||||||
| 9 | 1 | ▶ | unless (@ISA) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 10 | 0 | ▶ | eval <<"EOE"; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | use constant CATEGORY => 'stack'; | ||||||||||||||
| 12 | use constant SHORT_HELP => 'Move frame in the direction of the least recent frame'; | ||||||||||||||
| 13 | use constant NEED_STACK => 1; | ||||||||||||||
| 14 | use constant MIN_ARGS => 0; # Need at least this many | ||||||||||||||
| 15 | use constant MAX_ARGS => 1; # Need at most this many - undef -> unlimited. | ||||||||||||||
| 16 | EOE | ||||||||||||||
| 17 | } | ||||||||||||||
| 18 | |||||||||||||||
| 19 | 12 | ▶ | use strict; use vars qw(@ISA); @ISA = @CMD_ISA; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 20 | 12 | ▶ | use vars @CMD_VARS; # Value inherited from parent | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 21 | |||||||||||||||
| 22 | 1 | our $NAME = set_name(); | |||||||||||||
| 23 | =pod | ||||||||||||||
| 24 | |||||||||||||||
| 25 | =head2 Synopsis: | ||||||||||||||
| 26 | |||||||||||||||
| 27 | =cut | ||||||||||||||
| 28 | 1 | our $HELP = <<'HELP'; | |||||||||||||
| 29 | =pod | ||||||||||||||
| 30 | |||||||||||||||
| 31 | B<down> [I<count>] | ||||||||||||||
| 32 | |||||||||||||||
| 33 | Move the current frame down in the stack trace (to a newer frame). 0 | ||||||||||||||
| 34 | is the most recent frame. If no count is given, move down 1. This is | ||||||||||||||
| 35 | the same as C<up>, but moving in an opposite direction. | ||||||||||||||
| 36 | |||||||||||||||
| 37 | =head2 See also: | ||||||||||||||
| 38 | |||||||||||||||
| 39 | L<C<up>|Devel::Trepan::CmdProcessor::Command::Up>, | ||||||||||||||
| 40 | L<C<frame>|Devel::Trepan::CmdProcessor::Command::Frame>, | ||||||||||||||
| 41 | and L<C<backtrace>|Devel::Trepan::CmdProcessor::Command::Backtrace> | ||||||||||||||
| 42 | |||||||||||||||
| 43 | =cut | ||||||||||||||
| 44 | HELP | ||||||||||||||
| 45 | |||||||||||||||
| 46 | sub complete($$) | ||||||||||||||
| 47 | 0 | ▶ | { | ||||||||||||
|
Subroutine
complete: not called CC=1 SCAR=6.9
Subroutine
complete: not called CC=1 SCAR=6.9
Pod
undocumented
Pod
undocumented
| |||||||||||||||
| 48 | 0 | ▶ | my ($self, $prefix) = @_; | ||||||||||||
|
Subroutine
complete: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 49 | 0 | $self->{proc}->frame_complete($prefix, -1); | |||||||||||||
| 50 | } | ||||||||||||||
| 51 | |||||||||||||||
| 52 | # This method runs the command | ||||||||||||||
| 53 | sub run($$) | ||||||||||||||
| 54 | 0 | ▶ | { | ||||||||||||
|
Subroutine
run: not called CC=3 SCAR=17.9
Subroutine
run: not called CC=3 SCAR=17.9
Pod
undocumented
Pod
undocumented
| |||||||||||||||
| 55 | 0 | my ($self, $args) = @_; | |||||||||||||
| 56 | 0 | my $proc = $self->{proc}; | |||||||||||||
| 57 | 0 | my $count_str = $args->[1]; | |||||||||||||
| 58 | 0 | ▶ | $count_str = 1 unless defined $count_str; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 59 | 0 | my ($low, $high) = $proc->frame_low_high(0); | |||||||||||||
| 60 | 0 | my $opts= { | |||||||||||||
| 61 | 'msg_on_error' => | ||||||||||||||
| 62 | "The '${NAME}' command requires a frame number. Got: ${count_str}", | ||||||||||||||
| 63 | min_value => $low, | ||||||||||||||
| 64 | max_value => $high | ||||||||||||||
| 65 | }; | ||||||||||||||
| 66 | 0 | my $count = $proc->get_an_int($count_str, $opts); | |||||||||||||
| 67 | 0 | ▶ | return unless defined $count; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 68 | 0 | $proc->adjust_frame(-$count, 0); | |||||||||||||
| 69 | } | ||||||||||||||
| 70 | |||||||||||||||
| 71 | 12 | ▶ | unless (caller) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 72 | 0 | require Devel::Trepan::DB; | |||||||||||||
| 73 | 0 | require Devel::Trepan::Core; | |||||||||||||
| 74 | 0 | my $db = Devel::Trepan::Core->new; | |||||||||||||
| 75 | 0 | my $intf = Devel::Trepan::Interface::User->new; | |||||||||||||
| 76 | 0 | my $proc = Devel::Trepan::CmdProcessor->new([$intf], $db); | |||||||||||||
| 77 | 0 | $proc->{stack_size} = 0; | |||||||||||||
| 78 | 0 | my $cmd = __PACKAGE__->new($proc); | |||||||||||||
| 79 | 0 | $cmd->run([$NAME, 0]); | |||||||||||||
| 80 | } | ||||||||||||||
| 81 | |||||||||||||||
| 82 | 1 | 1; | |||||||||||||