Debugger/DebuggerInterfacePython3.py

branch
jsonrpc
changeset 5120
c5189d404cc7
parent 5119
80bd41498eef
child 5124
1ba8ee313b57
equal deleted inserted replaced
5119:80bd41498eef 5120:c5189d404cc7
480 """ 480 """
481 self.__scriptName = os.path.abspath(fn) 481 self.__scriptName = os.path.abspath(fn)
482 482
483 wd = self.translate(wd, False) 483 wd = self.translate(wd, False)
484 fn = self.translate(os.path.abspath(fn), False) 484 fn = self.translate(os.path.abspath(fn), False)
485 self.__sendCommand('{0}{1}\n'.format( 485 ## self.__sendCommand('{0}{1}\n'.format(
486 DebugProtocol.RequestForkMode, repr((autoFork, forkChild)))) 486 ## DebugProtocol.RequestForkMode, repr((autoFork, forkChild))))
487 self.__sendCommand('{0}{1}|{2}|{3}\n'.format( 487 ## self.__sendCommand('{0}{1}|{2}|{3}\n'.format(
488 DebugProtocol.RequestRun, wd, fn, 488 ## DebugProtocol.RequestRun, wd, fn,
489 str(Utilities.parseOptionString(argv)))) 489 ## str(Utilities.parseOptionString(argv))))
490 self.__sendJsonCommand("RequestRun", {
491 "workdir": wd,
492 "filename": fn,
493 "argv": Utilities.parseOptionString(argv),
494 "autofork": autoFork,
495 "forkChild": forkChild,
496 })
490 497
491 def remoteCoverage(self, fn, argv, wd, erase=False): 498 def remoteCoverage(self, fn, argv, wd, erase=False):
492 """ 499 """
493 Public method to load a new program to collect coverage data. 500 Public method to load a new program to collect coverage data.
494 501
500 """ 507 """
501 self.__scriptName = os.path.abspath(fn) 508 self.__scriptName = os.path.abspath(fn)
502 509
503 wd = self.translate(wd, False) 510 wd = self.translate(wd, False)
504 fn = self.translate(os.path.abspath(fn), False) 511 fn = self.translate(os.path.abspath(fn), False)
505 self.__sendCommand('{0}{1}@@{2}@@{3}@@{4:d}\n'.format( 512 ## self.__sendCommand('{0}{1}@@{2}@@{3}@@{4:d}\n'.format(
506 DebugProtocol.RequestCoverage, wd, fn, 513 ## DebugProtocol.RequestCoverage, wd, fn,
507 str(Utilities.parseOptionString(argv)), 514 ## str(Utilities.parseOptionString(argv)),
508 erase)) 515 ## erase))
516 self.__sendJsonCommand("RequestCoverage", {
517 "workdir": wd,
518 "filename": fn,
519 "argv": Utilities.parseOptionString(argv),
520 "erase": erase,
521 })
509 522
510 def remoteProfile(self, fn, argv, wd, erase=False): 523 def remoteProfile(self, fn, argv, wd, erase=False):
511 """ 524 """
512 Public method to load a new program to collect profiling data. 525 Public method to load a new program to collect profiling data.
513 526
519 """ 532 """
520 self.__scriptName = os.path.abspath(fn) 533 self.__scriptName = os.path.abspath(fn)
521 534
522 wd = self.translate(wd, False) 535 wd = self.translate(wd, False)
523 fn = self.translate(os.path.abspath(fn), False) 536 fn = self.translate(os.path.abspath(fn), False)
524 self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format( 537 ## self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format(
525 DebugProtocol.RequestProfile, wd, fn, 538 ## DebugProtocol.RequestProfile, wd, fn,
526 str(Utilities.parseOptionString(argv)), erase)) 539 ## str(Utilities.parseOptionString(argv)), erase))
540 self.__sendJsonCommand("RequestProfile", {
541 "workdir": wd,
542 "filename": fn,
543 "argv": Utilities.parseOptionString(argv),
544 "erase": erase,
545 })
527 546
528 def remoteStatement(self, stmt): 547 def remoteStatement(self, stmt):
529 """ 548 """
530 Public method to execute a Python statement. 549 Public method to execute a Python statement.
531 550
532 @param stmt the Python statement to execute (string). It 551 @param stmt the Python statement to execute (string). It
533 should not have a trailing newline. 552 should not have a trailing newline.
534 """ 553 """
535 self.__sendCommand('{0}\n'.format(stmt)) 554 ## self.__sendCommand('{0}\n'.format(stmt))
536 self.__sendCommand(DebugProtocol.RequestOK + '\n') 555 ## self.__sendCommand(DebugProtocol.RequestOK + '\n')
556 self.__sendJsonCommand("ExecuteStatement", {
557 "statement": stmt,
558 })
537 559
538 def remoteStep(self): 560 def remoteStep(self):
539 """ 561 """
540 Public method to single step the debugged program. 562 Public method to single step the debugged program.
541 """ 563 """
542 self.__sendCommand(DebugProtocol.RequestStep + '\n') 564 ## self.__sendCommand(DebugProtocol.RequestStep + '\n')
565 self.__sendJsonCommand("RequestStep", {})
543 566
544 def remoteStepOver(self): 567 def remoteStepOver(self):
545 """ 568 """
546 Public method to step over the debugged program. 569 Public method to step over the debugged program.
547 """ 570 """
548 self.__sendCommand(DebugProtocol.RequestStepOver + '\n') 571 ## self.__sendCommand(DebugProtocol.RequestStepOver + '\n')
572 self.__sendJsonCommand("RequestStepOver", {})
549 573
550 def remoteStepOut(self): 574 def remoteStepOut(self):
551 """ 575 """
552 Public method to step out the debugged program. 576 Public method to step out the debugged program.
553 """ 577 """
554 self.__sendCommand(DebugProtocol.RequestStepOut + '\n') 578 ## self.__sendCommand(DebugProtocol.RequestStepOut + '\n')
579 self.__sendJsonCommand("RequestStepOut", {})
555 580
556 def remoteStepQuit(self): 581 def remoteStepQuit(self):
557 """ 582 """
558 Public method to stop the debugged program. 583 Public method to stop the debugged program.
559 """ 584 """
560 self.__sendCommand(DebugProtocol.RequestStepQuit + '\n') 585 ## self.__sendCommand(DebugProtocol.RequestStepQuit + '\n')
586 self.__sendJsonCommand("RequestStepQuit", {})
561 587
562 def remoteContinue(self, special=False): 588 def remoteContinue(self, special=False):
563 """ 589 """
564 Public method to continue the debugged program. 590 Public method to continue the debugged program.
565 591
566 @param special flag indicating a special continue operation 592 @param special flag indicating a special continue operation
567 """ 593 """
568 self.__sendCommand('{0}{1:d}\n'.format( 594 ## self.__sendCommand('{0}{1:d}\n'.format(
569 DebugProtocol.RequestContinue, special)) 595 ## DebugProtocol.RequestContinue, special))
596 self.__sendJsonCommand("RequestContinue", {
597 "special": special,
598 })
570 599
571 def remoteBreakpoint(self, fn, line, set, cond=None, temp=False): 600 def remoteBreakpoint(self, fn, line, set, cond=None, temp=False):
572 """ 601 """
573 Public method to set or clear a breakpoint. 602 Public method to set or clear a breakpoint.
574 603
648 """ 677 """
649 Public method to send the raw input to the debugged program. 678 Public method to send the raw input to the debugged program.
650 679
651 @param s the raw input (string) 680 @param s the raw input (string)
652 """ 681 """
653 self.__sendCommand(s + '\n') 682 ## self.__sendCommand(s + '\n')
683 self.__sendJsonCommand("RawInput", {
684 "input": s,
685 })
654 686
655 def remoteThreadList(self): 687 def remoteThreadList(self):
656 """ 688 """
657 Public method to request the list of threads from the client. 689 Public method to request the list of threads from the client.
658 """ 690 """
900 except IndexError: 932 except IndexError:
901 variables = [] 933 variables = []
902 self.debugServer.signalClientVariable(scope, variables) 934 self.debugServer.signalClientVariable(scope, variables)
903 continue 935 continue
904 936
905 if resp == DebugProtocol.ResponseOK: 937 ## if resp == DebugProtocol.ResponseOK:
906 self.debugServer.signalClientStatement(False) 938 ## self.debugServer.signalClientStatement(False)
907 continue 939 ## continue
908 940 ##
909 if resp == DebugProtocol.ResponseContinue: 941 ## if resp == DebugProtocol.ResponseContinue:
910 self.debugServer.signalClientStatement(True) 942 ## self.debugServer.signalClientStatement(True)
911 continue 943 ## continue
912 944 ##
913 if resp == DebugProtocol.ResponseException: 945 if resp == DebugProtocol.ResponseException:
914 exc = line[eoc:-1] 946 exc = line[eoc:-1]
915 exc = self.translate(exc, True) 947 exc = self.translate(exc, True)
916 try: 948 try:
917 exclist = eval(exc) 949 exclist = eval(exc)
986 if resp == DebugProtocol.ResponseWPConditionError: 1018 if resp == DebugProtocol.ResponseWPConditionError:
987 cond = line[eoc:-1] 1019 cond = line[eoc:-1]
988 self.debugServer.signalClientWatchConditionError(cond) 1020 self.debugServer.signalClientWatchConditionError(cond)
989 continue 1021 continue
990 1022
991 if resp == DebugProtocol.ResponseRaw: 1023 ## if resp == DebugProtocol.ResponseRaw:
992 prompt, echo = eval(line[eoc:-1]) 1024 ## prompt, echo = eval(line[eoc:-1])
993 self.debugServer.signalClientRawInput(prompt, echo) 1025 ## self.debugServer.signalClientRawInput(prompt, echo)
994 continue 1026 ## continue
995 1027 ##
996 ## if resp == DebugProtocol.ResponseBanner: 1028 ## if resp == DebugProtocol.ResponseBanner:
997 ## version, platform, dbgclient = eval(line[eoc:-1]) 1029 ## version, platform, dbgclient = eval(line[eoc:-1])
998 ## self.debugServer.signalClientBanner( 1030 ## self.debugServer.signalClientBanner(
999 ## version, platform, dbgclient) 1031 ## version, platform, dbgclient)
1000 ## continue 1032 ## continue
1096 self.debugServer.signalClientBanner( 1128 self.debugServer.signalClientBanner(
1097 params["version"], 1129 params["version"],
1098 params["platform"], 1130 params["platform"],
1099 params["dbgclient"]) 1131 params["dbgclient"])
1100 return 1132 return
1133
1134 if method == "ResponseOK":
1135 self.debugServer.signalClientStatement(False)
1136 return
1137
1138 if method == "ResponseContinue":
1139 self.debugServer.signalClientStatement(True)
1140 return
1141
1142 if method == "RequestRaw":
1143 self.debugServer.signalClientRawInput(
1144 params["prompt"], params["echo"])
1145 return
1101 1146
1102 def __sendCommand(self, cmd): 1147 def __sendCommand(self, cmd):
1103 """ 1148 """
1104 Private method to send a single line command to the client. 1149 Private method to send a single line command to the client.
1105 1150

eric ide

mercurial