Debugger/DebuggerInterfacePython3.py

changeset 2988
f53c03574697
parent 2302
f29e9405c851
child 3020
542e97d4ecb3
child 3057
10516539f238
equal deleted inserted replaced
2987:c99695c0f13a 2988:f53c03574697
71 self.qsock = None 71 self.qsock = None
72 self.queue = [] 72 self.queue = []
73 # set default values for capabilities of clients 73 # set default values for capabilities of clients
74 self.clientCapabilities = ClientDefaultCapabilities 74 self.clientCapabilities = ClientDefaultCapabilities
75 75
76 self.codec = QTextCodec.codecForName(str(Preferences.getSystem("StringEncoding"))) 76 self.codec = QTextCodec.codecForName(
77 str(Preferences.getSystem("StringEncoding")))
77 78
78 if passive: 79 if passive:
79 # set translation function 80 # set translation function
80 if Preferences.getDebugger("PathTranslation"): 81 if Preferences.getDebugger("PathTranslation"):
81 self.translateRemote = \ 82 self.translateRemote = \
118 """ 119 """
119 Private method to start the debugger client process. 120 Private method to start the debugger client process.
120 121
121 @param program name of the executable to start (string) 122 @param program name of the executable to start (string)
122 @param arguments arguments to be passed to the program (list of string) 123 @param arguments arguments to be passed to the program (list of string)
123 @param environment dictionary of environment settings to pass (dict of string) 124 @param environment dictionary of environment settings to pass
125 (dict of string)
124 @return the process object (QProcess) or None 126 @return the process object (QProcess) or None
125 """ 127 """
126 proc = QProcess() 128 proc = QProcess()
127 if environment is not None: 129 if environment is not None:
128 env = [] 130 env = []
156 interpreter = sys.executable 158 interpreter = sys.executable
157 159
158 debugClientType = Preferences.getDebugger("DebugClientType3") 160 debugClientType = Preferences.getDebugger("DebugClientType3")
159 if debugClientType == "standard": 161 if debugClientType == "standard":
160 debugClient = os.path.join(getConfig('ericDir'), 162 debugClient = os.path.join(getConfig('ericDir'),
161 "DebugClients", "Python3", "DebugClient.py") 163 "DebugClients", "Python3",
164 "DebugClient.py")
162 elif debugClientType == "threaded": 165 elif debugClientType == "threaded":
163 debugClient = os.path.join(getConfig('ericDir'), 166 debugClient = os.path.join(getConfig('ericDir'),
164 "DebugClients", "Python3", "DebugClientThreads.py") 167 "DebugClients", "Python3",
168 "DebugClientThreads.py")
165 else: 169 else:
166 debugClient = Preferences.getDebugger("DebugClient3") 170 debugClient = Preferences.getDebugger("DebugClient3")
167 if debugClient == "": 171 if debugClient == "":
168 debugClient = os.path.join(sys.path[0], 172 debugClient = os.path.join(sys.path[0],
169 "DebugClients", "Python3", "DebugClient.py") 173 "DebugClients", "Python3",
174 "DebugClient.py")
170 175
171 redirect = str(Preferences.getDebugger("Python3Redirect")) 176 redirect = str(Preferences.getDebugger("Python3Redirect"))
172 noencoding = \ 177 noencoding = Preferences.getDebugger("Python3NoEncoding") and \
173 Preferences.getDebugger("Python3NoEncoding") and '--no-encoding' or '' 178 '--no-encoding' or ''
174 179
175 if Preferences.getDebugger("RemoteDbgEnabled"): 180 if Preferences.getDebugger("RemoteDbgEnabled"):
176 ipaddr = self.debugServer.getHostAddress(False) 181 ipaddr = self.debugServer.getHostAddress(False)
177 rexec = Preferences.getDebugger("RemoteExecution") 182 rexec = Preferences.getDebugger("RemoteExecution")
178 rhost = Preferences.getDebugger("RemoteHost") 183 rhost = Preferences.getDebugger("RemoteHost")
186 process = self.__startProcess(args[0], args[1:]) 191 process = self.__startProcess(args[0], args[1:])
187 if process is None: 192 if process is None:
188 E5MessageBox.critical(None, 193 E5MessageBox.critical(None,
189 self.trUtf8("Start Debugger"), 194 self.trUtf8("Start Debugger"),
190 self.trUtf8( 195 self.trUtf8(
191 """<p>The debugger backend could not be started.</p>""")) 196 """<p>The debugger backend could not be"""
197 """ started.</p>"""))
192 198
193 # set translation function 199 # set translation function
194 if Preferences.getDebugger("PathTranslation"): 200 if Preferences.getDebugger("PathTranslation"):
195 self.translateRemote = \ 201 self.translateRemote = \
196 Preferences.getDebugger("PathTranslationRemote") 202 Preferences.getDebugger("PathTranslationRemote")
231 process = self.__startProcess(args[0], args[1:], clientEnv) 237 process = self.__startProcess(args[0], args[1:], clientEnv)
232 if process is None: 238 if process is None:
233 E5MessageBox.critical(None, 239 E5MessageBox.critical(None,
234 self.trUtf8("Start Debugger"), 240 self.trUtf8("Start Debugger"),
235 self.trUtf8( 241 self.trUtf8(
236 """<p>The debugger backend could not be started.</p>""")) 242 """<p>The debugger backend could not be"""
243 """ started.</p>"""))
237 return process, self.__isNetworked 244 return process, self.__isNetworked
238 245
239 process = self.__startProcess(interpreter, 246 process = self.__startProcess(interpreter,
240 [debugClient, noencoding, str(port), redirect, ipaddr], 247 [debugClient, noencoding, str(port), redirect, ipaddr],
241 clientEnv) 248 clientEnv)
242 if process is None: 249 if process is None:
243 E5MessageBox.critical(None, 250 E5MessageBox.critical(None,
244 self.trUtf8("Start Debugger"), 251 self.trUtf8("Start Debugger"),
245 self.trUtf8("""<p>The debugger backend could not be started.</p>""")) 252 self.trUtf8(
253 """<p>The debugger backend could not be started.</p>"""))
246 return process, self.__isNetworked 254 return process, self.__isNetworked
247 255
248 def startRemoteForProject(self, port, runInConsole): 256 def startRemoteForProject(self, port, runInConsole):
249 """ 257 """
250 Public method to start a remote Python interpreter for a project. 258 Public method to start a remote Python interpreter for a project.
281 process = self.__startProcess(args[0], args[1:]) 289 process = self.__startProcess(args[0], args[1:])
282 if process is None: 290 if process is None:
283 E5MessageBox.critical(None, 291 E5MessageBox.critical(None,
284 self.trUtf8("Start Debugger"), 292 self.trUtf8("Start Debugger"),
285 self.trUtf8( 293 self.trUtf8(
286 """<p>The debugger backend could not be started.</p>""")) 294 """<p>The debugger backend could not be"""
295 """ started.</p>"""))
287 # set translation function 296 # set translation function
288 if project.getDebugProperty("PATHTRANSLATION"): 297 if project.getDebugProperty("PATHTRANSLATION"):
289 self.translateRemote = project.getDebugProperty("REMOTEPATH") 298 self.translateRemote = \
290 self.translateLocal = project.getDebugProperty("LOCALPATH") 299 project.getDebugProperty("REMOTEPATH")
300 self.translateLocal = \
301 project.getDebugProperty("LOCALPATH")
291 self.translate = self.__remoteTranslation 302 self.translate = self.__remoteTranslation
292 else: 303 else:
293 self.translate = self.__identityTranslation 304 self.translate = self.__identityTranslation
294 return process, self.__isNetworked 305 return process, self.__isNetworked
295 306
324 process = self.__startProcess(args[0], args[1:], clientEnv) 335 process = self.__startProcess(args[0], args[1:], clientEnv)
325 if process is None: 336 if process is None:
326 E5MessageBox.critical(None, 337 E5MessageBox.critical(None,
327 self.trUtf8("Start Debugger"), 338 self.trUtf8("Start Debugger"),
328 self.trUtf8( 339 self.trUtf8(
329 """<p>The debugger backend could not be started.</p>""")) 340 """<p>The debugger backend could not be"""
341 """ started.</p>"""))
330 return process, self.__isNetworked 342 return process, self.__isNetworked
331 343
332 process = self.__startProcess(interpreter, 344 process = self.__startProcess(interpreter,
333 [debugClient, noencoding, str(port), redirect, ipaddr], 345 [debugClient, noencoding, str(port), redirect, ipaddr],
334 clientEnv) 346 clientEnv)
335 if process is None: 347 if process is None:
336 E5MessageBox.critical(None, 348 E5MessageBox.critical(None,
337 self.trUtf8("Start Debugger"), 349 self.trUtf8("Start Debugger"),
338 self.trUtf8("""<p>The debugger backend could not be started.</p>""")) 350 self.trUtf8(
351 """<p>The debugger backend could not be started.</p>"""))
339 return process, self.__isNetworked 352 return process, self.__isNetworked
340 353
341 def getClientCapabilities(self): 354 def getClientCapabilities(self):
342 """ 355 """
343 Public method to retrieve the debug clients capabilities. 356 Public method to retrieve the debug clients capabilities.
413 """ 426 """
414 Public method to set the environment for a program to debug, run, ... 427 Public method to set the environment for a program to debug, run, ...
415 428
416 @param env environment settings (dictionary) 429 @param env environment settings (dictionary)
417 """ 430 """
418 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEnv, str(env))) 431 self.__sendCommand('{0}{1}\n'.format(
419 432 DebugProtocol.RequestEnv, str(env)))
420 def remoteLoad(self, fn, argv, wd, traceInterpreter=False, autoContinue=True, 433
421 autoFork=False, forkChild=False): 434 def remoteLoad(self, fn, argv, wd, traceInterpreter=False,
435 autoContinue=True, autoFork=False, forkChild=False):
422 """ 436 """
423 Public method to load a new program to debug. 437 Public method to load a new program to debug.
424 438
425 @param fn the filename to debug (string) 439 @param fn the filename to debug (string)
426 @param argv the commandline arguments to pass to the program (string) 440 @param argv the commandline arguments to pass to the program (string)
427 @param wd the working directory for the program (string) 441 @param wd the working directory for the program (string)
428 @keyparam traceInterpreter flag indicating if the interpreter library should be 442 @keyparam traceInterpreter flag indicating if the interpreter library
429 traced as well (boolean) 443 should be traced as well (boolean)
430 @keyparam autoContinue flag indicating, that the debugger should not stop 444 @keyparam autoContinue flag indicating, that the debugger should not
431 at the first executable line (boolean) 445 stop at the first executable line (boolean)
432 @keyparam autoFork flag indicating the automatic fork mode (boolean) 446 @keyparam autoFork flag indicating the automatic fork mode (boolean)
433 @keyparam forkChild flag indicating to debug the child after forking (boolean) 447 @keyparam forkChild flag indicating to debug the child after forking
448 (boolean)
434 """ 449 """
435 self.__autoContinue = autoContinue 450 self.__autoContinue = autoContinue
436 self.__scriptName = os.path.abspath(fn) 451 self.__scriptName = os.path.abspath(fn)
437 452
438 wd = self.translate(wd, False) 453 wd = self.translate(wd, False)
439 fn = self.translate(os.path.abspath(fn), False) 454 fn = self.translate(os.path.abspath(fn), False)
440 self.__sendCommand('{0}{1}\n'.format( 455 self.__sendCommand('{0}{1}\n'.format(
441 DebugProtocol.RequestForkMode, repr((autoFork, forkChild)))) 456 DebugProtocol.RequestForkMode, repr((autoFork, forkChild))))
442 self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format( 457 self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format(
443 DebugProtocol.RequestLoad, wd, fn, str(Utilities.parseOptionString(argv)), 458 DebugProtocol.RequestLoad, wd, fn,
444 traceInterpreter)) 459 str(Utilities.parseOptionString(argv)),
460 traceInterpreter))
445 461
446 def remoteRun(self, fn, argv, wd, autoFork=False, forkChild=False): 462 def remoteRun(self, fn, argv, wd, autoFork=False, forkChild=False):
447 """ 463 """
448 Public method to load a new program to run. 464 Public method to load a new program to run.
449 465
450 @param fn the filename to run (string) 466 @param fn the filename to run (string)
451 @param argv the commandline arguments to pass to the program (string) 467 @param argv the commandline arguments to pass to the program (string)
452 @param wd the working directory for the program (string) 468 @param wd the working directory for the program (string)
453 @keyparam autoFork flag indicating the automatic fork mode (boolean) 469 @keyparam autoFork flag indicating the automatic fork mode (boolean)
454 @keyparam forkChild flag indicating to debug the child after forking (boolean) 470 @keyparam forkChild flag indicating to debug the child after forking
471 (boolean)
455 """ 472 """
456 self.__scriptName = os.path.abspath(fn) 473 self.__scriptName = os.path.abspath(fn)
457 474
458 wd = self.translate(wd, False) 475 wd = self.translate(wd, False)
459 fn = self.translate(os.path.abspath(fn), False) 476 fn = self.translate(os.path.abspath(fn), False)
460 self.__sendCommand('{0}{1}\n'.format( 477 self.__sendCommand('{0}{1}\n'.format(
461 DebugProtocol.RequestForkMode, repr((autoFork, forkChild)))) 478 DebugProtocol.RequestForkMode, repr((autoFork, forkChild))))
462 self.__sendCommand('{0}{1}|{2}|{3}\n'.format( 479 self.__sendCommand('{0}{1}|{2}|{3}\n'.format(
463 DebugProtocol.RequestRun, wd, fn, str(Utilities.parseOptionString(argv)))) 480 DebugProtocol.RequestRun, wd, fn,
481 str(Utilities.parseOptionString(argv))))
464 482
465 def remoteCoverage(self, fn, argv, wd, erase=False): 483 def remoteCoverage(self, fn, argv, wd, erase=False):
466 """ 484 """
467 Public method to load a new program to collect coverage data. 485 Public method to load a new program to collect coverage data.
468 486
475 self.__scriptName = os.path.abspath(fn) 493 self.__scriptName = os.path.abspath(fn)
476 494
477 wd = self.translate(wd, False) 495 wd = self.translate(wd, False)
478 fn = self.translate(os.path.abspath(fn), False) 496 fn = self.translate(os.path.abspath(fn), False)
479 self.__sendCommand('{0}{1}@@{2}@@{3}@@{4:d}\n'.format( 497 self.__sendCommand('{0}{1}@@{2}@@{3}@@{4:d}\n'.format(
480 DebugProtocol.RequestCoverage, wd, fn, str(Utilities.parseOptionString(argv)), 498 DebugProtocol.RequestCoverage, wd, fn,
481 erase)) 499 str(Utilities.parseOptionString(argv)),
500 erase))
482 501
483 def remoteProfile(self, fn, argv, wd, erase=False): 502 def remoteProfile(self, fn, argv, wd, erase=False):
484 """ 503 """
485 Public method to load a new program to collect profiling data. 504 Public method to load a new program to collect profiling data.
486 505
487 @param fn the filename to run (string) 506 @param fn the filename to run (string)
488 @param argv the commandline arguments to pass to the program (string) 507 @param argv the commandline arguments to pass to the program (string)
489 @param wd the working directory for the program (string) 508 @param wd the working directory for the program (string)
490 @keyparam erase flag indicating that timing info should be cleared first (boolean) 509 @keyparam erase flag indicating that timing info should be cleared
510 first (boolean)
491 """ 511 """
492 self.__scriptName = os.path.abspath(fn) 512 self.__scriptName = os.path.abspath(fn)
493 513
494 wd = self.translate(wd, False) 514 wd = self.translate(wd, False)
495 fn = self.translate(os.path.abspath(fn), False) 515 fn = self.translate(os.path.abspath(fn), False)
535 """ 555 """
536 Public method to continue the debugged program. 556 Public method to continue the debugged program.
537 557
538 @param special flag indicating a special continue operation 558 @param special flag indicating a special continue operation
539 """ 559 """
540 self.__sendCommand('{0}{1:d}\n'.format(DebugProtocol.RequestContinue, special)) 560 self.__sendCommand('{0}{1:d}\n'.format(
561 DebugProtocol.RequestContinue, special))
541 562
542 def remoteBreakpoint(self, fn, line, set, cond=None, temp=False): 563 def remoteBreakpoint(self, fn, line, set, cond=None, temp=False):
543 """ 564 """
544 Public method to set or clear a breakpoint. 565 Public method to set or clear a breakpoint.
545 566
549 @param cond condition of the breakpoint (string) 570 @param cond condition of the breakpoint (string)
550 @param temp flag indicating a temporary breakpoint (boolean) 571 @param temp flag indicating a temporary breakpoint (boolean)
551 """ 572 """
552 fn = self.translate(fn, False) 573 fn = self.translate(fn, False)
553 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}@@{4:d}@@{5}\n'.format( 574 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}@@{4:d}@@{5}\n'.format(
554 DebugProtocol.RequestBreak, fn, line, temp, set, cond)) 575 DebugProtocol.RequestBreak, fn, line, temp, set, cond))
555 576
556 def remoteBreakpointEnable(self, fn, line, enable): 577 def remoteBreakpointEnable(self, fn, line, enable):
557 """ 578 """
558 Public method to enable or disable a breakpoint. 579 Public method to enable or disable a breakpoint.
559 580
560 @param fn filename the breakpoint belongs to (string) 581 @param fn filename the breakpoint belongs to (string)
561 @param line linenumber of the breakpoint (int) 582 @param line linenumber of the breakpoint (int)
562 @param enable flag indicating enabling or disabling a breakpoint (boolean) 583 @param enable flag indicating enabling or disabling a breakpoint
584 (boolean)
563 """ 585 """
564 fn = self.translate(fn, False) 586 fn = self.translate(fn, False)
565 self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( 587 self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format(
566 DebugProtocol.RequestBreakEnable, fn, line, enable)) 588 DebugProtocol.RequestBreakEnable, fn, line, enable))
567 589
580 def remoteWatchpoint(self, cond, set, temp=False): 602 def remoteWatchpoint(self, cond, set, temp=False):
581 """ 603 """
582 Public method to set or clear a watch expression. 604 Public method to set or clear a watch expression.
583 605
584 @param cond expression of the watch expression (string) 606 @param cond expression of the watch expression (string)
585 @param set flag indicating setting or resetting a watch expression (boolean) 607 @param set flag indicating setting or resetting a watch expression
608 (boolean)
586 @param temp flag indicating a temporary watch expression (boolean) 609 @param temp flag indicating a temporary watch expression (boolean)
587 """ 610 """
588 # cond is combination of cond and special (s. watch expression viewer) 611 # cond is combination of cond and special (s. watch expression viewer)
589 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}\n'.format( 612 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}\n'.format(
590 DebugProtocol.RequestWatch, cond, temp, set)) 613 DebugProtocol.RequestWatch, cond, temp, set))
592 def remoteWatchpointEnable(self, cond, enable): 615 def remoteWatchpointEnable(self, cond, enable):
593 """ 616 """
594 Public method to enable or disable a watch expression. 617 Public method to enable or disable a watch expression.
595 618
596 @param cond expression of the watch expression (string) 619 @param cond expression of the watch expression (string)
597 @param enable flag indicating enabling or disabling a watch expression (boolean) 620 @param enable flag indicating enabling or disabling a watch expression
621 (boolean)
598 """ 622 """
599 # cond is combination of cond and special (s. watch expression viewer) 623 # cond is combination of cond and special (s. watch expression viewer)
600 self.__sendCommand('{0}{1},{2:d}\n'.format( 624 self.__sendCommand('{0}{1},{2:d}\n'.format(
601 DebugProtocol.RequestWatchEnable, cond, enable)) 625 DebugProtocol.RequestWatchEnable, cond, enable))
602 626
603 def remoteWatchpointIgnore(self, cond, count): 627 def remoteWatchpointIgnore(self, cond, count):
604 """ 628 """
605 Public method to ignore a watch expression the next couple of occurrences. 629 Public method to ignore a watch expression the next couple of
630 occurrences.
606 631
607 @param cond expression of the watch expression (string) 632 @param cond expression of the watch expression (string)
608 @param count number of occurrences to ignore (int) 633 @param count number of occurrences to ignore (int)
609 """ 634 """
610 # cond is combination of cond and special (s. watch expression viewer) 635 # cond is combination of cond and special (s. watch expression viewer)
629 """ 654 """
630 Public method to request to set the given thread as current thread. 655 Public method to request to set the given thread as current thread.
631 656
632 @param tid id of the thread (integer) 657 @param tid id of the thread (integer)
633 """ 658 """
634 self.__sendCommand('{0}{1:d}\n'.format(DebugProtocol.RequestThreadSet, tid)) 659 self.__sendCommand('{0}{1:d}\n'.format(
660 DebugProtocol.RequestThreadSet, tid))
635 661
636 def remoteClientVariables(self, scope, filter, framenr=0): 662 def remoteClientVariables(self, scope, filter, framenr=0):
637 """ 663 """
638 Public method to request the variables of the debugged program. 664 Public method to request the variables of the debugged program.
639 665
652 @param filter list of variable types to filter out (list of int) 678 @param filter list of variable types to filter out (list of int)
653 @param var list encoded name of variable to retrieve (string) 679 @param var list encoded name of variable to retrieve (string)
654 @param framenr framenumber of the variables to retrieve (int) 680 @param framenr framenumber of the variables to retrieve (int)
655 """ 681 """
656 self.__sendCommand('{0}{1}, {2:d}, {3:d}, {4}\n'.format( 682 self.__sendCommand('{0}{1}, {2:d}, {3:d}, {4}\n'.format(
657 DebugProtocol.RequestVariable, str(var), framenr, scope, str(filter))) 683 DebugProtocol.RequestVariable, str(var), framenr, scope,
684 str(filter)))
658 685
659 def remoteClientSetFilter(self, scope, filter): 686 def remoteClientSetFilter(self, scope, filter):
660 """ 687 """
661 Public method to set a variables filter list. 688 Public method to set a variables filter list.
662 689
674 """ 701 """
675 if on: 702 if on:
676 cmd = "on" 703 cmd = "on"
677 else: 704 else:
678 cmd = "off" 705 cmd = "off"
679 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestCallTrace, cmd)) 706 self.__sendCommand('{0}{1}\n'.format(
707 DebugProtocol.RequestCallTrace, cmd))
680 708
681 def remoteEval(self, arg): 709 def remoteEval(self, arg):
682 """ 710 """
683 Public method to evaluate arg in the current context of the debugged program. 711 Public method to evaluate arg in the current context of the debugged
712 program.
684 713
685 @param arg the arguments to evaluate (string) 714 @param arg the arguments to evaluate (string)
686 """ 715 """
687 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEval, arg)) 716 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEval, arg))
688 717
689 def remoteExec(self, stmt): 718 def remoteExec(self, stmt):
690 """ 719 """
691 Public method to execute stmt in the current context of the debugged program. 720 Public method to execute stmt in the current context of the debugged
721 program.
692 722
693 @param stmt statement to execute (string) 723 @param stmt statement to execute (string)
694 """ 724 """
695 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestExec, stmt)) 725 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestExec, stmt))
696 726
711 Public slot to get the a list of possible commandline completions 741 Public slot to get the a list of possible commandline completions
712 from the remote client. 742 from the remote client.
713 743
714 @param text the text to be completed (string) 744 @param text the text to be completed (string)
715 """ 745 """
716 self.__sendCommand("{0}{1}\n".format(DebugProtocol.RequestCompletion, text)) 746 self.__sendCommand("{0}{1}\n".format(
747 DebugProtocol.RequestCompletion, text))
717 748
718 def remoteUTPrepare(self, fn, tn, tfn, failed, cov, covname, coverase): 749 def remoteUTPrepare(self, fn, tn, tfn, failed, cov, covname, coverase):
719 """ 750 """
720 Public method to prepare a new unittest run. 751 Public method to prepare a new unittest run.
721 752
722 @param fn the filename to load (string) 753 @param fn the filename to load (string)
723 @param tn the testname to load (string) 754 @param tn the testname to load (string)
724 @param tfn the test function name to load tests from (string) 755 @param tfn the test function name to load tests from (string)
725 @param failed list of failed test, if only failed test should be run 756 @param failed list of failed test, if only failed test should be run
726 (list of strings) 757 (list of strings)
727 @param cov flag indicating collection of coverage data is requested (boolean) 758 @param cov flag indicating collection of coverage data is requested
759 (boolean)
728 @param covname filename to be used to assemble the coverage caches 760 @param covname filename to be used to assemble the coverage caches
729 filename (string) 761 filename (string)
730 @param coverase flag indicating erasure of coverage data is requested (boolean) 762 @param coverase flag indicating erasure of coverage data is requested
763 (boolean)
731 """ 764 """
732 self.__scriptName = os.path.abspath(fn) 765 self.__scriptName = os.path.abspath(fn)
733 766
734 fn = self.translate(os.path.abspath(fn), False) 767 fn = self.translate(os.path.abspath(fn), False)
735 self.__sendCommand('{0}{1}|{2}|{3}|{4}|{5:d}|{6}|{7:d}\n'.format( 768 self.__sendCommand('{0}{1}|{2}|{3}|{4}|{5:d}|{6}|{7:d}\n'.format(
750 783
751 def __askForkTo(self): 784 def __askForkTo(self):
752 """ 785 """
753 Private method to ask the user which branch of a fork to follow. 786 Private method to ask the user which branch of a fork to follow.
754 """ 787 """
755 selections = [self.trUtf8("Parent Process"), self.trUtf8("Child process")] 788 selections = [self.trUtf8("Parent Process"),
789 self.trUtf8("Child process")]
756 res, ok = QInputDialog.getItem( 790 res, ok = QInputDialog.getItem(
757 None, 791 None,
758 self.trUtf8("Client forking"), 792 self.trUtf8("Client forking"),
759 self.trUtf8("Select the fork branch to follow."), 793 self.trUtf8("Select the fork branch to follow."),
760 selections, 794 selections,
805 cf = stack[0] 839 cf = stack[0]
806 if self.__autoContinue: 840 if self.__autoContinue:
807 self.__autoContinue = False 841 self.__autoContinue = False
808 QTimer.singleShot(0, self.remoteContinue) 842 QTimer.singleShot(0, self.remoteContinue)
809 else: 843 else:
810 self.debugServer.signalClientLine(cf[0], int(cf[1]), 844 self.debugServer.signalClientLine(
811 resp == DebugProtocol.ResponseStack) 845 cf[0], int(cf[1]),
846 resp == DebugProtocol.ResponseStack)
812 self.debugServer.signalClientStack(stack) 847 self.debugServer.signalClientStack(stack)
813 continue 848 continue
814 849
815 if resp == DebugProtocol.CallTrace: 850 if resp == DebugProtocol.CallTrace:
816 event, fromStr, toStr = line[eoc:-1].split("@@") 851 event, fromStr, toStr = line[eoc:-1].split("@@")
822 toFile, toLineno, toFunc) 857 toFile, toLineno, toFunc)
823 continue 858 continue
824 859
825 if resp == DebugProtocol.ResponseThreadList: 860 if resp == DebugProtocol.ResponseThreadList:
826 currentId, threadList = eval(line[eoc:-1]) 861 currentId, threadList = eval(line[eoc:-1])
827 self.debugServer.signalClientThreadList(currentId, threadList) 862 self.debugServer.signalClientThreadList(
863 currentId, threadList)
828 continue 864 continue
829 865
830 if resp == DebugProtocol.ResponseThreadSet: 866 if resp == DebugProtocol.ResponseThreadSet:
831 self.debugServer.signalClientThreadSet() 867 self.debugServer.signalClientThreadSet()
832 continue 868 continue
875 break 911 break
876 except (IndexError, ValueError, SyntaxError): 912 except (IndexError, ValueError, SyntaxError):
877 exctype = None 913 exctype = None
878 excmessage = '' 914 excmessage = ''
879 stack = [] 915 stack = []
880 self.debugServer.signalClientException(exctype, excmessage, stack) 916 self.debugServer.signalClientException(
917 exctype, excmessage, stack)
881 continue 918 continue
882 919
883 if resp == DebugProtocol.ResponseSyntax: 920 if resp == DebugProtocol.ResponseSyntax:
884 exc = line[eoc:-1] 921 exc = line[eoc:-1]
885 exc = self.translate(exc, True) 922 exc = self.translate(exc, True)
892 fn = '' 929 fn = ''
893 ln = 0 930 ln = 0
894 cn = 0 931 cn = 0
895 if cn is None: 932 if cn is None:
896 cn = 0 933 cn = 0
897 self.debugServer.signalClientSyntaxError(message, fn, ln, cn) 934 self.debugServer.signalClientSyntaxError(
935 message, fn, ln, cn)
898 continue 936 continue
899 937
900 if resp == DebugProtocol.ResponseExit: 938 if resp == DebugProtocol.ResponseExit:
901 self.__scriptName = "" 939 self.__scriptName = ""
902 self.debugServer.signalClientExit(line[eoc:-1]) 940 self.debugServer.signalClientExit(line[eoc:-1])
911 949
912 if resp == DebugProtocol.ResponseBPConditionError: 950 if resp == DebugProtocol.ResponseBPConditionError:
913 fn, lineno = line[eoc:-1].split(',') 951 fn, lineno = line[eoc:-1].split(',')
914 lineno = int(lineno) 952 lineno = int(lineno)
915 fn = self.translate(fn, True) 953 fn = self.translate(fn, True)
916 self.debugServer.signalClientBreakConditionError(fn, lineno) 954 self.debugServer.signalClientBreakConditionError(
955 fn, lineno)
917 continue 956 continue
918 957
919 if resp == DebugProtocol.ResponseClearWatch: 958 if resp == DebugProtocol.ResponseClearWatch:
920 cond = line[eoc:-1] 959 cond = line[eoc:-1]
921 self.debugServer.signalClientClearWatch(cond) 960 self.debugServer.signalClientClearWatch(cond)
931 self.debugServer.signalClientRawInput(prompt, echo) 970 self.debugServer.signalClientRawInput(prompt, echo)
932 continue 971 continue
933 972
934 if resp == DebugProtocol.ResponseBanner: 973 if resp == DebugProtocol.ResponseBanner:
935 version, platform, dbgclient = eval(line[eoc:-1]) 974 version, platform, dbgclient = eval(line[eoc:-1])
936 self.debugServer.signalClientBanner(version, platform, dbgclient) 975 self.debugServer.signalClientBanner(
976 version, platform, dbgclient)
937 continue 977 continue
938 978
939 if resp == DebugProtocol.ResponseCapabilities: 979 if resp == DebugProtocol.ResponseCapabilities:
940 cap, clType = eval(line[eoc:-1]) 980 cap, clType = eval(line[eoc:-1])
941 self.clientCapabilities = cap 981 self.clientCapabilities = cap
969 self.debugServer.clientUtStopTest() 1009 self.debugServer.clientUtStopTest()
970 continue 1010 continue
971 1011
972 if resp == DebugProtocol.ResponseUTTestFailed: 1012 if resp == DebugProtocol.ResponseUTTestFailed:
973 testname, traceback, id = eval(line[eoc:-1]) 1013 testname, traceback, id = eval(line[eoc:-1])
974 self.debugServer.clientUtTestFailed(testname, traceback, id) 1014 self.debugServer.clientUtTestFailed(
1015 testname, traceback, id)
975 continue 1016 continue
976 1017
977 if resp == DebugProtocol.ResponseUTTestErrored: 1018 if resp == DebugProtocol.ResponseUTTestErrored:
978 testname, traceback, id = eval(line[eoc:-1]) 1019 testname, traceback, id = eval(line[eoc:-1])
979 self.debugServer.clientUtTestErrored(testname, traceback, id) 1020 self.debugServer.clientUtTestErrored(
1021 testname, traceback, id)
980 continue 1022 continue
981 1023
982 if resp == DebugProtocol.ResponseUTTestSkipped: 1024 if resp == DebugProtocol.ResponseUTTestSkipped:
983 testname, reason, id = eval(line[eoc:-1]) 1025 testname, reason, id = eval(line[eoc:-1])
984 self.debugServer.clientUtTestSkipped(testname, reason, id) 1026 self.debugServer.clientUtTestSkipped(testname, reason, id)
985 continue 1027 continue
986 1028
987 if resp == DebugProtocol.ResponseUTTestFailedExpected: 1029 if resp == DebugProtocol.ResponseUTTestFailedExpected:
988 testname, traceback, id = eval(line[eoc:-1]) 1030 testname, traceback, id = eval(line[eoc:-1])
989 self.debugServer.clientUtTestFailedExpected(testname, traceback, id) 1031 self.debugServer.clientUtTestFailedExpected(
1032 testname, traceback, id)
990 continue 1033 continue
991 1034
992 if resp == DebugProtocol.ResponseUTTestSucceededUnexpected: 1035 if resp == DebugProtocol.ResponseUTTestSucceededUnexpected:
993 testname, id = eval(line[eoc:-1]) 1036 testname, id = eval(line[eoc:-1])
994 self.debugServer.clientUtTestSucceededUnexpected(testname, id) 1037 self.debugServer.clientUtTestSucceededUnexpected(
1038 testname, id)
995 continue 1039 continue
996 1040
997 if resp == DebugProtocol.ResponseUTFinished: 1041 if resp == DebugProtocol.ResponseUTFinished:
998 self.debugServer.clientUtFinished() 1042 self.debugServer.clientUtFinished()
999 continue 1043 continue

eric ide

mercurial