blob: 3d7e41b246ebf957dea3a13c54b057fccc7620de [file] [log] [blame]
Christian Heimesd8654cf2007-12-02 15:22:16 +00001:mod:`bdb` --- Debugger framework
2=================================
3
4.. module:: bdb
5 :synopsis: Debugger framework.
6
7The :mod:`bdb` module handles basic debugger functions, like setting breakpoints
8or managing execution via the debugger.
9
10The following exception is defined:
11
12.. exception:: BdbQuit
13
14 Exception raised by the :class:`Bdb` class for quitting the debugger.
15
16
17The :mod:`bdb` module also defines two classes:
18
Georg Brandlb868a662009-04-02 02:56:10 +000019.. class:: Breakpoint(self, file, line, temporary=0, cond=None, funcname=None)
Christian Heimesd8654cf2007-12-02 15:22:16 +000020
21 This class implements temporary breakpoints, ignore counts, disabling and
22 (re-)enabling, and conditionals.
23
24 Breakpoints are indexed by number through a list called :attr:`bpbynumber`
25 and by ``(file, line)`` pairs through :attr:`bplist`. The former points to a
26 single instance of class :class:`Breakpoint`. The latter points to a list of
27 such instances since there may be more than one breakpoint per line.
28
29 When creating a breakpoint, its associated filename should be in canonical
30 form. If a *funcname* is defined, a breakpoint hit will be counted when the
31 first line of that function is executed. A conditional breakpoint always
32 counts a hit.
33
Benjamin Petersone41251e2008-04-25 01:59:09 +000034 :class:`Breakpoint` instances have the following methods:
Christian Heimesd8654cf2007-12-02 15:22:16 +000035
Benjamin Petersone41251e2008-04-25 01:59:09 +000036 .. method:: deleteMe()
Christian Heimesd8654cf2007-12-02 15:22:16 +000037
Benjamin Petersone41251e2008-04-25 01:59:09 +000038 Delete the breakpoint from the list associated to a file/line. If it is
39 the last breakpoint in that position, it also deletes the entry for the
40 file/line.
Christian Heimesd8654cf2007-12-02 15:22:16 +000041
Christian Heimesd8654cf2007-12-02 15:22:16 +000042
Benjamin Petersone41251e2008-04-25 01:59:09 +000043 .. method:: enable()
Christian Heimesd8654cf2007-12-02 15:22:16 +000044
Benjamin Petersone41251e2008-04-25 01:59:09 +000045 Mark the breakpoint as enabled.
Christian Heimesd8654cf2007-12-02 15:22:16 +000046
Christian Heimesd8654cf2007-12-02 15:22:16 +000047
Benjamin Petersone41251e2008-04-25 01:59:09 +000048 .. method:: disable()
Christian Heimesd8654cf2007-12-02 15:22:16 +000049
Benjamin Petersone41251e2008-04-25 01:59:09 +000050 Mark the breakpoint as disabled.
Christian Heimesd8654cf2007-12-02 15:22:16 +000051
Benjamin Petersone41251e2008-04-25 01:59:09 +000052
Georg Brandlb868a662009-04-02 02:56:10 +000053 .. method:: bpprint(out=None)
Benjamin Petersone41251e2008-04-25 01:59:09 +000054
55 Print all the information about the breakpoint:
56
57 * The breakpoint number.
58 * If it is temporary or not.
59 * Its file,line position.
60 * The condition that causes a break.
61 * If it must be ignored the next N times.
62 * The breakpoint hit count.
Christian Heimesd8654cf2007-12-02 15:22:16 +000063
64
Benjamin Peterson8f6713f2009-11-13 02:29:35 +000065.. class:: Bdb(skip=None)
Christian Heimesd8654cf2007-12-02 15:22:16 +000066
Benjamin Peterson8f6713f2009-11-13 02:29:35 +000067 The :class:`Bdb` class acts as a generic Python debugger base class.
Christian Heimesd8654cf2007-12-02 15:22:16 +000068
69 This class takes care of the details of the trace facility; a derived class
70 should implement user interaction. The standard debugger class
71 (:class:`pdb.Pdb`) is an example.
72
Benjamin Peterson8f6713f2009-11-13 02:29:35 +000073 The *skip* argument, if given, must be an iterable of glob-style
74 module name patterns. The debugger will not step into frames that
75 originate in a module that matches one of these patterns. Whether a
76 frame is considered to originate in a certain module is determined
77 by the ``__name__`` in the frame globals.
78
Ezio Melotti3e1096d2010-01-27 22:53:48 +000079 .. versionadded:: 3.1
Benjamin Peterson8f6713f2009-11-13 02:29:35 +000080 The *skip* argument.
Christian Heimesd8654cf2007-12-02 15:22:16 +000081
Benjamin Petersone41251e2008-04-25 01:59:09 +000082 The following methods of :class:`Bdb` normally don't need to be overridden.
Christian Heimesd8654cf2007-12-02 15:22:16 +000083
Benjamin Petersone41251e2008-04-25 01:59:09 +000084 .. method:: canonic(filename)
Christian Heimesd8654cf2007-12-02 15:22:16 +000085
Benjamin Petersone41251e2008-04-25 01:59:09 +000086 Auxiliary method for getting a filename in a canonical form, that is, as a
87 case-normalized (on case-insensitive filesystems) absolute path, stripped
88 of surrounding angle brackets.
Christian Heimesd8654cf2007-12-02 15:22:16 +000089
Benjamin Petersone41251e2008-04-25 01:59:09 +000090 .. method:: reset()
Christian Heimesd8654cf2007-12-02 15:22:16 +000091
Benjamin Petersone41251e2008-04-25 01:59:09 +000092 Set the :attr:`botframe`, :attr:`stopframe`, :attr:`returnframe` and
93 :attr:`quitting` attributes with values ready to start debugging.
Christian Heimesd8654cf2007-12-02 15:22:16 +000094
Benjamin Petersone41251e2008-04-25 01:59:09 +000095 .. method:: trace_dispatch(frame, event, arg)
Christian Heimesd8654cf2007-12-02 15:22:16 +000096
Benjamin Petersone41251e2008-04-25 01:59:09 +000097 This function is installed as the trace function of debugged frames. Its
98 return value is the new trace function (in most cases, that is, itself).
Christian Heimesd8654cf2007-12-02 15:22:16 +000099
Benjamin Petersone41251e2008-04-25 01:59:09 +0000100 The default implementation decides how to dispatch a frame, depending on
101 the type of event (passed as a string) that is about to be executed.
102 *event* can be one of the following:
Christian Heimesd8654cf2007-12-02 15:22:16 +0000103
Benjamin Petersone41251e2008-04-25 01:59:09 +0000104 * ``"line"``: A new line of code is going to be executed.
105 * ``"call"``: A function is about to be called, or another code block
106 entered.
107 * ``"return"``: A function or other code block is about to return.
108 * ``"exception"``: An exception has occurred.
109 * ``"c_call"``: A C function is about to be called.
110 * ``"c_return"``: A C function has returned.
111 * ``"c_exception"``: A C function has thrown an exception.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000112
Benjamin Petersone41251e2008-04-25 01:59:09 +0000113 For the Python events, specialized functions (see below) are called. For
114 the C events, no action is taken.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000115
Benjamin Petersone41251e2008-04-25 01:59:09 +0000116 The *arg* parameter depends on the previous event.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000117
Benjamin Peterson4469d0c2008-11-30 22:46:23 +0000118 See the documentation for :func:`sys.settrace` for more information on the
119 trace function. For more information on code and frame objects, refer to
120 :ref:`types`.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000121
Benjamin Petersone41251e2008-04-25 01:59:09 +0000122 .. method:: dispatch_line(frame)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000123
Benjamin Petersone41251e2008-04-25 01:59:09 +0000124 If the debugger should stop on the current line, invoke the
125 :meth:`user_line` method (which should be overridden in subclasses).
126 Raise a :exc:`BdbQuit` exception if the :attr:`Bdb.quitting` flag is set
127 (which can be set from :meth:`user_line`). Return a reference to the
128 :meth:`trace_dispatch` method for further tracing in that scope.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000129
Benjamin Petersone41251e2008-04-25 01:59:09 +0000130 .. method:: dispatch_call(frame, arg)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000131
Benjamin Petersone41251e2008-04-25 01:59:09 +0000132 If the debugger should stop on this function call, invoke the
133 :meth:`user_call` method (which should be overridden in subclasses).
134 Raise a :exc:`BdbQuit` exception if the :attr:`Bdb.quitting` flag is set
135 (which can be set from :meth:`user_call`). Return a reference to the
136 :meth:`trace_dispatch` method for further tracing in that scope.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000137
Benjamin Petersone41251e2008-04-25 01:59:09 +0000138 .. method:: dispatch_return(frame, arg)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000139
Benjamin Petersone41251e2008-04-25 01:59:09 +0000140 If the debugger should stop on this function return, invoke the
141 :meth:`user_return` method (which should be overridden in subclasses).
142 Raise a :exc:`BdbQuit` exception if the :attr:`Bdb.quitting` flag is set
143 (which can be set from :meth:`user_return`). Return a reference to the
144 :meth:`trace_dispatch` method for further tracing in that scope.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000145
Benjamin Petersone41251e2008-04-25 01:59:09 +0000146 .. method:: dispatch_exception(frame, arg)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000147
Benjamin Petersone41251e2008-04-25 01:59:09 +0000148 If the debugger should stop at this exception, invokes the
149 :meth:`user_exception` method (which should be overridden in subclasses).
150 Raise a :exc:`BdbQuit` exception if the :attr:`Bdb.quitting` flag is set
151 (which can be set from :meth:`user_exception`). Return a reference to the
152 :meth:`trace_dispatch` method for further tracing in that scope.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000153
Benjamin Petersone41251e2008-04-25 01:59:09 +0000154 Normally derived classes don't override the following methods, but they may
155 if they want to redefine the definition of stopping and breakpoints.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000156
Benjamin Petersone41251e2008-04-25 01:59:09 +0000157 .. method:: stop_here(frame)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000158
Benjamin Petersone41251e2008-04-25 01:59:09 +0000159 This method checks if the *frame* is somewhere below :attr:`botframe` in
160 the call stack. :attr:`botframe` is the frame in which debugging started.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000161
Benjamin Petersone41251e2008-04-25 01:59:09 +0000162 .. method:: break_here(frame)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000163
Benjamin Petersone41251e2008-04-25 01:59:09 +0000164 This method checks if there is a breakpoint in the filename and line
165 belonging to *frame* or, at least, in the current function. If the
166 breakpoint is a temporary one, this method deletes it.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000167
Benjamin Petersone41251e2008-04-25 01:59:09 +0000168 .. method:: break_anywhere(frame)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000169
Benjamin Petersone41251e2008-04-25 01:59:09 +0000170 This method checks if there is a breakpoint in the filename of the current
171 frame.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000172
Benjamin Petersone41251e2008-04-25 01:59:09 +0000173 Derived classes should override these methods to gain control over debugger
174 operation.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000175
Benjamin Petersone41251e2008-04-25 01:59:09 +0000176 .. method:: user_call(frame, argument_list)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000177
Benjamin Petersone41251e2008-04-25 01:59:09 +0000178 This method is called from :meth:`dispatch_call` when there is the
179 possibility that a break might be necessary anywhere inside the called
180 function.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000181
Benjamin Petersone41251e2008-04-25 01:59:09 +0000182 .. method:: user_line(frame)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000183
Benjamin Petersone41251e2008-04-25 01:59:09 +0000184 This method is called from :meth:`dispatch_line` when either
185 :meth:`stop_here` or :meth:`break_here` yields True.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000186
Benjamin Petersone41251e2008-04-25 01:59:09 +0000187 .. method:: user_return(frame, return_value)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000188
Benjamin Petersone41251e2008-04-25 01:59:09 +0000189 This method is called from :meth:`dispatch_return` when :meth:`stop_here`
190 yields True.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000191
Benjamin Petersone41251e2008-04-25 01:59:09 +0000192 .. method:: user_exception(frame, exc_info)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000193
Benjamin Petersone41251e2008-04-25 01:59:09 +0000194 This method is called from :meth:`dispatch_exception` when
195 :meth:`stop_here` yields True.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000196
Benjamin Petersone41251e2008-04-25 01:59:09 +0000197 .. method:: do_clear(arg)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000198
Benjamin Petersone41251e2008-04-25 01:59:09 +0000199 Handle how a breakpoint must be removed when it is a temporary one.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000200
Benjamin Petersone41251e2008-04-25 01:59:09 +0000201 This method must be implemented by derived classes.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000202
203
Benjamin Petersone41251e2008-04-25 01:59:09 +0000204 Derived classes and clients can call the following methods to affect the
205 stepping state.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000206
Benjamin Petersone41251e2008-04-25 01:59:09 +0000207 .. method:: set_step()
Christian Heimesd8654cf2007-12-02 15:22:16 +0000208
Benjamin Petersone41251e2008-04-25 01:59:09 +0000209 Stop after one line of code.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000210
Benjamin Petersone41251e2008-04-25 01:59:09 +0000211 .. method:: set_next(frame)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000212
Benjamin Petersone41251e2008-04-25 01:59:09 +0000213 Stop on the next line in or below the given frame.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000214
Benjamin Petersone41251e2008-04-25 01:59:09 +0000215 .. method:: set_return(frame)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000216
Benjamin Petersone41251e2008-04-25 01:59:09 +0000217 Stop when returning from the given frame.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000218
Alexandre Vassalotti5f8ced22008-05-16 00:03:33 +0000219 .. method:: set_until(frame)
220
221 Stop when the line with the line no greater than the current one is
222 reached or when returning from current frame
223
Benjamin Petersone41251e2008-04-25 01:59:09 +0000224 .. method:: set_trace([frame])
Christian Heimesd8654cf2007-12-02 15:22:16 +0000225
Benjamin Petersone41251e2008-04-25 01:59:09 +0000226 Start debugging from *frame*. If *frame* is not specified, debugging
227 starts from caller's frame.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000228
Benjamin Petersone41251e2008-04-25 01:59:09 +0000229 .. method:: set_continue()
Christian Heimesd8654cf2007-12-02 15:22:16 +0000230
Benjamin Petersone41251e2008-04-25 01:59:09 +0000231 Stop only at breakpoints or when finished. If there are no breakpoints,
232 set the system trace function to None.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000233
Benjamin Petersone41251e2008-04-25 01:59:09 +0000234 .. method:: set_quit()
Christian Heimesd8654cf2007-12-02 15:22:16 +0000235
Benjamin Petersone41251e2008-04-25 01:59:09 +0000236 Set the :attr:`quitting` attribute to True. This raises :exc:`BdbQuit` in
237 the next call to one of the :meth:`dispatch_\*` methods.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000238
239
Benjamin Petersone41251e2008-04-25 01:59:09 +0000240 Derived classes and clients can call the following methods to manipulate
241 breakpoints. These methods return a string containing an error message if
242 something went wrong, or ``None`` if all is well.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000243
Georg Brandlb868a662009-04-02 02:56:10 +0000244 .. method:: set_break(filename, lineno, temporary=0, cond, funcname)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000245
Benjamin Petersone41251e2008-04-25 01:59:09 +0000246 Set a new breakpoint. If the *lineno* line doesn't exist for the
247 *filename* passed as argument, return an error message. The *filename*
248 should be in canonical form, as described in the :meth:`canonic` method.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000249
Benjamin Petersone41251e2008-04-25 01:59:09 +0000250 .. method:: clear_break(filename, lineno)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000251
Benjamin Petersone41251e2008-04-25 01:59:09 +0000252 Delete the breakpoints in *filename* and *lineno*. If none were set, an
253 error message is returned.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000254
Benjamin Petersone41251e2008-04-25 01:59:09 +0000255 .. method:: clear_bpbynumber(arg)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000256
Benjamin Petersone41251e2008-04-25 01:59:09 +0000257 Delete the breakpoint which has the index *arg* in the
258 :attr:`Breakpoint.bpbynumber`. If *arg* is not numeric or out of range,
259 return an error message.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000260
Benjamin Petersone41251e2008-04-25 01:59:09 +0000261 .. method:: clear_all_file_breaks(filename)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000262
Benjamin Petersone41251e2008-04-25 01:59:09 +0000263 Delete all breakpoints in *filename*. If none were set, an error message
264 is returned.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000265
Benjamin Petersone41251e2008-04-25 01:59:09 +0000266 .. method:: clear_all_breaks()
Christian Heimesd8654cf2007-12-02 15:22:16 +0000267
Benjamin Petersone41251e2008-04-25 01:59:09 +0000268 Delete all existing breakpoints.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000269
Benjamin Petersone41251e2008-04-25 01:59:09 +0000270 .. method:: get_break(filename, lineno)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000271
Benjamin Petersone41251e2008-04-25 01:59:09 +0000272 Check if there is a breakpoint for *lineno* of *filename*.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000273
Benjamin Petersone41251e2008-04-25 01:59:09 +0000274 .. method:: get_breaks(filename, lineno)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000275
Benjamin Petersone41251e2008-04-25 01:59:09 +0000276 Return all breakpoints for *lineno* in *filename*, or an empty list if
277 none are set.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000278
Benjamin Petersone41251e2008-04-25 01:59:09 +0000279 .. method:: get_file_breaks(filename)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000280
Benjamin Petersone41251e2008-04-25 01:59:09 +0000281 Return all breakpoints in *filename*, or an empty list if none are set.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000282
Benjamin Petersone41251e2008-04-25 01:59:09 +0000283 .. method:: get_all_breaks()
Christian Heimesd8654cf2007-12-02 15:22:16 +0000284
Benjamin Petersone41251e2008-04-25 01:59:09 +0000285 Return all breakpoints that are set.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000286
287
Benjamin Petersone41251e2008-04-25 01:59:09 +0000288 Derived classes and clients can call the following methods to get a data
289 structure representing a stack trace.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000290
Benjamin Petersone41251e2008-04-25 01:59:09 +0000291 .. method:: get_stack(f, t)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000292
Benjamin Petersone41251e2008-04-25 01:59:09 +0000293 Get a list of records for a frame and all higher (calling) and lower
294 frames, and the size of the higher part.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000295
Georg Brandlb868a662009-04-02 02:56:10 +0000296 .. method:: format_stack_entry(frame_lineno, lprefix=': ')
Christian Heimesd8654cf2007-12-02 15:22:16 +0000297
Benjamin Petersone41251e2008-04-25 01:59:09 +0000298 Return a string with information about a stack entry, identified by a
299 ``(frame, lineno)`` tuple:
Christian Heimesd8654cf2007-12-02 15:22:16 +0000300
Benjamin Petersone41251e2008-04-25 01:59:09 +0000301 * The canonical form of the filename which contains the frame.
302 * The function name, or ``"<lambda>"``.
303 * The input arguments.
304 * The return value.
305 * The line of code (if it exists).
Christian Heimesd8654cf2007-12-02 15:22:16 +0000306
307
Benjamin Petersone41251e2008-04-25 01:59:09 +0000308 The following two methods can be called by clients to use a debugger to debug
309 a :term:`statement`, given as a string.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000310
Georg Brandlb868a662009-04-02 02:56:10 +0000311 .. method:: run(cmd, globals=None, locals=None)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000312
Benjamin Petersone41251e2008-04-25 01:59:09 +0000313 Debug a statement executed via the :func:`exec` function. *globals*
314 defaults to :attr:`__main__.__dict__`, *locals* defaults to *globals*.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000315
Georg Brandlb868a662009-04-02 02:56:10 +0000316 .. method:: runeval(expr, globals=None, locals=None)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000317
Benjamin Petersone41251e2008-04-25 01:59:09 +0000318 Debug an expression executed via the :func:`eval` function. *globals* and
319 *locals* have the same meaning as in :meth:`run`.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000320
Benjamin Petersone41251e2008-04-25 01:59:09 +0000321 .. method:: runctx(cmd, globals, locals)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000322
Benjamin Petersone41251e2008-04-25 01:59:09 +0000323 For backwards compatibility. Calls the :meth:`run` method.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000324
Benjamin Petersone41251e2008-04-25 01:59:09 +0000325 .. method:: runcall(func, *args, **kwds)
Christian Heimesd8654cf2007-12-02 15:22:16 +0000326
Benjamin Petersone41251e2008-04-25 01:59:09 +0000327 Debug a single function call, and return its result.
Christian Heimesd8654cf2007-12-02 15:22:16 +0000328
329
330Finally, the module defines the following functions:
331
332.. function:: checkfuncname(b, frame)
333
334 Check whether we should break here, depending on the way the breakpoint *b*
335 was set.
Georg Brandl48310cd2009-01-03 21:18:54 +0000336
Christian Heimesd8654cf2007-12-02 15:22:16 +0000337 If it was set via line number, it checks if ``b.line`` is the same as the one
338 in the frame also passed as argument. If the breakpoint was set via function
339 name, we have to check we are in the right frame (the right function) and if
340 we are in its first executable line.
341
342.. function:: effective(file, line, frame)
343
344 Determine if there is an effective (active) breakpoint at this line of code.
345 Return breakpoint number or 0 if none.
Georg Brandl06788c92009-01-03 21:31:47 +0000346
Christian Heimesd8654cf2007-12-02 15:22:16 +0000347 Called only if we know there is a breakpoint at this location. Returns the
348 breakpoint that was triggered and a flag that indicates if it is ok to delete
349 a temporary breakpoint.
350
351.. function:: set_trace()
352
353 Starts debugging with a :class:`Bdb` instance from caller's frame.