Mercurial > cpython-lru_cache-weakref
annotate Lib/pdb.doc @ 80661:94de77bd0b4b 2.7
Issue #16194: document imp.load_dynamic problems
when read several extension modules from the same binary object file.
| author | Andrew Svetlov <andrew.svetlov@gmail.com> |
|---|---|
| date | Thu, 29 Nov 2012 19:51:28 +0200 |
| parents | 02842ecd8e5b |
| children |
| rev | line source |
|---|---|
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
1 The Python Debugger Pdb |
|
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
2 ======================= |
| 653 | 3 |
| 4 To use the debugger in its simplest form: | |
| 5 | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
6 >>> import pdb |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
7 >>> pdb.run('<a statement>') |
| 653 | 8 |
| 9 The debugger's prompt is '(Pdb) '. This will stop in the first | |
| 10 function call in <a statement>. | |
| 11 | |
|
1041
3dac204b74fa
Added post_mortem() and pm() interfaces to pdb and wdb.
Guido van Rossum <guido@python.org>
parents:
719
diff
changeset
|
12 Alternatively, if a statement terminated with an unhandled exception, |
|
3dac204b74fa
Added post_mortem() and pm() interfaces to pdb and wdb.
Guido van Rossum <guido@python.org>
parents:
719
diff
changeset
|
13 you can use pdb's post-mortem facility to inspect the contents of the |
|
3dac204b74fa
Added post_mortem() and pm() interfaces to pdb and wdb.
Guido van Rossum <guido@python.org>
parents:
719
diff
changeset
|
14 traceback: |
|
3dac204b74fa
Added post_mortem() and pm() interfaces to pdb and wdb.
Guido van Rossum <guido@python.org>
parents:
719
diff
changeset
|
15 |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
16 >>> <a statement> |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
17 <exception traceback> |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
18 >>> import pdb |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
19 >>> pdb.pm() |
|
1041
3dac204b74fa
Added post_mortem() and pm() interfaces to pdb and wdb.
Guido van Rossum <guido@python.org>
parents:
719
diff
changeset
|
20 |
| 653 | 21 The commands recognized by the debugger are listed in the next |
| 22 section. Most can be abbreviated as indicated; e.g., h(elp) means | |
| 23 that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel', | |
| 24 nor as 'H' or 'Help' or 'HELP'). Optional arguments are enclosed in | |
| 25 square brackets. | |
| 26 | |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
27 A blank line repeats the previous command literally, except for |
|
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
28 'list', where it lists the next 11 lines. |
| 653 | 29 |
| 30 Commands that the debugger doesn't recognize are assumed to be Python | |
| 31 statements and are executed in the context of the program being | |
| 32 debugged. Python statements can also be prefixed with an exclamation | |
| 33 point ('!'). This is a powerful way to inspect the program being | |
| 34 debugged; it is even possible to change variables. When an exception | |
| 35 occurs in such a statement, the exception name is printed but the | |
| 36 debugger's state is not changed. | |
| 37 | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
38 The debugger supports aliases, which can save typing. And aliases can |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
39 have parameters (see the alias help entry) which allows one a certain |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
40 level of adaptability to the context under examination. |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
41 |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
42 Multiple commands may be entered on a single line, separated by the |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
43 pair ';;'. No intelligence is applied to separating the commands; the |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
44 input is split at the first ';;', even if it is in the middle of a |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
45 quoted string. |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
46 |
|
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
47 If a file ".pdbrc" exists in your home directory or in the current |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
48 directory, it is read in and executed as if it had been typed at the |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
49 debugger prompt. This is particularly useful for aliases. If both |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
50 files exist, the one in the home directory is read first and aliases |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
51 defined there can be overriden by the local file. |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
52 |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
53 Aside from aliases, the debugger is not directly programmable; but it |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
54 is implemented as a class from which you can derive your own debugger |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
55 class, which you can make as fancy as you like. |
| 653 | 56 |
| 57 | |
| 58 Debugger commands | |
| 59 ================= | |
| 60 | |
| 61 h(elp) | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
62 Without argument, print the list of available commands. With |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
63 a command name as argument, print help about that command |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
64 (this is currently not implemented). |
| 653 | 65 |
| 66 w(here) | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
67 Print a stack trace, with the most recent frame at the bottom. |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
68 An arrow indicates the "current frame", which determines the |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
69 context of most commands. |
| 653 | 70 |
| 71 d(own) | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
72 Move the current frame one level down in the stack trace |
|
33130
8a282797895f
bug #989672: pdb.doc and the help messages for the help_d and help_u methods
Johannes Gijsbers <jlg@dds.nl>
parents:
9119
diff
changeset
|
73 (to a newer frame). |
| 653 | 74 |
| 75 u(p) | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
76 Move the current frame one level up in the stack trace |
|
33130
8a282797895f
bug #989672: pdb.doc and the help messages for the help_d and help_u methods
Johannes Gijsbers <jlg@dds.nl>
parents:
9119
diff
changeset
|
77 (to an older frame). |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
78 |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
79 b(reak) [ ([filename:]lineno | function) [, condition] ] |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
80 With a filename:line number argument, set a break there. If |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
81 filename is omitted, use the current file. With a function |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
82 name, set a break at the first executable line of that |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
83 function. Without argument, list all breaks. Each breakpoint |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
84 is assigned a number to which all the other breakpoint |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
85 commands refer. |
| 653 | 86 |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
87 The condition argument, if present, is a string which must |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
88 evaluate to true in order for the breakpoint to be honored. |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
89 |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
90 tbreak [ ([filename:]lineno | function) [, condition] ] |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
91 Temporary breakpoint, which is removed automatically when it |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
92 is first hit. The arguments are the same as break. |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
93 |
|
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
94 cl(ear) [bpnumber [bpnumber ...] ] |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
95 With a space separated list of breakpoint numbers, clear those |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
96 breakpoints. Without argument, clear all breaks (but first |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
97 ask confirmation). |
|
8691
35e1a140fe4e
Update the documentation. Get rid of the section "how it works"
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
98 |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
99 disable bpnumber [bpnumber ...] |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
100 Disables the breakpoints given as a space separated list of |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
101 breakpoint numbers. Disabling a breakpoint means it cannot |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
102 cause the program to stop execution, but unlike clearing a |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
103 breakpoint, it remains in the list of breakpoints and can be |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
104 (re-)enabled. |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
105 |
|
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
106 enable bpnumber [bpnumber ...] |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
107 Enables the breakpoints specified. |
| 653 | 108 |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
109 ignore bpnumber count |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
110 Sets the ignore count for the given breakpoint number. If |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
111 count is omitted, the ignore count is set to 0. A breakpoint |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
112 becomes active when the ignore count is zero. When non-zero, |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
113 the count is decremented each time the breakpoint is reached |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
114 and the breakpoint is not disabled and any associated |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
115 condition evaluates to true. |
| 653 | 116 |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
117 condition bpnumber condition |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
118 condition is an expression which must evaluate to true before |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
119 the breakpoint is honored. If condition is absent, any |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
120 existing condition is removed; i.e., the breakpoint is made |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
121 unconditional. |
|
8691
35e1a140fe4e
Update the documentation. Get rid of the section "how it works"
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
122 |
| 653 | 123 s(tep) |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
124 Execute the current line, stop at the first possible occasion |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
125 (either in a function that is called or in the current function). |
| 653 | 126 |
| 127 n(ext) | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
128 Continue execution until the next line in the current function |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
129 is reached or it returns. |
| 653 | 130 |
|
46882
a73e87f15ffa
Add the "until" command to pdb
Benjamin Peterson <benjamin@python.org>
parents:
41170
diff
changeset
|
131 unt(il) |
|
a73e87f15ffa
Add the "until" command to pdb
Benjamin Peterson <benjamin@python.org>
parents:
41170
diff
changeset
|
132 Continue execution until the line with a number greater than the |
|
46883
081f2a662634
Add some sentence endings.
Georg Brandl <georg@python.org>
parents:
46882
diff
changeset
|
133 current one is reached or until the current frame returns. |
|
46882
a73e87f15ffa
Add the "until" command to pdb
Benjamin Peterson <benjamin@python.org>
parents:
41170
diff
changeset
|
134 |
| 653 | 135 r(eturn) |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
136 Continue execution until the current function returns. |
| 653 | 137 |
|
41170
226d9fcf9d59
Patch #1393667: pdb now has a "run" command which restarts the debugged
Georg Brandl <georg@python.org>
parents:
33130
diff
changeset
|
138 run [args...] |
|
226d9fcf9d59
Patch #1393667: pdb now has a "run" command which restarts the debugged
Georg Brandl <georg@python.org>
parents:
33130
diff
changeset
|
139 Restart the debugged python program. If a string is supplied it is |
|
226d9fcf9d59
Patch #1393667: pdb now has a "run" command which restarts the debugged
Georg Brandl <georg@python.org>
parents:
33130
diff
changeset
|
140 splitted with "shlex", and the result is used as the new sys.argv. |
| 62539 | 141 History, breakpoints, actions and debugger options are preserved. |
| 142 "restart" is an alias for "run". | |
|
41170
226d9fcf9d59
Patch #1393667: pdb now has a "run" command which restarts the debugged
Georg Brandl <georg@python.org>
parents:
33130
diff
changeset
|
143 |
| 653 | 144 c(ont(inue)) |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
145 Continue execution, only stop when a breakpoint is encountered. |
| 653 | 146 |
| 147 l(ist) [first [,last]] | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
148 List source code for the current file. |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
149 Without arguments, list 11 lines around the current line |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
150 or continue the previous listing. |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
151 With one argument, list 11 lines starting at that line. |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
152 With two arguments, list the given range; |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
153 if the second argument is less than the first, it is a count. |
| 653 | 154 |
| 155 a(rgs) | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
156 Print the argument list of the current function. |
| 653 | 157 |
| 158 p expression | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
159 Print the value of the expression. |
| 653 | 160 |
| 161 (!) statement | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
162 Execute the (one-line) statement in the context of the current |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
163 stack frame. The exclamation point can be omitted unless the |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
164 first word of the statement resembles a debugger command. To |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
165 assign to a global variable you must always prefix the command |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
166 with a 'global' command, e.g.: |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
167 (Pdb) global list_options; list_options = ['-l'] |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
168 (Pdb) |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
169 |
|
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
170 |
|
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
171 whatis arg |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
172 Prints the type of the argument. |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
173 |
|
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
174 alias [name [command]] |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
175 Creates an alias called 'name' that executes 'command'. The |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
176 command must *not* be enclosed in quotes. Replaceable |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
177 parameters can be indicated by %1, %2, and so on, while %* is |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
178 replaced by all the parameters. If no command is given, the |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
179 current alias for name is shown. If no name is given, all |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
180 aliases are listed. |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
181 |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
182 Aliases may be nested and can contain anything that can be |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
183 legally typed at the pdb prompt. Note! You *can* override |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
184 internal pdb commands with aliases! Those internal commands |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
185 are then hidden until the alias is removed. Aliasing is |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
186 recursively applied to the first word of the command line; all |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
187 other words in the line are left alone. |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
188 |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
189 As an example, here are two useful aliases (especially when |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
190 placed in the .pdbrc file): |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
191 |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
192 #Print instance variables (usage "pi classInst") |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
193 alias pi for k in %1.__dict__.keys(): print "%1.",k,"=",%1.__dict__[k] |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
194 #Print instance variables in self |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
195 alias ps pi self |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
196 |
|
9092
2e07f1b298e1
Richard Wolff's changes:
Guido van Rossum <guido@python.org>
parents:
8692
diff
changeset
|
197 unalias name |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
198 Deletes the specified alias. |
| 653 | 199 |
| 200 q(uit) | |
|
9119
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
201 Quit from the debugger. |
|
4486862d5cbd
Untabified and applied Richard Wolff's changes (plus my own reflowing
Guido van Rossum <guido@python.org>
parents:
9092
diff
changeset
|
202 The program being executed is aborted. |
