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") |
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) |
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 |
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) |
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( |
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 |