X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/7d0d50dd8561c325a5cc8339d10802fc08146961..c2bb91f92aafd4647235159d54064fad237aa7b1:/pod/perldebug.pod diff --git a/pod/perldebug.pod b/pod/perldebug.pod index 7a9efa4..53c3d60 100644 --- a/pod/perldebug.pod +++ b/pod/perldebug.pod @@ -5,12 +5,15 @@ perldebug - Perl debugging =head1 DESCRIPTION -First of all, have you tried using the B<-w> switch? - +First of all, have you tried using L|strict> and +L|warnings>? If you're new to the Perl debugger, you may prefer to read L, which is a tutorial introduction to the debugger. +If you're looking for the nitty gritty details of how the debugger is +I, you may prefer to read L. + =head1 The Perl Debugger If you invoke Perl with the B<-d> switch, your script runs under the @@ -54,7 +57,7 @@ function with something that doesn't look like a debugger command, such as a leading C<;> or perhaps a C<+>, or by wrapping it with parentheses or braces. -=head2 Calling the debugger +=head2 Calling the Debugger There are several ways to call the debugger: @@ -68,9 +71,9 @@ On the given program identified by C. Interactively supply an arbitrary C using C<-e>. -=item perl -d:Ptkdb program_name +=item perl -d:ptkdb program_name -Debug a given program via the C GUI. +Debug a given program via the C GUI. =item perl -dt threaded_program_name @@ -105,7 +108,6 @@ that it's run through your pager, as in You may change the pager which is used via C command. - =item p expr X @@ -126,7 +128,7 @@ hashes, you'll probably prefer 'x \%h' rather than 'x %h'. See L if you'd like to do this yourself. The output format is governed by multiple options described under -L<"Configurable Options">. +L. If the C is included, it must be a numeral I; the value is dumped only I levels deep, as if the C option had been @@ -270,15 +272,19 @@ X List subroutine names [not] matching the regex. -=item t +=item t [n] X Toggle trace mode (see also the C option). +Optional argument is the maximum number of levels to trace below +the current one; anything deeper than that will be silent. -=item t expr +=item t [n] expr X Trace through execution of C. +Optional first argument is the maximum number of levels to trace below +the current one; anything deeper than that will be silent. See L for examples. =item b @@ -301,6 +307,22 @@ don't use C: b 237 ++$count237 < 11 b 33 /pattern/i +If the line number is C<.>, sets a breakpoint on the current line: + + b . $n > 100 + +=item b [file]:[line] [condition] +X +X + +Set a breakpoint before the given line in a (possibly different) file. If a +condition is specified, it's evaluated each time the statement is reached: a +breakpoint is taken only if the condition is true. Breakpoints may only be set +on lines that begin an executable statement. Conditions don't use C: + + b lib/MyModule.pm:237 $x > 30 + b /usr/lib/perl5/site_perl/CGI.pm:100 ++$count100 < 11 + =item b subname [condition] X X @@ -341,6 +363,42 @@ X Delete all installed breakpoints. +=item disable [file]:[line] +X +X +X + +Disable the breakpoint so it won't stop the execution of the program. +Breakpoints are enabled by default and can be re-enabled using the C +command. + +=item disable [line] +X +X +X + +Disable the breakpoint so it won't stop the execution of the program. +Breakpoints are enabled by default and can be re-enabled using the C +command. + +This is done for a breakpoint in the current file. + +=item enable [file]:[line] +X +X +X + +Enable the breakpoint so it will stop the execution of the program. + +=item enable [line] +X +X +X + +Enable the breakpoint so it will stop the execution of the program. + +This is done for a breakpoint in the current file. + =item a [line] command X @@ -418,7 +476,7 @@ For historical reasons, the C<=value> is optional, but defaults to 1 only where it is safe to do so--that is, mostly for Boolean options. It is always better to assign a specific value using C<=>. The C