@@ -20,20 +20,21 @@ The following exception is defined:
2020
2121The :mod: `bdb ` module also defines two classes:
2222
23- .. class :: Breakpoint(self, file, line, temporary=0 , cond=None, funcname=None)
23+ .. class :: Breakpoint(self, file, line, temporary=False , cond=None, funcname=None)
2424
2525 This class implements temporary breakpoints, ignore counts, disabling and
2626 (re-)enabling, and conditionals.
2727
2828 Breakpoints are indexed by number through a list called :attr: `bpbynumber `
29- and by ``(file, line) `` pairs through :attr: `bplist `. The former points to a
30- single instance of class :class: `Breakpoint `. The latter points to a list of
31- such instances since there may be more than one breakpoint per line.
29+ and by ``(file, line) `` pairs through :attr: `bplist `. The former points to
30+ a single instance of class :class: `Breakpoint `. The latter points to a list
31+ of such instances since there may be more than one breakpoint per line.
3232
33- When creating a breakpoint, its associated filename should be in canonical
34- form. If a *funcname * is defined, a breakpoint hit will be counted when the
35- first line of that function is executed. A conditional breakpoint always
36- counts a hit.
33+ When creating a breakpoint, its associated :attr: `file name <file> ` should
34+ be in canonical form. If a :attr: `funcname ` is defined, a breakpoint
35+ :attr: `hit <hits> ` will be counted when the first line of that function is
36+ executed. A :attr: `conditional <cond> ` breakpoint always counts a
37+ :attr: `hit <hits> `.
3738
3839 :class: `Breakpoint ` instances have the following methods:
3940
@@ -59,12 +60,12 @@ The :mod:`bdb` module also defines two classes:
5960 Return a string with all the information about the breakpoint, nicely
6061 formatted:
6162
62- * The breakpoint number.
63- * If it is temporary or not .
64- * Its file, line position.
65- * The condition that causes a break .
66- * If it must be ignored the next N times .
67- * The breakpoint hit count .
63+ * Breakpoint number.
64+ * Temporary status (del or keep) .
65+ * File/ line position.
66+ * Break condition.
67+ * Number of times to ignore .
68+ * Number of times hit .
6869
6970 .. versionadded :: 3.2
7071
@@ -73,6 +74,49 @@ The :mod:`bdb` module also defines two classes:
7374 Print the output of :meth: `bpformat ` to the file *out *, or if it is
7475 ``None ``, to standard output.
7576
77+ :class: `Breakpoint ` instances have the following attributes:
78+
79+ .. attribute :: file
80+
81+ File name of the :class: `Breakpoint `.
82+
83+ .. attribute :: line
84+
85+ Line number of the :class: `Breakpoint ` within :attr: `file `.
86+
87+ .. attribute :: temporary
88+
89+ True if a :class: `Breakpoint ` at (file, line) is temporary.
90+
91+ .. attribute :: cond
92+
93+ Condition for evaluating a :class: `Breakpoint ` at (file, line).
94+
95+ .. attribute :: funcname
96+
97+ Function name that defines whether a :class: `Breakpoint ` is hit upon
98+ entering the function.
99+
100+ .. attribute :: enabled
101+
102+ True if :class: `Breakpoint ` is enabled.
103+
104+ .. attribute :: bpbynumber
105+
106+ Numeric index for a single instance of a :class: `Breakpoint `.
107+
108+ .. attribute :: bplist
109+
110+ Dictionary of :class: `Breakpoint ` instances indexed by
111+ (:attr: `file `, :attr: `line `) tuples.
112+
113+ .. attribute :: ignore
114+
115+ Number of times to ignore a :class: `Breakpoint `.
116+
117+ .. attribute :: hits
118+
119+ Count of the number of times a :class: `Breakpoint ` has been hit.
76120
77121.. class :: Bdb(skip=None)
78122
@@ -95,9 +139,12 @@ The :mod:`bdb` module also defines two classes:
95139
96140 .. method :: canonic(filename)
97141
98- Auxiliary method for getting a filename in a canonical form, that is, as a
99- case-normalized (on case-insensitive filesystems) absolute path, stripped
100- of surrounding angle brackets.
142+ Return canonical form of *filename *.
143+
144+ For real file names, the canonical form is an operating-system-dependent,
145+ :func: `case-normalized <os.path.normcase> ` :func: `absolute path
146+ <os.path.abspath> `. A *filename * with angle brackets, such as `"<stdin>" `
147+ generated in interactive mode, is returned unchanged.
101148
102149 .. method :: reset()
103150
@@ -166,45 +213,46 @@ The :mod:`bdb` module also defines two classes:
166213 Normally derived classes don't override the following methods, but they may
167214 if they want to redefine the definition of stopping and breakpoints.
168215
216+ .. method :: is_skipped_line(module_name)
217+
218+ Return True if *module_name * matches any skip pattern.
219+
169220 .. method :: stop_here(frame)
170221
171- This method checks if the *frame * is somewhere below :attr: `botframe ` in
172- the call stack. :attr: `botframe ` is the frame in which debugging started.
222+ Return True if *frame * is below the starting frame in the stack.
173223
174224 .. method :: break_here(frame)
175225
176- This method checks if there is a breakpoint in the filename and line
177- belonging to *frame * or, at least, in the current function. If the
178- breakpoint is a temporary one, this method deletes it.
226+ Return True if there is an effective breakpoint for this line.
227+
228+ Check whether a line or function breakpoint exists and is in effect. Delete temporary
229+ breakpoints based on information from :func: `effective `.
179230
180231 .. method :: break_anywhere(frame)
181232
182- This method checks if there is a breakpoint in the filename of the current
183- frame.
233+ Return True if any breakpoint exists for *frame *'s filename.
184234
185235 Derived classes should override these methods to gain control over debugger
186236 operation.
187237
188238 .. method :: user_call(frame, argument_list)
189239
190- This method is called from :meth: `dispatch_call ` when there is the
191- possibility that a break might be necessary anywhere inside the called
192- function.
240+ Called from :meth: `dispatch_call ` if a break might stop inside the
241+ called function.
193242
194243 .. method :: user_line(frame)
195244
196- This method is called from :meth: `dispatch_line ` when either
197- :meth: `stop_here ` or :meth: ` break_here ` yields ``True ``.
245+ Called from :meth: `dispatch_line ` when either :meth: ` stop_here ` or
246+ :meth: `break_here ` returns ``True ``.
198247
199248 .. method :: user_return(frame, return_value)
200249
201- This method is called from :meth: `dispatch_return ` when :meth: `stop_here `
202- yields ``True ``.
250+ Called from :meth: `dispatch_return ` when :meth: `stop_here ` returns ``True ``.
203251
204252 .. method :: user_exception(frame, exc_info)
205253
206- This method is called from :meth: `dispatch_exception ` when
207- :meth: ` stop_here ` yields ``True ``.
254+ Called from :meth: `dispatch_exception ` when :meth: ` stop_here `
255+ returns ``True ``.
208256
209257 .. method :: do_clear(arg)
210258
@@ -228,9 +276,9 @@ The :mod:`bdb` module also defines two classes:
228276
229277 Stop when returning from the given frame.
230278
231- .. method :: set_until(frame)
279+ .. method :: set_until(frame, lineno=None )
232280
233- Stop when the line with the line no greater than the current one is
281+ Stop when the line with the * lineno * greater than the current one is
234282 reached or when returning from current frame.
235283
236284 .. method :: set_trace([frame])
@@ -253,16 +301,16 @@ The :mod:`bdb` module also defines two classes:
253301 breakpoints. These methods return a string containing an error message if
254302 something went wrong, or ``None `` if all is well.
255303
256- .. method :: set_break(filename, lineno, temporary=0 , cond, funcname)
304+ .. method :: set_break(filename, lineno, temporary=False , cond=None , funcname=None )
257305
258306 Set a new breakpoint. If the *lineno * line doesn't exist for the
259307 *filename * passed as argument, return an error message. The *filename *
260308 should be in canonical form, as described in the :meth: `canonic ` method.
261309
262310 .. method :: clear_break(filename, lineno)
263311
264- Delete the breakpoints in *filename * and *lineno *. If none were set, an
265- error message is returned .
312+ Delete the breakpoints in *filename * and *lineno *. If none were set,
313+ return an error message .
266314
267315 .. method :: clear_bpbynumber(arg)
268316
@@ -272,12 +320,13 @@ The :mod:`bdb` module also defines two classes:
272320
273321 .. method :: clear_all_file_breaks(filename)
274322
275- Delete all breakpoints in *filename *. If none were set, an error message
276- is returned .
323+ Delete all breakpoints in *filename *. If none were set, return an error
324+ message .
277325
278326 .. method :: clear_all_breaks()
279327
280- Delete all existing breakpoints.
328+ Delete all existing breakpoints. If none were set, return an error
329+ message.
281330
282331 .. method :: get_bpbynumber(arg)
283332
@@ -290,7 +339,7 @@ The :mod:`bdb` module also defines two classes:
290339
291340 .. method :: get_break(filename, lineno)
292341
293- Check if there is a breakpoint for *lineno * of *filename *.
342+ Return True if there is a breakpoint for *lineno * in *filename *.
294343
295344 .. method :: get_breaks(filename, lineno)
296345
@@ -311,16 +360,18 @@ The :mod:`bdb` module also defines two classes:
311360
312361 .. method :: get_stack(f, t)
313362
314- Get a list of records for a frame and all higher (calling) and lower
315- frames, and the size of the higher part.
363+ Return a list of (frame, lineno) tuples in a stack trace, and a size.
364+
365+ The most recently called frame is last in the list. The size is the number
366+ of frames below the frame where the debugger was invoked.
316367
317368 .. method :: format_stack_entry(frame_lineno, lprefix=': ')
318369
319- Return a string with information about a stack entry, identified by a
320- ``(frame, lineno) `` tuple:
370+ Return a string with information about a stack entry, which is a
371+ ``(frame, lineno) `` tuple. The return string contains :
321372
322- * The canonical form of the filename which contains the frame.
323- * The function name, or ``"<lambda>" ``.
373+ * The canonical filename which contains the frame.
374+ * The function name or ``"<lambda>" ``.
324375 * The input arguments.
325376 * The return value.
326377 * The line of code (if it exists).
@@ -352,20 +403,34 @@ Finally, the module defines the following functions:
352403
353404.. function :: checkfuncname(b, frame)
354405
355- Check whether we should break here, depending on the way the breakpoint * b *
356- was set.
406+ Return True if we should break here, depending on the way the
407+ :class: ` Breakpoint ` * b * was set.
357408
358- If it was set via line number, it checks if ``b.line `` is the same as the one
359- in the frame also passed as argument. If the breakpoint was set via function
360- name, we have to check we are in the right frame (the right function) and if
361- we are in its first executable line.
409+ If it was set via line number, it checks if
410+ :attr: `b.line <bdb.Breakpoint.line> ` is the same as the one in *frame *.
411+ If the breakpoint was set via
412+ :attr: `function name <bdb.Breakpoint.funcname> `, we have to check we are in
413+ the right *frame * (the right function) and if we are on its first executable
414+ line.
362415
363416.. function :: effective(file, line, frame)
364417
365- Determine if there is an effective (active) breakpoint at this line of code.
366- Return a tuple of the breakpoint and a boolean that indicates if it is ok
367- to delete a temporary breakpoint. Return ``(None, None) `` if there is no
368- matching breakpoint.
418+ Return ``(active breakpoint, delete temporary flag) `` or ``(None, None) `` as the
419+ breakpoint to act upon.
420+
421+ The *active breakpoint * is the first entry in
422+ :attr: `bplist <bdb.Breakpoint.bplist> ` for the
423+ (:attr: `file <bdb.Breakpoint.file> `, :attr: `line <bdb.Breakpoint.line> `)
424+ (which must exist) that is :attr: `enabled <bdb.Breakpoint.enabled> `, for
425+ which :func: `checkfuncname ` is True, and that has neither a False
426+ :attr: `condition <bdb.Breakpoint.cond> ` nor positive
427+ :attr: `ignore <bdb.Breakpoint.ignore> ` count. The *flag *, meaning that a
428+ temporary breakpoint should be deleted, is False only when the
429+ :attr: `cond <bdb.Breakpoint.cond> ` cannot be evaluated (in which case,
430+ :attr: `ignore <bdb.Breakpoint.ignore> ` count is ignored).
431+
432+ If no such entry exists, then (None, None) is returned.
433+
369434
370435.. function :: set_trace()
371436
0 commit comments