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