403 def __effective(self, frame): |
403 def __effective(self, frame): |
404 """ |
404 """ |
405 Private method to determine, if a watch expression is effective. |
405 Private method to determine, if a watch expression is effective. |
406 |
406 |
407 @param frame the current execution frame |
407 @param frame the current execution frame |
408 @return tuple of watch expression and a flag to indicate, that a temporary |
408 @return tuple of watch expression and a flag to indicate, that a |
409 watch expression may be deleted (bdb.Breakpoint, boolean) |
409 temporary watch expression may be deleted (bdb.Breakpoint, boolean) |
410 """ |
410 """ |
411 possibles = bdb.Breakpoint.bplist["Watch", 0] |
411 possibles = bdb.Breakpoint.bplist["Watch", 0] |
412 for i in range(0, len(possibles)): |
412 for i in range(0, len(possibles)): |
413 b = possibles[i] |
413 b = possibles[i] |
414 if not b.enabled: |
414 if not b.enabled: |
415 continue |
415 continue |
416 if not b.cond: |
416 if not b.cond: |
417 # watch expression without expression shouldn't occur, just ignore it |
417 # watch expression without expression shouldn't occur, |
|
418 # just ignore it |
418 continue |
419 continue |
419 try: |
420 try: |
420 val = eval(b.condition, frame.f_globals, frame.f_locals) |
421 val = eval(b.condition, frame.f_globals, frame.f_locals) |
421 if b.special: |
422 if b.special: |
422 if b.special == '??created??': |
423 if b.special == '??created??': |
469 |
470 |
470 if filename in self.breaks: |
471 if filename in self.breaks: |
471 lineno = frame.f_lineno |
472 lineno = frame.f_lineno |
472 if lineno not in self.breaks[filename]: |
473 if lineno not in self.breaks[filename]: |
473 # The line itself has no breakpoint, but maybe the line is the |
474 # The line itself has no breakpoint, but maybe the line is the |
474 # first line of a function with breakpoint set by function name. |
475 # first line of a function with breakpoint set by function |
|
476 # name. |
475 lineno = frame.f_code.co_firstlineno |
477 lineno = frame.f_code.co_firstlineno |
476 if lineno in self.breaks[filename]: |
478 if lineno in self.breaks[filename]: |
477 # flag says ok to delete temp. bp |
479 # flag says ok to delete temp. bp |
478 (bp, flag) = bdb.effective(filename, lineno, frame) |
480 (bp, flag) = bdb.effective(filename, lineno, frame) |
479 if bp: |
481 if bp: |
507 self.canonic(self.fix_frame_filename(frame)) in self.breaks or \ |
509 self.canonic(self.fix_frame_filename(frame)) in self.breaks or \ |
508 ("Watch" in self.breaks and self.breaks["Watch"]) |
510 ("Watch" in self.breaks and self.breaks["Watch"]) |
509 |
511 |
510 def get_break(self, filename, lineno): |
512 def get_break(self, filename, lineno): |
511 """ |
513 """ |
512 Reimplemented from bdb.py to get the first breakpoint of a particular line. |
514 Reimplemented from bdb.py to get the first breakpoint of a particular |
|
515 line. |
513 |
516 |
514 Because eric5 supports only one breakpoint per line, this overwritten |
517 Because eric5 supports only one breakpoint per line, this overwritten |
515 method will return this one and only breakpoint. |
518 method will return this one and only breakpoint. |
516 |
519 |
517 @param filename the filename of the bp to retrieve (string) |
520 @param filename the filename of the bp to retrieve (string) |
552 if ffunc == '?': |
555 if ffunc == '?': |
553 ffunc = '' |
556 ffunc = '' |
554 |
557 |
555 if ffunc and not ffunc.startswith("<"): |
558 if ffunc and not ffunc.startswith("<"): |
556 argInfo = inspect.getargvalues(fr) |
559 argInfo = inspect.getargvalues(fr) |
557 fargs = inspect.formatargvalues(argInfo.args, argInfo.varargs, |
560 fargs = inspect.formatargvalues( |
558 argInfo.keywords, argInfo.locals) |
561 argInfo.args, argInfo.varargs, |
|
562 argInfo.keywords, argInfo.locals) |
559 else: |
563 else: |
560 fargs = "" |
564 fargs = "" |
561 |
565 |
562 stack.append([fname, fline, ffunc, fargs]) |
566 stack.append([fname, fline, ffunc, fargs]) |
563 |
567 |
609 if ffunc == '?': |
613 if ffunc == '?': |
610 ffunc = '' |
614 ffunc = '' |
611 |
615 |
612 if ffunc and not ffunc.startswith("<"): |
616 if ffunc and not ffunc.startswith("<"): |
613 argInfo = inspect.getargvalues(fr) |
617 argInfo = inspect.getargvalues(fr) |
614 fargs = inspect.formatargvalues(argInfo.args, argInfo.varargs, |
618 fargs = inspect.formatargvalues( |
615 argInfo.keywords, argInfo.locals) |
619 argInfo.args, argInfo.varargs, |
|
620 argInfo.keywords, argInfo.locals) |
616 else: |
621 else: |
617 fargs = "" |
622 fargs = "" |
618 |
623 |
619 stack.append([fname, fline, ffunc, fargs]) |
624 stack.append([fname, fline, ffunc, fargs]) |
620 |
625 |
653 self._dbgClient.progTerminated(excval.code) |
658 self._dbgClient.progTerminated(excval.code) |
654 return |
659 return |
655 |
660 |
656 if exctype in [SyntaxError, IndentationError]: |
661 if exctype in [SyntaxError, IndentationError]: |
657 try: |
662 try: |
658 message, (filename, linenr, charnr, text) = excval[0], excval[1] |
663 message, (filename, linenr, charnr, text) = \ |
|
664 excval[0], excval[1] |
659 except ValueError: |
665 except ValueError: |
660 exclist = [] |
666 exclist = [] |
661 realSyntaxError = True |
667 realSyntaxError = True |
662 else: |
668 else: |
663 exclist = [message, [filename, linenr, charnr]] |
669 exclist = [message, [filename, linenr, charnr]] |
664 realSyntaxError = os.path.exists(filename) |
670 realSyntaxError = os.path.exists(filename) |
665 |
671 |
666 if realSyntaxError: |
672 if realSyntaxError: |
667 self._dbgClient.write("{0}{1}\n".format(ResponseSyntax, str(exclist))) |
673 self._dbgClient.write("{0}{1}\n".format( |
|
674 ResponseSyntax, str(exclist))) |
668 self._dbgClient.eventLoop() |
675 self._dbgClient.eventLoop() |
669 return |
676 return |
670 |
677 |
671 exctype = self.__extractExceptionName(exctype) |
678 exctype = self.__extractExceptionName(exctype) |
672 |
679 |
703 if ffunc == '?': |
710 if ffunc == '?': |
704 ffunc = '' |
711 ffunc = '' |
705 |
712 |
706 if ffunc and not ffunc.startswith("<"): |
713 if ffunc and not ffunc.startswith("<"): |
707 argInfo = inspect.getargvalues(fr) |
714 argInfo = inspect.getargvalues(fr) |
708 fargs = inspect.formatargvalues(argInfo.args, argInfo.varargs, |
715 fargs = inspect.formatargvalues( |
709 argInfo.keywords, argInfo.locals) |
716 argInfo.args, argInfo.varargs, |
|
717 argInfo.keywords, argInfo.locals) |
710 else: |
718 else: |
711 fargs = "" |
719 fargs = "" |
712 |
720 |
713 exclist.append([filename, linenr, ffunc, fargs]) |
721 exclist.append([filename, linenr, ffunc, fargs]) |
714 |
722 |
715 self._dbgClient.write("{0}{1}\n".format(ResponseException, str(exclist))) |
723 self._dbgClient.write("{0}{1}\n".format( |
|
724 ResponseException, str(exclist))) |
716 |
725 |
717 if exctb is None: |
726 if exctb is None: |
718 return |
727 return |
719 |
728 |
720 self._dbgClient.eventLoop() |
729 self._dbgClient.eventLoop() |