File Coverage

lib/Devel/Trepan/CmdProcessor/Command/Info_Subcmd/Program.pm
Criterion Covered Total %
statement 42 86 48.8
branch 0 32 0.0
condition 0 12 0.0
subroutine 14 16 87.5
pod n/a
total 56 146 38.3


line stmt bran cond sub pod time code
1             # -*- coding: utf-8 -*-
2             # Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org>
3 12     12   114 use warnings;
  12     1   41  
  12         585  
  1         8  
  1         4  
  1         28  
4 12     12   81 use rlib '../../../../..';
  12     1   34  
  12         81  
  1         5  
  1         2  
  1         6  
5              
6             package Devel::Trepan::CmdProcessor::Command::Info::Program;
7              
8 12     12   5766 use Devel::Trepan::CmdProcessor::Command::Subcmd::Core;
  12     1   34  
  12         349  
  1         438  
  1         3  
  1         20  
9              
10 12     12   85 use strict;
  12     1   39  
  12         356  
  1         5  
  1         2  
  1         20  
11 12     12   86 use vars qw(@ISA @SUBCMD_VARS);
  12     1   32  
  12         1108  
  1         5  
  1         2  
  1         55  
12             @ISA = qw(Devel::Trepan::CmdProcessor::Command::Subcmd);
13             # Values inherited from parent
14 12     12   85 use vars @Devel::Trepan::CmdProcessor::Command::Subcmd::SUBCMD_VARS;
  12     1   36  
  12         1733  
  1         5  
  1         4  
  1         105  
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 12     12   84 no warnings 'redefine';
  12     1   34  
  12         4382  
  1         5  
  1         3  
  1         293  
34             sub run($$)
35             {
36 0     0     my ($self, $args) = @_;
  0     0      
37 0           my $proc = $self->{proc};
  0            
38 0           my $frame = $proc->{frame};
  0            
39 0           my $line = $frame->{line};
  0            
40 0           my $pkg = $frame->{pkg};
  0            
41             my $function = $frame->{fn} if
42 0 0 0       $frame->{fn} && $frame->{fn} ne 'DB::DB';
  0 0 0        
43              
44 0           my $m;
  0            
45 0 0 0       if (defined($DB::ini_dollar0) && $DB::ini_dollar0) {
  0 0 0        
46 0           $m = sprintf "Program: %s.", $DB::ini_dollar0;
  0            
47 0           $proc->msg($m);
  0            
48             }
49 0           $m = sprintf "Program stop event: %s.", $proc->{event};
  0            
50 0           $proc->msg($m);
  0            
51 0 0         if (defined($DB::OP_addr)) {
  0 0          
52 0           $m = sprintf "OP address: 0x%x.", $DB::OP_addr;
  0            
53 0           $proc->msg($m);
  0            
54             }
55 0 0         $proc->msg("Function: $function") if defined $function;
  0 0          
56 0           $proc->msg("Package: $pkg");
  0            
57 0 0         if ('return' eq $proc->{event}) {
  0 0          
    0          
    0          
58 0           $proc->{commands}{info}->run(['info', 'return']);
  0            
59             } elsif ('raise' eq $proc->{event}) {
60             # $self->msg($proc->core.hook_arg) if $proc->core.hook_arg;
61             }
62              
63 0 0         if ($DB::brkpt) {
  0 0          
64 0 0         my $m = sprintf('It is stopped at %sbreakpoint %d.',
  0 0          
65             $DB::brkpt->type eq 'tbrkpt' ? 'temporary ' : '',
66             $DB::brkpt->id);
67 0           $proc->msg($m);
  0            
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;