Inheritance diagram for IPython.core.debugger:
Pdb debugger class.
Modified from the standard pdb.Pdb class to avoid including readline, so that the command line completion of other programs which include this isn’t damaged.
In the future, this class will be expanded with improvements over the standard pdb.
The code in this file is mainly lifted out of cmd.py in Python 2.2, with minor changes. Licensing should therefore be under the standard Python terms. For details on the PSF (Python Software Foundation) standard license, see:
Bases: pdb.Pdb
Modified Pdb class, does not load readline.
Call every command that was set for the current active breakpoint (if there is one) Returns True if the normal interaction function must be called, False otherwise
Check whether specified line seems to be executable.
Return lineno if it is, 0 if not (e.g. a docstring, comment, blank line or EOF). Warning: testing is not comprehensive.
Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.
Display a list of strings as a compact set of columns.
Each column is only as wide as necessary. Columns are separated by two spaces (one was not legible enough).
Return the next possible completion for ‘text’.
If a command has not been entered, then complete against command list. Otherwise try to call complete_<command> to get list of completions.
Method called to complete an input line when no command-specific complete_*() method is available.
By default, it returns an empty list.
Produce a reasonable default.
Custom displayhook for the exec in default(), which prevents assignment of the _ variable in the builtins.
Three possibilities, tried in this order: clear -> clear all breaks, ask for confirmation clear file:lineno -> clear all breaks at file:lineno clear bpno bpno ... -> clear breakpoints by number
Three possibilities, tried in this order: clear -> clear all breaks, ask for confirmation clear file:lineno -> clear all breaks at file:lineno clear bpno bpno ... -> clear breakpoints by number
Defines a list of commands associated to a breakpoint Those commands will be executed whenever the breakpoint causes the program to stop execution.
arg is bp number followed by ignore count.
The debugger interface to magic_pdef
The debugger interface to magic_pdoc
The debugger equivalant of ?obj
Restart program by raising an exception to be caught in the main debugger loop. If arguments were given, set them in sys.argv.
Restart program by raising an exception to be caught in the main debugger loop. If arguments were given, set them in sys.argv.
Called when an empty line is entered in response to the prompt.
If this method is not overridden, it repeats the last nonempty command entered.
Handles one command line during command list definition.
List command to use if we have a newer pydb installed
Helper function for break/clear parsing – may be overridden.
lookupmodule() translates (possibly incomplete) file or module name into an absolute file name.
Restart command. In the context of ipython this is exactly the same thing as ‘quit’.
Interpret the argument as though it had been typed in response to the prompt.
Checks whether this line is typed at the normal prompt or in a breakpoint command list definition.
Parse the line into a command name and a string containing the arguments. Returns a tuple containing (command, args, line). ‘command’ and ‘args’ may be None if the line couldn’t be parsed.
Hook method executed just after a command dispatch is finished.
Handle alias expansion and ‘;;’ separator.
Hook method executed once when the cmdloop() method is called.
The printing (as opposed to the parsing part of a ‘list’ command.
Shorthand access to the color table scheme selector method.
Stop on the next line in or below the given frame.
Stop when returning from the given frame.
Stop after one line of code.
Start debugging from frame.
If frame is not specified, debugging starts from caller’s frame.
Stop when the line with the line no greater than the current one is reached or when returning from current frame
This method is called when there is the remote possibility that we ever need to stop in this function.
This function is called if an exception occurs, but only if we are to stop at or just below this level.
This function is called when we stop or break at this line.
This function is called when a return trap is set here.
Bases: object
Class for local debugging, similar to pdb.set_trace.
Instances of this class, when called, behave like pdb.set_trace, but providing IPython’s enhanced capabilities.
This is implemented as a class which must be initialized in your own code and not as a standalone function because we need to detect at runtime whether IPython is already active or not. That detection is done in the constructor, ensuring that this code plays nicely with a running IPython, while functioning acceptably (though with limitations) if outside of it.
Create a local debugger instance.
Parameters : |
|
---|
use, it must be one of IPython’s valid color schemes. If not given, the function will default to the current IPython scheme when running inside IPython, and to ‘NoColor’ otherwise.
Usage example:
from IPython.core.debugger import Tracer; debug_here = Tracer()
... later in your code debug_here() # -> will open up the debugger at that point.
Once the debugger activates, you can use all of its regular commands to step through code, set breakpoints, etc. See the pdb documentation from the Python standard library for usage details.