DebugClients/Python/DebugBase.py

changeset 3591
2f2a4a76dd22
parent 3160
209a07d7e401
child 3670
f0cb7579c0b4
equal deleted inserted replaced
3590:5280e37405b8 3591:2f2a4a76dd22
189 self._dbgClient.write("%s%s@@%s@@%s\n" % ( 189 self._dbgClient.write("%s%s@@%s@@%s\n" % (
190 CallTrace, event[0], fromStr, toStr)) 190 CallTrace, event[0], fromStr, toStr))
191 191
192 def trace_dispatch(self, frame, event, arg): 192 def trace_dispatch(self, frame, event, arg):
193 """ 193 """
194 Reimplemented from bdb.py to do some special things. 194 Public method reimplemented from bdb.py to do some special things.
195 195
196 This specialty is to check the connection to the debug server 196 This specialty is to check the connection to the debug server
197 for new events (i.e. new breakpoints) while we are going through 197 for new events (i.e. new breakpoints) while we are going through
198 the code. 198 the code.
199 199
228 print 'DebugBase.trace_dispatch: unknown debugging event:', repr(event) 228 print 'DebugBase.trace_dispatch: unknown debugging event:', repr(event)
229 return self.trace_dispatch 229 return self.trace_dispatch
230 230
231 def dispatch_line(self, frame): 231 def dispatch_line(self, frame):
232 """ 232 """
233 Reimplemented from bdb.py to do some special things. 233 Public method reimplemented from bdb.py to do some special things.
234 234
235 This speciality is to check the connection to the debug server 235 This speciality is to check the connection to the debug server
236 for new events (i.e. new breakpoints) while we are going through 236 for new events (i.e. new breakpoints) while we are going through
237 the code. 237 the code.
238 238
246 raise bdb.BdbQuit 246 raise bdb.BdbQuit
247 return self.trace_dispatch 247 return self.trace_dispatch
248 248
249 def dispatch_return(self, frame, arg): 249 def dispatch_return(self, frame, arg):
250 """ 250 """
251 Reimplemented from bdb.py to handle passive mode cleanly. 251 Public method reimplemented from bdb.py to handle passive mode cleanly.
252 252
253 @param frame The current stack frame. 253 @param frame The current stack frame.
254 @param arg The arguments 254 @param arg The arguments
255 @return local trace function 255 @return local trace function
256 @exception bdb.BdbQuit raised to indicate the end of the debug session 256 @exception bdb.BdbQuit raised to indicate the end of the debug session
261 raise bdb.BdbQuit 261 raise bdb.BdbQuit
262 return self.trace_dispatch 262 return self.trace_dispatch
263 263
264 def dispatch_exception(self, frame, arg): 264 def dispatch_exception(self, frame, arg):
265 """ 265 """
266 Reimplemented from bdb.py to always call user_exception. 266 Public method reimplemented from bdb.py to always call user_exception.
267 267
268 @param frame The current stack frame. 268 @param frame The current stack frame.
269 @param arg The arguments 269 @param arg The arguments
270 @return local trace function 270 @return local trace function
271 @exception bdb.BdbQuit raised to indicate the end of the debug session 271 @exception bdb.BdbQuit raised to indicate the end of the debug session
276 raise bdb.BdbQuit 276 raise bdb.BdbQuit
277 return self.trace_dispatch 277 return self.trace_dispatch
278 278
279 def set_trace(self, frame=None): 279 def set_trace(self, frame=None):
280 """ 280 """
281 Overridden method of bdb.py to do some special setup. 281 Public method reimplemented from bdb.py to do some special setup.
282 282
283 @param frame frame to start debugging from 283 @param frame frame to start debugging from
284 """ 284 """
285 bdb.Bdb.set_trace(self, frame) 285 bdb.Bdb.set_trace(self, frame)
286 sys.setprofile(self.profile) 286 sys.setprofile(self.profile)
287 287
288 def set_continue(self, special): 288 def set_continue(self, special):
289 """ 289 """
290 Reimplemented from bdb.py to always get informed of exceptions. 290 Public method reimplemented from bdb.py to always get informed of
291 exceptions.
291 292
292 @param special flag indicating a special continue operation 293 @param special flag indicating a special continue operation
293 """ 294 """
294 # Modified version of the one found in bdb.py 295 # Modified version of the one found in bdb.py
295 # Here we only set a new stop frame if it is a normal continue. 296 # Here we only set a new stop frame if it is a normal continue.
452 continue 453 continue
453 return (None, None) 454 return (None, None)
454 455
455 def break_here(self, frame): 456 def break_here(self, frame):
456 """ 457 """
457 Reimplemented from bdb.py to fix the filename from the frame. 458 Public method reimplemented from bdb.py to fix the filename from the
459 frame.
458 460
459 See fix_frame_filename for more info. 461 See fix_frame_filename for more info.
460 462
461 @param frame the frame object 463 @param frame the frame object
462 @return flag indicating the break status (boolean) 464 @return flag indicating the break status (boolean)
487 489
488 return 0 490 return 0
489 491
490 def break_anywhere(self, frame): 492 def break_anywhere(self, frame):
491 """ 493 """
492 Reimplemented from bdb.py to do some special things. 494 Public method reimplemented from bdb.py to do some special things.
493 495
494 These speciality is to fix the filename from the frame 496 These speciality is to fix the filename from the frame
495 (see fix_frame_filename for more info). 497 (see fix_frame_filename for more info).
496 498
497 @param frame the frame object 499 @param frame the frame object
501 self.canonic(self.fix_frame_filename(frame)) in self.breaks or \ 503 self.canonic(self.fix_frame_filename(frame)) in self.breaks or \
502 ("Watch" in self.breaks and self.breaks["Watch"]) 504 ("Watch" in self.breaks and self.breaks["Watch"])
503 505
504 def get_break(self, filename, lineno): 506 def get_break(self, filename, lineno):
505 """ 507 """
506 Reimplemented from bdb.py to get the first breakpoint of a particular 508 Public method reimplemented from bdb.py to get the first breakpoint of
507 line. 509 a particular line.
508 510
509 Because eric5 supports only one breakpoint per line, this overwritten 511 Because eric5 supports only one breakpoint per line, this overwritten
510 method will return this one and only breakpoint. 512 method will return this one and only breakpoint.
511 513
512 @param filename filename of the bp to retrieve (string) 514 @param filename filename of the bp to retrieve (string)
563 565
564 return stack 566 return stack
565 567
566 def user_line(self, frame): 568 def user_line(self, frame):
567 """ 569 """
568 Reimplemented to handle the program about to execute a particular line. 570 Public method reimplemented to handle the program about to execute a
571 particular line.
569 572
570 @param frame the frame object 573 @param frame the frame object
571 """ 574 """
572 line = frame.f_lineno 575 line = frame.f_lineno
573 576
623 self._dbgClient.write('%s%s\n' % (ResponseLine, unicode(stack))) 626 self._dbgClient.write('%s%s\n' % (ResponseLine, unicode(stack)))
624 self._dbgClient.eventLoop() 627 self._dbgClient.eventLoop()
625 628
626 def user_exception(self, frame, (exctype, excval, exctb), unhandled=0): 629 def user_exception(self, frame, (exctype, excval, exctb), unhandled=0):
627 """ 630 """
628 Reimplemented to report an exception to the debug server. 631 Public method reimplemented to report an exception to the debug server.
629 632
630 @param frame the frame object 633 @param frame the frame object
631 @param exctype the type of the exception 634 @param exctype the type of the exception
632 @param excval data about the exception 635 @param excval data about the exception
633 @param exctb traceback for the exception 636 @param exctb traceback for the exception
731 tb = None 734 tb = None
732 return stack 735 return stack
733 736
734 def user_return(self, frame, retval): 737 def user_return(self, frame, retval):
735 """ 738 """
736 Reimplemented to report program termination to the debug server. 739 Public method reimplemented to report program termination to the
740 debug server.
737 741
738 @param frame the frame object 742 @param frame the frame object
739 @param retval the return value of the program 743 @param retval the return value of the program
740 """ 744 """
741 # The program has finished if we have just left the first frame. 745 # The program has finished if we have just left the first frame.
747 self.stepFrame = None 751 self.stepFrame = None
748 self.user_line(frame) 752 self.user_line(frame)
749 753
750 def stop_here(self, frame): 754 def stop_here(self, frame):
751 """ 755 """
752 Reimplemented to filter out debugger files. 756 Public method reimplemented to filter out debugger files.
753 757
754 Tracing is turned off for files that are part of the 758 Tracing is turned off for files that are part of the
755 debugger that are called from the application being debugged. 759 debugger that are called from the application being debugged.
756 760
757 @param frame the frame object 761 @param frame the frame object
807 """ 811 """
808 return self.__isBroken 812 return self.__isBroken
809 813
810 def getEvent(self): 814 def getEvent(self):
811 """ 815 """
812 Public method to return the last debugger event. 816 Protected method to return the last debugger event.
813 817
814 @return last debugger event (string) 818 @return last debugger event (string)
815 """ 819 """
816 return self.__event 820 return self.__event
817 821

eric ide

mercurial