DebugClients/Python/DebugBase.py

changeset 2987
c99695c0f13a
parent 2953
703452a2876f
child 3021
801289962f4e
equal deleted inserted replaced
2986:cd4e2cab7eb2 2987:c99695c0f13a
12 import os 12 import os
13 import types 13 import types
14 import atexit 14 import atexit
15 import inspect 15 import inspect
16 16
17 from DebugProtocol import ResponseClearWatch, ResponseClearBreak, ResponseLine, \ 17 from DebugProtocol import ResponseClearWatch, ResponseClearBreak, \
18 ResponseSyntax, ResponseException, CallTrace 18 ResponseLine, ResponseSyntax, ResponseException, CallTrace
19 19
20 gRecursionLimit = 64 20 gRecursionLimit = 64
21 21
22 22
23 def printerr(s): 23 def printerr(s):
400 def __effective(self, frame): 400 def __effective(self, frame):
401 """ 401 """
402 Private method to determine, if a watch expression is effective. 402 Private method to determine, if a watch expression is effective.
403 403
404 @param frame the current execution frame 404 @param frame the current execution frame
405 @return tuple of watch expression and a flag to indicate, that a temporary 405 @return tuple of watch expression and a flag to indicate, that a
406 watch expression may be deleted (bdb.Breakpoint, boolean) 406 temporary watch expression may be deleted (bdb.Breakpoint, boolean)
407 """ 407 """
408 possibles = bdb.Breakpoint.bplist["Watch", 0] 408 possibles = bdb.Breakpoint.bplist["Watch", 0]
409 for i in range(0, len(possibles)): 409 for i in range(0, len(possibles)):
410 b = possibles[i] 410 b = possibles[i]
411 if b.enabled == 0: 411 if b.enabled == 0:
412 continue 412 continue
413 if not b.cond: 413 if not b.cond:
414 # watch expression without expression shouldn't occur, just ignore it 414 # watch expression without expression shouldn't occur,
415 # just ignore it
415 continue 416 continue
416 try: 417 try:
417 val = eval(b.condition, frame.f_globals, frame.f_locals) 418 val = eval(b.condition, frame.f_globals, frame.f_locals)
418 if b.special: 419 if b.special:
419 if b.special == '??created??': 420 if b.special == '??created??':
499 self.canonic(self.fix_frame_filename(frame)) in self.breaks or \ 500 self.canonic(self.fix_frame_filename(frame)) in self.breaks or \
500 ("Watch" in self.breaks and self.breaks["Watch"]) 501 ("Watch" in self.breaks and self.breaks["Watch"])
501 502
502 def get_break(self, filename, lineno): 503 def get_break(self, filename, lineno):
503 """ 504 """
504 Reimplemented from bdb.py to get the first breakpoint of a particular line. 505 Reimplemented from bdb.py to get the first breakpoint of a particular
506 line.
505 507
506 Because eric5 supports only one breakpoint per line, this overwritten 508 Because eric5 supports only one breakpoint per line, this overwritten
507 method will return this one and only breakpoint. 509 method will return this one and only breakpoint.
508 510
509 @param filename filename of the bp to retrieve (string) 511 @param filename filename of the bp to retrieve (string)
521 523
522 @param filename name of the file the bp belongs to 524 @param filename name of the file the bp belongs to
523 @param lineno linenumber of the bp 525 @param lineno linenumber of the bp
524 """ 526 """
525 self.clear_break(filename, lineno) 527 self.clear_break(filename, lineno)
526 self._dbgClient.write('%s%s,%d\n' % (ResponseClearBreak, filename, lineno)) 528 self._dbgClient.write('%s%s,%d\n' % (ResponseClearBreak, filename,
529 lineno))
527 530
528 def getStack(self): 531 def getStack(self):
529 """ 532 """
530 Public method to get the stack. 533 Public method to get the stack.
531 534
651 else: 654 else:
652 exclist = [message, [filename, linenr, charnr]] 655 exclist = [message, [filename, linenr, charnr]]
653 realSyntaxError = os.path.exists(filename) 656 realSyntaxError = os.path.exists(filename)
654 657
655 if realSyntaxError: 658 if realSyntaxError:
656 self._dbgClient.write("%s%s\n" % (ResponseSyntax, unicode(exclist))) 659 self._dbgClient.write("%s%s\n" % (ResponseSyntax,
660 unicode(exclist)))
657 self._dbgClient.eventLoop() 661 self._dbgClient.eventLoop()
658 return 662 return
659 663
660 if type(exctype) in [types.ClassType, # Python up to 2.4 664 if type(exctype) in [types.ClassType, # Python up to 2.4
661 types.TypeType]: # Python 2.5+ 665 types.TypeType]: # Python 2.5+

eric ide

mercurial