|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.DebugClients.Python.DebugBase</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body> |
|
22 <a NAME="top" ID="top"></a> |
|
23 <h1>eric7.DebugClients.Python.DebugBase</h1> |
|
24 |
|
25 <p> |
|
26 Module implementing the debug base class which based originally on bdb. |
|
27 </p> |
|
28 <h3>Global Attributes</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>gRecursionLimit</td></tr> |
|
32 </table> |
|
33 <h3>Classes</h3> |
|
34 |
|
35 <table> |
|
36 |
|
37 <tr> |
|
38 <td><a href="#DebugBase">DebugBase</a></td> |
|
39 <td>Class implementing base class of the debugger.</td> |
|
40 </tr> |
|
41 </table> |
|
42 <h3>Functions</h3> |
|
43 |
|
44 <table> |
|
45 |
|
46 <tr> |
|
47 <td><a href="#printerr">printerr</a></td> |
|
48 <td>Module function used for debugging the debug client.</td> |
|
49 </tr> |
|
50 <tr> |
|
51 <td><a href="#setRecursionLimit">setRecursionLimit</a></td> |
|
52 <td>Module function to set the recursion limit.</td> |
|
53 </tr> |
|
54 </table> |
|
55 <hr /> |
|
56 <hr /> |
|
57 <a NAME="DebugBase" ID="DebugBase"></a> |
|
58 <h2>DebugBase</h2> |
|
59 |
|
60 <p> |
|
61 Class implementing base class of the debugger. |
|
62 </p> |
|
63 <p> |
|
64 Provides methods for the 'owning' client to call to step etc. |
|
65 </p> |
|
66 <h3>Derived from</h3> |
|
67 None |
|
68 <h3>Class Attributes</h3> |
|
69 |
|
70 <table> |
|
71 <tr><td>_fnCache</td></tr><tr><td>filesToSkip</td></tr><tr><td>lib</td></tr><tr><td>pathsToSkip</td></tr><tr><td>pollTimerEnabled</td></tr> |
|
72 </table> |
|
73 <h3>Class Methods</h3> |
|
74 |
|
75 <table> |
|
76 <tr><td>None</td></tr> |
|
77 </table> |
|
78 <h3>Methods</h3> |
|
79 |
|
80 <table> |
|
81 |
|
82 <tr> |
|
83 <td><a href="#DebugBase.__init__">DebugBase</a></td> |
|
84 <td>Constructor</td> |
|
85 </tr> |
|
86 <tr> |
|
87 <td><a href="#DebugBase.__checkBreakInFrame">__checkBreakInFrame</a></td> |
|
88 <td>Private method to check if the function / method has a line number which is a breakpoint.</td> |
|
89 </tr> |
|
90 <tr> |
|
91 <td><a href="#DebugBase.__disassemble">__disassemble</a></td> |
|
92 <td>Private method to generate a disassembly of the given code object.</td> |
|
93 </tr> |
|
94 <tr> |
|
95 <td><a href="#DebugBase.__do_clearBreak">__do_clearBreak</a></td> |
|
96 <td>Private method called to clear a temporary breakpoint.</td> |
|
97 </tr> |
|
98 <tr> |
|
99 <td><a href="#DebugBase.__do_clearWatch">__do_clearWatch</a></td> |
|
100 <td>Private method called to clear a temporary watch expression.</td> |
|
101 </tr> |
|
102 <tr> |
|
103 <td><a href="#DebugBase.__eventPollTimer">__eventPollTimer</a></td> |
|
104 <td>Private method to set a flag every 0.5 s to check for new messages.</td> |
|
105 </tr> |
|
106 <tr> |
|
107 <td><a href="#DebugBase.__extractExceptionName">__extractExceptionName</a></td> |
|
108 <td>Private method to extract the exception name given the exception type object.</td> |
|
109 </tr> |
|
110 <tr> |
|
111 <td><a href="#DebugBase.__extractSystemExitMessage">__extractSystemExitMessage</a></td> |
|
112 <td>Private method to get the SystemExit code and message.</td> |
|
113 </tr> |
|
114 <tr> |
|
115 <td><a href="#DebugBase.__extract_stack">__extract_stack</a></td> |
|
116 <td>Private member to return a list of stack frames.</td> |
|
117 </tr> |
|
118 <tr> |
|
119 <td><a href="#DebugBase.__sendCallTrace">__sendCallTrace</a></td> |
|
120 <td>Private method to send a call/return trace.</td> |
|
121 </tr> |
|
122 <tr> |
|
123 <td><a href="#DebugBase.__skipFrame">__skipFrame</a></td> |
|
124 <td>Private method to filter out debugger files.</td> |
|
125 </tr> |
|
126 <tr> |
|
127 <td><a href="#DebugBase._set_stopinfo">_set_stopinfo</a></td> |
|
128 <td>Protected method to update the frame pointers.</td> |
|
129 </tr> |
|
130 <tr> |
|
131 <td><a href="#DebugBase.bootstrap">bootstrap</a></td> |
|
132 <td>Public method to bootstrap a thread.</td> |
|
133 </tr> |
|
134 <tr> |
|
135 <td><a href="#DebugBase.break_here">break_here</a></td> |
|
136 <td>Public method reimplemented from bdb.py to fix the filename from the frame.</td> |
|
137 </tr> |
|
138 <tr> |
|
139 <td><a href="#DebugBase.fix_frame_filename">fix_frame_filename</a></td> |
|
140 <td>Public method used to fixup the filename for a given frame.</td> |
|
141 </tr> |
|
142 <tr> |
|
143 <td><a href="#DebugBase.getCurrentFrame">getCurrentFrame</a></td> |
|
144 <td>Public method to return the current frame.</td> |
|
145 </tr> |
|
146 <tr> |
|
147 <td><a href="#DebugBase.getFrameLocals">getFrameLocals</a></td> |
|
148 <td>Public method to return the locals dictionary of the current frame or a frame below.</td> |
|
149 </tr> |
|
150 <tr> |
|
151 <td><a href="#DebugBase.getStack">getStack</a></td> |
|
152 <td>Public method to get the stack.</td> |
|
153 </tr> |
|
154 <tr> |
|
155 <td><a href="#DebugBase.go">go</a></td> |
|
156 <td>Public method to resume the thread.</td> |
|
157 </tr> |
|
158 <tr> |
|
159 <td><a href="#DebugBase.move_instruction_pointer">move_instruction_pointer</a></td> |
|
160 <td>Public methode to move the instruction pointer to another line.</td> |
|
161 </tr> |
|
162 <tr> |
|
163 <td><a href="#DebugBase.profile">profile</a></td> |
|
164 <td>Public method used to trace some stuff independent of the debugger trace function.</td> |
|
165 </tr> |
|
166 <tr> |
|
167 <td><a href="#DebugBase.profileWithRecursion">profileWithRecursion</a></td> |
|
168 <td>Public method used to trace some stuff independent of the debugger trace function.</td> |
|
169 </tr> |
|
170 <tr> |
|
171 <td><a href="#DebugBase.run">run</a></td> |
|
172 <td>Public method to start a given command under debugger control.</td> |
|
173 </tr> |
|
174 <tr> |
|
175 <td><a href="#DebugBase.setRecursionDepth">setRecursionDepth</a></td> |
|
176 <td>Public method to determine the current recursion depth.</td> |
|
177 </tr> |
|
178 <tr> |
|
179 <td><a href="#DebugBase.set_continue">set_continue</a></td> |
|
180 <td>Public method to stop only on next breakpoint.</td> |
|
181 </tr> |
|
182 <tr> |
|
183 <td><a href="#DebugBase.set_next">set_next</a></td> |
|
184 <td>Public method to stop on the next line in or below the given frame.</td> |
|
185 </tr> |
|
186 <tr> |
|
187 <td><a href="#DebugBase.set_quit">set_quit</a></td> |
|
188 <td>Public method to quit.</td> |
|
189 </tr> |
|
190 <tr> |
|
191 <td><a href="#DebugBase.set_return">set_return</a></td> |
|
192 <td>Public method to stop when returning from the given frame.</td> |
|
193 </tr> |
|
194 <tr> |
|
195 <td><a href="#DebugBase.set_step">set_step</a></td> |
|
196 <td>Public method to stop after one line of code.</td> |
|
197 </tr> |
|
198 <tr> |
|
199 <td><a href="#DebugBase.set_trace">set_trace</a></td> |
|
200 <td>Public method to start debugging from 'frame'.</td> |
|
201 </tr> |
|
202 <tr> |
|
203 <td><a href="#DebugBase.set_until">set_until</a></td> |
|
204 <td>Public method to stop when the line with the lineno greater than the current one is reached or when returning from current frame.</td> |
|
205 </tr> |
|
206 <tr> |
|
207 <td><a href="#DebugBase.step">step</a></td> |
|
208 <td>Public method to perform a step operation in this thread.</td> |
|
209 </tr> |
|
210 <tr> |
|
211 <td><a href="#DebugBase.stepOut">stepOut</a></td> |
|
212 <td>Public method to perform a step out of the current call.</td> |
|
213 </tr> |
|
214 <tr> |
|
215 <td><a href="#DebugBase.stop_here">stop_here</a></td> |
|
216 <td>Public method reimplemented to filter out debugger files.</td> |
|
217 </tr> |
|
218 <tr> |
|
219 <td><a href="#DebugBase.storeFrameLocals">storeFrameLocals</a></td> |
|
220 <td>Public method to store the locals into the frame, so an access to frame.f_locals returns the last data.</td> |
|
221 </tr> |
|
222 <tr> |
|
223 <td><a href="#DebugBase.tracePythonLibs">tracePythonLibs</a></td> |
|
224 <td>Public method to update the settings to trace into Python libraries.</td> |
|
225 </tr> |
|
226 <tr> |
|
227 <td><a href="#DebugBase.trace_dispatch">trace_dispatch</a></td> |
|
228 <td>Public method reimplemented from bdb.py to do some special things.</td> |
|
229 </tr> |
|
230 <tr> |
|
231 <td><a href="#DebugBase.user_exception">user_exception</a></td> |
|
232 <td>Public method reimplemented to report an exception to the debug server.</td> |
|
233 </tr> |
|
234 <tr> |
|
235 <td><a href="#DebugBase.user_line">user_line</a></td> |
|
236 <td>Public method reimplemented to handle the program about to execute a particular line.</td> |
|
237 </tr> |
|
238 </table> |
|
239 <h3>Static Methods</h3> |
|
240 |
|
241 <table> |
|
242 <tr><td>None</td></tr> |
|
243 </table> |
|
244 |
|
245 <a NAME="DebugBase.__init__" ID="DebugBase.__init__"></a> |
|
246 <h4>DebugBase (Constructor)</h4> |
|
247 <b>DebugBase</b>(<i>dbgClient</i>) |
|
248 |
|
249 <p> |
|
250 Constructor |
|
251 </p> |
|
252 <dl> |
|
253 |
|
254 <dt><i>dbgClient</i></dt> |
|
255 <dd> |
|
256 the owning client |
|
257 </dd> |
|
258 </dl> |
|
259 <a NAME="DebugBase.__checkBreakInFrame" ID="DebugBase.__checkBreakInFrame"></a> |
|
260 <h4>DebugBase.__checkBreakInFrame</h4> |
|
261 <b>__checkBreakInFrame</b>(<i>frame</i>) |
|
262 |
|
263 <p> |
|
264 Private method to check if the function / method has a line number |
|
265 which is a breakpoint. |
|
266 </p> |
|
267 <dl> |
|
268 |
|
269 <dt><i>frame</i> (frame object)</dt> |
|
270 <dd> |
|
271 the frame object |
|
272 </dd> |
|
273 </dl> |
|
274 <dl> |
|
275 <dt>Return:</dt> |
|
276 <dd> |
|
277 Flag indicating a function / method with breakpoint |
|
278 </dd> |
|
279 </dl> |
|
280 <dl> |
|
281 <dt>Return Type:</dt> |
|
282 <dd> |
|
283 bool |
|
284 </dd> |
|
285 </dl> |
|
286 <a NAME="DebugBase.__disassemble" ID="DebugBase.__disassemble"></a> |
|
287 <h4>DebugBase.__disassemble</h4> |
|
288 <b>__disassemble</b>(<i>frame</i>) |
|
289 |
|
290 <p> |
|
291 Private method to generate a disassembly of the given code object. |
|
292 </p> |
|
293 <dl> |
|
294 |
|
295 <dt><i>frame</i> (code)</dt> |
|
296 <dd> |
|
297 frame object to be disassembled |
|
298 </dd> |
|
299 </dl> |
|
300 <dl> |
|
301 <dt>Return:</dt> |
|
302 <dd> |
|
303 dictionary containing the disassembly information |
|
304 </dd> |
|
305 </dl> |
|
306 <dl> |
|
307 <dt>Return Type:</dt> |
|
308 <dd> |
|
309 dict |
|
310 </dd> |
|
311 </dl> |
|
312 <a NAME="DebugBase.__do_clearBreak" ID="DebugBase.__do_clearBreak"></a> |
|
313 <h4>DebugBase.__do_clearBreak</h4> |
|
314 <b>__do_clearBreak</b>(<i>filename, lineno</i>) |
|
315 |
|
316 <p> |
|
317 Private method called to clear a temporary breakpoint. |
|
318 </p> |
|
319 <dl> |
|
320 |
|
321 <dt><i>filename</i> (str)</dt> |
|
322 <dd> |
|
323 name of the file the bp belongs to |
|
324 </dd> |
|
325 <dt><i>lineno</i> (int)</dt> |
|
326 <dd> |
|
327 linenumber of the bp |
|
328 </dd> |
|
329 </dl> |
|
330 <a NAME="DebugBase.__do_clearWatch" ID="DebugBase.__do_clearWatch"></a> |
|
331 <h4>DebugBase.__do_clearWatch</h4> |
|
332 <b>__do_clearWatch</b>(<i>cond</i>) |
|
333 |
|
334 <p> |
|
335 Private method called to clear a temporary watch expression. |
|
336 </p> |
|
337 <dl> |
|
338 |
|
339 <dt><i>cond</i> (str)</dt> |
|
340 <dd> |
|
341 expression of the watch expression to be cleared |
|
342 </dd> |
|
343 </dl> |
|
344 <a NAME="DebugBase.__eventPollTimer" ID="DebugBase.__eventPollTimer"></a> |
|
345 <h4>DebugBase.__eventPollTimer</h4> |
|
346 <b>__eventPollTimer</b>(<i></i>) |
|
347 |
|
348 <p> |
|
349 Private method to set a flag every 0.5 s to check for new messages. |
|
350 </p> |
|
351 <a NAME="DebugBase.__extractExceptionName" ID="DebugBase.__extractExceptionName"></a> |
|
352 <h4>DebugBase.__extractExceptionName</h4> |
|
353 <b>__extractExceptionName</b>(<i>exctype</i>) |
|
354 |
|
355 <p> |
|
356 Private method to extract the exception name given the exception |
|
357 type object. |
|
358 </p> |
|
359 <dl> |
|
360 |
|
361 <dt><i>exctype</i></dt> |
|
362 <dd> |
|
363 type of the exception |
|
364 </dd> |
|
365 </dl> |
|
366 <dl> |
|
367 <dt>Return:</dt> |
|
368 <dd> |
|
369 exception name (string) |
|
370 </dd> |
|
371 </dl> |
|
372 <a NAME="DebugBase.__extractSystemExitMessage" ID="DebugBase.__extractSystemExitMessage"></a> |
|
373 <h4>DebugBase.__extractSystemExitMessage</h4> |
|
374 <b>__extractSystemExitMessage</b>(<i>excinfo</i>) |
|
375 |
|
376 <p> |
|
377 Private method to get the SystemExit code and message. |
|
378 </p> |
|
379 <dl> |
|
380 |
|
381 <dt><i>excinfo</i> (tuple(Exception, excval object, traceback frame object))</dt> |
|
382 <dd> |
|
383 details about the SystemExit exception |
|
384 </dd> |
|
385 </dl> |
|
386 <dl> |
|
387 <dt>Return:</dt> |
|
388 <dd> |
|
389 SystemExit code and message |
|
390 </dd> |
|
391 </dl> |
|
392 <dl> |
|
393 <dt>Return Type:</dt> |
|
394 <dd> |
|
395 int, str |
|
396 </dd> |
|
397 </dl> |
|
398 <a NAME="DebugBase.__extract_stack" ID="DebugBase.__extract_stack"></a> |
|
399 <h4>DebugBase.__extract_stack</h4> |
|
400 <b>__extract_stack</b>(<i>exctb</i>) |
|
401 |
|
402 <p> |
|
403 Private member to return a list of stack frames. |
|
404 </p> |
|
405 <dl> |
|
406 |
|
407 <dt><i>exctb</i></dt> |
|
408 <dd> |
|
409 exception traceback |
|
410 </dd> |
|
411 </dl> |
|
412 <dl> |
|
413 <dt>Return:</dt> |
|
414 <dd> |
|
415 list of stack frames |
|
416 </dd> |
|
417 </dl> |
|
418 <a NAME="DebugBase.__sendCallTrace" ID="DebugBase.__sendCallTrace"></a> |
|
419 <h4>DebugBase.__sendCallTrace</h4> |
|
420 <b>__sendCallTrace</b>(<i>event, fromFrame, toFrame</i>) |
|
421 |
|
422 <p> |
|
423 Private method to send a call/return trace. |
|
424 </p> |
|
425 <dl> |
|
426 |
|
427 <dt><i>event</i> (str)</dt> |
|
428 <dd> |
|
429 trace event |
|
430 </dd> |
|
431 <dt><i>fromFrame</i> (frame object)</dt> |
|
432 <dd> |
|
433 originating frame |
|
434 </dd> |
|
435 <dt><i>toFrame</i> (frame object)</dt> |
|
436 <dd> |
|
437 destination frame |
|
438 </dd> |
|
439 </dl> |
|
440 <a NAME="DebugBase.__skipFrame" ID="DebugBase.__skipFrame"></a> |
|
441 <h4>DebugBase.__skipFrame</h4> |
|
442 <b>__skipFrame</b>(<i>frame</i>) |
|
443 |
|
444 <p> |
|
445 Private method to filter out debugger files. |
|
446 </p> |
|
447 <p> |
|
448 Tracing is turned off for files that are part of the |
|
449 debugger that are called from the application being debugged. |
|
450 </p> |
|
451 <dl> |
|
452 |
|
453 <dt><i>frame</i> (frame object)</dt> |
|
454 <dd> |
|
455 the frame object |
|
456 </dd> |
|
457 </dl> |
|
458 <dl> |
|
459 <dt>Return:</dt> |
|
460 <dd> |
|
461 flag indicating whether the debugger should skip this frame |
|
462 </dd> |
|
463 </dl> |
|
464 <dl> |
|
465 <dt>Return Type:</dt> |
|
466 <dd> |
|
467 bool |
|
468 </dd> |
|
469 </dl> |
|
470 <a NAME="DebugBase._set_stopinfo" ID="DebugBase._set_stopinfo"></a> |
|
471 <h4>DebugBase._set_stopinfo</h4> |
|
472 <b>_set_stopinfo</b>(<i>stopframe, returnframe, stoplineno=0</i>) |
|
473 |
|
474 <p> |
|
475 Protected method to update the frame pointers. |
|
476 </p> |
|
477 <dl> |
|
478 |
|
479 <dt><i>stopframe</i> (frame object)</dt> |
|
480 <dd> |
|
481 the frame object where to stop |
|
482 </dd> |
|
483 <dt><i>returnframe</i> (frame object)</dt> |
|
484 <dd> |
|
485 the frame object where to stop on a function return |
|
486 </dd> |
|
487 <dt><i>stoplineno</i> (int)</dt> |
|
488 <dd> |
|
489 line number to stop at. If stoplineno is greater than |
|
490 or equal to 0, then stop at line greater than or equal to the |
|
491 stopline. If stoplineno is -1, then don't stop at all. |
|
492 </dd> |
|
493 </dl> |
|
494 <a NAME="DebugBase.bootstrap" ID="DebugBase.bootstrap"></a> |
|
495 <h4>DebugBase.bootstrap</h4> |
|
496 <b>bootstrap</b>(<i>target, args, kwargs</i>) |
|
497 |
|
498 <p> |
|
499 Public method to bootstrap a thread. |
|
500 </p> |
|
501 <p> |
|
502 It wraps the call to the user function to enable tracing |
|
503 before hand. |
|
504 </p> |
|
505 <dl> |
|
506 |
|
507 <dt><i>target</i> (function pointer)</dt> |
|
508 <dd> |
|
509 function which is called in the new created thread |
|
510 </dd> |
|
511 <dt><i>args</i> (tuple)</dt> |
|
512 <dd> |
|
513 arguments to pass to target |
|
514 </dd> |
|
515 <dt><i>kwargs</i> (dict)</dt> |
|
516 <dd> |
|
517 keyword arguments to pass to target |
|
518 </dd> |
|
519 </dl> |
|
520 <a NAME="DebugBase.break_here" ID="DebugBase.break_here"></a> |
|
521 <h4>DebugBase.break_here</h4> |
|
522 <b>break_here</b>(<i>frame</i>) |
|
523 |
|
524 <p> |
|
525 Public method reimplemented from bdb.py to fix the filename from the |
|
526 frame. |
|
527 </p> |
|
528 <p> |
|
529 See fix_frame_filename for more info. |
|
530 </p> |
|
531 <dl> |
|
532 |
|
533 <dt><i>frame</i> (frame object)</dt> |
|
534 <dd> |
|
535 the frame object |
|
536 </dd> |
|
537 </dl> |
|
538 <dl> |
|
539 <dt>Return:</dt> |
|
540 <dd> |
|
541 flag indicating the break status |
|
542 </dd> |
|
543 </dl> |
|
544 <dl> |
|
545 <dt>Return Type:</dt> |
|
546 <dd> |
|
547 bool |
|
548 </dd> |
|
549 </dl> |
|
550 <a NAME="DebugBase.fix_frame_filename" ID="DebugBase.fix_frame_filename"></a> |
|
551 <h4>DebugBase.fix_frame_filename</h4> |
|
552 <b>fix_frame_filename</b>(<i>frame</i>) |
|
553 |
|
554 <p> |
|
555 Public method used to fixup the filename for a given frame. |
|
556 </p> |
|
557 <p> |
|
558 The logic employed here is that if a module was loaded |
|
559 from a .pyc file, then the correct .py to operate with |
|
560 should be in the same path as the .pyc. The reason this |
|
561 logic is needed is that when a .pyc file is generated, the |
|
562 filename embedded and thus what is readable in the code object |
|
563 of the frame object is the fully qualified filepath when the |
|
564 pyc is generated. If files are moved from machine to machine |
|
565 this can break debugging as the .pyc will refer to the .py |
|
566 on the original machine. Another case might be sharing |
|
567 code over a network... This logic deals with that. |
|
568 </p> |
|
569 <dl> |
|
570 |
|
571 <dt><i>frame</i> (frame object)</dt> |
|
572 <dd> |
|
573 the frame object |
|
574 </dd> |
|
575 </dl> |
|
576 <dl> |
|
577 <dt>Return:</dt> |
|
578 <dd> |
|
579 fixed up file name |
|
580 </dd> |
|
581 </dl> |
|
582 <dl> |
|
583 <dt>Return Type:</dt> |
|
584 <dd> |
|
585 str |
|
586 </dd> |
|
587 </dl> |
|
588 <a NAME="DebugBase.getCurrentFrame" ID="DebugBase.getCurrentFrame"></a> |
|
589 <h4>DebugBase.getCurrentFrame</h4> |
|
590 <b>getCurrentFrame</b>(<i></i>) |
|
591 |
|
592 <p> |
|
593 Public method to return the current frame. |
|
594 </p> |
|
595 <dl> |
|
596 <dt>Return:</dt> |
|
597 <dd> |
|
598 the current frame |
|
599 </dd> |
|
600 </dl> |
|
601 <dl> |
|
602 <dt>Return Type:</dt> |
|
603 <dd> |
|
604 frame object |
|
605 </dd> |
|
606 </dl> |
|
607 <a NAME="DebugBase.getFrameLocals" ID="DebugBase.getFrameLocals"></a> |
|
608 <h4>DebugBase.getFrameLocals</h4> |
|
609 <b>getFrameLocals</b>(<i>frmnr=0</i>) |
|
610 |
|
611 <p> |
|
612 Public method to return the locals dictionary of the current frame |
|
613 or a frame below. |
|
614 </p> |
|
615 <dl> |
|
616 |
|
617 <dt><i>frmnr</i></dt> |
|
618 <dd> |
|
619 distance of frame to get locals dictionary of. 0 is |
|
620 the current frame (int) |
|
621 </dd> |
|
622 </dl> |
|
623 <dl> |
|
624 <dt>Return:</dt> |
|
625 <dd> |
|
626 locals dictionary of the frame |
|
627 </dd> |
|
628 </dl> |
|
629 <a NAME="DebugBase.getStack" ID="DebugBase.getStack"></a> |
|
630 <h4>DebugBase.getStack</h4> |
|
631 <b>getStack</b>(<i>frame=None, applyTrace=False</i>) |
|
632 |
|
633 <p> |
|
634 Public method to get the stack. |
|
635 </p> |
|
636 <dl> |
|
637 |
|
638 <dt><i>frame</i> (frame object or list)</dt> |
|
639 <dd> |
|
640 frame object to inspect |
|
641 </dd> |
|
642 <dt><i>applyTrace</i> (bool)</dt> |
|
643 <dd> |
|
644 flag to assign trace function to fr.f_trace |
|
645 </dd> |
|
646 </dl> |
|
647 <dl> |
|
648 <dt>Return:</dt> |
|
649 <dd> |
|
650 list of lists with file name (string), line number (integer) |
|
651 and function name (string) |
|
652 </dd> |
|
653 </dl> |
|
654 <a NAME="DebugBase.go" ID="DebugBase.go"></a> |
|
655 <h4>DebugBase.go</h4> |
|
656 <b>go</b>(<i>special</i>) |
|
657 |
|
658 <p> |
|
659 Public method to resume the thread. |
|
660 </p> |
|
661 <p> |
|
662 It resumes the thread stopping only at breakpoints or exceptions. |
|
663 </p> |
|
664 <dl> |
|
665 |
|
666 <dt><i>special</i></dt> |
|
667 <dd> |
|
668 flag indicating a special continue operation |
|
669 </dd> |
|
670 </dl> |
|
671 <a NAME="DebugBase.move_instruction_pointer" ID="DebugBase.move_instruction_pointer"></a> |
|
672 <h4>DebugBase.move_instruction_pointer</h4> |
|
673 <b>move_instruction_pointer</b>(<i>lineno</i>) |
|
674 |
|
675 <p> |
|
676 Public methode to move the instruction pointer to another line. |
|
677 </p> |
|
678 <dl> |
|
679 |
|
680 <dt><i>lineno</i> (int)</dt> |
|
681 <dd> |
|
682 new line number |
|
683 </dd> |
|
684 </dl> |
|
685 <a NAME="DebugBase.profile" ID="DebugBase.profile"></a> |
|
686 <h4>DebugBase.profile</h4> |
|
687 <b>profile</b>(<i>frame, event, arg</i>) |
|
688 |
|
689 <p> |
|
690 Public method used to trace some stuff independent of the debugger |
|
691 trace function. |
|
692 </p> |
|
693 <dl> |
|
694 |
|
695 <dt><i>frame</i> (frame object)</dt> |
|
696 <dd> |
|
697 current stack frame |
|
698 </dd> |
|
699 <dt><i>event</i> (str)</dt> |
|
700 <dd> |
|
701 trace event |
|
702 </dd> |
|
703 <dt><i>arg</i> (depends on the previous event parameter)</dt> |
|
704 <dd> |
|
705 arguments |
|
706 </dd> |
|
707 </dl> |
|
708 <a NAME="DebugBase.profileWithRecursion" ID="DebugBase.profileWithRecursion"></a> |
|
709 <h4>DebugBase.profileWithRecursion</h4> |
|
710 <b>profileWithRecursion</b>(<i>frame, event, arg</i>) |
|
711 |
|
712 <p> |
|
713 Public method used to trace some stuff independent of the debugger |
|
714 trace function. |
|
715 </p> |
|
716 <dl> |
|
717 |
|
718 <dt><i>frame</i> (frame object)</dt> |
|
719 <dd> |
|
720 current stack frame |
|
721 </dd> |
|
722 <dt><i>event</i> (str)</dt> |
|
723 <dd> |
|
724 trace event |
|
725 </dd> |
|
726 <dt><i>arg</i> (depends on the previous event parameter)</dt> |
|
727 <dd> |
|
728 arguments |
|
729 </dd> |
|
730 </dl> |
|
731 <dl> |
|
732 |
|
733 <dt>Raises <b>RuntimeError</b>:</dt> |
|
734 <dd> |
|
735 raised to indicate too many recursions |
|
736 </dd> |
|
737 </dl> |
|
738 <a NAME="DebugBase.run" ID="DebugBase.run"></a> |
|
739 <h4>DebugBase.run</h4> |
|
740 <b>run</b>(<i>cmd, globalsDict=None, localsDict=None, debug=True, closeSession=True</i>) |
|
741 |
|
742 <p> |
|
743 Public method to start a given command under debugger control. |
|
744 </p> |
|
745 <dl> |
|
746 |
|
747 <dt><i>cmd</i> (str or CodeType)</dt> |
|
748 <dd> |
|
749 command / code to execute under debugger control |
|
750 </dd> |
|
751 <dt><i>globalsDict</i> (dict)</dt> |
|
752 <dd> |
|
753 dictionary of global variables for cmd |
|
754 </dd> |
|
755 <dt><i>localsDict</i> (dict)</dt> |
|
756 <dd> |
|
757 dictionary of local variables for cmd |
|
758 </dd> |
|
759 <dt><i>debug</i> (bool)</dt> |
|
760 <dd> |
|
761 flag if command should run under debugger control |
|
762 </dd> |
|
763 <dt><i>closeSession</i> (bool)</dt> |
|
764 <dd> |
|
765 flag indicating to close the debugger session |
|
766 at exit |
|
767 </dd> |
|
768 </dl> |
|
769 <dl> |
|
770 <dt>Return:</dt> |
|
771 <dd> |
|
772 exit code of the program |
|
773 </dd> |
|
774 </dl> |
|
775 <dl> |
|
776 <dt>Return Type:</dt> |
|
777 <dd> |
|
778 int |
|
779 </dd> |
|
780 </dl> |
|
781 <a NAME="DebugBase.setRecursionDepth" ID="DebugBase.setRecursionDepth"></a> |
|
782 <h4>DebugBase.setRecursionDepth</h4> |
|
783 <b>setRecursionDepth</b>(<i>frame</i>) |
|
784 |
|
785 <p> |
|
786 Public method to determine the current recursion depth. |
|
787 </p> |
|
788 <dl> |
|
789 |
|
790 <dt><i>frame</i></dt> |
|
791 <dd> |
|
792 The current stack frame. |
|
793 </dd> |
|
794 </dl> |
|
795 <a NAME="DebugBase.set_continue" ID="DebugBase.set_continue"></a> |
|
796 <h4>DebugBase.set_continue</h4> |
|
797 <b>set_continue</b>(<i>special</i>) |
|
798 |
|
799 <p> |
|
800 Public method to stop only on next breakpoint. |
|
801 </p> |
|
802 <dl> |
|
803 |
|
804 <dt><i>special</i> (bool)</dt> |
|
805 <dd> |
|
806 flag indicating a special continue operation |
|
807 </dd> |
|
808 </dl> |
|
809 <a NAME="DebugBase.set_next" ID="DebugBase.set_next"></a> |
|
810 <h4>DebugBase.set_next</h4> |
|
811 <b>set_next</b>(<i>frame</i>) |
|
812 |
|
813 <p> |
|
814 Public method to stop on the next line in or below the given frame. |
|
815 </p> |
|
816 <dl> |
|
817 |
|
818 <dt><i>frame</i> (frame object)</dt> |
|
819 <dd> |
|
820 the frame object |
|
821 </dd> |
|
822 </dl> |
|
823 <a NAME="DebugBase.set_quit" ID="DebugBase.set_quit"></a> |
|
824 <h4>DebugBase.set_quit</h4> |
|
825 <b>set_quit</b>(<i></i>) |
|
826 |
|
827 <p> |
|
828 Public method to quit. |
|
829 </p> |
|
830 <p> |
|
831 Disables the trace functions and resets all frame pointer. |
|
832 </p> |
|
833 <a NAME="DebugBase.set_return" ID="DebugBase.set_return"></a> |
|
834 <h4>DebugBase.set_return</h4> |
|
835 <b>set_return</b>(<i>frame</i>) |
|
836 |
|
837 <p> |
|
838 Public method to stop when returning from the given frame. |
|
839 </p> |
|
840 <dl> |
|
841 |
|
842 <dt><i>frame</i> (frame object)</dt> |
|
843 <dd> |
|
844 the frame object |
|
845 </dd> |
|
846 </dl> |
|
847 <a NAME="DebugBase.set_step" ID="DebugBase.set_step"></a> |
|
848 <h4>DebugBase.set_step</h4> |
|
849 <b>set_step</b>(<i></i>) |
|
850 |
|
851 <p> |
|
852 Public method to stop after one line of code. |
|
853 </p> |
|
854 <a NAME="DebugBase.set_trace" ID="DebugBase.set_trace"></a> |
|
855 <h4>DebugBase.set_trace</h4> |
|
856 <b>set_trace</b>(<i>frame=None</i>) |
|
857 |
|
858 <p> |
|
859 Public method to start debugging from 'frame'. |
|
860 </p> |
|
861 <p> |
|
862 If frame is not specified, debugging starts from caller's frame. |
|
863 Because of jump optimizations it's not possible to use sys.breakpoint() |
|
864 as last instruction in a function or method. |
|
865 </p> |
|
866 <dl> |
|
867 |
|
868 <dt><i>frame</i> (frame object)</dt> |
|
869 <dd> |
|
870 frame to start debugging from |
|
871 </dd> |
|
872 </dl> |
|
873 <a NAME="DebugBase.set_until" ID="DebugBase.set_until"></a> |
|
874 <h4>DebugBase.set_until</h4> |
|
875 <b>set_until</b>(<i>frame=None, lineno=None</i>) |
|
876 |
|
877 <p> |
|
878 Public method to stop when the line with the lineno greater than the |
|
879 current one is reached or when returning from current frame. |
|
880 </p> |
|
881 <dl> |
|
882 |
|
883 <dt><i>frame</i> (frame object)</dt> |
|
884 <dd> |
|
885 reference to the frame object |
|
886 </dd> |
|
887 <dt><i>lineno</i> (int)</dt> |
|
888 <dd> |
|
889 line number to continue to |
|
890 </dd> |
|
891 </dl> |
|
892 <a NAME="DebugBase.step" ID="DebugBase.step"></a> |
|
893 <h4>DebugBase.step</h4> |
|
894 <b>step</b>(<i>traceMode</i>) |
|
895 |
|
896 <p> |
|
897 Public method to perform a step operation in this thread. |
|
898 </p> |
|
899 <dl> |
|
900 |
|
901 <dt><i>traceMode</i></dt> |
|
902 <dd> |
|
903 If it is True, then the step is a step into, |
|
904 otherwise it is a step over. |
|
905 </dd> |
|
906 </dl> |
|
907 <a NAME="DebugBase.stepOut" ID="DebugBase.stepOut"></a> |
|
908 <h4>DebugBase.stepOut</h4> |
|
909 <b>stepOut</b>(<i></i>) |
|
910 |
|
911 <p> |
|
912 Public method to perform a step out of the current call. |
|
913 </p> |
|
914 <a NAME="DebugBase.stop_here" ID="DebugBase.stop_here"></a> |
|
915 <h4>DebugBase.stop_here</h4> |
|
916 <b>stop_here</b>(<i>frame</i>) |
|
917 |
|
918 <p> |
|
919 Public method reimplemented to filter out debugger files. |
|
920 </p> |
|
921 <p> |
|
922 Tracing is turned off for files that are part of the |
|
923 debugger that are called from the application being debugged. |
|
924 </p> |
|
925 <dl> |
|
926 |
|
927 <dt><i>frame</i> (frame object)</dt> |
|
928 <dd> |
|
929 the frame object |
|
930 </dd> |
|
931 </dl> |
|
932 <dl> |
|
933 <dt>Return:</dt> |
|
934 <dd> |
|
935 flag indicating whether the debugger should stop here |
|
936 </dd> |
|
937 </dl> |
|
938 <dl> |
|
939 <dt>Return Type:</dt> |
|
940 <dd> |
|
941 bool |
|
942 </dd> |
|
943 </dl> |
|
944 <a NAME="DebugBase.storeFrameLocals" ID="DebugBase.storeFrameLocals"></a> |
|
945 <h4>DebugBase.storeFrameLocals</h4> |
|
946 <b>storeFrameLocals</b>(<i>frmnr=0</i>) |
|
947 |
|
948 <p> |
|
949 Public method to store the locals into the frame, so an access to |
|
950 frame.f_locals returns the last data. |
|
951 </p> |
|
952 <dl> |
|
953 |
|
954 <dt><i>frmnr</i></dt> |
|
955 <dd> |
|
956 distance of frame to store locals dictionary to. 0 is |
|
957 the current frame (int) |
|
958 </dd> |
|
959 </dl> |
|
960 <a NAME="DebugBase.tracePythonLibs" ID="DebugBase.tracePythonLibs"></a> |
|
961 <h4>DebugBase.tracePythonLibs</h4> |
|
962 <b>tracePythonLibs</b>(<i>enable</i>) |
|
963 |
|
964 <p> |
|
965 Public method to update the settings to trace into Python libraries. |
|
966 </p> |
|
967 <dl> |
|
968 |
|
969 <dt><i>enable</i> (bool)</dt> |
|
970 <dd> |
|
971 flag to debug into Python libraries |
|
972 </dd> |
|
973 </dl> |
|
974 <a NAME="DebugBase.trace_dispatch" ID="DebugBase.trace_dispatch"></a> |
|
975 <h4>DebugBase.trace_dispatch</h4> |
|
976 <b>trace_dispatch</b>(<i>frame, event, arg</i>) |
|
977 |
|
978 <p> |
|
979 Public method reimplemented from bdb.py to do some special things. |
|
980 </p> |
|
981 <p> |
|
982 This specialty is to check the connection to the debug server |
|
983 for new events (i.e. new breakpoints) while we are going through |
|
984 the code. |
|
985 </p> |
|
986 <dl> |
|
987 |
|
988 <dt><i>frame</i> (frame object)</dt> |
|
989 <dd> |
|
990 The current stack frame |
|
991 </dd> |
|
992 <dt><i>event</i> (str)</dt> |
|
993 <dd> |
|
994 The trace event |
|
995 </dd> |
|
996 <dt><i>arg</i> (depends on the previous event parameter)</dt> |
|
997 <dd> |
|
998 The arguments |
|
999 </dd> |
|
1000 </dl> |
|
1001 <dl> |
|
1002 <dt>Return:</dt> |
|
1003 <dd> |
|
1004 local trace function |
|
1005 </dd> |
|
1006 </dl> |
|
1007 <dl> |
|
1008 <dt>Return Type:</dt> |
|
1009 <dd> |
|
1010 trace function or None |
|
1011 </dd> |
|
1012 </dl> |
|
1013 <dl> |
|
1014 |
|
1015 <dt>Raises <b>SystemExit</b>:</dt> |
|
1016 <dd> |
|
1017 |
|
1018 </dd> |
|
1019 </dl> |
|
1020 <a NAME="DebugBase.user_exception" ID="DebugBase.user_exception"></a> |
|
1021 <h4>DebugBase.user_exception</h4> |
|
1022 <b>user_exception</b>(<i>excinfo, unhandled=False</i>) |
|
1023 |
|
1024 <p> |
|
1025 Public method reimplemented to report an exception to the debug server. |
|
1026 </p> |
|
1027 <dl> |
|
1028 |
|
1029 <dt><i>excinfo</i> (tuple(Exception, excval object, traceback frame object))</dt> |
|
1030 <dd> |
|
1031 details about the exception |
|
1032 </dd> |
|
1033 <dt><i>unhandled</i> (bool)</dt> |
|
1034 <dd> |
|
1035 flag indicating an uncaught exception |
|
1036 </dd> |
|
1037 </dl> |
|
1038 <a NAME="DebugBase.user_line" ID="DebugBase.user_line"></a> |
|
1039 <h4>DebugBase.user_line</h4> |
|
1040 <b>user_line</b>(<i>frame</i>) |
|
1041 |
|
1042 <p> |
|
1043 Public method reimplemented to handle the program about to execute a |
|
1044 particular line. |
|
1045 </p> |
|
1046 <dl> |
|
1047 |
|
1048 <dt><i>frame</i></dt> |
|
1049 <dd> |
|
1050 the frame object |
|
1051 </dd> |
|
1052 </dl> |
|
1053 <div align="right"><a href="#top">Up</a></div> |
|
1054 <hr /> |
|
1055 <hr /> |
|
1056 <a NAME="printerr" ID="printerr"></a> |
|
1057 <h2>printerr</h2> |
|
1058 <b>printerr</b>(<i>s</i>) |
|
1059 |
|
1060 <p> |
|
1061 Module function used for debugging the debug client. |
|
1062 </p> |
|
1063 <dl> |
|
1064 |
|
1065 <dt><i>s</i></dt> |
|
1066 <dd> |
|
1067 data to be printed |
|
1068 </dd> |
|
1069 </dl> |
|
1070 <div align="right"><a href="#top">Up</a></div> |
|
1071 <hr /> |
|
1072 <hr /> |
|
1073 <a NAME="setRecursionLimit" ID="setRecursionLimit"></a> |
|
1074 <h2>setRecursionLimit</h2> |
|
1075 <b>setRecursionLimit</b>(<i>limit</i>) |
|
1076 |
|
1077 <p> |
|
1078 Module function to set the recursion limit. |
|
1079 </p> |
|
1080 <dl> |
|
1081 |
|
1082 <dt><i>limit</i></dt> |
|
1083 <dd> |
|
1084 recursion limit (integer) |
|
1085 </dd> |
|
1086 </dl> |
|
1087 <div align="right"><a href="#top">Up</a></div> |
|
1088 <hr /> |
|
1089 </body></html> |