Debugger/DebuggerInterfacePython3.py

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

eric ide

mercurial