« blib/lib/Devel/Trepan/CmdProcessor/Command/Subcmd/Core.pm
↑ Summary
lib/Devel/Trepan/BrkptMgr.pm »
| 1 | # Copyright (C) 2011-2015 Rocky Bernstein <rocky@cpan.org> | ||||||||||||||||||||||||||||||
| 2 | 13 | ▶ | use Exporter; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use warnings; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||
| 5 | 13 | ▶ | use rlib '../../..'; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||
| 7 | package Devel::Trepan::CmdProcessor; | ||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||
| 9 | 13 | ▶ | use if !@ISA, Devel::Trepan::Options; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 10 | 13 | ▶ | use vars qw(@EXPORT $HAVE_DATA_DUMPER_CONCISE $HAVE_DATA_PRINT | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 11 | 13 | $HAVE_PERLTIDY @DISPLAY_TYPES); | |||||||||||||||||||||||||||||
| 12 | 13 | @EXPORT = qw(default_eval_display $HAVE_DATA_DUMPER_CONCISE | |||||||||||||||||||||||||||||
| 13 | $HAVE_DATA_PRINT $HAVE_PERLTIDY | ||||||||||||||||||||||||||||||
| 14 | @DISPLAY_TYPES); | ||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||
| 16 | 13 | ▶ | use strict; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||
| 18 | 13 | our @ISA; | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||
| 20 | 13 | ▶ | BEGIN { | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=7 SCAR=20.3
| |||||||||||||||||||||||||||||||
| 21 | 13 | ▶ | $HAVE_DATA_PRINT = | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 22 | eval("use Data::Printer { colored => 1, deparse => 1, sort_keys => 1 }; 1") ? | ||||||||||||||||||||||||||||||
| 23 | 1 : 0; | ||||||||||||||||||||||||||||||
| 24 | 13 | ▶ | $HAVE_DATA_DUMPER_CONCISE = | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 25 | eval("use Data::Dumper::Concise; 1") ? | ||||||||||||||||||||||||||||||
| 26 | 1 : 0; | ||||||||||||||||||||||||||||||
| 27 | 13 | ▶ | $HAVE_PERLTIDY = eval { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 28 | 13 | require Data::Dumper::Perltidy; | |||||||||||||||||||||||||||||
| 29 | } ? 1 : 0; | ||||||||||||||||||||||||||||||
| 30 | 13 | @DISPLAY_TYPES = ('dumper'); | |||||||||||||||||||||||||||||
| 31 | 13 | ▶ | push @DISPLAY_TYPES, 'ddp' if $HAVE_DATA_PRINT; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 32 | 13 | ▶ | push @DISPLAY_TYPES, 'tidy' if $HAVE_PERLTIDY; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 33 | 13 | ▶ | push @DISPLAY_TYPES, 'concise' if $HAVE_DATA_DUMPER_CONCISE; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||
| 36 | # Return what to use for evaluation display | ||||||||||||||||||||||||||||||
| 37 | 13 | ▶ | sub default_eval_display() { | ||||||||||||||||||||||||||||
|
Subroutine
default_eval_display: called CC=4 SCAR=26.6
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | if ($HAVE_DATA_PRINT) { | ||||||||||||||||||||||||||||
|
Subroutine
default_eval_display: not called CC=4 SCAR=26.6
Pod
undocumented
Branch: 6 branches
| |||||||||||||||||||||||||||||||
| 39 | 0 | return 'ddp'; | |||||||||||||||||||||||||||||
| 40 | } elsif ($HAVE_PERLTIDY) { | ||||||||||||||||||||||||||||||
| 41 | 0 | return 'tidy'; | |||||||||||||||||||||||||||||
| 42 | } elsif ($HAVE_DATA_DUMPER_CONCISE) { | ||||||||||||||||||||||||||||||
| 43 | 0 | return 'concise'; | |||||||||||||||||||||||||||||
| 44 | } else { | ||||||||||||||||||||||||||||||
| 45 | 0 | return 'dumper'; | |||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||
| 50 | 13 | ▶ | use constant DEFAULT_SETTINGS => { | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||
| 51 | abbrev => 1, # Allow abbreviations of debugger commands? | ||||||||||||||||||||||||||||||
| 52 | autoeval => 1, # Perl eval non-debugger commands | ||||||||||||||||||||||||||||||
| 53 | autoirb => 0, # Go into IRB in debugger command loop | ||||||||||||||||||||||||||||||
| 54 | autolist => 0, # Run 'list' before entering command loop? | ||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||
| 56 | basename => 0, # Show basename of filenames only | ||||||||||||||||||||||||||||||
| 57 | confirm => 1, # Confirm potentially dangerous operations? | ||||||||||||||||||||||||||||||
| 58 | cmddir => [], # Additional directories to load commands | ||||||||||||||||||||||||||||||
| 59 | # from | ||||||||||||||||||||||||||||||
| 60 | different => 0, # stop *only* when different position? | ||||||||||||||||||||||||||||||
| 61 | displayop => !$ENV{AUTOMATED_TESTING}, | ||||||||||||||||||||||||||||||
| 62 | # If set, show OP address in location | ||||||||||||||||||||||||||||||
| 63 | debugdbgr => 0, # Debugging the debugger | ||||||||||||||||||||||||||||||
| 64 | debugexcept => 1, # Internal debugging of command exceptions | ||||||||||||||||||||||||||||||
| 65 | debugmacro => 0, # debugging macros | ||||||||||||||||||||||||||||||
| 66 | debugskip => 0, # Internal debugging of step/next skipping | ||||||||||||||||||||||||||||||
| 67 | directory => # last-resort path-search for files | ||||||||||||||||||||||||||||||
| 68 | '$cdir:$cwd', # that are not fully qualified. | ||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||
| 70 | displayeval => default_eval_display(), | ||||||||||||||||||||||||||||||
| 71 | # use Data::Dumper (dumper) or | ||||||||||||||||||||||||||||||
| 72 | # Data::Dumper::Perltidy::dumper (tidy) ? | ||||||||||||||||||||||||||||||
| 73 | hidestack => -1, # Fixnum. How many hidden outer | ||||||||||||||||||||||||||||||
| 74 | # debugger stack frames to hide? | ||||||||||||||||||||||||||||||
| 75 | # -1 means compute value. 0 | ||||||||||||||||||||||||||||||
| 76 | # means hide none. Less than 0 means show | ||||||||||||||||||||||||||||||
| 77 | # all stack entries. | ||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||
| 79 | highlight => Devel::Trepan::Options::default_term(), | ||||||||||||||||||||||||||||||
| 80 | # Use terminal highlight? 0 or undef if off. | ||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||
| 82 | maxlines => 1, # Number of context lines in location, | ||||||||||||||||||||||||||||||
| 83 | maxlist => 10, # Number of source lines to list | ||||||||||||||||||||||||||||||
| 84 | maxstack => 10, # backtrace limit | ||||||||||||||||||||||||||||||
| 85 | maxstring => 150, # Strings which are larger than this | ||||||||||||||||||||||||||||||
| 86 | # will be truncated to this length when | ||||||||||||||||||||||||||||||
| 87 | # printed | ||||||||||||||||||||||||||||||
| 88 | 13 | ▶ | maxwidth => ($ENV{'COLUMNS'} || 80), | ||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'COLUMNS'} || 80
MC/DC0%0/1
$ENV{'COLUMNS'} || 80
$ENV{'COLUMNS'}
Truth table50%1/2
A
A= $ENV{'COLUMNS'}
| |||||||||||||||||||||||||||||||
| 89 | prompt => 'trepanpl', # core part of prompt. Additional info like | ||||||||||||||||||||||||||||||
| 90 | # debug nesting and thread added later | ||||||||||||||||||||||||||||||
| 91 | reload => 0, # Reread source file if we determine | ||||||||||||||||||||||||||||||
| 92 | # it has changed? | ||||||||||||||||||||||||||||||
| 93 | save_cmdfile => 0, # If set, debugger command file to be | ||||||||||||||||||||||||||||||
| 94 | # used on restart | ||||||||||||||||||||||||||||||
| 95 | timer => 0, # show elapsed time between events | ||||||||||||||||||||||||||||||
| 96 | traceprint => 0, # event tracing printing | ||||||||||||||||||||||||||||||
| 97 | tracebuffer => 0, # save events to a trace buffer. | ||||||||||||||||||||||||||||||
| 98 | ## user_cmd_dir => File.join(%W(#{Trepan::HOME_DIR} trepan command)), | ||||||||||||||||||||||||||||||
| 99 | ## # User command directory | ||||||||||||||||||||||||||||||
| 100 | 13 | }; | |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||
| 102 | 13 | ▶ | unless (caller) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 103 | # Show it: | ||||||||||||||||||||||||||||||
| 104 | 0 | require Data::Dumper; | |||||||||||||||||||||||||||||
| 105 | 0 | print Data::Dumper::Dumper(DEFAULT_SETTINGS), "\n"; | |||||||||||||||||||||||||||||
| 106 | 0 | print '-' x 20, "\n"; | |||||||||||||||||||||||||||||
| 107 | 0 | print join(', ', @DISPLAY_TYPES), "\n"; | |||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||
| 110 | 13 | 1; | |||||||||||||||||||||||||||||