« lib/Devel/Trepan/CmdProcessor/Command/Step.pm
↑ Summary
lib/Devel/Trepan/CmdProcessor/Command/Backtrace.pm »
| 1 | # Copyright (C) 2011-2012 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::Frame; | ||||||||||||||||||||||
| 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 => 'Set frame for use in commands'; | ||||||||||||||||||||||
| 13 | use constant MIN_ARGS => 0; # Need at least this many | ||||||||||||||||||||||
| 14 | use constant MAX_ARGS => 2; # Need at most this many - undef -> unlimited. | ||||||||||||||||||||||
| 15 | use constant NEED_STACK => 1; | ||||||||||||||||||||||
| 16 | EOE | ||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||
| 18 | |||||||||||||||||||||||
| 19 | 12 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 20 | |||||||||||||||||||||||
| 21 | 12 | ▶ | use vars qw(@ISA); @ISA = @CMD_ISA; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 22 | 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
| |||||||||||||||||||||||
| 23 | |||||||||||||||||||||||
| 24 | 12 | our $NAME = set_name(); | |||||||||||||||||||||
| 25 | =pod | ||||||||||||||||||||||
| 26 | |||||||||||||||||||||||
| 27 | =head2 Synopsis: | ||||||||||||||||||||||
| 28 | |||||||||||||||||||||||
| 29 | =cut | ||||||||||||||||||||||
| 30 | 1 | our $HELP = <<"HELP"; | |||||||||||||||||||||
| 31 | =pod | ||||||||||||||||||||||
| 32 | |||||||||||||||||||||||
| 33 | B<frame> [I<frame-number>] | ||||||||||||||||||||||
| 34 | |||||||||||||||||||||||
| 35 | Change the current frame to frame I<frame-number> if specified, or the | ||||||||||||||||||||||
| 36 | most-recent frame, 0, if no frame number specified. | ||||||||||||||||||||||
| 37 | |||||||||||||||||||||||
| 38 | A negative number indicates the position from the other or | ||||||||||||||||||||||
| 39 | least-recently-entered end. So C<frame -1> moves to the oldest frame. | ||||||||||||||||||||||
| 40 | |||||||||||||||||||||||
| 41 | =head2 Examples: | ||||||||||||||||||||||
| 42 | |||||||||||||||||||||||
| 43 | frame # Set current frame at the current stopping point | ||||||||||||||||||||||
| 44 | frame 0 # Same as above | ||||||||||||||||||||||
| 45 | frame . # Same as above. 'current thread' is explicit. | ||||||||||||||||||||||
| 46 | frame . 0 # Same as above. | ||||||||||||||||||||||
| 47 | frame 1 # Move to frame 1. Same as: frame 0; up | ||||||||||||||||||||||
| 48 | frame -1 # The least-recent frame | ||||||||||||||||||||||
| 49 | |||||||||||||||||||||||
| 50 | =head2 See also: | ||||||||||||||||||||||
| 51 | |||||||||||||||||||||||
| 52 | L<C<up>|Devel::Trepan::CmdProcessor::Command::Up>, | ||||||||||||||||||||||
| 53 | L<C<down>|Devel::Trepan::CmdProcessor::Command::Down>, | ||||||||||||||||||||||
| 54 | and L<C<backtrace>|Devel::Trepan::CmdProcessor::Command::Backtrace> | ||||||||||||||||||||||
| 55 | |||||||||||||||||||||||
| 56 | =cut | ||||||||||||||||||||||
| 57 | HELP | ||||||||||||||||||||||
| 58 | |||||||||||||||||||||||
| 59 | sub complete($$) | ||||||||||||||||||||||
| 60 | 0 | ▶ | { | ||||||||||||||||||||
|
Subroutine
complete: not called CC=1 SCAR=6.9
Subroutine
complete: not called CC=1 SCAR=6.9
Pod
undocumented
Pod
undocumented
| |||||||||||||||||||||||
| 61 | 0 | ▶ | my ($self, $prefix) = @_; | ||||||||||||||||||||
|
Subroutine
complete: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 62 | 0 | $self->{proc}->frame_complete($prefix); | |||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||
| 64 | |||||||||||||||||||||||
| 65 | # This method runs the command | ||||||||||||||||||||||
| 66 | sub run($$) | ||||||||||||||||||||||
| 67 | 0 | ▶ | { | ||||||||||||||||||||
|
Subroutine
run: not called CC=4 SCAR=24.1
Subroutine
run: not called CC=4 SCAR=24.1
Pod
undocumented
Pod
undocumented
| |||||||||||||||||||||||
| 68 | 0 | my ($self, $args) = @_; | |||||||||||||||||||||
| 69 | 0 | my $proc = $self->{proc}; | |||||||||||||||||||||
| 70 | 0 | my $position_str; | |||||||||||||||||||||
| 71 | |||||||||||||||||||||||
| 72 | 0 | ▶ | if (scalar @$args == 1) { | ||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||
| 73 | # Form is: "frame" which means "frame 0" | ||||||||||||||||||||||
| 74 | 0 | $position_str = '0'; | |||||||||||||||||||||
| 75 | } elsif (scalar @$args == 2) { | ||||||||||||||||||||||
| 76 | # Form is: "frame position" | ||||||||||||||||||||||
| 77 | 0 | $position_str = $args->[1]; | |||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||
| 79 | |||||||||||||||||||||||
| 80 | 0 | my ($low, $high) = $proc->frame_low_high(0); | |||||||||||||||||||||
| 81 | 0 | my $opts= { | |||||||||||||||||||||
| 82 | 'msg_on_error' => | ||||||||||||||||||||||
| 83 | "The '${NAME}' command requires a frame number. Got: ${position_str}", | ||||||||||||||||||||||
| 84 | min_value => $low, | ||||||||||||||||||||||
| 85 | max_value => $high | ||||||||||||||||||||||
| 86 | }; | ||||||||||||||||||||||
| 87 | 0 | my $frame_num = $proc->get_an_int($position_str, $opts); | |||||||||||||||||||||
| 88 | 0 | ▶ | return unless defined $frame_num; | ||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||
| 89 | 0 | $proc->adjust_frame($frame_num, 1); | |||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||
| 91 | |||||||||||||||||||||||
| 92 | 1 | ▶ | unless (caller) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 93 | 0 | require Devel::Trepan::DB; | |||||||||||||||||||||
| 94 | 0 | require Devel::Trepan::Core; | |||||||||||||||||||||
| 95 | 0 | my $db = Devel::Trepan::Core->new; | |||||||||||||||||||||
| 96 | 0 | my $intf = Devel::Trepan::Interface::User->new; | |||||||||||||||||||||
| 97 | 0 | my $proc = Devel::Trepan::CmdProcessor->new([$intf], $db); | |||||||||||||||||||||
| 98 | 0 | $proc->{stack_size} = 0; | |||||||||||||||||||||
| 99 | 0 | my $cmd = __PACKAGE__->new($proc); | |||||||||||||||||||||
| 100 | 0 | $cmd->run([$NAME, 0]); | |||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||
| 102 | |||||||||||||||||||||||
| 103 | 1 | 1; | |||||||||||||||||||||