Lines Matching defs:DB
67 The debugger uses this trick a I<lot>. Of particular note is C<DB::eval>,
70 keep C<$@> safe until it C<DB::eval> returns, at which point the previous
270 a C<&DB::DB();> in front of each place that can have a
271 breakpoint. At each subroutine call, it calls C<&DB::sub> with
272 C<$DB::sub> set to the called subroutine. It also inserts a C<BEGIN
276 call to C<&DB::postponed($main::{'_<'.$filename})> is done. C<$filename>
299 Any other positive value causes C<DB::sub> to print return values.
303 The item to be eval'ed by C<DB::eval>. Used to prevent messing with the current
304 contents of C<@_> when C<DB::eval> is called.
340 Controls what (if anything) C<DB::eval()> will print after evaluating an
360 Used to track whether or not an C<INT> signal has been detected. C<DB::DB()>,
403 Stack of filehandles that C<DB::readline()> will read commands from.
404 Manipulated by the debugger's C<source> command and C<DB::readline()> itself.
434 The typeahead buffer, used by C<DB::readline>.
498 C<DB::sub> uses to tell when a program has recursed deeply. In addition, the
514 package DB;
541 =head2 C<DB::eval()>
547 C<$DB::evalarg>; this is done to avoid fiddling with the contents of C<@_>.
552 user's current package, grabbed when C<DB::DB> got control. This causes the
572 =head3 Parameters and variables influencing execution of DB::eval()
574 C<DB::eval> isn't parameterized in the standard way; this is to keep the
575 debugger's calls to C<DB::eval()> from mucking with C<@_>, among other things.
576 The variables listed below influence C<DB::eval()>'s execution directly.
592 The following variables are altered by C<DB::eval()> during its execution. They
593 are "stacked" via C<local()>, enabling recursive calls to C<DB::eval()>.
613 The context of C<DB::eval()> presents us with some problems. Obviously,
618 We can't use local, because the code inside C<DB::eval> can see localized
715 return 'no strict; ($@, $!, $^E, $,, $/, $\, $^W) = @DB::saved;'
723 # Remember: this localizes @DB::res, not @main::res.
739 # $usercontext built in DB::DB near the comment
740 # "set up the context for DB::eval ..."
757 eval { &DB::save };
801 # Note that no subroutine call is possible until &DB::sub is defined
802 # (for subroutines defined outside of the package DB). In fact the same is
849 [tid] DB<$i>
906 # without threads, $filename is not defined until DB::DB is called
1693 # Unbuffer DB::OUT. We need to see responses right away.
1718 print $OUT "\nDaughter DB session started...\n";
1721 print $OUT "\nLoading DB routines from $header\n";
1757 =head2 DB
1833 $evalarg = "\$DB::signal |= 1 if do {$stop}";
1835 &DB::eval;
1869 $cmd = DB::readline(
1870 "$pidprompt $tid DB"
2361 open( SAVEOUT, ">&OUT" ) || _db_warn("Can't save DB::OUT");
2375 || _db_warn("Can't restore DB::OUT");
2384 || _db_warn("Can't restore DB::OUT");
2390 $SIG{PIPE} = \&DB::catch
2420 # m expr - set up DB::eval to do the work
2421 if ($cmd =~ s#\Am\b# #) { # Rest gets done by DB::eval()
2441 close(OUT) || print SAVEOUT "\nCan't close DB::OUT\n";
2462 open( OUT, ">&STDOUT" ) || _db_warn("Can't restore DB::OUT");
2467 $SIG{PIPE} = "DEFAULT" if $SIG{PIPE} eq \&DB::catch;
2475 open( OUT, ">&SAVEOUT" ) || _db_warn("Can't restore DB::OUT");
2501 if ( $DB::trace & 2 ) {
2502 for my $n (0 .. $#DB::to_watch) {
2503 $DB::evalarg = $DB::to_watch[$n];
2504 local $DB::onetimeDump; # Tell DB::eval() to not output results
2506 # Fix context DB::eval() wants to return an array, but
2508 my ($val) = join( "', '", DB::eval(@_) );
2512 if ( $val ne $DB::old_watch[$n] ) {
2515 $DB::signal = 1;
2516 print {$DB::OUT} <<EOP;
2517 Watchpoint $n:\t$DB::to_watch[$n] changed:
2518 old value:\t$DB::old_watch[$n]
2521 $DB::old_watch[$n] = $val;
2543 ($isa) = &DB::eval;
2607 my ($s) = DB::eval();
2790 # Set up for DB::eval() - evaluate in *user* context.
2872 sub DB {
2891 my $obj = DB::Obj->new(
2910 DB::save();
2912 # Since DB::DB gets called after every line, we can use caller() to
2919 # set up the context for DB::eval, so it can properly execute
2944 function which will be run on each entry to C<DB::DB>; it gets the
2980 # If there's a user-defined DB::watchfunction, call it with the
2982 # the DB:: package.
3026 &DB::eval;
3040 &DB::eval;
3076 Most of C<DB::DB> is actually a command parsing and dispatch loop. It comes
3121 $cmd .= DB::readline(" cont: ");
3233 Hands the expression off to C<DB::eval>, setting it up to print the value
3238 Just uses C<DB::methods> to determine what methods are available.
3281 when entered (see C<DB::sub> in L</DEBUGGER INTERFACE VARIABLES>). We also
3288 Sets C<$single> to 1, which causes C<DB::sub> to continue tracing inside
3308 Just calls C<DB::print_trace>.
3312 Just calls C<DB::cmd_w>.
3316 Just calls C<DB::cmd_W>.
3400 Opens a lexical filehandle and stacks it on C<@cmdfhs>; C<DB::readline> will
3436 # || - run command in the pager, with output to DB::OUT.
3443 any variables we might want to address in the C<DB> package.
3450 $cmd =~ s/^t\s/\$DB::trace |= 1;\n/;
3454 $evalarg = "\$^D = \$^D | \$DB::db_stop;\n$cmd";
3458 &DB::eval;
3501 DB::Obj::_do_quit();
3507 &DB::eval;
3514 } ## end sub DB
3516 # Because DB::Obj is used above,
3518 # my $obj = DB::Obj->new(
3528 package DB::Obj;
3620 DB::print_lineinfo( ' ' x $stack_depth,
3621 "$i:\t$DB::dbline[$i]" . $self->after );
3624 DB::depth_print_lineinfo($self->explicit_stop, $incr_pos);
3629 return $DB::dbline[$line];
3635 return ($DB::cmd eq $letter);
3646 $self->position("$sub_twice${DB::filename}:$line:0\n");
3647 DB::print_lineinfo($self->position());
3652 Special check: if we're in package C<DB::fake>, we've gone through the
3658 elsif ( $DB::package eq 'DB::fake' ) {
3661 if (!$DB::term) {
3662 DB::setterm();
3665 DB::print_help(<<EOP);
3671 $DB::package = 'main';
3672 $DB::usercontext = DB::_calc_usercontext($DB::package);
3673 } ## end elsif ($package eq 'DB::fake')
3688 $DB::sub =~ s/\'/::/; # Swap Perl 4 package separators (') to
3692 $self->prefix($DB::sub =~ /::/ ? "" : ($DB::package . '::'));
3693 $self->append_to_prefix( "$DB::sub(${DB::filename}:" );
3714 my $line_i = sub { return $DB::dbline[$i]; };
3718 for ( $i = $line + 1 ; $i <= $DB::max && $line_i->() == 0 ; ++$i )
3750 $DB::trace_to_depth = $levels ? $stack_depth + $levels : 1E9;
3753 ? ( $levels ? "on (to level $DB::trace_to_depth)" : "on" )
3795 $DB::cmd =~ s/^X\b/V $DB::package/;
3800 $DB::cmd = "V $DB::package";
3805 $DB::cmd =~ /\AV\b\s*(\S+)\s*(.*)/) {
3868 $DB::cmd = 'l ' . ($start) . '+';
3877 next CMD if DB::_DB__is_finished();
3883 $laststep = $DB::cmd;
3919 next CMD if DB::_DB__is_finished();
3936 DB::print_trace( $OUT, 1 ); # skip DB
3946 DB::cmd_w( 'w', $self->cmd_args() );
3956 DB::cmd_W( 'W', $arg );
3967 if (my ($minus, $arg) = $DB::cmd =~ m#\A$rc+\s*(-)?(\d+)?\z#) {
3970 pop(@hist) if length($DB::cmd) > 1;
3982 $DB::cmd = $hist[$self->cmd_verb];
3986 print {$OUT} $DB::cmd, "\n";
3997 if (my ($arg) = $DB::cmd =~ /\A$rc([^$rc].*)\z/) {
4004 pop(@hist) if length($DB::cmd) > 1;
4023 $DB::cmd = $hist[$i];
4024 print $OUT $DB::cmd, "\n";
4069 = $DB::cmd =~ /\A(?:man|(?:perl)?doc)\b(?:\s+([^(]*))?\z/) {
4070 DB::runman($man_page);
4080 my $print_cmd = 'print {$DB::OUT} ';
4083 $DB::cmd = $print_cmd . '$_';
4087 $DB::cmd =~ s/\Ap\b/$print_cmd /;
4096 if ($DB::cmd =~ s/\A=\s*//) {
4098 if ( length $DB::cmd == 0 ) {
4103 elsif ( my ( $k, $v ) = ( $DB::cmd =~ /^(\S+)\s+(\S.*)/ ) ) {
4135 } ## end elsif (my ($k, $v) = ($DB::cmd...
4139 @keys = ($DB::cmd);
4183 DB::_db_warn("Can't execute '$sourced_fn': $!\n");
4201 $fn = $DB::filename;
4210 DB::_db_warn("Wrong spec for enable/disable argument.\n");
4214 if (DB::_has_breakpoint_data_ref($fn, $line_num)) {
4215 DB::_set_breakpoint_enabled_status($fn, $line_num,
4220 DB::_db_warn("No breakpoint set at ${fn}:${line_num}\n");
4245 DB::_db_warn("Can't save debugger commands in '$new_fn': $!\n");
4257 if ($DB::cmd =~ s#\A\Q$letter\E\s#\$DB::single = $new_val;\n#) {
4269 my $my_cmd = $DB::cmd;
4275 DB::_db_system( $ENV{SHELL} || "/bin/sh" );
4280 DB::_db_system($1);
4284 DB::_db_system( $ENV{SHELL} || "/bin/sh", "-c", $1 );
4293 if ($DB::cmd =~ s#\Ax\b# #) { # Remainder gets done by DB::eval()
4298 if ( $DB::cmd =~ s#\A\s*(\d+)(?=\s)# #) {
4308 DB::clean_ENV();
4325 DB::cmd_wrapper( $self->cmd_verb, $self->cmd_args, $line );
4334 if (my ($cmd_letter, $my_arg) = $DB::cmd =~ /\A([<>\{]{1,2})\s*(.*)/so) {
4335 DB::cmd_wrapper( $cmd_letter, $my_arg, $line );
4342 } ## end DB::Obj
4344 package DB;
4352 debugged. The variable C<$DB::sub> contains the name of the subroutine
4356 context, capturing its output. This of course causes C<DB::DB> to get called
4357 again, repeating until the subroutine ends and returns control to C<DB::sub>
4358 again. Once control returns, C<DB::sub> figures out whether or not to dump the
4361 C<DB::sub> hadn't been there at all.
4376 If C<caller()> is called from the package C<DB>, it provides some
4421 =item * C<@DB::args>
4431 # We need to fully qualify the name ("DB::sub") to make "use strict;"
4465 sub DB::sub {
4522 # DB::DB will recursively get control again if appropriate; we'll come
6073 # Parameterize DB::eval and call it to get the expression's value
6078 my ($val) = join( ' ', &DB::eval);
6226 For breakpoints, we use C<DB::find_sub> to locate the source file and line
6310 # Enter the command loop when DB::DB gets called.
6768 return DB::readline("cont: ");
7237 of the created I<TTY> in B<\$DB::fork_TTY>, or define a function
7238 B<DB::get_fork_TTY()> returning this.
8043 s/^perl5db$/DB/; # Special case: debugger
8044 # moves to package DB
8185 B<$psh$psh> I<cmd> Run cmd in a subprocess (reads from DB::IN, writes to DB::OUT)"
8200 B<p> I<expr> Same as \"I<print {DB::OUT} expr>\" in current package.
8201 B<|>I<dbcmd> Run debugger command, piping DB::OUT to current pager.
8202 B<||>I<dbcmd> Same as B<|>I<dbcmd> but DB::OUT is temporarily select()ed as well.
8245 B<q> or B<^D> Quit. Set B<\$DB::finished = 0> to debug global destruction.
8251 Set B<\$DB::doccmd> to change viewer.
8365 B<$psh$psh> I<cmd> Run cmd in a subprocess (reads from DB::IN, writes to DB::OUT)"
8375 B<p> I<expr> Same as \"I<print {DB::OUT} expr>\" in current package.
8376 B<|>I<dbcmd> Run debugger command, piping DB::OUT to current pager.
8377 B<||>I<dbcmd> Same as B<|>I<dbcmd> but DB::OUT is temporarilly select()ed as well.
8421 B<q> or B<^D> Quit. Set B<\$DB::finished = 0> to debug global destruction.
8426 Set B<\$DB::doccmd> to change viewer.
8615 print $DB::OUT "Got signal @_\n";
8625 be able to get a stack trace, and output the warning message vi C<DB::dbwarn()>.
8708 # inside DB::DB, but not in Carp). Save $single and $trace, turn them off,
8726 Set the C<$DB::warnLevel> variable that stores the value of the
8739 $SIG{__WARN__} = \&DB::dbwarn;
8753 C<DB::dbdie()> function overriding any other C<die()> handler. Setting it to
8766 $SIG{__DIE__} = \&DB::dbdie; # if $dieLevel < 2;
8769 #$SIG{__DIE__} = \&DB::diehard if $dieLevel >= 2;
8798 takes over and handles them with C<DB::diesignal()>.
8808 $SIG{SEGV} = \&DB::diesignal;
8809 $SIG{BUS} = \&DB::diesignal;
8972 print $DB::OUT $_ foreach sort @to_print;
9078 debugger package globals that C<DB::sub()> requires have to be defined before
9140 $IN = \*STDIN; # For bugs before DB::OUT has been opened
9141 $OUT = \*STDERR; # For errors before DB::OUT has been opened
9165 # ($signal) that DB::DB() will check before each command is executed.
9166 $SIG{INT} = \&DB::catch;
9176 # DB::DB and DB::sub". We will turn it on forcibly before we try to
9468 We look for the lexical scope above DB::DB and auto-complete lexical variables
9483 last if $info[3] eq 'DB::DB';
9629 PERLDBf_GOTO => 0x80, # Report goto: call DB::goto
9717 push(@DB::typeahead, @truehist); # saved
9779 the debugger's status in environment variables. The C<DB::set_list> routine
9810 variable via C<DB::set_list>.
9951 We then call C<DB::fake::at_exit()>, which returns the C<Use 'q' to quit ...>
9968 $DB::single = 1;
9969 DB::fake::at_exit();
10247 my ($val) = &DB::eval;
10387 =head1 C<DB::fake>
10396 package DB::fake;
10402 package DB; # Do not trace this 1; below!