| 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | package Debug::Mixin ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use base Exporter ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use strict ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 11 | ▶ | use warnings ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | BEGIN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 11 | ▶ | use vars qw ($VERSION @EXPORT_OK %EXPORT_TAGS); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 11 | $VERSION = '0.4' ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 11 | @EXPORT_OK = qw (IsDebuggerEnabled CheckBreakpoint); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 11 | %EXPORT_TAGS = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 11 | ▶ | use Carp qw(croak carp confess cluck); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 11 | ▶ | use Data::TreeDumper ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 11 | ▶ | use Sub::Install; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 11 | ▶ | use English qw( -no_match_vars ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 11 | ▶ | use Readonly ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 11 | Readonly my $EMPTY_STRING => q{} ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 11 | ▶ | use Tie::Hash::Indexed ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 11 | ▶ | use List::MoreUtils qw(any) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | Debug::Mixin - Make your applications and modules easier to debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | package my_module ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # load Debug::Mixin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | use Debug::Mixin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | BANNER => "my banner", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # available at any point in the debugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | DEBUGGER_SUBS => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | NAME => CheckDependencyMatrix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ALIASES => [qw(dm_cdm cdm)], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | DESCRIPTION => "a short description of what this sub is for", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | HELP => "a long, possibly multi line description displayed" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | . "when the user needs it", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | SUB => sub{}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # add breakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | AddBreakpoint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | NAME => 'hi' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | FILTERS => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | my (%filter) = @_ ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | $filter{ARGS}{TYPE} eq 'DEPEND' ; # true will enable the actions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ACTIONS => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | my (%filter) = @_ ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | print DumpTree $filter{ARGS}{COMPLEX_ELEMENT} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | return JUMP_TO_DEBUGGER # want to jump into debugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | DEBUGGER_SUBS=> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | NAME => 'BreakpointDebuggerSub', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | DESCRIPTION => "a short description of what this sub is for", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | HELP => "a long, possibly multi line description displayed" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | . "when the user needs it", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | SUB => sub{}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | LOCAL_STORAGE => {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | ALWAYS_USE_DEBUGGER => 0 # let subs decide if we jump in the debugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | ACTIVE => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # use the breakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | sub DoSomething | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | #DEBUG | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | my %debug_data = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | TYPE => 'VARIABLE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | , VARIABLE_NAME => $key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | , VARIABLE_VALUE => $value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | , ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | #DEBUG | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | $DB::single = 1 if(Debug::Mixin::IsDebuggerEnabled() && Debug::Mixin::CheckBreakpoint(%debug_data)) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | # or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | if(Debug::Mixin::IsDebuggerEnabled()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | %debug_data = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | TYPE => 'VARIABLE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | , ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | $DB::single = 1 if(Debug::Mixin::CheckBreakpoint(%debug_data, MORE_DATA => 1)) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | This module help you define breakpoints for your own module or applications making them easier to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | debug. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | =head1 DOCUMENTATION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | Lately,I've been speculating about architectures that would allow us to debug them more easily. Logging, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | aspect oriented, web interface to internals are some examples of techniques already in use. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | The perl debugger already allows us to do a lot of tricky testing before displaying a prompt or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | stopping only when certain conditions are met. I believe in making debugging even more practical | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | and intelligent. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | My theory is simple, actively present data, from your code, and check if a breakpoint matches. This | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | is, in theory, not very different from smart breakpoints in the debugger except the breakpoints are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | defined in files outside the debugger and are part of the module distribution. The place where this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | breakpoints triggers are not defined by the breakpoints but by the code being debugged. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | Finding where the breakpoints should be checked is best determined while writing the code though | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | they can be added later making your module more . This, of course, doesn't stop you | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | from using the debugger in a normal fashion, with or without the help of these "code called" breakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | In your module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | use Debug::Mixin ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | $DB::single = 1 if(Debug::Mixin::IsDebuggerEnabled() && Debug::Mixin::CheckBreakpoint(%debug_data)) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | At the cost of a subroutine call, you get checking of breakpoints at a position you deem strategic and the possibility | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | to stop in the debugger if any of the breakpoints actions flag to stop. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | I'd check if the cost has a real impact before trying to reduce it. you could write: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | use Filter::Uncomment GROUPS => [ debug_mixin => ['DM'] ] ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | use Debug::Mixin ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | ##DM $DB::single = 1 if(Debug::Mixin::IsDebuggerEnabled() && Debug::Mixin::CheckBreakpoint(%debug_data)) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | You'll now pay only if you are actively using B<Debug::Mixin> to debug your application/modules. The only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | cost being the filtration of the code if, and only if, you decide to uncomment. if you don't, the cost is practically zero. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | Have I used this in any real project, PBS on CPAN, and it did really help a lot with very complex problems. Mainly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | because it let me run debugging very fast but also because the check point were put in the code before I had | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | any problems saving me time to find out where I should place them. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | =head1 DEBUG SESSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | script Debug::Mixin aware | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | perl -d script.pl --argument_loading_plenty_breakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | script doesn't have to be aware of modules debugging facilities, only modules using Debug::Mixin have to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | perl -d -MDebug::Mixin='LoadBreakpointsFiles=file' script.pl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | > Using Debug::Mixin banner, use 'dm_help' for Debug::Mixin help. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | > dm_help | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | dm_subs() list and run debugging subs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | dm_load(@files) load breakpoints files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # all breakpoints functions take a regex | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | dm_bp(qr//) list breakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | dm_activate(qr//) activate breakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | dm_deactivate(qr//) deactivate breakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | dm_use_debugger(qr//) jump in debugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | dm_dont_use_debugger(qr//) jump in debugger only if a breakpoint action says to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | > run part of the program ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | > Breakpoints display information (eventually interacting with the user) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | > stop at a breakpoint, if local commands are available interact with the user, display their documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | =head1 SUBROUTINES/METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 11 | ▶ | if(*DB::DB{CODE}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | Output("Debug::Mixin support available, type 'dm_help' for help, or man Debug::Mixin for more help.\n\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 11 | Output("Debug::Mixin banner when debugger is not loaded\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 11 | my $debug_enabled = 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 11 | my %debugger_subs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 11 | tie my %breakpoints, 'Tie::Hash::Indexed' ; ## no critic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | sub import | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=7 SCAR=22.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | =head2 import | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | Called for you by Perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 11 | my ($module_name, $data, @more_data) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 11 | my ($package, $file_name, $line) = caller() ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 11 | Output("Debug::Mixin used at '$package, $file_name, $line'\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | #~ use Data::TreeDumper ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | #~ print DumpTree \@_ ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 11 | ▶ | if(defined $data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 1 | ▶ | if('HASH' eq ref $data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 1 | ▶ | while( my($key, $value) = each %{$data}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 1 | SetupElement($package, $file_name, $line, $key, $value) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | unshift @more_data, $data ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | for(@more_data) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | SetupElement($package, $file_name, $line, split(/=/sxm, $_)) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | # this module doesnt export any subroutine | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | #~ Debug::Mixin->export_to_level(1, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | #except | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 11 | ▶ | if(*DB::DB{CODE}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | for my $sub | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | [\&dm_help, 'dm_help'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | [\&dm_subs , 'dm_subs'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | [\&LoadBreakpointsFiles , 'dm_load'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | [\&ListBreakpoints , 'dm_bp'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | [\&ActivateBreakpoints, 'dm_activate'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | [\&DeactivateBreakpoints, 'dm_deactivate'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | [\&ActivateAlwaysUseDebugger , 'dm_use_debugger'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | [\&DeactivateAlwaysUseDebugger , 'dm_dont_use_debugger'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | my ($code, $as) = @{$sub} ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | Sub::Install::reinstall_sub | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | code => $code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | into => 'main', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | as => $as, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 11 | return(1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | sub SetupElement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SetupElement: called CC=17 SCAR=38.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | =head2 SetupElement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | Private function | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | my ($package, $file_name, $line, $key, $value) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | for($key) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | /BANNER/smix and do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | if(*DB::DB{CODE}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | Output("Debug::Mixin loaded for '$value'\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | next ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | /LoadBreakpointsFiles/smx and do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | my $files = 'ARRAY' eq ref $value ? $value : [$value] ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | for my $file (@{$files}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | Output("Loading '$file'\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | next ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | /DEBUGGER_SUBS/smx and do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 1 | ▶ | croak "Debug::Mixin: DEBUGGER_SUBS must be a list!\n" unless('ARRAY' eq ref $value) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | ▶ | croak "Debug::Mixin: no subroutine defined in DEBUGGER_SUBS!\n" if( @{$value} <= 0) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | Readonly my $EXPECTED_NUMBER_OF_DEBUGGER_SUB_FIELDS => 5 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 1 | for my $debugger_sub (@{$value}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 1 | ▶ | croak "Debug::Mixin: local subroutine must be a hash!\n" unless 'HASH' eq ref $debugger_sub ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | croak "Debug::Mixin: invalid local subroutine definition!\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 1 | ▶ | unless $EXPECTED_NUMBER_OF_DEBUGGER_SUB_FIELDS == keys %{$debugger_sub} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 1 | my $valid_keys = join('$|^', qw(NAME ALIASES DESCRIPTION HELP SUB)) ; ## no critic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 1 | for my $key (keys %{$debugger_sub}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 5 | ▶ | croak "Debug::Mixin: Unrecognized local subroutine argument '$key'!\n" unless $key =~ /^$valid_keys$/smxo ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 1 | ▶ | if(*DB::DB{CODE}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $debugger_subs{$package}{$debugger_sub->{NAME}} = $debugger_sub ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | Sub::Install::reinstall_sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | code => $debugger_sub->{SUB}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | into => $package, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | as => $debugger_sub->{NAME}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | for my $alias ($debugger_sub->{ALIASES}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | Sub::Install::reinstall_sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | code => $debugger_sub->{SUB}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | into => $package, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | as => $alias, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | Output("Debug::Mixin registrating debugger sub '${package}::$debugger_sub->{NAME}'\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 1 | next ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | croak "Unknown setup element '$key'!\n" ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 1 | return(1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | sub EnableDebugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
EnableDebugger: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | =head2 EnableDebugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | Globally Enables or disables this module. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | Debug::Mixin::EnableDebugger(0) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | Debug::Mixin::EnableDebugger(1) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 2 | $debug_enabled = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 2 | return($debug_enabled) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | sub IsDebuggerEnabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
IsDebuggerEnabled: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | =head2 IsDebuggerEnabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | Returns the state of this module. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | my $status = Debug::Mixin::IsDebuggerEnabled() ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | return($debug_enabled) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | sub AddBreakpoint ## no critic (Subroutines::RequireArgUnpacking) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 40 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AddBreakpoint: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | =head2 AddBreakpoint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | use Debug::Mixin ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | AddBreakpoint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | NAME => 'add dependencies' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | FILTERS => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | my (%filter) = @_ ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | $filter{ARGS}{TYPE} eq 'DEPEND' ; # true will enable the actions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | ACTIONS => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | my (%filter) = @_ ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | print DumpTree $filter{ARGS}{COMPLEX_ELEMENT} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | return JUMP_TO_DEBUGGER # want to jump into debugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | DEBUGGER_SUBS => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | NAME => 'CheckDependencyMatrix', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | ALIASES => [qw(dm_cdm cdm)], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | DESCRIPTION => "a short description of what this sub is for", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | HELP => "a long, possibly multi line description displayed" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | . "when the user needs it", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | SUB => sub{}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | LOCAL_STORAGE => {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | ALWAYS_USE_DEBUGGER => 0 # let subs decide if we jump in the debugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | ACTIVE => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | =head2 Breakpoint elements | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | =item * NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | The name of the breakpoint, you can remove and otherwise manipulate breakpoints by name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | =item * FILTERS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | Used to enable or disable all the actions with a single check. FILTERS is a list of sub references. The | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | references are passed the argument you pass to L<CheckBreakpoints> and : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | =item * DEBUG_MIXIN_BREAKPOINT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | A reference to the breakpoint. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | =item * DEBUG_MIXIN_CALLED_AT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | a hash containing the file and line where L<CheckBreakpoints> was called. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | =item * ACTIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | B<ACTIONS> is a list of sub references. All the subs are run. All debugging functionality | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | (ex: activating or adding breakpoints) are available within the subs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | =item * DEBUGGER_SUBS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | List of functions available, at the time the breakpoint matches, when running under the debugger. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | Debug::Mixin will present you with the list of local functions and allow you to run any of the functions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | each entry must have follow the following format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | NAME => 'CheckDependencyMatrix', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | ALIASES => [qw(dm_cdm cdm)], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | DESCRIPTION => "a short description of what this sub is for", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | HELP => "a long, possibly multi line description displayed" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | . "when the user needs it", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | SUB => sub{}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | =item * ALWAYS_USE_DEBUGGER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | If the breakpoint is active, L<CheckBreakpoints> will always return true. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | =item * ACTIVE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | The breakpoint actions will only be called if B<ACTIVE> is set. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | =item * LOCAL_STORAGE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | A user storage area within the breakpoint. You can store and manipulate it as you wish. You must use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | this area as Debug::Mixin only allows certain fields in a breakpoint. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | This item can be manipulated through the breakpoint reference passed to filters and actions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | A warning is displayed if you override an existing breakpoint. A breakpoint creation history is kept. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 40 | ▶ | croak 'AddBreakpoint: odd number of arguments!' if @_ % 2 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 39 | my (%breakpoint) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 39 | CheckBreakPointDefinitions(\%breakpoint) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 21 | my ($package, $file_name, $line) = caller() ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 21 | ▶ | unless (exists $breakpoints{$breakpoint{NAME}}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 20 | $breakpoints{$breakpoint{NAME}} = \%breakpoint ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 1 | carp ("Redefining breakpoint '$breakpoint{NAME}' at '$file_name:$line'.\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | #keep history | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 1 | my $at = $breakpoints{$breakpoint{NAME}}{AT} ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 1 | $breakpoints{$breakpoint{NAME}} = \%breakpoint ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 1 | $breakpoints{$breakpoint{NAME}}{AT} = $at ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 21 | push @{$breakpoints{$breakpoint{NAME}}{AT}}, {FILE => $file_name, LINE => $line, PACKAGE => $package} ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 21 | return(1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | sub CheckBreakPointDefinitions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 39 | ▶ | {## no critic (ProhibitExcessComplexity) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CheckBreakPointDefinitions: called CC=30 SCAR=34.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | =head2 CheckBreakPointDefinitions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | Checks the validity of the user supplied breakpoint definitions. Croaks on error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 39 | my ($breakpoint) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 39 | my $valid_keys = join('$|^', qw(NAME FILTERS ACTIONS DEBUGGER_SUBS LOCAL_STORAGE ALWAYS_USE_DEBUGGER ACTIVE)) ; ## no critic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 39 | for my $key (keys %{$breakpoint}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 108 | ▶ | croak "AddBreakpoint: Unrecognized argument '$key'!\n" unless $key =~ /^$valid_keys$/smox ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 37 | ▶ | croak "AddBreakpoint: Missing NAME!\n" unless exists $breakpoint->{NAME} && defined $breakpoint->{NAME} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $breakpoint->{"NAME"} and defined $breakpoint->{"NAME"}
MC/DC50%1/2
exists $breakpoint->{"NAME"} and defined $breakpoint->{"NAME"}
exists $breakpoint->{"NAME"}
defined $breakpoint->{"NAME"}
Truth table66%2/3
A and B
A= exists $breakpoint->{"NAME"}B= defined $breakpoint->{"NAME"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 36 | ▶ | croak "AddBreakpoint: NAME must be a scalar!\n" unless $EMPTY_STRING eq ref $breakpoint->{NAME} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 35 | ▶ | if(exists $breakpoint->{ACTIONS}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 33 | ▶ | croak "AddBreakpoint: ACTIONS must be a list of subs!\n" unless 'ARRAY' eq ref $breakpoint->{ACTIONS} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 32 | ▶ | croak "AddBreakpoint: no actions defined in ACTIONS!\n" if @{$breakpoint->{ACTIONS}} <= 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 31 | ▶ | croak "AddBreakpoint: actions is not a sub reference!\n" if any {'CODE' ne ref $_} @{$breakpoint->{ACTIONS}} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 32 | ▶ | if(exists $breakpoint->{FILTERS}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 8 | ▶ | croak "AddBreakpoint: FILTERS must be an array!\n" unless 'ARRAY' eq ref $breakpoint->{FILTERS} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 7 | ▶ | croak "AddBreakpoint: no filters defined in FILTERS!\n" if @{$breakpoint->{FILTERS}} <= 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 6 | ▶ | croak "AddBreakpoint: filter is not a code ref!\n" if any {'CODE' ne ref $_} @{$breakpoint->{FILTERS}} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 29 | ▶ | unless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
exists $breakpoint->{"ACTIONS"} or exists $breakpoint->{"FILTERS"} and exists $breakpoint->{"ALWAYS_USE_DEBUGGER"} and $breakpoint->{"ALWAYS_USE_DEBUGGER"} == 1
exists $breakpoint->{"FILTERS"} and exists $breakpoint->{"ALWAYS_USE_DEBUGGER"} and $breakpoint->{"ALWAYS_USE_DEBUGGER"} == 1
exists $breakpoint->{"FILTERS"} and exists $breakpoint->{"ALWAYS_USE_DEBUGGER"}
MC/DC25%1/4
exists $breakpoint->{"ACTIONS"} or exists $breakpoint->{"FILTERS"} and exists $breakpoint->{"ALWAYS_USE_DEBUGGER"} and $breakpoint->{"ALWAYS_USE_DEBUGGER"} == 1
exists $breakpoint->{"ACTIONS"}
exists $breakpoint->{"FILTERS"}
exists $breakpoint->{"ALWAYS_USE_DEBUGGER"}
$breakpoint->{"ALWAYS_USE_DEBUGGER"} == 1
Truth table60%3/5
A or B and C and D
A= exists $breakpoint->{"ACTIONS"}B= exists $breakpoint->{"FILTERS"}C= exists $breakpoint->{"ALWAYS_USE_DEBUGGER"}D= $breakpoint->{"ALWAYS_USE_DEBUGGER"} == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | exists $breakpoint->{ACTIONS} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | (exists $breakpoint->{FILTERS} && exists $breakpoint->{ALWAYS_USE_DEBUGGER} && $breakpoint->{ALWAYS_USE_DEBUGGER} == 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 2 | croak "AddBreakpoint: Missing ACTIONS or (FILTERS + ALWAYS_USE_DEBUGGER)!\n" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 27 | ▶ | if(exists $breakpoint->{DEBUGGER_SUBS}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 6 | ▶ | croak "AddBreakpoint: DEBUGGER_SUBS must be a list!\n" unless 'ARRAY' eq ref $breakpoint->{DEBUGGER_SUBS} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 5 | ▶ | croak "AddBreakpoint: no subroutine defined in DEBUGGER_SUBS!\n" if @{$breakpoint->{DEBUGGER_SUBS}} <= 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 4 | Readonly my $EXPECTED_NUMBER_OF_DEBUGGER_SUB_FIELDS => 4 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 4 | for my $debugger_sub (@{$breakpoint->{DEBUGGER_SUBS}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 5 | ▶ | croak "AddBreakpoint: local subroutine must be a hash!\n" unless 'HASH' eq ref $debugger_sub ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | croak "AddBreakpoint: invalid local subroutine definition!\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 4 | ▶ | unless $EXPECTED_NUMBER_OF_DEBUGGER_SUB_FIELDS == keys %{$debugger_sub} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 3 | my $valid_function_keys = join('$|^', qw(NAME DESCRIPTION HELP SUB)) ; ## no critic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 3 | for my $key (keys %{$debugger_sub}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 12 | ▶ | croak "AddBreakpoint: Unrecognized local subroutine argument '$key'!\n" unless $key =~ /^$valid_function_keys$/smox ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 22 | ▶ | croak "AddBreakpoint: ALWAYS_USE_DEBUGGER must be a scalar!\n" if exists $breakpoint->{ALWAYS_USE_DEBUGGER}&& $EMPTY_STRING ne ref $breakpoint->{ALWAYS_USE_DEBUGGER} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $breakpoint->{"ALWAYS_USE_DEBUGGER"} and $EMPTY_STRING ne ref $breakpoint->{"ALWAYS_USE_DEBUGGER"}
MC/DC0%0/2
exists $breakpoint->{"ALWAYS_USE_DEBUGGER"} and $EMPTY_STRING ne ref $breakpoint->{"ALWAYS_USE_DEBUGGER"}
exists $breakpoint->{"ALWAYS_USE_DEBUGGER"}
$EMPTY_STRING ne ref $breakpoint->{"ALWAYS_USE_DEBUGGER"}
Truth table66%2/3
A and B
A= exists $breakpoint->{"ALWAYS_USE_DEBUGGER"}B= $EMPTY_STRING ne ref $breakpoint->{"ALWAYS_USE_DEBUGGER"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 22 | ▶ | croak "AddBreakpoint: ACTIVE must be a scalar!\n" if exists $breakpoint->{ACTIVE}&& $EMPTY_STRING ne ref $breakpoint->{ACTIVE} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $breakpoint->{"ACTIVE"} and $EMPTY_STRING ne ref $breakpoint->{"ACTIVE"}
MC/DC100%2/2
exists $breakpoint->{"ACTIVE"} and $EMPTY_STRING ne ref $breakpoint->{"ACTIVE"}
exists $breakpoint->{"ACTIVE"}
$EMPTY_STRING ne ref $breakpoint->{"ACTIVE"}
Truth table100%3/3
A and B
A= exists $breakpoint->{"ACTIVE"}B= $EMPTY_STRING ne ref $breakpoint->{"ACTIVE"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 21 | return ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | sub LoadBreakpointsFiles | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LoadBreakpointsFiles: called CC=6 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | =head2 LoadBreakpointsFiles | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | Evaluates a perl script. The main purpose of the script is to define breakpoints but the script | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | can also query Debug::Mixin and change existing breakpoints or run any perl code deemed fit. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | Croaks on error, return(1) on success. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 4 | my (@files) = @_ ; # can contains breakpoint definitions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 4 | for my $file (@files) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 4 | ▶ | if($file ne $EMPTY_STRING) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 4 | ▶ | unless (my $return = do $file ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 4 | ▶ | croak "couldn't parse '$file': $EVAL_ERROR" if $EVAL_ERROR; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 4 | ▶ | croak "couldn't do '$file': $OS_ERROR" unless defined $return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | #~ croak "couldn't run '$file'" unless $return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | return(1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | sub RemoveBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
RemoveBreakpoints: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | =head2 RemoveBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | Removes one or more breakpoint matching the name regex passed as argument. A warning is displayed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | for each removed breakpoint. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | Debug::Mixin::RemoveBreakpoints(qr/dependencies/) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | Returns the number of removed breakpoints. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 1 | my ($breakpoint_regex) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 1 | ▶ | $breakpoint_regex ||= q{.} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$breakpoint_regex ||= "."
MC/DC0%0/1
$breakpoint_regex ||= "."
$breakpoint_regex
Truth table50%1/2
A
A= $breakpoint_regex
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 1 | my $removed_breakpoints = 0 ;#bp local subs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 1 | for my $breakpoint_name (sort keys %breakpoints) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 1 | ▶ | if($breakpoint_name =~ $breakpoint_regex) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 1 | carp("Debug::Mixin: Breakpoint '$breakpoint_name' removed.\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 1 | delete $breakpoints{$breakpoint_name} ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 1 | $removed_breakpoints++ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 1 | return($removed_breakpoints) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | sub RemoveAllBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 17 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
RemoveAllBreakpoints: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | =head2 RemoveAllBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | Removes all breakpoints. No message is displayed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | Debug::Mixin::RemoveAllBreakpoints(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 17 | %breakpoints = () ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 17 | return(1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | sub ListDebuggerSubs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ListDebuggerSubs: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | =head2 ListDebuggerSubs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | List all the debugger subs registered by modules loading Debug::Mixin on STDOUT. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | my (@packages) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | ▶ | unless(@packages) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | @packages = keys %debugger_subs ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | for my $package(@packages) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | Output(DumpTree($debugger_subs{$package}, "$package:")) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | return(1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | sub ListBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ListBreakpoints: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | =head2 ListBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | List, on STDOUT, all the breakpoints matching the name regex passed as argument. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | my ($breakpoint_regex) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | ▶ | $breakpoint_regex = qr/./sxm unless defined $breakpoint_regex ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | for my $breakpoint_name (sort keys %breakpoints) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | ▶ | if($breakpoint_name =~ $breakpoint_regex) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | Output(DumpTree($breakpoints{$breakpoint_name}, "$breakpoint_name:")) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | return(1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | sub GetBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 7 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
GetBreakpoints: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | =head2 GetBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | Returns a reference to all the breakpoints. Elements are returned in the insertion order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | Use this only if you know what you are doing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 7 | return(\%breakpoints) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | sub ActivateBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ActivateBreakpoints: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | =head2 ActivateBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | Activate all the breakpoints matching the name regex passed as argument. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | Only active breakpoints are checked by Debug::Mixin. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 1 | my (@breakpoint_regexes) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 1 | ▶ | push @breakpoint_regexes, q{.} unless @breakpoint_regexes ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 1 | my $activated_breakpoints = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 1 | for my $breakpoint_name (sort keys %breakpoints) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 1 | for my $breakpoint_regex (@breakpoint_regexes) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 1 | ▶ | next unless $breakpoint_name =~ $breakpoint_regex ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 1 | $breakpoints{$breakpoint_name}{ACTIVE} = 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 1 | carp("Breakpoint '$breakpoint_name' activated. \n") ;#bp local subs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 1 | $activated_breakpoints++ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 1 | return($activated_breakpoints) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | sub DeactivateBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DeactivateBreakpoints: called CC=5 SCAR=16.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | =head2 DeactivateBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | Deactivate all the breakpoints matching the name regex passed as argument. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | Only active breakpoints are checked by when you call I<CheckBreakpoints>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 1 | my (@breakpoint_regexes) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 1 | ▶ | push @breakpoint_regexes, q{.} unless @breakpoint_regexes ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 1 | my $deactivated_breakpoints = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 1 | for my $breakpoint_name (sort keys %breakpoints) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 1 | for my $breakpoint_regex (@breakpoint_regexes) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 1 | ▶ | next unless $breakpoint_name =~ $breakpoint_regex ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 1 | $breakpoints{$breakpoint_name}{ACTIVE} = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 1 | carp("Breakpoint '$breakpoint_name' deactivated. \n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 1 | return($deactivated_breakpoints) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | sub ActivateAlwaysUseDebugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ActivateAlwaysUseDebugger: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | =head2 ActivateAlwaysUseDebugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | Sets all breakpoints matching the name regex passed as argument to always jumps to the perl debugger. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 1 | my (@breakpoint_regexes) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 1 | my $always_use_debugger_breakpoints = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 1 | for my $breakpoint_name (sort keys %breakpoints) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 1 | for my $breakpoint_regex (@breakpoint_regexes) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 1 | ▶ | next unless $breakpoint_name =~ $breakpoint_regex ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 1 | $breakpoints{$breakpoint_name}{ALWAYS_USE_DEBUGGER} = 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 1 | carp("Breakpoint '$breakpoint_name' will always activate the perl debugger.\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 1 | $always_use_debugger_breakpoints++ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 1 | return($always_use_debugger_breakpoints) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | sub DeactivateAlwaysUseDebugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DeactivateAlwaysUseDebugger: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | =head2 DeactivateAlwaysUseDebugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | Sets all breakpoints matching the name regex passed as argument, to never jumps to the perl debugger. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 1 | my (@breakpoint_regexes) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 1 | my $never_use_debugger_breakpoints = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 1 | for my $breakpoint_name (sort keys %breakpoints) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 1 | for my $breakpoint_regex (@breakpoint_regexes) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 1 | ▶ | next unless $breakpoint_name =~ $breakpoint_regex ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 1 | $breakpoints{$breakpoint_name}{ALWAYS_USE_DEBUGGER} = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 1 | carp("Breakpoint '$breakpoint_name' will NOT always activate the perl debugger. \n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 1 | $never_use_debugger_breakpoints++ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 1 | return($never_use_debugger_breakpoints) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | sub CheckBreakpoints ## no critic (Subroutines::RequireArgUnpacking) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 18 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CheckBreakpoints: called CC=16 SCAR=28.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | =head2 CheckBreakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | Check a user state against all registered breakpoints. Returned value tells caller if it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | should jump into the debugger. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | if(Debug::Mixin::IsDebuggerEnabled()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | {#bp local subs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | %debug_data = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | # user data passed to the breakpoint actions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | TYPE => '...' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | , COMMENT => '...' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | , ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | $DB::single = 1 if(Debug::Mixin::CheckBreakpoint(%debug_data)) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 18 | ▶ | return(0) unless $debug_enabled ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 17 | my (%user_state) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 17 | my $use_debugger = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 17 | my ($package, $file_name, $line) = caller() ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 17 | for my $breakpoint (values %breakpoints) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 19 | ▶ | next unless $breakpoint->{ACTIVE} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 16 | my $breakpoint_matches = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 16 | ▶ | if(exists $breakpoint->{FILTERS}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 4 | my $filter_index = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 4 | for my $filter ( @{$breakpoint->{FILTERS}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | eval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 5 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 5 | $breakpoint_matches+= | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | $filter-> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | %user_state, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | DEBUG_MIXIN_BREAKPOINT => $breakpoint, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | DEBUG_MIXIN_CALLED_AT => {FILE => $file_name,LINE => $line} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | } ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 5 | ▶ | if($EVAL_ERROR) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 1 | my $original_exception = $EVAL_ERROR ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 1 | chomp $original_exception ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 1 | my $error_message = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | "CheckBreakpoints: Caught exception while running breakpoint filter!\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | . DumpTree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | BREAKPOINT => $breakpoint, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | CALLED_AT => {FILE => $file_name,LINE => $line} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | . "Action # $filter_index\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | . "Original exception: '$original_exception'\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 1 | ▶ | if(*DB::DB{CODE}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 0 | carp $error_message ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | $DB::single = 1 ; ## no critic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 1 | croak $error_message ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 4 | $filter_index++ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 12 | $breakpoint_matches++ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 15 | ▶ | $use_debugger++ if $breakpoint->{ALWAYS_USE_DEBUGGER} ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 15 | ▶ | if($breakpoint_matches) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 14 | $breakpoint->{MATCHED}++ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 14 | my $action_index = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 14 | for my $action (@{$breakpoint->{ACTIONS}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | eval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 16 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 16 | my $result = $action-> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | %user_state, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | DEBUG_MIXIN_BREAKPOINT => $breakpoint, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | DEBUG_MIXIN_CALLED_AT => {FILE => $file_name,LINE => $line} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 15 | ▶ | $use_debugger += $result || 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$result || 0
MC/DC100%1/1
$result || 0
$result
Truth table100%2/2
A
A= $result
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | } ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 16 | ▶ | if($EVAL_ERROR) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 1 | my $original_exception = $EVAL_ERROR ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 1 | chomp $original_exception ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 1 | my $error_message = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | "CheckBreakpoints: Caught exception while running breakpoint action!\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | . DumpTree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | BREAKPOINT => $breakpoint, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | CALLED_AT => {FILE => $file_name,LINE => $line} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | . "Action # $action_index\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | . "Original exception: '$original_exception'\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 1 | ▶ | if(*DB::DB{CODE}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | carp $error_message ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 0 | $DB::single = 1 ; ## no critic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 1 | croak $error_message ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 15 | $action_index++ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 13 | ▶ | if(*DB::DB{CODE} && exists $breakpoint->{DEBUGGER_SUBS}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
*DB::DB{"CODE"} and exists $breakpoint->{"DEBUGGER_SUBS"}
MC/DC0%0/2
*DB::DB{"CODE"} and exists $breakpoint->{"DEBUGGER_SUBS"}
*DB::DB{"CODE"}
exists $breakpoint->{"DEBUGGER_SUBS"}
Truth table33%1/3
A and B
A= *DB::DB{"CODE"}B= exists $breakpoint->{"DEBUGGER_SUBS"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | HandleBreakpointSubInteraction($breakpoint, $file_name, $line, \%user_state) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 15 | return($use_debugger) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | sub HandleBreakpointSubInteraction | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
HandleBreakpointSubInteraction: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | =head2 HandleBreakpointSubInteraction | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | Private subroutine handling user interaction in a debugger session. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 0 | my ($breakpoint, $file_name, $line, $user_state) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | my $choice = $EMPTY_STRING ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | my $header = "Debug::Mixin: Available subs at breakpoint '$breakpoint->{NAME}' ($breakpoint->{MATCHED}):" ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | my $separator = q{-} x length $header ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 0 | Output("$separator\n$header\n$separator\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 0 | my $index = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | my $max_length = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | for my $sub (@{$breakpoint->{DEBUGGER_SUBS}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | ▶ | $max_length = length($sub->{NAME}) if length($sub->{NAME}) > $max_length ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 0 | for my $sub (@{$breakpoint->{DEBUGGER_SUBS}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 0 | Output(sprintf(" #%2d %${max_length}s => $sub->{DESCRIPTION}\n", $index, $sub->{NAME})) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 0 | $index++ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | Output("\n'#' to run sub, 'd #' for a long descriptions of the sub or 'c' to continue.\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | Output(q{>}) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 0 | $choice = <> ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | chomp($choice) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 0 | for($choice) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | /^[0-9]+$/smx and do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | ▶ | if($choice < @{$breakpoint->{DEBUGGER_SUBS}}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | $breakpoint->{DEBUGGER_SUBS}[$choice]{SUB}-> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 0 | %{$user_state}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | DEBUG_MIXIN_BREAKPOINT => $breakpoint, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | DEBUG_MIXIN_CALLED_AT => {FILE => $file_name,LINE => $line} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | #else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | # invalid input re-query user | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 0 | last ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | } ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | /^d ([0-9]+)$/smx and do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 0 | my $sub_index = $1 ; ## no critic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 0 | ▶ | if($sub_index < @{$breakpoint->{DEBUGGER_SUBS}}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 0 | my $sub = $breakpoint->{DEBUGGER_SUBS}[$sub_index] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 0 | my $sub_header = "$sub->{NAME}:" ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | my $sub_separator = q{-} x length($sub_header) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | Output("$sub_header\n$sub_separator\n$sub->{HELP}\n\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | 0 | last ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | while($choice ne 'c') ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 0 | return(1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | sub dm_help | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dm_help: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | =head2 dm_help | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | Displays the commands made available by B<Debug::Mixin> in the debugger. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 0 | Output(<<'EOC') ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | dm_subs list and run debugging subs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | dm_load @files load breakpoints files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | # all breakpoints functions take a optional regex | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | dm_bp list breakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | dm_activate activate breakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | dm_deactivate deactivate breakpoints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | dm_use_debugger jump in debugger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | dm_dont_use_debugger jump in debugger only if a breakpoint action says to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | EOC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | 0 | return(1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | sub dm_subs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dm_subs: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | =head2 dm_subs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | List all the available debugging subs and interacts with the user to run them. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 0 | my $choice = $EMPTY_STRING ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 0 | my $header = 'Debug::Mixin: Available subs:' ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 0 | my $separator = q{-} x length $header ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 0 | Output("$separator\n$header\n$separator\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 0 | my $index = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | 0 | my $max_length = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 0 | my @subs = () ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 0 | for my $package (keys %debugger_subs) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 0 | Output("$package:\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 0 | for my $sub (values %{$debugger_subs{$package}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 0 | push @subs, $sub ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 0 | Output(sprintf(" #%2d $sub->{NAME} => $sub->{DESCRIPTION}\n", $index)) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 0 | $index++ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 0 | Output("\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | 0 | Output("\n'#' to run sub, 'd #' for a long descriptions of the sub or 'c' to continue.\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | 0 | Output(q{>}) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | $choice = <> ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | 0 | chomp($choice) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 0 | for($choice) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | /^[0-9]+$/smx and do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 0 | ▶ | if($choice < @subs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 0 | $subs[$choice]{SUB}->() ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | #else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | # invalid input re-query user | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | last ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | } ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | /^d ([0-9]+)$/smx and do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | 0 | my $sub_index = $1 ; ## no critic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 0 | ▶ | if($sub_index < @subs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 0 | my $sub = $subs[$sub_index] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 0 | my $sub_header = "$sub->{NAME}:" ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 0 | my $sub_separator = q{-} x length($sub_header) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 0 | Output("$sub_header\n$sub_separator\n$sub->{HELP}\n\n") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | 0 | last ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | } ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | while($choice ne 'c') ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | 0 | return(1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | sub Output ## no critic (Subroutines::RequireArgUnpacking) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 22 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Output: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | =head2 Output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | Prints the passed arguments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 22 | ▶ | print(@_) or die "Can't output!\n" ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 22 | return ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 11 | 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | =head1 TO DO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | More test, testing the module through the perl debugger's automation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | =head1 BUGS AND LIMITATIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | None so far. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | Khemir Nadim ibn Hamouda | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | CPAN ID: NKH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | mailto:nadim@khemir.net | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | This program is free software; you can redistribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | perldoc Debug::Mixin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | L<http://annocpan.org/dist/Debug-Mixin> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | Please report any bugs or feature requests to L <bug-my $storage_ref = debug-mixin@rt.cpan.org>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | We will be notified, and then you'll automatically be notified of progress on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | your bug as we make changes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | =item * Search CPAN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | L<http://search.cpan.org/dist/Debug-Mixin> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | L<Filter::Uncomment> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||