386 """ |
386 """ |
387 Public method to set the environment for a program to debug, run, ... |
387 Public method to set the environment for a program to debug, run, ... |
388 |
388 |
389 @param env environment settings (dictionary) |
389 @param env environment settings (dictionary) |
390 """ |
390 """ |
391 self.__sendCommand('{0}{1}\n'.format(RequestEnv, str(env))) |
391 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEnv, str(env))) |
392 |
392 |
393 def remoteLoad(self, fn, argv, wd, traceInterpreter=False, autoContinue=True, |
393 def remoteLoad(self, fn, argv, wd, traceInterpreter=False, autoContinue=True, |
394 autoFork=False, forkChild=False): |
394 autoFork=False, forkChild=False): |
395 """ |
395 """ |
396 Public method to load a new program to debug. |
396 Public method to load a new program to debug. |
409 self.__autoContinue = autoContinue |
409 self.__autoContinue = autoContinue |
410 |
410 |
411 wd = self.translate(wd, False) |
411 wd = self.translate(wd, False) |
412 fn = self.translate(os.path.abspath(fn), False) |
412 fn = self.translate(os.path.abspath(fn), False) |
413 self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format( |
413 self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format( |
414 RequestLoad, wd, fn, str(Utilities.parseOptionString(argv)), |
414 DebugProtocol.RequestLoad, wd, fn, str(Utilities.parseOptionString(argv)), |
415 traceInterpreter)) |
415 traceInterpreter)) |
416 |
416 |
417 def remoteRun(self, fn, argv, wd, autoFork=False, forkChild=False): |
417 def remoteRun(self, fn, argv, wd, autoFork=False, forkChild=False): |
418 """ |
418 """ |
419 Public method to load a new program to run. |
419 Public method to load a new program to run. |
426 (boolean) (ignored) |
426 (boolean) (ignored) |
427 """ |
427 """ |
428 wd = self.translate(wd, False) |
428 wd = self.translate(wd, False) |
429 fn = self.translate(os.path.abspath(fn), False) |
429 fn = self.translate(os.path.abspath(fn), False) |
430 self.__sendCommand('{0}{1}|{2}|{3}\n'.format( |
430 self.__sendCommand('{0}{1}|{2}|{3}\n'.format( |
431 RequestRun, wd, fn, str(Utilities.parseOptionString(argv)))) |
431 DebugProtocol.RequestRun, wd, fn, str(Utilities.parseOptionString(argv)))) |
432 |
432 |
433 def remoteCoverage(self, fn, argv, wd, erase=False): |
433 def remoteCoverage(self, fn, argv, wd, erase=False): |
434 """ |
434 """ |
435 Public method to load a new program to collect coverage data. |
435 Public method to load a new program to collect coverage data. |
436 |
436 |
459 |
459 |
460 @param stmt the Ruby statement to execute (string). It |
460 @param stmt the Ruby statement to execute (string). It |
461 should not have a trailing newline. |
461 should not have a trailing newline. |
462 """ |
462 """ |
463 self.__sendCommand('{0}\n'.format(stmt)) |
463 self.__sendCommand('{0}\n'.format(stmt)) |
464 self.__sendCommand(RequestOK + '\n') |
464 self.__sendCommand(DebugProtocol.RequestOK + '\n') |
465 |
465 |
466 def remoteStep(self): |
466 def remoteStep(self): |
467 """ |
467 """ |
468 Public method to single step the debugged program. |
468 Public method to single step the debugged program. |
469 """ |
469 """ |
470 self.__sendCommand(RequestStep + '\n') |
470 self.__sendCommand(DebugProtocol.RequestStep + '\n') |
471 |
471 |
472 def remoteStepOver(self): |
472 def remoteStepOver(self): |
473 """ |
473 """ |
474 Public method to step over the debugged program. |
474 Public method to step over the debugged program. |
475 """ |
475 """ |
476 self.__sendCommand(RequestStepOver + '\n') |
476 self.__sendCommand(DebugProtocol.RequestStepOver + '\n') |
477 |
477 |
478 def remoteStepOut(self): |
478 def remoteStepOut(self): |
479 """ |
479 """ |
480 Public method to step out the debugged program. |
480 Public method to step out the debugged program. |
481 """ |
481 """ |
482 self.__sendCommand(RequestStepOut + '\n') |
482 self.__sendCommand(DebugProtocol.RequestStepOut + '\n') |
483 |
483 |
484 def remoteStepQuit(self): |
484 def remoteStepQuit(self): |
485 """ |
485 """ |
486 Public method to stop the debugged program. |
486 Public method to stop the debugged program. |
487 """ |
487 """ |
488 self.__sendCommand(RequestStepQuit + '\n') |
488 self.__sendCommand(DebugProtocol.RequestStepQuit + '\n') |
489 |
489 |
490 def remoteContinue(self, special=False): |
490 def remoteContinue(self, special=False): |
491 """ |
491 """ |
492 Public method to continue the debugged program. |
492 Public method to continue the debugged program. |
493 |
493 |
494 @param special flag indicating a special continue operation (boolean) |
494 @param special flag indicating a special continue operation (boolean) |
495 """ |
495 """ |
496 self.__sendCommand('{0}{1:d}\n'.format(RequestContinue, special)) |
496 self.__sendCommand('{0}{1:d}\n'.format(DebugProtocol.RequestContinue, special)) |
497 |
497 |
498 def remoteBreakpoint(self, fn, line, set, cond=None, temp=False): |
498 def remoteBreakpoint(self, fn, line, set, cond=None, temp=False): |
499 """ |
499 """ |
500 Public method to set or clear a breakpoint. |
500 Public method to set or clear a breakpoint. |
501 |
501 |
505 @param cond condition of the breakpoint (string) |
505 @param cond condition of the breakpoint (string) |
506 @param temp flag indicating a temporary breakpoint (boolean) |
506 @param temp flag indicating a temporary breakpoint (boolean) |
507 """ |
507 """ |
508 fn = self.translate(fn, False) |
508 fn = self.translate(fn, False) |
509 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}@@{4:d}@@{5}\n'.format( |
509 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}@@{4:d}@@{5}\n'.format( |
510 RequestBreak, fn, line, temp, set, cond)) |
510 DebugProtocol.RequestBreak, fn, line, temp, set, cond)) |
511 |
511 |
512 def remoteBreakpointEnable(self, fn, line, enable): |
512 def remoteBreakpointEnable(self, fn, line, enable): |
513 """ |
513 """ |
514 Public method to enable or disable a breakpoint. |
514 Public method to enable or disable a breakpoint. |
515 |
515 |
517 @param line linenumber of the breakpoint (int) |
517 @param line linenumber of the breakpoint (int) |
518 @param enable flag indicating enabling or disabling a breakpoint (boolean) |
518 @param enable flag indicating enabling or disabling a breakpoint (boolean) |
519 """ |
519 """ |
520 fn = self.translate(fn, False) |
520 fn = self.translate(fn, False) |
521 self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( |
521 self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( |
522 RequestBreakEnable, fn, line, enable)) |
522 DebugProtocol.RequestBreakEnable, fn, line, enable)) |
523 |
523 |
524 def remoteBreakpointIgnore(self, fn, line, count): |
524 def remoteBreakpointIgnore(self, fn, line, count): |
525 """ |
525 """ |
526 Public method to ignore a breakpoint the next couple of occurrences. |
526 Public method to ignore a breakpoint the next couple of occurrences. |
527 |
527 |
529 @param line linenumber of the breakpoint (int) |
529 @param line linenumber of the breakpoint (int) |
530 @param count number of occurrences to ignore (int) |
530 @param count number of occurrences to ignore (int) |
531 """ |
531 """ |
532 fn = self.translate(fn, False) |
532 fn = self.translate(fn, False) |
533 self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( |
533 self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( |
534 RequestBreakIgnore, fn, line, count)) |
534 DebugProtocol.RequestBreakIgnore, fn, line, count)) |
535 |
535 |
536 def remoteWatchpoint(self, cond, set, temp=False): |
536 def remoteWatchpoint(self, cond, set, temp=False): |
537 """ |
537 """ |
538 Public method to set or clear a watch expression. |
538 Public method to set or clear a watch expression. |
539 |
539 |
540 @param cond expression of the watch expression (string) |
540 @param cond expression of the watch expression (string) |
541 @param set flag indicating setting or resetting a watch expression (boolean) |
541 @param set flag indicating setting or resetting a watch expression (boolean) |
542 @param temp flag indicating a temporary watch expression (boolean) |
542 @param temp flag indicating a temporary watch expression (boolean) |
543 """ |
543 """ |
544 # cond is combination of cond and special (s. watch expression viewer) |
544 # cond is combination of cond and special (s. watch expression viewer) |
545 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}\n'.format(RequestWatch, cond, temp, set)) |
545 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}\n'.format( |
|
546 DebugProtocol.RequestWatch, cond, temp, set)) |
546 |
547 |
547 def remoteWatchpointEnable(self, cond, enable): |
548 def remoteWatchpointEnable(self, cond, enable): |
548 """ |
549 """ |
549 Public method to enable or disable a watch expression. |
550 Public method to enable or disable a watch expression. |
550 |
551 |
551 @param cond expression of the watch expression (string) |
552 @param cond expression of the watch expression (string) |
552 @param enable flag indicating enabling or disabling a watch expression (boolean) |
553 @param enable flag indicating enabling or disabling a watch expression (boolean) |
553 """ |
554 """ |
554 # cond is combination of cond and special (s. watch expression viewer) |
555 # cond is combination of cond and special (s. watch expression viewer) |
555 self.__sendCommand('{0}{1},{2:d}\n'.format(RequestWatchEnable, cond, enable)) |
556 self.__sendCommand('{0}{1},{2:d}\n'.format( |
|
557 DebugProtocol.RequestWatchEnable, cond, enable)) |
556 |
558 |
557 def remoteWatchpointIgnore(self, cond, count): |
559 def remoteWatchpointIgnore(self, cond, count): |
558 """ |
560 """ |
559 Public method to ignore a watch expression the next couple of occurrences. |
561 Public method to ignore a watch expression the next couple of occurrences. |
560 |
562 |
561 @param cond expression of the watch expression (string) |
563 @param cond expression of the watch expression (string) |
562 @param count number of occurrences to ignore (int) |
564 @param count number of occurrences to ignore (int) |
563 """ |
565 """ |
564 # cond is combination of cond and special (s. watch expression viewer) |
566 # cond is combination of cond and special (s. watch expression viewer) |
565 self.__sendCommand('{0}{1},{2:d}\n'.format(RequestWatchIgnore, cond, count)) |
567 self.__sendCommand('{0}{1},{2:d}\n'.format( |
|
568 DebugProtocol.RequestWatchIgnore, cond, count)) |
566 |
569 |
567 def remoteRawInput(self, s): |
570 def remoteRawInput(self, s): |
568 """ |
571 """ |
569 Public method to send the raw input to the debugged program. |
572 Public method to send the raw input to the debugged program. |
570 |
573 |
593 @param scope the scope of the variables (0 = local, 1 = global) |
596 @param scope the scope of the variables (0 = local, 1 = global) |
594 @param filter list of variable types to filter out (list of int) |
597 @param filter list of variable types to filter out (list of int) |
595 @param framenr framenumber of the variables to retrieve (int) |
598 @param framenr framenumber of the variables to retrieve (int) |
596 """ |
599 """ |
597 self.__sendCommand('{0}{1:d}, {2:d}, {3}\n'.format( |
600 self.__sendCommand('{0}{1:d}, {2:d}, {3}\n'.format( |
598 RequestVariables, framenr, scope, str(filter))) |
601 DebugProtocol.RequestVariables, framenr, scope, str(filter))) |
599 |
602 |
600 def remoteClientVariable(self, scope, filter, var, framenr=0): |
603 def remoteClientVariable(self, scope, filter, var, framenr=0): |
601 """ |
604 """ |
602 Public method to request the variables of the debugged program. |
605 Public method to request the variables of the debugged program. |
603 |
606 |
605 @param filter list of variable types to filter out (list of int) |
608 @param filter list of variable types to filter out (list of int) |
606 @param var list encoded name of variable to retrieve (string) |
609 @param var list encoded name of variable to retrieve (string) |
607 @param framenr framenumber of the variables to retrieve (int) |
610 @param framenr framenumber of the variables to retrieve (int) |
608 """ |
611 """ |
609 self.__sendCommand('{0}{1}, {2:d}, {3:d}, {4}\n'.format( |
612 self.__sendCommand('{0}{1}, {2:d}, {3:d}, {4}\n'.format( |
610 RequestVariable, str(var), framenr, scope, str(filter))) |
613 DebugProtocol.RequestVariable, str(var), framenr, scope, str(filter))) |
611 |
614 |
612 def remoteClientSetFilter(self, scope, filter): |
615 def remoteClientSetFilter(self, scope, filter): |
613 """ |
616 """ |
614 Public method to set a variables filter list. |
617 Public method to set a variables filter list. |
615 |
618 |
616 @param scope the scope of the variables (0 = local, 1 = global) |
619 @param scope the scope of the variables (0 = local, 1 = global) |
617 @param filter regexp string for variable names to filter out (string) |
620 @param filter regexp string for variable names to filter out (string) |
618 """ |
621 """ |
619 self.__sendCommand('{0}{1:d}, "{2}"\n'.format(RequestSetFilter, scope, filter)) |
622 self.__sendCommand('{0}{1:d}, "{2}"\n'.format( |
|
623 DebugProtocol.RequestSetFilter, scope, filter)) |
620 |
624 |
621 def remoteEval(self, arg): |
625 def remoteEval(self, arg): |
622 """ |
626 """ |
623 Public method to evaluate arg in the current context of the debugged program. |
627 Public method to evaluate arg in the current context of the debugged program. |
624 |
628 |
625 @param arg the arguments to evaluate (string) |
629 @param arg the arguments to evaluate (string) |
626 """ |
630 """ |
627 self.__sendCommand('{0}{1}\n'.format(RequestEval, arg)) |
631 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEval, arg)) |
628 |
632 |
629 def remoteExec(self, stmt): |
633 def remoteExec(self, stmt): |
630 """ |
634 """ |
631 Public method to execute stmt in the current context of the debugged program. |
635 Public method to execute stmt in the current context of the debugged program. |
632 |
636 |
633 @param stmt statement to execute (string) |
637 @param stmt statement to execute (string) |
634 """ |
638 """ |
635 self.__sendCommand('{0}{1}\n'.format(RequestExec, stmt)) |
639 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestExec, stmt)) |
636 |
640 |
637 def remoteBanner(self): |
641 def remoteBanner(self): |
638 """ |
642 """ |
639 Public slot to get the banner info of the remote client. |
643 Public slot to get the banner info of the remote client. |
640 """ |
644 """ |
641 self.__sendCommand(RequestBanner + '\n') |
645 self.__sendCommand(DebugProtocol.RequestBanner + '\n') |
642 |
646 |
643 def remoteCapabilities(self): |
647 def remoteCapabilities(self): |
644 """ |
648 """ |
645 Public slot to get the debug clients capabilities. |
649 Public slot to get the debug clients capabilities. |
646 """ |
650 """ |
647 self.__sendCommand(RequestCapabilities + '\n') |
651 self.__sendCommand(DebugProtocol.RequestCapabilities + '\n') |
648 |
652 |
649 def remoteCompletion(self, text): |
653 def remoteCompletion(self, text): |
650 """ |
654 """ |
651 Public slot to get the a list of possible commandline completions |
655 Public slot to get the a list of possible commandline completions |
652 from the remote client. |
656 from the remote client. |
653 |
657 |
654 @param text the text to be completed (string) |
658 @param text the text to be completed (string) |
655 """ |
659 """ |
656 self.__sendCommand("{0}{1}\n".format(RequestCompletion, text)) |
660 self.__sendCommand("{0}{1}\n".format(DebugProtocol.RequestCompletion, text)) |
657 |
661 |
658 def remoteUTPrepare(self, fn, tn, tfn, cov, covname, coverase): |
662 def remoteUTPrepare(self, fn, tn, tfn, cov, covname, coverase): |
659 """ |
663 """ |
660 Public method to prepare a new unittest run. |
664 Public method to prepare a new unittest run. |
661 |
665 |
725 else: |
729 else: |
726 self.debugServer.signalClientLine(cf[0], int(cf[1])) |
730 self.debugServer.signalClientLine(cf[0], int(cf[1])) |
727 self.debugServer.signalClientStack(stack) |
731 self.debugServer.signalClientStack(stack) |
728 continue |
732 continue |
729 |
733 |
730 if resp == ResponseVariables: |
734 if resp == DebugProtocol.ResponseVariables: |
731 vlist = eval(line[eoc:-1]) |
735 vlist = eval(line[eoc:-1]) |
732 scope = vlist[0] |
736 scope = vlist[0] |
733 try: |
737 try: |
734 variables = vlist[1:] |
738 variables = vlist[1:] |
735 except IndexError: |
739 except IndexError: |
736 variables = [] |
740 variables = [] |
737 self.debugServer.signalClientVariables(scope, variables) |
741 self.debugServer.signalClientVariables(scope, variables) |
738 continue |
742 continue |
739 |
743 |
740 if resp == ResponseVariable: |
744 if resp == DebugProtocol.ResponseVariable: |
741 vlist = eval(line[eoc:-1]) |
745 vlist = eval(line[eoc:-1]) |
742 scope = vlist[0] |
746 scope = vlist[0] |
743 try: |
747 try: |
744 variables = vlist[1:] |
748 variables = vlist[1:] |
745 except IndexError: |
749 except IndexError: |
746 variables = [] |
750 variables = [] |
747 self.debugServer.signalClientVariable(scope, variables) |
751 self.debugServer.signalClientVariable(scope, variables) |
748 continue |
752 continue |
749 |
753 |
750 if resp == ResponseOK: |
754 if resp == DebugProtocol.ResponseOK: |
751 self.debugServer.signalClientStatement(False) |
755 self.debugServer.signalClientStatement(False) |
752 continue |
756 continue |
753 |
757 |
754 if resp == ResponseContinue: |
758 if resp == DebugProtocol.ResponseContinue: |
755 self.debugServer.signalClientStatement(True) |
759 self.debugServer.signalClientStatement(True) |
756 continue |
760 continue |
757 |
761 |
758 if resp == ResponseException: |
762 if resp == DebugProtocol.ResponseException: |
759 exc = line[eoc:-1] |
763 exc = line[eoc:-1] |
760 exc = self.translate(exc, True) |
764 exc = self.translate(exc, True) |
761 try: |
765 try: |
762 exclist = eval(exc) |
766 exclist = eval(exc) |
763 exctype = exclist[0] |
767 exctype = exclist[0] |
783 ln = 0 |
787 ln = 0 |
784 cn = 0 |
788 cn = 0 |
785 self.debugServer.signalClientSyntaxError(message, fn, ln, cn) |
789 self.debugServer.signalClientSyntaxError(message, fn, ln, cn) |
786 continue |
790 continue |
787 |
791 |
788 if resp == ResponseExit: |
792 if resp == DebugProtocol.ResponseExit: |
789 self.debugServer.signalClientExit(line[eoc:-1]) |
793 self.debugServer.signalClientExit(line[eoc:-1]) |
790 continue |
794 continue |
791 |
795 |
792 if resp == ResponseClearBreak: |
796 if resp == DebugProtocol.ResponseClearBreak: |
793 fn, lineno = line[eoc:-1].split(',') |
797 fn, lineno = line[eoc:-1].split(',') |
794 lineno = int(lineno) |
798 lineno = int(lineno) |
795 fn = self.translate(fn, True) |
799 fn = self.translate(fn, True) |
796 self.debugServer.signalClientClearBreak(fn, lineno) |
800 self.debugServer.signalClientClearBreak(fn, lineno) |
797 continue |
801 continue |
798 |
802 |
799 if resp == ResponseClearWatch: |
803 if resp == DebugProtocol.ResponseClearWatch: |
800 cond = line[eoc:-1] |
804 cond = line[eoc:-1] |
801 self.debugServer.signalClientClearWatch(cond) |
805 self.debugServer.signalClientClearWatch(cond) |
802 continue |
806 continue |
803 |
807 |
804 if resp == ResponseBanner: |
808 if resp == DebugProtocol.ResponseBanner: |
805 version, platform, dbgclient = eval(line[eoc:-1]) |
809 version, platform, dbgclient = eval(line[eoc:-1]) |
806 self.debugServer.signalClientBanner(version, platform, dbgclient) |
810 self.debugServer.signalClientBanner(version, platform, dbgclient) |
807 continue |
811 continue |
808 |
812 |
809 if resp == ResponseCapabilities: |
813 if resp == DebugProtocol.ResponseCapabilities: |
810 cap, clType = eval(line[eoc:-1]) |
814 cap, clType = eval(line[eoc:-1]) |
811 self.clientCapabilities = cap |
815 self.clientCapabilities = cap |
812 self.debugServer.signalClientCapabilities(cap, clType) |
816 self.debugServer.signalClientCapabilities(cap, clType) |
813 continue |
817 continue |
814 |
818 |
815 if resp == ResponseCompletion: |
819 if resp == DebugProtocol.ResponseCompletion: |
816 clstring, text = line[eoc:-1].split('||') |
820 clstring, text = line[eoc:-1].split('||') |
817 cl = eval(clstring) |
821 cl = eval(clstring) |
818 self.debugServer.signalClientCompletionList(cl, text) |
822 self.debugServer.signalClientCompletionList(cl, text) |
819 continue |
823 continue |
820 |
824 |
821 if resp == PassiveStartup: |
825 if resp == DebugProtocol.PassiveStartup: |
822 fn, exc = line[eoc:-1].split('|') |
826 fn, exc = line[eoc:-1].split('|') |
823 exc = bool(exc) |
827 exc = bool(exc) |
824 fn = self.translate(fn, True) |
828 fn = self.translate(fn, True) |
825 self.debugServer.passiveStartUp(fn, exc) |
829 self.debugServer.passiveStartUp(fn, exc) |
826 continue |
830 continue |