+++ /dev/null
-The Python Debugger Pdb\r
-=======================\r
-\r
-To use the debugger in its simplest form:\r
-\r
- >>> import pdb\r
- >>> pdb.run('<a statement>')\r
-\r
-The debugger's prompt is '(Pdb) '. This will stop in the first\r
-function call in <a statement>.\r
-\r
-Alternatively, if a statement terminated with an unhandled exception,\r
-you can use pdb's post-mortem facility to inspect the contents of the\r
-traceback:\r
-\r
- >>> <a statement>\r
- <exception traceback>\r
- >>> import pdb\r
- >>> pdb.pm()\r
-\r
-The commands recognized by the debugger are listed in the next\r
-section. Most can be abbreviated as indicated; e.g., h(elp) means\r
-that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel',\r
-nor as 'H' or 'Help' or 'HELP'). Optional arguments are enclosed in\r
-square brackets.\r
-\r
-A blank line repeats the previous command literally, except for\r
-'list', where it lists the next 11 lines.\r
-\r
-Commands that the debugger doesn't recognize are assumed to be Python\r
-statements and are executed in the context of the program being\r
-debugged. Python statements can also be prefixed with an exclamation\r
-point ('!'). This is a powerful way to inspect the program being\r
-debugged; it is even possible to change variables. When an exception\r
-occurs in such a statement, the exception name is printed but the\r
-debugger's state is not changed.\r
-\r
-The debugger supports aliases, which can save typing. And aliases can\r
-have parameters (see the alias help entry) which allows one a certain\r
-level of adaptability to the context under examination.\r
-\r
-Multiple commands may be entered on a single line, separated by the\r
-pair ';;'. No intelligence is applied to separating the commands; the\r
-input is split at the first ';;', even if it is in the middle of a\r
-quoted string.\r
-\r
-If a file ".pdbrc" exists in your home directory or in the current\r
-directory, it is read in and executed as if it had been typed at the\r
-debugger prompt. This is particularly useful for aliases. If both\r
-files exist, the one in the home directory is read first and aliases\r
-defined there can be overriden by the local file.\r
-\r
-Aside from aliases, the debugger is not directly programmable; but it\r
-is implemented as a class from which you can derive your own debugger\r
-class, which you can make as fancy as you like.\r
-\r
-\r
-Debugger commands\r
-=================\r
-\r
-h(elp)\r
- Without argument, print the list of available commands. With\r
- a command name as argument, print help about that command\r
- (this is currently not implemented).\r
-\r
-w(here)\r
- Print a stack trace, with the most recent frame at the bottom.\r
- An arrow indicates the "current frame", which determines the\r
- context of most commands.\r
-\r
-d(own)\r
- Move the current frame one level down in the stack trace\r
- (to a newer frame).\r
-\r
-u(p)\r
- Move the current frame one level up in the stack trace\r
- (to an older frame).\r
-\r
-b(reak) [ ([filename:]lineno | function) [, condition] ]\r
- With a filename:line number argument, set a break there. If\r
- filename is omitted, use the current file. With a function\r
- name, set a break at the first executable line of that\r
- function. Without argument, list all breaks. Each breakpoint\r
- is assigned a number to which all the other breakpoint\r
- commands refer.\r
-\r
- The condition argument, if present, is a string which must\r
- evaluate to true in order for the breakpoint to be honored.\r
-\r
-tbreak [ ([filename:]lineno | function) [, condition] ]\r
- Temporary breakpoint, which is removed automatically when it\r
- is first hit. The arguments are the same as break.\r
-\r
-cl(ear) [bpnumber [bpnumber ...] ]\r
- With a space separated list of breakpoint numbers, clear those\r
- breakpoints. Without argument, clear all breaks (but first\r
- ask confirmation).\r
-\r
-disable bpnumber [bpnumber ...]\r
- Disables the breakpoints given as a space separated list of\r
- breakpoint numbers. Disabling a breakpoint means it cannot\r
- cause the program to stop execution, but unlike clearing a\r
- breakpoint, it remains in the list of breakpoints and can be\r
- (re-)enabled.\r
-\r
-enable bpnumber [bpnumber ...]\r
- Enables the breakpoints specified.\r
-\r
-ignore bpnumber count\r
- Sets the ignore count for the given breakpoint number. If\r
- count is omitted, the ignore count is set to 0. A breakpoint\r
- becomes active when the ignore count is zero. When non-zero,\r
- the count is decremented each time the breakpoint is reached\r
- and the breakpoint is not disabled and any associated\r
- condition evaluates to true.\r
-\r
-condition bpnumber condition\r
- condition is an expression which must evaluate to true before\r
- the breakpoint is honored. If condition is absent, any\r
- existing condition is removed; i.e., the breakpoint is made\r
- unconditional.\r
-\r
-s(tep)\r
- Execute the current line, stop at the first possible occasion\r
- (either in a function that is called or in the current function).\r
-\r
-n(ext)\r
- Continue execution until the next line in the current function\r
- is reached or it returns.\r
-\r
-unt(il)\r
- Continue execution until the line with a number greater than the \r
- current one is reached or until the current frame returns.\r
-\r
-r(eturn)\r
- Continue execution until the current function returns.\r
-\r
-run [args...]\r
- Restart the debugged python program. If a string is supplied it is\r
- splitted with "shlex", and the result is used as the new sys.argv.\r
- History, breakpoints, actions and debugger options are preserved.\r
- "restart" is an alias for "run".\r
-\r
-c(ont(inue))\r
- Continue execution, only stop when a breakpoint is encountered.\r
-\r
-l(ist) [first [,last]]\r
- List source code for the current file.\r
- Without arguments, list 11 lines around the current line\r
- or continue the previous listing.\r
- With one argument, list 11 lines starting at that line.\r
- With two arguments, list the given range;\r
- if the second argument is less than the first, it is a count.\r
-\r
-a(rgs)\r
- Print the argument list of the current function.\r
-\r
-p expression\r
- Print the value of the expression.\r
-\r
-(!) statement\r
- Execute the (one-line) statement in the context of the current\r
- stack frame. The exclamation point can be omitted unless the\r
- first word of the statement resembles a debugger command. To\r
- assign to a global variable you must always prefix the command\r
- with a 'global' command, e.g.:\r
- (Pdb) global list_options; list_options = ['-l']\r
- (Pdb)\r
-\r
-\r
-whatis arg\r
- Prints the type of the argument.\r
-\r
-alias [name [command]]\r
- Creates an alias called 'name' that executes 'command'. The\r
- command must *not* be enclosed in quotes. Replaceable\r
- parameters can be indicated by %1, %2, and so on, while %* is\r
- replaced by all the parameters. If no command is given, the\r
- current alias for name is shown. If no name is given, all\r
- aliases are listed.\r
-\r
- Aliases may be nested and can contain anything that can be\r
- legally typed at the pdb prompt. Note! You *can* override\r
- internal pdb commands with aliases! Those internal commands\r
- are then hidden until the alias is removed. Aliasing is\r
- recursively applied to the first word of the command line; all\r
- other words in the line are left alone.\r
-\r
- As an example, here are two useful aliases (especially when\r
- placed in the .pdbrc file):\r
-\r
- #Print instance variables (usage "pi classInst")\r
- alias pi for k in %1.__dict__.keys(): print "%1.",k,"=",%1.__dict__[k]\r
- #Print instance variables in self\r
- alias ps pi self\r
- \r
-unalias name\r
- Deletes the specified alias.\r
-\r
-q(uit)\r
- Quit from the debugger.\r
- The program being executed is aborted.\r