blib/lib/Devel/Trepan/CmdProcessor/Command/Info_Subcmd/Program.pm untested

filter: Statementstmt 0.0% 0 / 54 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 97 CC 9 SCAR 38.8
CC
9
Cov
0%
run
90.0
BEGIN
2.0
BEGIN
2.0
CRAP 48.6
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org>
3 use warnings;
4 use rlib '../../../../..';
5  
6 package Devel::Trepan::CmdProcessor::Command::Info::Program;
7  
8 use Devel::Trepan::CmdProcessor::Command::Subcmd::Core;
9  
10 use strict;
11 use vars qw(@ISA @SUBCMD_VARS);
12 @ISA = qw(Devel::Trepan::CmdProcessor::Command::Subcmd);
13 # Values inherited from parent
14 use vars @Devel::Trepan::CmdProcessor::Command::Subcmd::SUBCMD_VARS;
15  
16 our $SHORT_HELP = 'Information about debugged program and its environment';
17 our $MIN_ABBREV = length('pr');
18  
19 =pod
20  
21 =head2 Synopsis:
22  
23 =cut
24 our $HELP = <<'HELP';
25 =pod
26  
27 B<info program>
28  
29 Information about debugged program and its environment.
30 =cut
31 HELP
32  
33 no warnings 'redefine';
34 sub run($$)
35 {
36 my ($self, $args) = @_;
37 my $proc = $self->{proc};
38 my $frame = $proc->{frame};
39 my $line = $frame->{line};
40 my $pkg = $frame->{pkg};
41 my $function = $frame->{fn} if
42 $frame->{fn} && $frame->{fn} ne 'DB::DB';
43  
44 my $m;
45 if (defined($DB::ini_dollar0) && $DB::ini_dollar0) {
46 $m = sprintf "Program: %s.", $DB::ini_dollar0;
47 $proc->msg($m);
48 }
49 $m = sprintf "Program stop event: %s.", $proc->{event};
50 $proc->msg($m);
51 if (defined($DB::OP_addr)) {
52 $m = sprintf "OP address: 0x%x.", $DB::OP_addr;
53 $proc->msg($m);
54 }
55 $proc->msg("Function: $function") if defined $function;
56 $proc->msg("Package: $pkg");
57 if ('return' eq $proc->{event}) {
58 $proc->{commands}{info}->run(['info', 'return']);
59 } elsif ('raise' eq $proc->{event}) {
60 # $self->msg($proc->core.hook_arg) if $proc->core.hook_arg;
61 }
62  
63 if ($DB::brkpt) {
64 my $m = sprintf('It is stopped at %sbreakpoint %d.',
65 $DB::brkpt->type eq 'tbrkpt' ? 'temporary ' : '',
66 $DB::brkpt->id);
67 $proc->msg($m);
68 }
69 }
70  
71 unless (caller) {
72 require Devel::Trepan;
73 # Demo it.
74 # require_relative '../../mock'
75 # my($dbgr, $parent_cmd) = MockDebugger::setup('show');
76 # $cmd = __PACKAGE__->new(parent_cmd);
77 # $cmd->run(@$cmd->prefix);
78 }
79  
80 # Suppress a "used-once" warning;
81 $HELP || scalar @SUBCMD_VARS;