X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperldebug.pod;h=77502f27d31ea20aad23842f7ce078a8ce78d9a3;hb=28757baaaeaa3801dd997fad8b1f5f62c64a228e;hp=f9dd6f4ab642b582cdd77b425ae02caa9344b518;hpb=36477c247f3c188fb8cc7e276c87b739d3e6ab7c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perldebug.pod b/pod/perldebug.pod index f9dd6f4..77502f2 100644 --- a/pod/perldebug.pod +++ b/pod/perldebug.pod @@ -11,7 +11,7 @@ First of all, have you tried using the B<-w> switch? If you invoke Perl with the B<-d> switch, your script runs under the Perl source debugger. This works like an interactive Perl environment, prompting for debugger commands that let you examine -source code, set breakpoints, get stack backtraces, change the values of +source code, set breakpoints, get stack back-traces, change the values of variables, etc. This is so convenient that you often fire up the debugger all by itself just to test out Perl constructs interactively to see what they do. For example: @@ -63,12 +63,12 @@ it's run through your pager, as in =item p expr Same as C in the current package. In particular, -since this is just Perl's own B function, this means that nested +because this is just Perl's own B function, this means that nested data structures and objects are not dumped, unlike with the C command. =item x expr -Evals its expression in list context and dumps out the result +Evaluates its expression in list context and dumps out the result in a pretty-printed fashion. Nested data structures are printed out recursively, unlike the C function. @@ -97,7 +97,7 @@ Same as C. =item T -Produce a stack backtrace. See below for details on its output. +Produce a stack back-trace. See below for details on its output. =item s [expr] @@ -218,7 +218,7 @@ or, with the Cption C set, Set a breakpoint. If line is omitted, sets a breakpoint on the line that is about to be executed. If a condition is specified, it's evaluated each time the statement is reached and a breakpoint is taken -only if the condition is true. Breakpoints may only be set on lines +only if the condition is true. Breakpoints may be set on only lines that begin an executable statement. Conditions don't use B: b 237 $x > 30 @@ -251,29 +251,11 @@ Delete all installed breakpoints. Set an action to be done before the line is executed. The sequence of steps taken by the debugger is -=over 3 - -=item 1 - -check for a breakpoint at this line - -=item 2 - -print the line if necessary (tracing) - -=item 3 - -do any actions associated with that line - -=item 4 - -prompt user if at a breakpoint or in single-step - -=item 5 - -evaluate line - -=back + 1. check for a breakpoint at this line + 2. print the line if necessary (tracing) + 3. do any actions associated with that line + 4. prompt user if at a breakpoint or in single-step + 5. evaluate line For example, this will print out C<$foo> every time line 53 is passed: @@ -332,7 +314,7 @@ affects printing of return value after C command. affects printing messages on entry and exit from subroutines. If C is false, messages are printed on entry only. (Printing -on exit may be useful if interdispersed with other messages.) +on exit may be useful if inter(di)spersed with other messages.) If C, arguments to functions are printed as well as the context and caller info. @@ -452,40 +434,42 @@ corresponds to F, say, by issuing a command like See L<"Debugger Internals"> below for more details. +=over 12 + =item E [ command ] Set an action (Perl command) to happen before every debugger prompt. -A multiline command may be entered by backslashing the newlines. If +A multi-line command may be entered by backslashing the newlines. If C is missing, resets the list of actions. =item EE command Add an action (Perl command) to happen before every debugger prompt. -A multiline command may be entered by backslashing the newlines. +A multi-line command may be entered by backslashing the newlines. =item E command Set an action (Perl command) to happen after the prompt when you've -just given a command to return to executing the script. A multiline +just given a command to return to executing the script. A multi-line command may be entered by backslashing the newlines. If C is missing, resets the list of actions. =item EE command Adds an action (Perl command) to happen after the prompt when you've -just given a command to return to executing the script. A multiline +just given a command to return to executing the script. A multi-line command may be entered by backslashing the newlines. =item { [ command ] Set an action (debugger command) to happen before every debugger prompt. -A multiline command may be entered by backslashing the newlines. If +A multi-line command may be entered by backslashing the newlines. If C is missing, resets the list of actions. =item {{ command Add an action (debugger command) to happen before every debugger prompt. -A multiline command may be entered by backslashing the newlines. +A multi-line command may be entered by backslashing the newlines. =item ! number @@ -525,9 +509,9 @@ Restart the debugger by Bing a new session. It tries to maintain your history across this, but internal settings and command line options may be lost. -Currently the following setting are preserved: history, breakpoints -and actions, debugger Cptions and the following command-line -options: B<-w>, B<-I>, B<-e>. +Currently the following setting are preserved: history, breakpoints, +actions, debugger Cptions, and the following command-line +options: B<-w>, B<-I>, and B<-e>. =item |dbcmd @@ -566,7 +550,7 @@ or even DB<<17>> where that number is the command number, which you'd use to access with -the built-in B-like history mechanism, e.g. C would repeat +the built-in B-like history mechanism, e.g., C would repeat command number 17. The number of angle brackets indicates the depth of the debugger. You could get more than one set of brackets, for example, if you'd already at a breakpoint and then printed out the result of a @@ -588,7 +572,7 @@ normally end the debugger command with a backslash. Here's an example: Note that this business of escaping a newline is specific to interactive commands typed into the debugger. -Here's an example of what a stack backtrace might look like: +Here's an example of what a stack back-trace might look like: $ = main::infested called from file `Ambulation.pm' line 10 @ = Ambulation::legs(1, 2, 3, 4) called from file `camel_flea' line 7 @@ -763,16 +747,16 @@ the form C<(eval 31)> for subroutines defined inside Cs. =item * -When an exection of the application reaches a place that can have a -breakpoint, a call to C is performed if any one of -variables $DB::trace, $DB::single, $DB::signal is true. (Note that +When execution of the application reaches a place that can have +a breakpoint, a call to C is performed if any one of +variables $DB::trace, $DB::single, or $DB::signal is true. (Note that these variables are not Cizable.) This feature is disabled when the control is inside C or functions called from it (unless C<$^D & 1 EE 30>). =item * -When an exection of the application reaches a subroutine call, a call +When execution of the application reaches a subroutine call, a call to C<&DB::sub>(I) is performed instead, with C<$DB::sub> being the name of the called subroutine. (Unless the subroutine is compiled in the package C.) @@ -792,7 +776,7 @@ F<~/.perldb> under UNIX), which can set important options. This file may define a subroutine C<&afterinit> to be executed after the debugger is initialized. -After the rc file is read, the debugger reads environment variable +After the rc file is read, the debugger reads environment variable PERLDB_OPTS and parses it as a rest of C line in debugger prompt. It also maintains magical internal variables, such as C<@DB::dbline>, @@ -807,7 +791,7 @@ function C skips the specified number of frames, and returns an array containing info about the caller frames (all if C is missing). Each entry is a hash with keys C (C<$> or C<@>), C (subroutine name, or info about -eval), C (C or a reference to an array), C and +eval), C (C or a reference to an array), C, and C. The function C prints @@ -824,7 +808,4 @@ You cannot get the stack frame information or otherwise debug functions that were not compiled by Perl, such as C or C++ extensions. If you alter your @_ arguments in a subroutine (such as with B -or B, the stack backtrace will not show the original values. - -Some subroutines are called without creating a call frame. This may -confuse backtrace C and output of C=4>. +or B, the stack back-trace will not show the original values.