diff options
-rw-r--r-- | Lib/pdb.doc | 78 |
1 files changed, 18 insertions, 60 deletions
diff --git a/Lib/pdb.doc b/Lib/pdb.doc index 43a91c2..2844f80 100644 --- a/Lib/pdb.doc +++ b/Lib/pdb.doc @@ -44,9 +44,10 @@ Debugger commands ================= h(elp) - Without argument, print the list of available commands. - With a command name as argument, print help about that command - (this is currently not implemented). + Without argument, print the list of available commands. + With a command name as argument, print help about that command + "help pdb" pipes the full documentation file to the $PAGER + "help exec" gives help on the ! command w(here) Print a stack trace, with the most recent frame at the bottom. @@ -61,15 +62,25 @@ u(p) Move the current frame one level up in the stack trace (to a newer frame). -b(reak) [lineno | function] - With a line number argument, set a break there in the current - file. With a function name, set a break at the entry of that - function. Without argument, list all breaks. +b(reak) ([file:]lineno | function) [, "condition"] + With a line number argument, set a break there in the current + file. With a function name, set a break at the entry of that + function. Without argument, list all breaks. If a second + argument is present, it is a string specifying an expression + which must evaluate to true before the breakpoint is honored. + + The line number may be prefixed with a filename and a colon, + to specify a breakpoint in another file (probably one that + hasn't been loaded yet). The file is searched on sys.path. cl(ear) [lineno] With a line number argument, clear that break in the current file. Without argument, clear all breaks (but first ask confirmation). + The line number may be prefixed with a filename and a colon, + to specify a breakpoint in another file (probably one that + hasn't been loaded yet). The file is searched on sys.path. + s(tep) Execute the current line, stop at the first possible occasion (either in a function that is called or in the current function). @@ -111,56 +122,3 @@ p expression q(uit) Quit from the debugger. The program being executed is aborted. - - -How it works -============ - -Some changes were made to the interpreter: -- sys.settrace(func) sets the global trace function -- there can also a local trace function (see later) - -Trace functions have three arguments: (frame, event, arg) - - frame is the current stack frame - - event is a string: 'call', 'line', 'return' or 'exception' - - arg is dependent on the event type -A trace function should return a new trace function or None. -Class methods are accepted (and most useful!) as trace methods. - -The events have the following meaning: - - 'call': A function is called (or some other code block entered). - The global trace function is called; - arg is the argument list to the function; - the return value specifies the local trace function. - - 'line': The interpreter is about to execute a new line of code - (sometimes multiple line events on one line exist). - The local trace function is called; arg in None; - the return value specifies the new local trace function. - - 'return': A function (or other code block) is about to return. - The local trace function is called; - arg is the value that will be returned. - The trace function's return value is ignored. - - 'exception': An exception has occurred. - The local trace function is called; - arg is a triple (exception, value, traceback); - the return value specifies the new local trace function - -Note that as an exception is propagated down the chain of callers, an -'exception' event is generated at each level. - -Stack frame objects have the following read-only attributes: - f_code: the code object being executed - f_lineno: the current line number (-1 for 'call' events) - f_back: the stack frame of the caller, or None - f_locals: dictionary containing local name bindings - f_globals: dictionary containing global name bindings - -Code objects have the following read-only attributes: - co_code: the code string - co_names: the list of names used by the code - co_consts: the list of (literal) constants used by the code - co_filename: the filename from which the code was compiled |