188 self._dbgClient.write("{0}{1}@@{2}@@{3}\n".format( |
188 self._dbgClient.write("{0}{1}@@{2}@@{3}\n".format( |
189 CallTrace, event[0], fromStr, toStr)) |
189 CallTrace, event[0], fromStr, toStr)) |
190 |
190 |
191 def trace_dispatch(self, frame, event, arg): |
191 def trace_dispatch(self, frame, event, arg): |
192 """ |
192 """ |
193 Reimplemented from bdb.py to do some special things. |
193 Public method reimplemented from bdb.py to do some special things. |
194 |
194 |
195 This specialty is to check the connection to the debug server |
195 This specialty is to check the connection to the debug server |
196 for new events (i.e. new breakpoints) while we are going through |
196 for new events (i.e. new breakpoints) while we are going through |
197 the code. |
197 the code. |
198 |
198 |
227 print('bdb.Bdb.dispatch: unknown debugging event: ', repr(event)) |
227 print('bdb.Bdb.dispatch: unknown debugging event: ', repr(event)) |
228 return self.trace_dispatch |
228 return self.trace_dispatch |
229 |
229 |
230 def dispatch_line(self, frame): |
230 def dispatch_line(self, frame): |
231 """ |
231 """ |
232 Reimplemented from bdb.py to do some special things. |
232 Public method reimplemented from bdb.py to do some special things. |
233 |
233 |
234 This speciality is to check the connection to the debug server |
234 This speciality is to check the connection to the debug server |
235 for new events (i.e. new breakpoints) while we are going through |
235 for new events (i.e. new breakpoints) while we are going through |
236 the code. |
236 the code. |
237 |
237 |
245 raise bdb.BdbQuit |
245 raise bdb.BdbQuit |
246 return self.trace_dispatch |
246 return self.trace_dispatch |
247 |
247 |
248 def dispatch_return(self, frame, arg): |
248 def dispatch_return(self, frame, arg): |
249 """ |
249 """ |
250 Reimplemented from bdb.py to handle passive mode cleanly. |
250 Public method reimplemented from bdb.py to handle passive mode cleanly. |
251 |
251 |
252 @param frame The current stack frame. |
252 @param frame The current stack frame. |
253 @param arg The arguments |
253 @param arg The arguments |
254 @return local trace function |
254 @return local trace function |
255 @exception bdb.BdbQuit raised to indicate the end of the debug session |
255 @exception bdb.BdbQuit raised to indicate the end of the debug session |
260 raise bdb.BdbQuit |
260 raise bdb.BdbQuit |
261 return self.trace_dispatch |
261 return self.trace_dispatch |
262 |
262 |
263 def dispatch_exception(self, frame, arg): |
263 def dispatch_exception(self, frame, arg): |
264 """ |
264 """ |
265 Reimplemented from bdb.py to always call user_exception. |
265 Public method reimplemented from bdb.py to always call user_exception. |
266 |
266 |
267 @param frame The current stack frame. |
267 @param frame The current stack frame. |
268 @param arg The arguments |
268 @param arg The arguments |
269 @return local trace function |
269 @return local trace function |
270 @exception bdb.BdbQuit raised to indicate the end of the debug session |
270 @exception bdb.BdbQuit raised to indicate the end of the debug session |
275 raise bdb.BdbQuit |
275 raise bdb.BdbQuit |
276 return self.trace_dispatch |
276 return self.trace_dispatch |
277 |
277 |
278 def set_trace(self, frame=None): |
278 def set_trace(self, frame=None): |
279 """ |
279 """ |
280 Overridden method of bdb.py to do some special setup. |
280 Public method reimplemented from bdb.py to do some special setup. |
281 |
281 |
282 @param frame frame to start debugging from |
282 @param frame frame to start debugging from |
283 """ |
283 """ |
284 bdb.Bdb.set_trace(self, frame) |
284 bdb.Bdb.set_trace(self, frame) |
285 sys.setprofile(self.profile) |
285 sys.setprofile(self.profile) |
286 |
286 |
287 def set_continue(self, special): |
287 def set_continue(self, special): |
288 """ |
288 """ |
289 Reimplemented from bdb.py to always get informed of exceptions. |
289 Public method reimplemented from bdb.py to always get informed of |
|
290 exceptions. |
290 |
291 |
291 @param special flag indicating a special continue operation |
292 @param special flag indicating a special continue operation |
292 """ |
293 """ |
293 # Modified version of the one found in bdb.py |
294 # Modified version of the one found in bdb.py |
294 # Here we only set a new stop frame if it is a normal continue. |
295 # Here we only set a new stop frame if it is a normal continue. |
456 |
457 |
457 return (None, False) |
458 return (None, False) |
458 |
459 |
459 def break_here(self, frame): |
460 def break_here(self, frame): |
460 """ |
461 """ |
461 Reimplemented from bdb.py to fix the filename from the frame. |
462 Public method reimplemented from bdb.py to fix the filename from the |
|
463 frame. |
462 |
464 |
463 See fix_frame_filename for more info. |
465 See fix_frame_filename for more info. |
464 |
466 |
465 @param frame the frame object |
467 @param frame the frame object |
466 @return flag indicating the break status (boolean) |
468 @return flag indicating the break status (boolean) |
496 |
498 |
497 return False |
499 return False |
498 |
500 |
499 def break_anywhere(self, frame): |
501 def break_anywhere(self, frame): |
500 """ |
502 """ |
501 Reimplemented from bdb.py to do some special things. |
503 Public method reimplemented from bdb.py to do some special things. |
502 |
504 |
503 These speciality is to fix the filename from the frame |
505 These speciality is to fix the filename from the frame |
504 (see fix_frame_filename for more info). |
506 (see fix_frame_filename for more info). |
505 |
507 |
506 @param frame the frame object |
508 @param frame the frame object |
510 self.canonic(self.fix_frame_filename(frame)) in self.breaks or \ |
512 self.canonic(self.fix_frame_filename(frame)) in self.breaks or \ |
511 ("Watch" in self.breaks and self.breaks["Watch"]) |
513 ("Watch" in self.breaks and self.breaks["Watch"]) |
512 |
514 |
513 def get_break(self, filename, lineno): |
515 def get_break(self, filename, lineno): |
514 """ |
516 """ |
515 Reimplemented from bdb.py to get the first breakpoint of a particular |
517 Public method reimplemented from bdb.py to get the first breakpoint of |
516 line. |
518 a particular line. |
517 |
519 |
518 Because eric5 supports only one breakpoint per line, this overwritten |
520 Because eric5 supports only one breakpoint per line, this overwritten |
519 method will return this one and only breakpoint. |
521 method will return this one and only breakpoint. |
520 |
522 |
521 @param filename the filename of the bp to retrieve (string) |
523 @param filename the filename of the bp to retrieve (string) |
634 self._dbgClient.write('{0}{1}\n'.format(ResponseLine, str(stack))) |
637 self._dbgClient.write('{0}{1}\n'.format(ResponseLine, str(stack))) |
635 self._dbgClient.eventLoop() |
638 self._dbgClient.eventLoop() |
636 |
639 |
637 def user_exception(self, frame, excinfo, unhandled=False): |
640 def user_exception(self, frame, excinfo, unhandled=False): |
638 """ |
641 """ |
639 Reimplemented to report an exception to the debug server. |
642 Public method reimplemented to report an exception to the debug server. |
640 |
643 |
641 @param frame the frame object |
644 @param frame the frame object |
642 @param excinfo information about the exception |
645 @param excinfo information about the exception |
643 @param unhandled flag indicating an uncaught exception |
646 @param unhandled flag indicating an uncaught exception |
644 """ |
647 """ |
756 tb = None |
759 tb = None |
757 return stack |
760 return stack |
758 |
761 |
759 def user_return(self, frame, retval): |
762 def user_return(self, frame, retval): |
760 """ |
763 """ |
761 Reimplemented to report program termination to the debug server. |
764 Public method reimplemented to report program termination to the debug |
|
765 server. |
762 |
766 |
763 @param frame the frame object |
767 @param frame the frame object |
764 @param retval the return value of the program |
768 @param retval the return value of the program |
765 """ |
769 """ |
766 # The program has finished if we have just left the first frame. |
770 # The program has finished if we have just left the first frame. |
772 self.stepFrame = None |
776 self.stepFrame = None |
773 self.user_line(frame) |
777 self.user_line(frame) |
774 |
778 |
775 def stop_here(self, frame): |
779 def stop_here(self, frame): |
776 """ |
780 """ |
777 Reimplemented to filter out debugger files. |
781 Public method reimplemented to filter out debugger files. |
778 |
782 |
779 Tracing is turned off for files that are part of the |
783 Tracing is turned off for files that are part of the |
780 debugger that are called from the application being debugged. |
784 debugger that are called from the application being debugged. |
781 |
785 |
782 @param frame the frame object |
786 @param frame the frame object |