Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/share/perl5
File: perl5db.pl
[0] Fix | Delete
=head1 NAME
[1] Fix | Delete
[2] Fix | Delete
perl5db.pl - the perl debugger
[3] Fix | Delete
[4] Fix | Delete
=head1 SYNOPSIS
[5] Fix | Delete
[6] Fix | Delete
perl -d your_Perl_script
[7] Fix | Delete
[8] Fix | Delete
=head1 DESCRIPTION
[9] Fix | Delete
[10] Fix | Delete
C<perl5db.pl> is the perl debugger. It is loaded automatically by Perl when
[11] Fix | Delete
you invoke a script with C<perl -d>. This documentation tries to outline the
[12] Fix | Delete
structure and services provided by C<perl5db.pl>, and to describe how you
[13] Fix | Delete
can use them.
[14] Fix | Delete
[15] Fix | Delete
=head1 GENERAL NOTES
[16] Fix | Delete
[17] Fix | Delete
The debugger can look pretty forbidding to many Perl programmers. There are
[18] Fix | Delete
a number of reasons for this, many stemming out of the debugger's history.
[19] Fix | Delete
[20] Fix | Delete
When the debugger was first written, Perl didn't have a lot of its nicer
[21] Fix | Delete
features - no references, no lexical variables, no closures, no object-oriented
[22] Fix | Delete
programming. So a lot of the things one would normally have done using such
[23] Fix | Delete
features was done using global variables, globs and the C<local()> operator
[24] Fix | Delete
in creative ways.
[25] Fix | Delete
[26] Fix | Delete
Some of these have survived into the current debugger; a few of the more
[27] Fix | Delete
interesting and still-useful idioms are noted in this section, along with notes
[28] Fix | Delete
on the comments themselves.
[29] Fix | Delete
[30] Fix | Delete
=head2 Why not use more lexicals?
[31] Fix | Delete
[32] Fix | Delete
Experienced Perl programmers will note that the debugger code tends to use
[33] Fix | Delete
mostly package globals rather than lexically-scoped variables. This is done
[34] Fix | Delete
to allow a significant amount of control of the debugger from outside the
[35] Fix | Delete
debugger itself.
[36] Fix | Delete
[37] Fix | Delete
Unfortunately, though the variables are accessible, they're not well
[38] Fix | Delete
documented, so it's generally been a decision that hasn't made a lot of
[39] Fix | Delete
difference to most users. Where appropriate, comments have been added to
[40] Fix | Delete
make variables more accessible and usable, with the understanding that these
[41] Fix | Delete
I<are> debugger internals, and are therefore subject to change. Future
[42] Fix | Delete
development should probably attempt to replace the globals with a well-defined
[43] Fix | Delete
API, but for now, the variables are what we've got.
[44] Fix | Delete
[45] Fix | Delete
=head2 Automated variable stacking via C<local()>
[46] Fix | Delete
[47] Fix | Delete
As you may recall from reading C<perlfunc>, the C<local()> operator makes a
[48] Fix | Delete
temporary copy of a variable in the current scope. When the scope ends, the
[49] Fix | Delete
old copy is restored. This is often used in the debugger to handle the
[50] Fix | Delete
automatic stacking of variables during recursive calls:
[51] Fix | Delete
[52] Fix | Delete
sub foo {
[53] Fix | Delete
local $some_global++;
[54] Fix | Delete
[55] Fix | Delete
# Do some stuff, then ...
[56] Fix | Delete
return;
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
What happens is that on entry to the subroutine, C<$some_global> is localized,
[60] Fix | Delete
then altered. When the subroutine returns, Perl automatically undoes the
[61] Fix | Delete
localization, restoring the previous value. Voila, automatic stack management.
[62] Fix | Delete
[63] Fix | Delete
The debugger uses this trick a I<lot>. Of particular note is C<DB::eval>,
[64] Fix | Delete
which lets the debugger get control inside of C<eval>'ed code. The debugger
[65] Fix | Delete
localizes a saved copy of C<$@> inside the subroutine, which allows it to
[66] Fix | Delete
keep C<$@> safe until it C<DB::eval> returns, at which point the previous
[67] Fix | Delete
value of C<$@> is restored. This makes it simple (well, I<simpler>) to keep
[68] Fix | Delete
track of C<$@> inside C<eval>s which C<eval> other C<eval's>.
[69] Fix | Delete
[70] Fix | Delete
In any case, watch for this pattern. It occurs fairly often.
[71] Fix | Delete
[72] Fix | Delete
=head2 The C<^> trick
[73] Fix | Delete
[74] Fix | Delete
This is used to cleverly reverse the sense of a logical test depending on
[75] Fix | Delete
the value of an auxiliary variable. For instance, the debugger's C<S>
[76] Fix | Delete
(search for subroutines by pattern) allows you to negate the pattern
[77] Fix | Delete
like this:
[78] Fix | Delete
[79] Fix | Delete
# Find all non-'foo' subs:
[80] Fix | Delete
S !/foo/
[81] Fix | Delete
[82] Fix | Delete
Boolean algebra states that the truth table for XOR looks like this:
[83] Fix | Delete
[84] Fix | Delete
=over 4
[85] Fix | Delete
[86] Fix | Delete
=item * 0 ^ 0 = 0
[87] Fix | Delete
[88] Fix | Delete
(! not present and no match) --> false, don't print
[89] Fix | Delete
[90] Fix | Delete
=item * 0 ^ 1 = 1
[91] Fix | Delete
[92] Fix | Delete
(! not present and matches) --> true, print
[93] Fix | Delete
[94] Fix | Delete
=item * 1 ^ 0 = 1
[95] Fix | Delete
[96] Fix | Delete
(! present and no match) --> true, print
[97] Fix | Delete
[98] Fix | Delete
=item * 1 ^ 1 = 0
[99] Fix | Delete
[100] Fix | Delete
(! present and matches) --> false, don't print
[101] Fix | Delete
[102] Fix | Delete
=back
[103] Fix | Delete
[104] Fix | Delete
As you can see, the first pair applies when C<!> isn't supplied, and
[105] Fix | Delete
the second pair applies when it is. The XOR simply allows us to
[106] Fix | Delete
compact a more complicated if-then-elseif-else into a more elegant
[107] Fix | Delete
(but perhaps overly clever) single test. After all, it needed this
[108] Fix | Delete
explanation...
[109] Fix | Delete
[110] Fix | Delete
=head2 FLAGS, FLAGS, FLAGS
[111] Fix | Delete
[112] Fix | Delete
There is a certain C programming legacy in the debugger. Some variables,
[113] Fix | Delete
such as C<$single>, C<$trace>, and C<$frame>, have I<magical> values composed
[114] Fix | Delete
of 1, 2, 4, etc. (powers of 2) OR'ed together. This allows several pieces
[115] Fix | Delete
of state to be stored independently in a single scalar.
[116] Fix | Delete
[117] Fix | Delete
A test like
[118] Fix | Delete
[119] Fix | Delete
if ($scalar & 4) ...
[120] Fix | Delete
[121] Fix | Delete
is checking to see if the appropriate bit is on. Since each bit can be
[122] Fix | Delete
"addressed" independently in this way, C<$scalar> is acting sort of like
[123] Fix | Delete
an array of bits. Obviously, since the contents of C<$scalar> are just a
[124] Fix | Delete
bit-pattern, we can save and restore it easily (it will just look like
[125] Fix | Delete
a number).
[126] Fix | Delete
[127] Fix | Delete
The problem, is of course, that this tends to leave magic numbers scattered
[128] Fix | Delete
all over your program whenever a bit is set, cleared, or checked. So why do
[129] Fix | Delete
it?
[130] Fix | Delete
[131] Fix | Delete
=over 4
[132] Fix | Delete
[133] Fix | Delete
=item *
[134] Fix | Delete
[135] Fix | Delete
First, doing an arithmetical or bitwise operation on a scalar is
[136] Fix | Delete
just about the fastest thing you can do in Perl: C<use constant> actually
[137] Fix | Delete
creates a subroutine call, and array and hash lookups are much slower. Is
[138] Fix | Delete
this over-optimization at the expense of readability? Possibly, but the
[139] Fix | Delete
debugger accesses these variables a I<lot>. Any rewrite of the code will
[140] Fix | Delete
probably have to benchmark alternate implementations and see which is the
[141] Fix | Delete
best balance of readability and speed, and then document how it actually
[142] Fix | Delete
works.
[143] Fix | Delete
[144] Fix | Delete
=item *
[145] Fix | Delete
[146] Fix | Delete
Second, it's very easy to serialize a scalar number. This is done in
[147] Fix | Delete
the restart code; the debugger state variables are saved in C<%ENV> and then
[148] Fix | Delete
restored when the debugger is restarted. Having them be just numbers makes
[149] Fix | Delete
this trivial.
[150] Fix | Delete
[151] Fix | Delete
=item *
[152] Fix | Delete
[153] Fix | Delete
Third, some of these variables are being shared with the Perl core
[154] Fix | Delete
smack in the middle of the interpreter's execution loop. It's much faster for
[155] Fix | Delete
a C program (like the interpreter) to check a bit in a scalar than to access
[156] Fix | Delete
several different variables (or a Perl array).
[157] Fix | Delete
[158] Fix | Delete
=back
[159] Fix | Delete
[160] Fix | Delete
=head2 What are those C<XXX> comments for?
[161] Fix | Delete
[162] Fix | Delete
Any comment containing C<XXX> means that the comment is either somewhat
[163] Fix | Delete
speculative - it's not exactly clear what a given variable or chunk of
[164] Fix | Delete
code is doing, or that it is incomplete - the basics may be clear, but the
[165] Fix | Delete
subtleties are not completely documented.
[166] Fix | Delete
[167] Fix | Delete
Send in a patch if you can clear up, fill out, or clarify an C<XXX>.
[168] Fix | Delete
[169] Fix | Delete
=head1 DATA STRUCTURES MAINTAINED BY CORE
[170] Fix | Delete
[171] Fix | Delete
There are a number of special data structures provided to the debugger by
[172] Fix | Delete
the Perl interpreter.
[173] Fix | Delete
[174] Fix | Delete
The array C<@{$main::{'_<'.$filename}}> (aliased locally to C<@dbline>
[175] Fix | Delete
via glob assignment) contains the text from C<$filename>, with each
[176] Fix | Delete
element corresponding to a single line of C<$filename>. Additionally,
[177] Fix | Delete
breakable lines will be dualvars with the numeric component being the
[178] Fix | Delete
memory address of a COP node. Non-breakable lines are dualvar to 0.
[179] Fix | Delete
[180] Fix | Delete
The hash C<%{'_<'.$filename}> (aliased locally to C<%dbline> via glob
[181] Fix | Delete
assignment) contains breakpoints and actions. The keys are line numbers;
[182] Fix | Delete
you can set individual values, but not the whole hash. The Perl interpreter
[183] Fix | Delete
uses this hash to determine where breakpoints have been set. Any true value is
[184] Fix | Delete
considered to be a breakpoint; C<perl5db.pl> uses C<$break_condition\0$action>.
[185] Fix | Delete
Values are magical in numeric context: 1 if the line is breakable, 0 if not.
[186] Fix | Delete
[187] Fix | Delete
The scalar C<${"_<$filename"}> simply contains the string C<$filename>.
[188] Fix | Delete
This is also the case for evaluated strings that contain subroutines, or
[189] Fix | Delete
which are currently being executed. The $filename for C<eval>ed strings looks
[190] Fix | Delete
like C<(eval 34)>.
[191] Fix | Delete
[192] Fix | Delete
=head1 DEBUGGER STARTUP
[193] Fix | Delete
[194] Fix | Delete
When C<perl5db.pl> starts, it reads an rcfile (C<perl5db.ini> for
[195] Fix | Delete
non-interactive sessions, C<.perldb> for interactive ones) that can set a number
[196] Fix | Delete
of options. In addition, this file may define a subroutine C<&afterinit>
[197] Fix | Delete
that will be executed (in the debugger's context) after the debugger has
[198] Fix | Delete
initialized itself.
[199] Fix | Delete
[200] Fix | Delete
Next, it checks the C<PERLDB_OPTS> environment variable and treats its
[201] Fix | Delete
contents as the argument of a C<o> command in the debugger.
[202] Fix | Delete
[203] Fix | Delete
=head2 STARTUP-ONLY OPTIONS
[204] Fix | Delete
[205] Fix | Delete
The following options can only be specified at startup.
[206] Fix | Delete
To set them in your rcfile, add a call to
[207] Fix | Delete
C<&parse_options("optionName=new_value")>.
[208] Fix | Delete
[209] Fix | Delete
=over 4
[210] Fix | Delete
[211] Fix | Delete
=item * TTY
[212] Fix | Delete
[213] Fix | Delete
the TTY to use for debugging i/o.
[214] Fix | Delete
[215] Fix | Delete
=item * noTTY
[216] Fix | Delete
[217] Fix | Delete
if set, goes in NonStop mode. On interrupt, if TTY is not set,
[218] Fix | Delete
uses the value of noTTY or F<$HOME/.perldbtty$$> to find TTY using
[219] Fix | Delete
Term::Rendezvous. Current variant is to have the name of TTY in this
[220] Fix | Delete
file.
[221] Fix | Delete
[222] Fix | Delete
=item * ReadLine
[223] Fix | Delete
[224] Fix | Delete
if false, a dummy ReadLine is used, so you can debug
[225] Fix | Delete
ReadLine applications.
[226] Fix | Delete
[227] Fix | Delete
=item * NonStop
[228] Fix | Delete
[229] Fix | Delete
if true, no i/o is performed until interrupt.
[230] Fix | Delete
[231] Fix | Delete
=item * LineInfo
[232] Fix | Delete
[233] Fix | Delete
file or pipe to print line number info to. If it is a
[234] Fix | Delete
pipe, a short "emacs like" message is used.
[235] Fix | Delete
[236] Fix | Delete
=item * RemotePort
[237] Fix | Delete
[238] Fix | Delete
host:port to connect to on remote host for remote debugging.
[239] Fix | Delete
[240] Fix | Delete
=item * HistFile
[241] Fix | Delete
[242] Fix | Delete
file to store session history to. There is no default and so no
[243] Fix | Delete
history file is written unless this variable is explicitly set.
[244] Fix | Delete
[245] Fix | Delete
=item * HistSize
[246] Fix | Delete
[247] Fix | Delete
number of commands to store to the file specified in C<HistFile>.
[248] Fix | Delete
Default is 100.
[249] Fix | Delete
[250] Fix | Delete
=back
[251] Fix | Delete
[252] Fix | Delete
=head3 SAMPLE RCFILE
[253] Fix | Delete
[254] Fix | Delete
&parse_options("NonStop=1 LineInfo=db.out");
[255] Fix | Delete
sub afterinit { $trace = 1; }
[256] Fix | Delete
[257] Fix | Delete
The script will run without human intervention, putting trace
[258] Fix | Delete
information into C<db.out>. (If you interrupt it, you had better
[259] Fix | Delete
reset C<LineInfo> to something I<interactive>!)
[260] Fix | Delete
[261] Fix | Delete
=head1 INTERNALS DESCRIPTION
[262] Fix | Delete
[263] Fix | Delete
=head2 DEBUGGER INTERFACE VARIABLES
[264] Fix | Delete
[265] Fix | Delete
Perl supplies the values for C<%sub>. It effectively inserts
[266] Fix | Delete
a C<&DB::DB();> in front of each place that can have a
[267] Fix | Delete
breakpoint. At each subroutine call, it calls C<&DB::sub> with
[268] Fix | Delete
C<$DB::sub> set to the called subroutine. It also inserts a C<BEGIN
[269] Fix | Delete
{require 'perl5db.pl'}> before the first line.
[270] Fix | Delete
[271] Fix | Delete
After each C<require>d file is compiled, but before it is executed, a
[272] Fix | Delete
call to C<&DB::postponed($main::{'_<'.$filename})> is done. C<$filename>
[273] Fix | Delete
is the expanded name of the C<require>d file (as found via C<%INC>).
[274] Fix | Delete
[275] Fix | Delete
=head3 IMPORTANT INTERNAL VARIABLES
[276] Fix | Delete
[277] Fix | Delete
=head4 C<$CreateTTY>
[278] Fix | Delete
[279] Fix | Delete
Used to control when the debugger will attempt to acquire another TTY to be
[280] Fix | Delete
used for input.
[281] Fix | Delete
[282] Fix | Delete
=over
[283] Fix | Delete
[284] Fix | Delete
=item * 1 - on C<fork()>
[285] Fix | Delete
[286] Fix | Delete
=item * 2 - debugger is started inside debugger
[287] Fix | Delete
[288] Fix | Delete
=item * 4 - on startup
[289] Fix | Delete
[290] Fix | Delete
=back
[291] Fix | Delete
[292] Fix | Delete
=head4 C<$doret>
[293] Fix | Delete
[294] Fix | Delete
The value -2 indicates that no return value should be printed.
[295] Fix | Delete
Any other positive value causes C<DB::sub> to print return values.
[296] Fix | Delete
[297] Fix | Delete
=head4 C<$evalarg>
[298] Fix | Delete
[299] Fix | Delete
The item to be eval'ed by C<DB::eval>. Used to prevent messing with the current
[300] Fix | Delete
contents of C<@_> when C<DB::eval> is called.
[301] Fix | Delete
[302] Fix | Delete
=head4 C<$frame>
[303] Fix | Delete
[304] Fix | Delete
Determines what messages (if any) will get printed when a subroutine (or eval)
[305] Fix | Delete
is entered or exited.
[306] Fix | Delete
[307] Fix | Delete
=over 4
[308] Fix | Delete
[309] Fix | Delete
=item * 0 - No enter/exit messages
[310] Fix | Delete
[311] Fix | Delete
=item * 1 - Print I<entering> messages on subroutine entry
[312] Fix | Delete
[313] Fix | Delete
=item * 2 - Adds exit messages on subroutine exit. If no other flag is on, acts like 1+2.
[314] Fix | Delete
[315] Fix | Delete
=item * 4 - Extended messages: C<< <in|out> I<context>=I<fully-qualified sub name> from I<file>:I<line> >>. If no other flag is on, acts like 1+4.
[316] Fix | Delete
[317] Fix | Delete
=item * 8 - Adds parameter information to messages, and overloaded stringify and tied FETCH is enabled on the printed arguments. Ignored if C<4> is not on.
[318] Fix | Delete
[319] Fix | Delete
=item * 16 - Adds C<I<context> return from I<subname>: I<value>> messages on subroutine/eval exit. Ignored if C<4> is not on.
[320] Fix | Delete
[321] Fix | Delete
=back
[322] Fix | Delete
[323] Fix | Delete
To get everything, use C<$frame=30> (or C<o f=30> as a debugger command).
[324] Fix | Delete
The debugger internally juggles the value of C<$frame> during execution to
[325] Fix | Delete
protect external modules that the debugger uses from getting traced.
[326] Fix | Delete
[327] Fix | Delete
=head4 C<$level>
[328] Fix | Delete
[329] Fix | Delete
Tracks current debugger nesting level. Used to figure out how many
[330] Fix | Delete
C<E<lt>E<gt>> pairs to surround the line number with when the debugger
[331] Fix | Delete
outputs a prompt. Also used to help determine if the program has finished
[332] Fix | Delete
during command parsing.
[333] Fix | Delete
[334] Fix | Delete
=head4 C<$onetimeDump>
[335] Fix | Delete
[336] Fix | Delete
Controls what (if anything) C<DB::eval()> will print after evaluating an
[337] Fix | Delete
expression.
[338] Fix | Delete
[339] Fix | Delete
=over 4
[340] Fix | Delete
[341] Fix | Delete
=item * C<undef> - don't print anything
[342] Fix | Delete
[343] Fix | Delete
=item * C<dump> - use C<dumpvar.pl> to display the value returned
[344] Fix | Delete
[345] Fix | Delete
=item * C<methods> - print the methods callable on the first item returned
[346] Fix | Delete
[347] Fix | Delete
=back
[348] Fix | Delete
[349] Fix | Delete
=head4 C<$onetimeDumpDepth>
[350] Fix | Delete
[351] Fix | Delete
Controls how far down C<dumpvar.pl> will go before printing C<...> while
[352] Fix | Delete
dumping a structure. Numeric. If C<undef>, print all levels.
[353] Fix | Delete
[354] Fix | Delete
=head4 C<$signal>
[355] Fix | Delete
[356] Fix | Delete
Used to track whether or not an C<INT> signal has been detected. C<DB::DB()>,
[357] Fix | Delete
which is called before every statement, checks this and puts the user into
[358] Fix | Delete
command mode if it finds C<$signal> set to a true value.
[359] Fix | Delete
[360] Fix | Delete
=head4 C<$single>
[361] Fix | Delete
[362] Fix | Delete
Controls behavior during single-stepping. Stacked in C<@stack> on entry to
[363] Fix | Delete
each subroutine; popped again at the end of each subroutine.
[364] Fix | Delete
[365] Fix | Delete
=over 4
[366] Fix | Delete
[367] Fix | Delete
=item * 0 - run continuously.
[368] Fix | Delete
[369] Fix | Delete
=item * 1 - single-step, go into subs. The C<s> command.
[370] Fix | Delete
[371] Fix | Delete
=item * 2 - single-step, don't go into subs. The C<n> command.
[372] Fix | Delete
[373] Fix | Delete
=item * 4 - print current sub depth (turned on to force this when C<too much
[374] Fix | Delete
recursion> occurs.
[375] Fix | Delete
[376] Fix | Delete
=back
[377] Fix | Delete
[378] Fix | Delete
=head4 C<$trace>
[379] Fix | Delete
[380] Fix | Delete
Controls the output of trace information.
[381] Fix | Delete
[382] Fix | Delete
=over 4
[383] Fix | Delete
[384] Fix | Delete
=item * 1 - The C<t> command was entered to turn on tracing (every line executed is printed)
[385] Fix | Delete
[386] Fix | Delete
=item * 2 - watch expressions are active
[387] Fix | Delete
[388] Fix | Delete
=item * 4 - user defined a C<watchfunction()> in C<afterinit()>
[389] Fix | Delete
[390] Fix | Delete
=back
[391] Fix | Delete
[392] Fix | Delete
=head4 C<$slave_editor>
[393] Fix | Delete
[394] Fix | Delete
1 if C<LINEINFO> was directed to a pipe; 0 otherwise.
[395] Fix | Delete
[396] Fix | Delete
=head4 C<@cmdfhs>
[397] Fix | Delete
[398] Fix | Delete
Stack of filehandles that C<DB::readline()> will read commands from.
[399] Fix | Delete
Manipulated by the debugger's C<source> command and C<DB::readline()> itself.
[400] Fix | Delete
[401] Fix | Delete
=head4 C<@dbline>
[402] Fix | Delete
[403] Fix | Delete
Local alias to the magical line array, C<@{$main::{'_<'.$filename}}> ,
[404] Fix | Delete
supplied by the Perl interpreter to the debugger. Contains the source.
[405] Fix | Delete
[406] Fix | Delete
=head4 C<@old_watch>
[407] Fix | Delete
[408] Fix | Delete
Previous values of watch expressions. First set when the expression is
[409] Fix | Delete
entered; reset whenever the watch expression changes.
[410] Fix | Delete
[411] Fix | Delete
=head4 C<@saved>
[412] Fix | Delete
[413] Fix | Delete
Saves important globals (C<$@>, C<$!>, C<$^E>, C<$,>, C<$/>, C<$\>, C<$^W>)
[414] Fix | Delete
so that the debugger can substitute safe values while it's running, and
[415] Fix | Delete
restore them when it returns control.
[416] Fix | Delete
[417] Fix | Delete
=head4 C<@stack>
[418] Fix | Delete
[419] Fix | Delete
Saves the current value of C<$single> on entry to a subroutine.
[420] Fix | Delete
Manipulated by the C<c> command to turn off tracing in all subs above the
[421] Fix | Delete
current one.
[422] Fix | Delete
[423] Fix | Delete
=head4 C<@to_watch>
[424] Fix | Delete
[425] Fix | Delete
The 'watch' expressions: to be evaluated before each line is executed.
[426] Fix | Delete
[427] Fix | Delete
=head4 C<@typeahead>
[428] Fix | Delete
[429] Fix | Delete
The typeahead buffer, used by C<DB::readline>.
[430] Fix | Delete
[431] Fix | Delete
=head4 C<%alias>
[432] Fix | Delete
[433] Fix | Delete
Command aliases. Stored as character strings to be substituted for a command
[434] Fix | Delete
entered.
[435] Fix | Delete
[436] Fix | Delete
=head4 C<%break_on_load>
[437] Fix | Delete
[438] Fix | Delete
Keys are file names, values are 1 (break when this file is loaded) or undef
[439] Fix | Delete
(don't break when it is loaded).
[440] Fix | Delete
[441] Fix | Delete
=head4 C<%dbline>
[442] Fix | Delete
[443] Fix | Delete
Keys are line numbers, values are C<condition\0action>. If used in numeric
[444] Fix | Delete
context, values are 0 if not breakable, 1 if breakable, no matter what is
[445] Fix | Delete
in the actual hash entry.
[446] Fix | Delete
[447] Fix | Delete
=head4 C<%had_breakpoints>
[448] Fix | Delete
[449] Fix | Delete
Keys are file names; values are bitfields:
[450] Fix | Delete
[451] Fix | Delete
=over 4
[452] Fix | Delete
[453] Fix | Delete
=item * 1 - file has a breakpoint in it.
[454] Fix | Delete
[455] Fix | Delete
=item * 2 - file has an action in it.
[456] Fix | Delete
[457] Fix | Delete
=back
[458] Fix | Delete
[459] Fix | Delete
A zero or undefined value means this file has neither.
[460] Fix | Delete
[461] Fix | Delete
=head4 C<%option>
[462] Fix | Delete
[463] Fix | Delete
Stores the debugger options. These are character string values.
[464] Fix | Delete
[465] Fix | Delete
=head4 C<%postponed>
[466] Fix | Delete
[467] Fix | Delete
Saves breakpoints for code that hasn't been compiled yet.
[468] Fix | Delete
Keys are subroutine names, values are:
[469] Fix | Delete
[470] Fix | Delete
=over 4
[471] Fix | Delete
[472] Fix | Delete
=item * C<compile> - break when this sub is compiled
[473] Fix | Delete
[474] Fix | Delete
=item * C<< break +0 if <condition> >> - break (conditionally) at the start of this routine. The condition will be '1' if no condition was specified.
[475] Fix | Delete
[476] Fix | Delete
=back
[477] Fix | Delete
[478] Fix | Delete
=head4 C<%postponed_file>
[479] Fix | Delete
[480] Fix | Delete
This hash keeps track of breakpoints that need to be set for files that have
[481] Fix | Delete
not yet been compiled. Keys are filenames; values are references to hashes.
[482] Fix | Delete
Each of these hashes is keyed by line number, and its values are breakpoint
[483] Fix | Delete
definitions (C<condition\0action>).
[484] Fix | Delete
[485] Fix | Delete
=head1 DEBUGGER INITIALIZATION
[486] Fix | Delete
[487] Fix | Delete
The debugger's initialization actually jumps all over the place inside this
[488] Fix | Delete
package. This is because there are several BEGIN blocks (which of course
[489] Fix | Delete
execute immediately) spread through the code. Why is that?
[490] Fix | Delete
[491] Fix | Delete
The debugger needs to be able to change some things and set some things up
[492] Fix | Delete
before the debugger code is compiled; most notably, the C<$deep> variable that
[493] Fix | Delete
C<DB::sub> uses to tell when a program has recursed deeply. In addition, the
[494] Fix | Delete
debugger has to turn off warnings while the debugger code is compiled, but then
[495] Fix | Delete
restore them to their original setting before the program being debugged begins
[496] Fix | Delete
executing.
[497] Fix | Delete
[498] Fix | Delete
The first C<BEGIN> block simply turns off warnings by saving the current
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function