Lines Matching refs:we

44 API, but for now, the variables are what we've got.
125 bit-pattern, we can save and restore it easily (it will just look like
512 and the user's current package) and a add a newline before we do the C<eval()>.
514 Afterward, we restore C<$trace>, C<$single>, and C<$^D>.
516 Next we need to handle C<$@> without getting confused. We save C<$@> in a
520 considered sane by the debugger. If there was an C<eval()> error, we print
521 it on the debugger's output. If X<C<$onetimedump>> is defined, we call
528 In any case, we then return the list of output from C<eval> to the caller,
574 we want to be 'sandboxed' away from the debugger's internals when we do
575 the eval, but we need some way to control how punctuation variables and
579 variables; and we can't use C<my> either for the same reason. The code
582 After this routine is over, we don't have user code executing in the debugger's
583 context, so we can use C<my> freely.
594 # much as we can.
604 # even if the eval'ed code changes them, we can put them back again.
607 # inside the eval(), and we want to try to stay safe.
631 # Since we're only saving $@, we only have to localize the array element
636 # Now see whether we need to report an error back to the user.
759 # if we're paging to less.
1082 # the moment, we're just recommenting, and we are NOT going to change
1144 environment first. if it's not defined there, we try to find it in
1145 the Perl C<Config.pm>. If it's not there, we default to C<more>. We
1184 We also set the limit on the number of arguments we'll display during a
1191 # If we didn't get a default for the length of eval/stack trace args,
1200 If we are the primary, we just hang onto our pid so we'll have it when
1201 or if we start a child debugger. If we are a child, we'll set things up
1202 so we'll have a unique greeting and so the parent will give us our own
1206 because we mess around with it. We'll also need to hang onto it because
1207 we'll need it if we restart.
1215 # Save the current contents of the environment; we're about to
1216 # much with it. We'll need this if we have to restart.
1228 # We're the parent PID. Initialize PERLDB_PID in case we end up with a
1229 # child debugger, and mark us as the parent, so we'll know to set up
1230 # more TTY's is we have to.
1309 # If the rcfile (whichever one we decided was the right one to read)
1310 # exists, we safely do it.
1330 The last thing we do during initialization is determine which subroutine is
1342 and defined $ENV{TERM} # and we know what kind
1345 and defined $ENV{WINDOWID} # and we know what
1365 then sets C<PERLDB_RESTART>. When we start executing again, we check to see
1366 if C<PERLDB_RESTART> is there; if so, we reload all the information that
1388 # We're restarting, so we don't need the flag that says to restart anymore.
1423 Now, we'll decide how the debugger is going to interact with the user.
1424 If there's no TTY, we set the debugger to run non-stop; there's not going
1435 If there is a TTY, we have to determine who it belongs to before we can
1437 the first command-line switch being '-emacs'), we shift this off and
1526 # In OS/2, we need to use STDIN to get textmode too, even though
1539 If there is a TTY hanging around from a parent, we use that as the console.
1572 If no C<RemotePort> was defined, and we want to create a TTY on startup,
1575 OUT filehandle, and do the necessary mojo to create a new TTY if we know how
1576 and if we can.
1584 # filehandle, and do the necessary mojo to create a new tty if we
1585 # know how, and we can.
1588 # If we have a console, check to see if there are separate ins and
1603 open(OUT, ">&STDOUT"); # so we don't dongle stdout
1612 open(OUT, ">&STDOUT"); # so we don't dongle stdout
1636 To finish initialization, we show the debugger greeting,
1700 # Check for whether we should be running continuously or not.
1703 # Options say run non-stop. Run until we get an interrupt.
1710 # And we are now no longer in single-step mode.
1713 # If we simply returned at this point, we wouldn't get
1726 # If we're in single-step mode, or an interrupt (real or fake)
1734 # Since DB::DB gets called after every line, we can use caller() to
1735 # figure out where we last were executing. Sneaky, eh? This works because
1752 # we need to check for pseudofiles on Mac OS (these are files
1762 # if we have something here, see if we should break.
1769 # see if we should stop. If so, remove the one-time sigil.
1781 # If we have any watch expressions ...
1788 # we need a scalar here.
1859 has fallen off the end, we set things up so that entering further commands
1860 won't cause trouble, and we say that the program is over.
1864 # Check to see if we should grab control ($single true,
1865 # trace set appropriately, or we got a signal).
1876 Special check: if we're in package C<DB::fake>, we've gone through the
1877 C<END> block at least once. We set up everything so that we can continue
1900 If the program hasn't finished executing, we scan forward to the
1910 # Perl 5 ones (sorry, we don't print Klingon
1969 If there's an action to be executed for the line we stopped at, execute it.
1977 # Are we nested another level (e.g., did we evaluate a function
1988 # Complain about too much recursion if we passed the limit.
1992 # The line we're currently on. Set $incr to -1 to stay here
1993 # until we get a command that tells us to advance.
2005 execution. Sometimes, though, we want to see the next line, or to move elsewhere
2043 # If we have a terminal for input, and we get something back
2049 # ... and it belogs to this PID or we get one for this PID ...
2051 # ... and we got a line of command input ...
2079 we'll do nothing below (no command will match). If there was, we also save it
2110 # Squelch signal handling; we want to keep control here
2115 # This is a command, so we eval it in the DEBUGGER's
2116 # scope! Otherwise, we can't see the special debugger
2117 # variables, or get to the debugger's subs. (Well, we
2134 Quit the debugger. This entails setting the C<$fall_off_end> flag, so we don't
2317 # If not successfully switched now, we failed.
2332 # We didn't switch; say we didn't.
2342 and then we look up the line in the magical C<%dbline> hash.
2356 # Now where are we?
2363 We change C<$start> to be one window back; if we go back past the first line,
2364 we set it to be the first line. We ser C<$incr> to put us back at the
2387 them. At this point, we check for the new commands and call C<cmd_wrapper> to
2393 # we send them off to the secondary dispatcher (see below).
2408 # See if we've got the necessary support.
2417 # Load up dumpvar if we don't have it. If we can, that is.
2423 # Got all the modules we need. Find them and print them.
2509 # Probably not needed, since we finish an interactive
2516 # out, we'll just leave that to speculation for now.
2518 # If the "subname" isn't all digits, we'll assume it
2526 # to where the subroutine is defined; we call find_sub,
2534 # If we got a line number, we found the sub.
2537 # we're actually working with that file.
2556 # absolute line-break request) or we've scanned through
2558 # for an executable, which we may or may not have found.
2560 # If $i (which we set $subname from) is non-zero, we
2564 # file at the specified line, so we have to check to make
2573 # On the gripping hand, we can't do anything unless the
2599 we are printing return values when a C<r> is executed, set C<$doret>
2618 First, we try to reconstruct the command line that was used to invoke Perl
2659 # Otherwise we just reuse the original name we had
2686 # Save the debugger options we chose.
2695 can live in an awful lot of places, and we have to go through all of them,
2712 # is in a postponed file (we'll do postponed ones
2716 # In an eval. This is a little harder, so we'll
2794 After all the debugger status has been saved, we take the command we built
2802 # flags we built up, the script (whether a one-liner
2842 bad one, we return the error we got from trying to C<eval> it and exit.
2843 If not, we create some code to do the search and C<eval> it so it can't
2888 # Wrap if we pass the last line.
2891 # Stop if we have gotten back to this line again,
2894 # A hit! (Note, though, that we are doing
2907 # And quit since we found something.
2911 # If we wrapped, there never was a match.
2929 # If we've got one ...
2945 # Where we are now is where to stop after wraparound.
2958 # Wrap if we pass the first line.
2961 # Quit if we get back where we started,
2980 # Say we failed if the loop never found anything,
3046 # Stop if we find it.
3078 Like the above, but the command is passed to the shell. Again, we use
3108 # Stay in while we're still above the ending value.
3168 # as separators (which is why we escaped them in
3258 FOR C<|>, we save C<OUT> (the debugger's output filehandle) and C<STDOUT>
3259 (the program's standard output). For C<||>, we only save C<OUT>. We open a
3261 is the C<|> command, we also set up a C<SIGPIPE> handler which will simply
3284 # Fix up environment to record we have less if so.
3326 Anything left in C<$cmd> at this point is a Perl expression that we want to
3328 any variables we might want to address in the C<DB> package.
3345 # still on, to make sure we get control again.
3366 After each command, we check to see if the command output was piped anywhere.
3367 If so, we go through the necessary code to unhook the pipe and go back to
3381 # we cannot warn here: the handle is missing --tchrist
3401 # Reopen filehandle for our output (if we can) and
3402 # restore STDOUT (if we can).
3430 When commands have finished executing, we come here. If the user closed the
3431 input filehandle, we turn on C<$fall_off_end> to emulate a C<q> command. We
3543 # If the last ten characters are C'::AUTOLOAD', note we've traced
3564 # If we've gotten really deeply recursed, turn on the flag that will
3588 # DB::DB will recursively get control again if appropriate; we'll come
3607 # Print the return info if we need to.
3613 # Indent if we're printing because of $frame tracing.
3623 # And we have to return the return value now.
3643 # If we're doing exit messages...
3655 # If we are supposed to show the return value... same as before.
3753 # command set and command name in %set. If we can't find it,
3783 # If we have an expression ...
3828 # we print $@ and get out.
3850 is specified, we check for the line being executable (if it's not, it
3851 couldn't have had an action). If it is, we just take the action off (this
3889 we try to parse the command type, and then shuttle it off to an appropriate
3916 # The interpreter actually traps this one for us; we just put the
4003 # This is a block because that way we can use a redo inside it
4029 Several of the functions we need to implement in the API need to work both
4036 initialized to C<''>, no filename will appear when we are working on the
4045 =item * Localizes the C<*dbline> glob and reassigns it to point to the file we want to process.
4049 The first function works on the "current" (i.e., the one we changed to) file,
4051 if it needs to. When the functions return, C<*dbline> is restored to point to the actual current file (the one we're executing in) and C<$filename_error> is
4085 # If there are at least 2 arguments, we're trying to search a range.
4098 # $delta of 1 (positive), so the result is > 0 and we should use $to
4102 # times $delta of 1 (positive), so the result is < 0 and we should
4107 # (negative) so the result is > 0, and we use $to as the stopping
4112 # we use $limit (1) as the stopping point.
4116 # we use $limit (1) as the stopping point.
4119 # (negative), giving a positive (>0) value, so we'll set $limit to
4125 # $i starts at $from (the point we want to start searching from).
4128 # We stay in as long as we haven't hit an executable line
4129 # ($dbline[$i] == 0 means not executable) and we haven't reached
4142 # If there's a filename in filename_error, we'll see it.
4304 We take the incoming subroutine name and fully-qualify it as best we can.
4318 After all this cleanup, we call C<break_subroutine> to try to set the
4326 # Add always-true condition if we have none.
4382 # If it's * we're deleting all the breakpoints.
4408 For a single line, we look for it in C<@dbline>. If it's nonbreakable, we
4409 just drop out with a message saying so. If it is, we remove the condition
4411 after we've done that, there's nothing left, we delete the corresponding
4414 For all breakpoints, we iterate through the keys of C<%had_breakpoints>,
4418 we did in the single line case: delete the condition in C<@dbline>, and
4431 # If we got a line, delete just that one.
4470 # If, after we turn off the "there were breakpoints in this file"
4472 # we should remove this file from the hash.
4515 # If we have no operand, assume null.
4531 my $qasked = quotemeta($asked); # for searching; we don't
4665 # If we're not in that file, switch over to it.
4712 # Create a line range we'll understand, and recurse to do it.
4732 # If we're running under a slave editor, force it to show the lines.
4774 # Save the point we last listed to in case another relative 'l'
4785 breakpoints and/or actions. For each file, we switch the C<*dbline> glob (the
4792 Watchpoints are simpler: we just list the entries in C<@to_watch>.
4809 # Breaks and actions are found together, so we look in the same place
4819 my $was; # Flag: did we print something
4826 # Print the header if we haven't.
4920 If this is just C<o> by itself, we list the current settings via
4921 C<dump_option>. If there's a nonblank value following it, we pass that on to
4969 # which means that we'll always enter this loop (though a non-numeric
5038 If C<*> is specified, we simply empty the watch expression list and the
5039 watch expression value list. We also turn off the bit that says we've got
5042 If an expression (or partial expression) is specified, we pattern-match
5044 the corresponding values. If no watch expressions are left, we turn off
5066 # Where we are in the list.
5083 # a) we don't want to stop calling watchfunction() it it exists
5106 and installs the versions we like better.
5122 =head2 C<print_lineinfo> - show where we are now
5132 # Make the terminal sensible if we're not the primary debugger.
5142 For breakpoints, we use C<DB::find_sub> to locate the source file and line
5145 search the given range of lines to find a breakable line. If we find one,
5146 we set the breakpoint on it, deleting the breakpoint from C<%postponed>.
5181 # Search forward until we hit a breakable line or get to
5218 # Right, we've stopped. Turn it off.
5237 # Do we have any breakpoints to put in this file?
5243 # "Cannot be done: unsufficient magic" - we can't just put the
5245 # the whole hash; we have to do it one item at a time for the
5297 and we then return to the caller.
5315 # Load dumpvar.pl unless we've already got the sub we need from it.
5320 # If the load succeeded (or we already had dumpvalue()), go ahead
5377 # If this is going to a slave editor, but we're not the primary
5470 # it's unlikely that we'll have more than a billion stack frames. If you
5475 # the current one. Add $skip to the count of frames so we have a
5485 # XXX Okay... why'd we do that?
5494 # If we haven't reached the number of frames requested, and caller() is
5495 # still returning something, stay in the loop. (If we pass the requested
5496 # number of stack frames, or we run out - caller() returns nothing - we
5569 # If the sub is '(eval)', this is a block eval, meaning we don't
5625 already defined, we don't try to define it again. A speed hack.
5659 STDOUT, but under the debugger, we want it to use the debugger's input and
5707 Top-level function called when we want to set up a new terminal for use
5710 If the C<noTTY> debugger option was set, we'll either use the terminal
5711 supplied (the value of the C<noTTY> option), or we'll use C<Term::Rendezvous>
5712 to find one. If we're a forked debugger, we call C<resetterm> to try to
5713 get a whole new terminal if we can.
5715 In either case, we set up the terminal next. If the C<ReadLine> option was
5716 true, we'll get a C<Term::ReadLine> object for the current terminal and save
5727 # If noTTY is set, but we have a TTY name, go ahead and hook up to it.
5744 # See if we have anything to pass to Term::Rendezvous.
5761 # If we shouldn't use Term::ReadLine, don't.
5798 via C<system()> which starts a new debugger, we need to be able to get a new
5819 we're spawning route file number 3 to STDOUT, and then execute the C<tty>
5820 command (which prints the device name of the TTY we'll want to use for input
5822 to file number 3. This way we can simply read from the <XT> filehandle (which
5823 is STDOUT from the I<commands> we ran) to get the TTY we want to use.
5880 ($kpid = CORE::system 4, $^X, '-we',
5888 system P_NOWAIT, $^X, '-we', <<EOS or die "Cannot start a grandkid";
5925 =item * 2 - Debugger has forked, but we can't get a new TTY.
5935 # If we know how to get a new TTY, do it! $in will have
5982 Handles rejiggering the prompt when we've forked off a new debugger.
5989 isn't any list yet, we make one up out of the initial pid associated with
5994 we don't try to create a new IN and OUT filehandle. Otherwise, we go ahead
5999 sub resetterm { # We forked, so we need a different TTY
6018 # The prompt we're going to be using for this debugger.
6024 # Just return if we're not supposed to try to create a new TTY.
6033 First, we handle stuff in the typeahead buffer. If there is any, we shift off
6034 the next line, print a message saying we got it, add it to the terminal
6039 if we got one. If not, we pop the filehandle off and close it, and try the
6042 If we've emptied the filehandle stack, we check to see if we've got a socket
6043 open, and we read that and return it if we do. If we don't, we just call the
6061 # Print a message saying we got input from the typeahead.
6081 # If we got a line ...
6089 # Send anyting we have to send.
6097 # What we got.
6182 If 'option=value' is entered, we try to extract a quoted string from the
6183 value (if it is quoted). If it's not, we just use the whole value as-is.
6185 We load any modules required to service this option, and then we set it: if
6186 it just gets stuck in a variable, we do that; if there's a subroutine to
6187 handle setting the option, we call that.
6189 Finally, if we're running in interactive mode, we display the effect of the
6190 user's command back to the terminal, skipping this if we're setting things
6235 # They're going for a default, which we assume is 1.
6300 # Not initialization - echo the value we set it to.
6323 # VAR_n: how many we have. Scalar assignment gets the number of items.
6338 Reverse the set_list operation: grab VAR_n to see how many we should be getting
6363 get all confused if we do.
6377 If the composited message I<doesn't> end with a newline, we automatically
6396 after we've tried and failed to move them elsewhere. In addition, it assigns
6437 If the terminal supports switching, we go ahead and do it. If not, and
6438 there's already a terminal in place, we save the information to take effect
6442 we go ahead and set C<$console> and C<$tty> to the file indicated.
6488 we save the value to use it if we're restarted.
6502 Sets the C<$rl> option variable. If 0, we use C<Term::ReadLine::Stub>
6503 (essentially, no C<readline> processing on this "terminal"). Otherwise, we
6504 use C<Term::ReadLine>. Can't be changed after a terminal's in place; we save
6505 the value in case a restart is done so we can change it then.
6520 If the terminal's already been set up, we can't do it, but we remember the
6591 # If we got an argument, meta-quote it, and add '\b' if it
6615 # We don't want to show warning backtraces, but we do want die() ones.
6623 # Use what was passed in if we can't determine it ourselves.
7180 C<$ENV{LESS}> so we don't have to go through doing the stats again.
7204 # 'r' added so we don't do (slow) stats again.
7230 # If we enter the signal handler recursively, kill myself with an
7231 # abort signal (so we just terminate).
7234 # If we can show detailed info, do so.
7236 # Don't recursively enter the warn handler, since we're carping.
7239 # Skip two levels before reporting traceback: we're skipping
7247 # No Carp. Tell us about the signal as best we can.
7276 # Load Carp if we can. If $^S is false (current thing being compiled isn't
7277 # done yet), we may not be able to do a require.
7293 # We can call Carp::longmess without its being "debugged" (which we
7294 # don't want - we just want to use it!). Capture this for later.
7310 debugging it - we just want to use it.
7312 If C<dieLevel> is zero, we let the program being debugged handle the
7405 # If we've finished initialization, mention that stack dumps
7406 # are enabled, If dieLevel is 1, we won't stack dump if we die
7552 try; C<$prefix> is the message prefix, which gets built up as we go up the
7553 C<@ISA> tree to show parentage; C<$crawl_upward> is 1 if we should try to go
7554 higher in the C<@ISA> tree, 0 if we should stop.
7559 # If we've processed this class already, just quit.
7563 # This is a package that is contributing the methods we're about to print.
7574 # If we printed this already, skip it.
7709 =item * The fact that we're not in a sub at all right now.
7719 =item * That we want no return values and no subroutine entry/exit trace.
7749 # We're not in any sub yet, but we need this to be a defined value.
7757 # debug itself. Perhaps we can try that someday.
7764 # DB::DB and DB::sub". We will turn it on forcibly before we try to
7765 # execute anything in the user's context, because we always want to
7770 # This variable records how many levels we're nested in debugging. Used
7775 # "Triggers bug (?) in perl if we postpone this until runtime."
7776 # XXX No details on this yet, or whether we should fix the bug instead
7830 =item * Add "postpone", "load", and "compile" as possibles (we may be completing the keyword itself
7834 =item * C<grep> out the ones that match the text we have so far
7891 Here, we want to get a fully-qualified filename for the C<f> command.
7908 # like '(eval 9)'), so we may need to clean up the completion text
7947 Much like the above, except we have to do a little more cleanup:
7983 =item * If there's only one hit, and it's a package qualifier, and it's not equal to the initial text, re-complete it using the symbol we actually found.
8053 only a single value, we complete the command in such a way that it is a
8055 possible values, we generate a command consisting of the option plus a trailing
8070 # There's really nothing else we can do.
8079 # whtespace), but we want to make sure we don't end up with
8082 # If we didn't find this quote character in the value,
8120 Say we're done.
8131 If we have $ini_pids, save it in the environment; else remove it from the
8148 loop where we allow the user to enter commands and interact with the
8149 debugger, but we don't want anything else to execute.
8151 First we set the C<$finished> variable, so that some commands that
8154 We then figure out whether we're truly done (as in the user entered a C<q>
8155 command, or we finished execution while running nonstop). If we aren't,
8156 we set C<$single> to 1 (causing the debugger to get control again).
8180 Because we wanted to retain the option of being able to go back to the
8181 former command set, we moved the old code off to this section.
8264 # The interpreter actually traps this one for us; we just put the
8338 # If, after we turn off the "there were breakpoints in this file"
8340 # we should remove this file from the hash.
8474 references anyway, all we have to do is pick the right array reference and
8487 # Make sure we have some array or another to address later.
8488 # This means that if ssome reason the tests fail, we won't be
8518 # Did we find something that makes sense?