diff options
author | Richard Foley <richard.foley@rfi.net> | 2002-02-25 14:47:03 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-02-25 14:30:28 +0000 |
commit | 492652be590915fcb2621eeceaf000a1c070956a (patch) | |
tree | 79730601f2dc72b288ce07b3c4dfa305dc452a41 /pod | |
parent | dad0832b48bc3fb5c9ac55cc93b1737be98d5db8 (diff) | |
download | perl-492652be590915fcb2621eeceaf000a1c070956a.tar.gz |
consistent commands for perl5db.pl etc.
Message-ID: <16fJgP-1mbVeSC@fwd04.sul.t-online.com>
p4raw-id: //depot/perl@14865
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perldebguts.pod | 6 | ||||
-rw-r--r-- | pod/perldebtut.pod | 93 | ||||
-rw-r--r-- | pod/perldebug.pod | 88 | ||||
-rw-r--r-- | pod/perldelta.pod | 8 |
4 files changed, 109 insertions, 86 deletions
diff --git a/pod/perldebguts.pod b/pod/perldebguts.pod index d14478155f..f507ac8997 100644 --- a/pod/perldebguts.pod +++ b/pod/perldebguts.pod @@ -151,7 +151,7 @@ after the debugger completes its own initialization.) After the rc file is read, the debugger reads the PERLDB_OPTS environment variable and uses it to set debugger options. The contents of this variable are treated as if they were the argument -of an C<O ...> debugger command (q.v. in L<perldebug/Options>). +of an C<o ...> debugger command (q.v. in L<perldebug/Options>). =head3 Debugger internal variables In addition to the file and subroutine-related variables mentioned above, @@ -240,9 +240,9 @@ information. For example, contrast this expression trace: main::bar((eval 170):2): 42 -with this one, once the C<O>ption C<frame=2> has been set: +with this one, once the C<o>ption C<frame=2> has been set: - DB<4> O f=2 + DB<4> o f=2 frame = '2' DB<5> t print foo() * bar() 3: foo() * bar() diff --git a/pod/perldebtut.pod b/pod/perldebtut.pod index f9f19ac08c..e2c982dcb0 100644 --- a/pod/perldebtut.pod +++ b/pod/perldebtut.pod @@ -75,7 +75,7 @@ getting this script to compile has exposed the '$varl' (with the letter 'l) variable, and simply changing $varl to $var1 solves the problem. -=head1 Looking at data and -w and w +=head1 Looking at data and -w and v Ok, but how about when you want to really see your data, what's in that dynamic variable, just before using it? @@ -144,46 +144,46 @@ That's it, you're back on home turf again. =head1 help Fire the debugger up again on your script and we'll look at the help menu. -There's a couple of ways of calling help: a simple 'B<h>' will get you a long -scrolled list of help, 'B<|h>' (pipe-h) will pipe the help through your pager -('more' or 'less' probably), and finally, 'B<h h>' (h-space-h) will give you a -helpful mini-screen snapshot: - - DB<1> h h - List/search source lines: Control script execution: - l [ln|sub] List source code T Stack trace - - or . List previous/current line s [expr] Single step [in expr] - w [line] List around line n [expr] Next, steps over subs - f filename View source in file <CR/Enter> Repeat last n or s - /pattern/ ?patt? Search forw/backw r Return from subroutine - v Show versions of modules c [ln|sub] Continue until position - Debugger controls: L List -break/watch/actions - O [...] Set debugger options t [expr] Toggle trace [trace expr] - <[<]|{[{]|>[>] [cmd] Do pre/post-prompt b [ln|event|sub] [cnd] Set breakpoint - ! [N|pat] Redo a previous command d [ln] or D Delete a/all breakpoints - H [-num] Display last num commands a [ln] cmd Do cmd before line - = [a val] Define/list an alias W expr Add a watch expression - h [db_cmd] Get help on command A or W Delete all actions/watch - |[|]db_cmd Send output to pager ![!] syscmd Run cmd in a subprocess - q or ^D Quit R Attempt a restart - Data Examination: expr Execute perl code, also see: s,n,t expr - x|m expr Evals expr in list context, dumps the result or lists methods. - p expr Print expression (uses script's current package). - S [[!]pat] List subroutine names [not] matching pattern - V [Pk [Vars]] List Variables in Package. Vars can be ~pattern or !pattern. - X [Vars] Same as "V current_package [Vars]". - For more help, type h cmd_letter, or run man perldebug for all docs. +There's a couple of ways of calling help: a simple 'B<h>' will get the summary +help list, 'B<|h>' (pipe-h) will pipe the help through your pager (which is +(probably 'more' or 'less'), and finally, 'B<h h>' (h-space-h) will give you +the entire help screen. Here is the summary page: + +DB<1>h +List/search source lines: Control script execution: + l [ln|sub] List source code T Stack trace + - or . List previous/current line s [expr] Single step [in expr] + v [line] View around line n [expr] Next, steps over subs + f filename View source in file <CR/Enter> Repeat last n or s + /pattern/ ?patt? Search forw/backw r Return from subroutine + M Show module versions c [ln|sub] Continue until position +Debugger controls: L List break/watch/actions + o [...] Set debugger options t [expr] Toggle trace [trace expr] + <[<]|{[{]|>[>] [cmd] Do pre/post-prompt b [ln|event|sub] [cnd] Set breakpoint + ! [N|pat] Redo a previous command B ln|* Delete a/all breakpoints + H [-num] Display last num commands a [ln] cmd Do cmd before line + = [a val] Define/list an alias A ln|* Delete a/all actions + h [db_cmd] Get help on command w expr Add a watch expression + h h Complete help page W expr|* Delete a/all watch expressions + |[|]db_cmd Send output to pager ![!] syscmd Run cmd in a subprocess + q or ^D Quit R Attempt a restart +Data Examination: expr Execute perl code, also see: s,n,t expr + x|m expr Evals expr in list context, dumps the result or lists methods. + p expr Print expression (uses script's current package). + S [[!]pat] List subroutine names [not] matching pattern + V [Pk [Vars]] List Variables in Package. Vars can be ~pattern or !pattern. + X [Vars] Same as "V current_package [Vars]". +For more help, type h cmd_letter, or run man perldebug for all docs. More confusing options than you can shake a big stick at! It's not as bad as it looks and it's very useful to know more about all of it, and fun too! There's a couple of useful ones to know about straight away. You wouldn't -think we're using any libraries at all at the moment, but 'B<v>' will show -which modules are currently loaded, by the debugger as well your script. -'B<V>' and 'B<X>' show variables in the program by package scope and can be -constrained by pattern. 'B<m>' shows methods and 'B<S>' shows all subroutines -(by pattern): +think we're using any libraries at all at the moment, but 'B<M>' will show +which modules are currently loaded, and their version number, while 'B<m>' +will show the methods, and 'B<S>' shows all subroutines (by pattern) as +shown below. 'B<V>' and 'B<X>' show variables in the program by package +scope and can be constrained by pattern. DB<2>S str dumpvar::stringify @@ -198,11 +198,10 @@ the 'name': FileHandle(stderr) => fileno(2) Remember we're in our tiny program with a problem, we should have a look at -where we are, and what our data looks like. First of all let's have a window -on our present position (the first line of code in this case), via the letter -'B<w>': +where we are, and what our data looks like. First of all let's view some code +at our present position (the first line of code in this case), via 'B<v>': - DB<4> w + DB<4> v 1 #!/usr/bin/perl 2: use strict; 3 @@ -215,9 +214,9 @@ on our present position (the first line of code in this case), via the letter 10 ); At line number 4 is a helpful pointer, that tells you where you are now. To -see more code, type 'w' again: +see more code, type 'v' again: - DB<4> w + DB<4> v 8 'welcome' => q(Hello World), 9 'zip' => q(welcome), 10 ); @@ -477,9 +476,9 @@ We'll simply continue down to our pre-set breakpoint with a 'B<c>': DB<1> c main::(temp:10): if ($deg eq 'c') { -Followed by a window command to see where we are: +Followed by a view command to see where we are: - DB<1> w + DB<1> v 7: my ($deg, $num) = ($1, $2); 8: my ($in, $out) = ($num, $num); 9: $DB::single=2; @@ -513,12 +512,12 @@ using the list 'L' command: Note that to delete a breakpoint you use 'd' or 'D'. Now we'll continue down into our subroutine, this time rather than by line -number, we'll use the subroutine name, followed by the now familiar 'w': +number, we'll use the subroutine name, followed by the now familiar 'v': DB<3> c f2c main::f2c(temp:30): my $f = shift; - DB<4> w + DB<4> v 24: exit; 25 26 sub f2c { @@ -586,7 +585,7 @@ Actions, watch variables, stack traces etc.: on the TODO list. a - W + w t diff --git a/pod/perldebug.pod b/pod/perldebug.pod index 4946f7d95d..5d0ef3f54d 100644 --- a/pod/perldebug.pod +++ b/pod/perldebug.pod @@ -52,22 +52,26 @@ The debugger understands the following commands: =over 12 +=item h + +Prints out a summary help message + =item h [command] -Prints out a help message. +Prints out a help message for the given debugger command. -If you supply another debugger command as an argument to the C<h> command, -it prints out the description for just that command. The special -argument of C<h h> produces a more compact help listing, designed to fit -together on one screen. +=item h h -If the output of the C<h> command (or any command, for that matter) scrolls +The special argument of C<h h> produces the entire help page, which is quite long. + +If the output of the C<h h> command (or any command, for that matter) scrolls past your screen, precede the command with a leading pipe symbol so that it's run through your pager, as in - DB> |h + DB> |h h + +You may change the pager which is used via C<o pager=...> command. -You may change the pager which is used via C<O pager=...> command. =item p expr @@ -166,9 +170,9 @@ be a variable that contains a code reference. List previous window of lines. -=item w [line] +=item v [line] -List window (a few lines) around the current line. +View a few lines of code around the current line. =item . @@ -197,9 +201,9 @@ The search is case-insensitive by default. Search backwards for pattern; final ? is optional. The search is case-insensitive by default. -=item L +=item L [abw] -List all breakpoints and actions. +List (default all) actions, breakpoints and watch expressions =item S [[!]regex] @@ -214,10 +218,13 @@ Toggle trace mode (see also the C<AutoTrace> option). Trace through execution of C<expr>. See L<perldebguts/"Frame Listing Output Examples"> for examples. +=item b + +Sets breakpoint on current line + =item b [line] [condition] -Set a breakpoint before the given line. If I<line> is omitted, set a -breakpoint on the line about to be executed. If a condition +Set a breakpoint before the given line. 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 @@ -247,12 +254,11 @@ which should be a full pathname found amongst the %INC values. Sets a breakpoint before the first statement executed after the specified subroutine is compiled. -=item d [line] +=item B line -Delete a breakpoint from the specified I<line>. If I<line> is omitted, deletes -the breakpoint from the line about to be executed. +Delete a breakpoint from the specified I<line>. -=item D +=item B * Delete all installed breakpoints. @@ -273,45 +279,50 @@ For example, this will print out $foo every time line a 53 print "DB FOUND $foo\n" -=item a [line] +=item A line -Delete an action from the specified line. If I<line> is omitted, delete -the action on the line that is about to be executed. +Delete an action from the specified line. -=item A +=item A * Delete all installed actions. -=item W expr +=item w expr Add a global watch-expression. We hope you know what one of these -is, because they're supposed to be obvious. B<WARNING>: It is far -too easy to destroy your watch expressions by accidentally omitting -the I<expr>. +is, because they're supposed to be obvious. -=item W +=item W expr + +Delete watch-expression + +=item W * Delete all watch-expressions. -=item O booloption ... +=item o + +Display all options + +=item o booloption ... Set each listed Boolean option to the value C<1>. -=item O anyoption? ... +=item o anyoption? ... Print out the value of one or more options. -=item O option=value ... +=item o option=value ... Set the value of one or more options. If the value has internal -whitespace, it should be quoted. For example, you could set C<O +whitespace, it should be quoted. For example, you could set C<o pager="less -MQeicsNfr"> to call B<less> with those specific options. You may use either single or double quotes, but if you do, you must escape any embedded instances of same sort of quote you began with, as well as any escaping any escapes that immediately precede that quote but which are not meant to escape the quote itself. In other words, you follow single-quoting rules irrespective of the quote; -eg: C<O option='this isn\'t bad'> or C<O option="She said, \"Isn't +eg: C<o option='this isn\'t bad'> or C<o option="She said, \"Isn't it?\"">. For historical reasons, the C<=value> is optional, but defaults to @@ -385,12 +396,12 @@ Redo number'th previous command. =item ! pattern Redo last command that started with pattern. -See C<O recallCommand>, too. +See C<o recallCommand>, too. =item !! cmd Run cmd in a subprocess (reads from DB::IN, writes to DB::OUT) See -C<O shellBang>, also. Note that the user's current shell (well, +C<o shellBang>, also. Note that the user's current shell (well, their C<$ENV{SHELL}> variable) will be used, which can interfere with proper interpretation of exit status or signal and coredump information. @@ -453,6 +464,11 @@ List which methods may be called on the result of the evaluated expression. The expression may evaluated to a reference to a blessed object, or to a package name. +=item M + +Displays all loaded modules and their versions + + =item man [manpage] Despite its name, this calls your system's default documentation @@ -478,7 +494,7 @@ working example of something along the lines of: =head2 Configurable Options -The debugger has numerous options settable using the C<O> command, +The debugger has numerous options settable using the C<o> command, either interactively or from the environment or an rc file. (./.perldb or ~/.perldb under Unix.) @@ -838,7 +854,7 @@ compile subname> for the same purpose. The debugger probably contains enough configuration hooks that you won't ever have to modify it yourself. You may change the behaviour -of debugger from within the debugger using its C<O> command, from +of debugger from within the debugger using its C<o> command, from the command line via the C<PERLDB_OPTS> environment variable, and from customization files. diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 52f93157a9..f621c856cd 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -2273,6 +2273,14 @@ respectively. =item * +perl5db.pl has been modified to present a more consistent commands +interface, via (CommandSet=580). perl5db.t was also added to test the +changes, and as a placeholder for further tests. + +See L<perldebug> + +=item * + If an attempt to use a (non-blessed) reference as an array index is made, a warning is given. |