162 return None, False |
164 return None, False |
163 |
165 |
164 debugClientType = Preferences.getDebugger("DebugClientType") |
166 debugClientType = Preferences.getDebugger("DebugClientType") |
165 if debugClientType == "standard": |
167 if debugClientType == "standard": |
166 debugClient = os.path.join(getConfig('ericDir'), |
168 debugClient = os.path.join(getConfig('ericDir'), |
167 "DebugClients", "Python", "DebugClient.py") |
169 "DebugClients", "Python", |
|
170 "DebugClient.py") |
168 elif debugClientType == "threaded": |
171 elif debugClientType == "threaded": |
169 debugClient = os.path.join(getConfig('ericDir'), |
172 debugClient = os.path.join(getConfig('ericDir'), |
170 "DebugClients", "Python", "DebugClientThreads.py") |
173 "DebugClients", "Python", |
|
174 "DebugClientThreads.py") |
171 else: |
175 else: |
172 debugClient = Preferences.getDebugger("DebugClient") |
176 debugClient = Preferences.getDebugger("DebugClient") |
173 if debugClient == "": |
177 if debugClient == "": |
174 debugClient = os.path.join(sys.path[0], |
178 debugClient = os.path.join(sys.path[0], |
175 "DebugClients", "Python", "DebugClient.py") |
179 "DebugClients", "Python", |
|
180 "DebugClient.py") |
176 |
181 |
177 redirect = str(Preferences.getDebugger("PythonRedirect")) |
182 redirect = str(Preferences.getDebugger("PythonRedirect")) |
178 noencoding = \ |
183 noencoding = Preferences.getDebugger("PythonNoEncoding") and \ |
179 Preferences.getDebugger("PythonNoEncoding") and '--no-encoding' or '' |
184 '--no-encoding' or '' |
180 |
185 |
181 if Preferences.getDebugger("RemoteDbgEnabled"): |
186 if Preferences.getDebugger("RemoteDbgEnabled"): |
182 ipaddr = self.debugServer.getHostAddress(False) |
187 ipaddr = self.debugServer.getHostAddress(False) |
183 rexec = Preferences.getDebugger("RemoteExecution") |
188 rexec = Preferences.getDebugger("RemoteExecution") |
184 rhost = Preferences.getDebugger("RemoteHost") |
189 rhost = Preferences.getDebugger("RemoteHost") |
237 process = self.__startProcess(args[0], args[1:], clientEnv) |
243 process = self.__startProcess(args[0], args[1:], clientEnv) |
238 if process is None: |
244 if process is None: |
239 E5MessageBox.critical(None, |
245 E5MessageBox.critical(None, |
240 self.trUtf8("Start Debugger"), |
246 self.trUtf8("Start Debugger"), |
241 self.trUtf8( |
247 self.trUtf8( |
242 """<p>The debugger backend could not be started.</p>""")) |
248 """<p>The debugger backend could not be""" |
|
249 """ started.</p>""")) |
243 return process, self.__isNetworked |
250 return process, self.__isNetworked |
244 |
251 |
245 process = self.__startProcess(interpreter, |
252 process = self.__startProcess(interpreter, |
246 [debugClient, noencoding, str(port), redirect, ipaddr], |
253 [debugClient, noencoding, str(port), redirect, ipaddr], |
247 clientEnv) |
254 clientEnv) |
248 if process is None: |
255 if process is None: |
249 E5MessageBox.critical(None, |
256 E5MessageBox.critical(None, |
250 self.trUtf8("Start Debugger"), |
257 self.trUtf8("Start Debugger"), |
251 self.trUtf8("""<p>The debugger backend could not be started.</p>""")) |
258 self.trUtf8( |
|
259 """<p>The debugger backend could not be started.</p>""")) |
252 return process, self.__isNetworked |
260 return process, self.__isNetworked |
253 |
261 |
254 def startRemoteForProject(self, port, runInConsole): |
262 def startRemoteForProject(self, port, runInConsole): |
255 """ |
263 """ |
256 Public method to start a remote Python interpreter for a project. |
264 Public method to start a remote Python interpreter for a project. |
287 process = self.__startProcess(args[0], args[1:]) |
295 process = self.__startProcess(args[0], args[1:]) |
288 if process is None: |
296 if process is None: |
289 E5MessageBox.critical(None, |
297 E5MessageBox.critical(None, |
290 self.trUtf8("Start Debugger"), |
298 self.trUtf8("Start Debugger"), |
291 self.trUtf8( |
299 self.trUtf8( |
292 """<p>The debugger backend could not be started.</p>""")) |
300 """<p>The debugger backend could not be""" |
|
301 """ started.</p>""")) |
293 # set translation function |
302 # set translation function |
294 if project.getDebugProperty("PATHTRANSLATION"): |
303 if project.getDebugProperty("PATHTRANSLATION"): |
295 self.translateRemote = project.getDebugProperty("REMOTEPATH") |
304 self.translateRemote = \ |
296 self.translateLocal = project.getDebugProperty("LOCALPATH") |
305 project.getDebugProperty("REMOTEPATH") |
|
306 self.translateLocal = \ |
|
307 project.getDebugProperty("LOCALPATH") |
297 self.translate = self.__remoteTranslation |
308 self.translate = self.__remoteTranslation |
298 else: |
309 else: |
299 self.translate = self.__identityTranslation |
310 self.translate = self.__identityTranslation |
300 return process, self.__isNetworked |
311 return process, self.__isNetworked |
301 |
312 |
330 process = self.__startProcess(args[0], args[1:], clientEnv) |
341 process = self.__startProcess(args[0], args[1:], clientEnv) |
331 if process is None: |
342 if process is None: |
332 E5MessageBox.critical(None, |
343 E5MessageBox.critical(None, |
333 self.trUtf8("Start Debugger"), |
344 self.trUtf8("Start Debugger"), |
334 self.trUtf8( |
345 self.trUtf8( |
335 """<p>The debugger backend could not be started.</p>""")) |
346 """<p>The debugger backend could not be""" |
|
347 """ started.</p>""")) |
336 return process, self.__isNetworked |
348 return process, self.__isNetworked |
337 |
349 |
338 process = self.__startProcess(interpreter, |
350 process = self.__startProcess(interpreter, |
339 [debugClient, noencoding, str(port), redirect, ipaddr], |
351 [debugClient, noencoding, str(port), redirect, ipaddr], |
340 clientEnv) |
352 clientEnv) |
341 if process is None: |
353 if process is None: |
342 E5MessageBox.critical(None, |
354 E5MessageBox.critical(None, |
343 self.trUtf8("Start Debugger"), |
355 self.trUtf8("Start Debugger"), |
344 self.trUtf8("""<p>The debugger backend could not be started.</p>""")) |
356 self.trUtf8( |
|
357 """<p>The debugger backend could not be started.</p>""")) |
345 return process, self.__isNetworked |
358 return process, self.__isNetworked |
346 |
359 |
347 def getClientCapabilities(self): |
360 def getClientCapabilities(self): |
348 """ |
361 """ |
349 Public method to retrieve the debug clients capabilities. |
362 Public method to retrieve the debug clients capabilities. |
419 """ |
432 """ |
420 Public method to set the environment for a program to debug, run, ... |
433 Public method to set the environment for a program to debug, run, ... |
421 |
434 |
422 @param env environment settings (dictionary) |
435 @param env environment settings (dictionary) |
423 """ |
436 """ |
424 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEnv, str(env))) |
437 self.__sendCommand('{0}{1}\n'.format( |
425 |
438 DebugProtocol.RequestEnv, str(env))) |
426 def remoteLoad(self, fn, argv, wd, traceInterpreter=False, autoContinue=True, |
439 |
427 autoFork=False, forkChild=False): |
440 def remoteLoad(self, fn, argv, wd, traceInterpreter=False, |
|
441 autoContinue=True, autoFork=False, forkChild=False): |
428 """ |
442 """ |
429 Public method to load a new program to debug. |
443 Public method to load a new program to debug. |
430 |
444 |
431 @param fn the filename to debug (string) |
445 @param fn the filename to debug (string) |
432 @param argv the commandline arguments to pass to the program (string) |
446 @param argv the commandline arguments to pass to the program (string) |
433 @param wd the working directory for the program (string) |
447 @param wd the working directory for the program (string) |
434 @keyparam traceInterpreter flag indicating if the interpreter library should be |
448 @keyparam traceInterpreter flag indicating if the interpreter library |
435 traced as well (boolean) |
449 should be traced as well (boolean) |
436 @keyparam autoContinue flag indicating, that the debugger should not stop |
450 @keyparam autoContinue flag indicating, that the debugger should not |
437 at the first executable line (boolean) |
451 stop at the first executable line (boolean) |
438 @keyparam autoFork flag indicating the automatic fork mode (boolean) |
452 @keyparam autoFork flag indicating the automatic fork mode (boolean) |
439 @keyparam forkChild flag indicating to debug the child after forking (boolean) |
453 @keyparam forkChild flag indicating to debug the child after forking |
|
454 (boolean) |
440 """ |
455 """ |
441 self.__autoContinue = autoContinue |
456 self.__autoContinue = autoContinue |
442 self.__scriptName = os.path.abspath(fn) |
457 self.__scriptName = os.path.abspath(fn) |
443 |
458 |
444 wd = self.translate(wd, False) |
459 wd = self.translate(wd, False) |
445 fn = self.translate(os.path.abspath(fn), False) |
460 fn = self.translate(os.path.abspath(fn), False) |
446 self.__sendCommand('{0}{1}\n'.format( |
461 self.__sendCommand('{0}{1}\n'.format( |
447 DebugProtocol.RequestForkMode, repr((autoFork, forkChild)))) |
462 DebugProtocol.RequestForkMode, repr((autoFork, forkChild)))) |
448 self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format( |
463 self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format( |
449 DebugProtocol.RequestLoad, wd, fn, str(Utilities.parseOptionString(argv)), |
464 DebugProtocol.RequestLoad, wd, fn, |
450 traceInterpreter)) |
465 str(Utilities.parseOptionString(argv)), |
|
466 traceInterpreter)) |
451 |
467 |
452 def remoteRun(self, fn, argv, wd, autoFork=False, forkChild=False): |
468 def remoteRun(self, fn, argv, wd, autoFork=False, forkChild=False): |
453 """ |
469 """ |
454 Public method to load a new program to run. |
470 Public method to load a new program to run. |
455 |
471 |
456 @param fn the filename to run (string) |
472 @param fn the filename to run (string) |
457 @param argv the commandline arguments to pass to the program (string) |
473 @param argv the commandline arguments to pass to the program (string) |
458 @param wd the working directory for the program (string) |
474 @param wd the working directory for the program (string) |
459 @keyparam autoFork flag indicating the automatic fork mode (boolean) |
475 @keyparam autoFork flag indicating the automatic fork mode (boolean) |
460 @keyparam forkChild flag indicating to debug the child after forking (boolean) |
476 @keyparam forkChild flag indicating to debug the child after forking |
|
477 (boolean) |
461 """ |
478 """ |
462 self.__scriptName = os.path.abspath(fn) |
479 self.__scriptName = os.path.abspath(fn) |
463 |
480 |
464 wd = self.translate(wd, False) |
481 wd = self.translate(wd, False) |
465 fn = self.translate(os.path.abspath(fn), False) |
482 fn = self.translate(os.path.abspath(fn), False) |
466 self.__sendCommand('{0}{1}\n'.format( |
483 self.__sendCommand('{0}{1}\n'.format( |
467 DebugProtocol.RequestForkMode, repr((autoFork, forkChild)))) |
484 DebugProtocol.RequestForkMode, repr((autoFork, forkChild)))) |
468 self.__sendCommand('{0}{1}|{2}|{3}\n'.format( |
485 self.__sendCommand('{0}{1}|{2}|{3}\n'.format( |
469 DebugProtocol.RequestRun, wd, fn, str(Utilities.parseOptionString(argv)))) |
486 DebugProtocol.RequestRun, wd, fn, |
|
487 str(Utilities.parseOptionString(argv)))) |
470 |
488 |
471 def remoteCoverage(self, fn, argv, wd, erase=False): |
489 def remoteCoverage(self, fn, argv, wd, erase=False): |
472 """ |
490 """ |
473 Public method to load a new program to collect coverage data. |
491 Public method to load a new program to collect coverage data. |
474 |
492 |
481 self.__scriptName = os.path.abspath(fn) |
499 self.__scriptName = os.path.abspath(fn) |
482 |
500 |
483 wd = self.translate(wd, False) |
501 wd = self.translate(wd, False) |
484 fn = self.translate(os.path.abspath(fn), False) |
502 fn = self.translate(os.path.abspath(fn), False) |
485 self.__sendCommand('{0}{1}@@{2}@@{3}@@{4:d}\n'.format( |
503 self.__sendCommand('{0}{1}@@{2}@@{3}@@{4:d}\n'.format( |
486 DebugProtocol.RequestCoverage, wd, fn, str(Utilities.parseOptionString(argv)), |
504 DebugProtocol.RequestCoverage, wd, fn, |
487 erase)) |
505 str(Utilities.parseOptionString(argv)), erase)) |
488 |
506 |
489 def remoteProfile(self, fn, argv, wd, erase=False): |
507 def remoteProfile(self, fn, argv, wd, erase=False): |
490 """ |
508 """ |
491 Public method to load a new program to collect profiling data. |
509 Public method to load a new program to collect profiling data. |
492 |
510 |
493 @param fn the filename to run (string) |
511 @param fn the filename to run (string) |
494 @param argv the commandline arguments to pass to the program (string) |
512 @param argv the commandline arguments to pass to the program (string) |
495 @param wd the working directory for the program (string) |
513 @param wd the working directory for the program (string) |
496 @keyparam erase flag indicating that timing info should be cleared first (boolean) |
514 @keyparam erase flag indicating that timing info should be cleared |
|
515 first (boolean) |
497 """ |
516 """ |
498 self.__scriptName = os.path.abspath(fn) |
517 self.__scriptName = os.path.abspath(fn) |
499 |
518 |
500 wd = self.translate(wd, False) |
519 wd = self.translate(wd, False) |
501 fn = self.translate(os.path.abspath(fn), False) |
520 fn = self.translate(os.path.abspath(fn), False) |
555 @param cond condition of the breakpoint (string) |
575 @param cond condition of the breakpoint (string) |
556 @param temp flag indicating a temporary breakpoint (boolean) |
576 @param temp flag indicating a temporary breakpoint (boolean) |
557 """ |
577 """ |
558 fn = self.translate(fn, False) |
578 fn = self.translate(fn, False) |
559 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}@@{4:d}@@{5}\n'.format( |
579 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}@@{4:d}@@{5}\n'.format( |
560 DebugProtocol.RequestBreak, fn, line, temp, set, cond)) |
580 DebugProtocol.RequestBreak, fn, line, temp, set, |
|
581 cond)) |
561 |
582 |
562 def remoteBreakpointEnable(self, fn, line, enable): |
583 def remoteBreakpointEnable(self, fn, line, enable): |
563 """ |
584 """ |
564 Public method to enable or disable a breakpoint. |
585 Public method to enable or disable a breakpoint. |
565 |
586 |
566 @param fn filename the breakpoint belongs to (string) |
587 @param fn filename the breakpoint belongs to (string) |
567 @param line linenumber of the breakpoint (int) |
588 @param line linenumber of the breakpoint (int) |
568 @param enable flag indicating enabling or disabling a breakpoint (boolean) |
589 @param enable flag indicating enabling or disabling a breakpoint |
|
590 (boolean) |
569 """ |
591 """ |
570 fn = self.translate(fn, False) |
592 fn = self.translate(fn, False) |
571 self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( |
593 self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( |
572 DebugProtocol.RequestBreakEnable, fn, line, enable)) |
594 DebugProtocol.RequestBreakEnable, fn, line, enable)) |
573 |
595 |
598 def remoteWatchpointEnable(self, cond, enable): |
621 def remoteWatchpointEnable(self, cond, enable): |
599 """ |
622 """ |
600 Public method to enable or disable a watch expression. |
623 Public method to enable or disable a watch expression. |
601 |
624 |
602 @param cond expression of the watch expression (string) |
625 @param cond expression of the watch expression (string) |
603 @param enable flag indicating enabling or disabling a watch expression (boolean) |
626 @param enable flag indicating enabling or disabling a watch expression |
|
627 (boolean) |
604 """ |
628 """ |
605 # cond is combination of cond and special (s. watch expression viewer) |
629 # cond is combination of cond and special (s. watch expression viewer) |
606 self.__sendCommand('{0}{1},{2:d}\n'.format( |
630 self.__sendCommand('{0}{1},{2:d}\n'.format( |
607 DebugProtocol.RequestWatchEnable, cond, enable)) |
631 DebugProtocol.RequestWatchEnable, cond, enable)) |
608 |
632 |
609 def remoteWatchpointIgnore(self, cond, count): |
633 def remoteWatchpointIgnore(self, cond, count): |
610 """ |
634 """ |
611 Public method to ignore a watch expression the next couple of occurrences. |
635 Public method to ignore a watch expression the next couple of |
|
636 occurrences. |
612 |
637 |
613 @param cond expression of the watch expression (string) |
638 @param cond expression of the watch expression (string) |
614 @param count number of occurrences to ignore (int) |
639 @param count number of occurrences to ignore (int) |
615 """ |
640 """ |
616 # cond is combination of cond and special (s. watch expression viewer) |
641 # cond is combination of cond and special (s. watch expression viewer) |
680 """ |
707 """ |
681 if on: |
708 if on: |
682 cmd = "on" |
709 cmd = "on" |
683 else: |
710 else: |
684 cmd = "off" |
711 cmd = "off" |
685 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestCallTrace, cmd)) |
712 self.__sendCommand('{0}{1}\n'.format( |
|
713 DebugProtocol.RequestCallTrace, cmd)) |
686 |
714 |
687 def remoteEval(self, arg): |
715 def remoteEval(self, arg): |
688 """ |
716 """ |
689 Public method to evaluate arg in the current context of the debugged program. |
717 Public method to evaluate arg in the current context of the debugged |
|
718 program. |
690 |
719 |
691 @param arg the arguments to evaluate (string) |
720 @param arg the arguments to evaluate (string) |
692 """ |
721 """ |
693 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEval, arg)) |
722 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEval, arg)) |
694 |
723 |
695 def remoteExec(self, stmt): |
724 def remoteExec(self, stmt): |
696 """ |
725 """ |
697 Public method to execute stmt in the current context of the debugged program. |
726 Public method to execute stmt in the current context of the debugged |
|
727 program. |
698 |
728 |
699 @param stmt statement to execute (string) |
729 @param stmt statement to execute (string) |
700 """ |
730 """ |
701 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestExec, stmt)) |
731 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestExec, stmt)) |
702 |
732 |
717 Public slot to get the a list of possible commandline completions |
747 Public slot to get the a list of possible commandline completions |
718 from the remote client. |
748 from the remote client. |
719 |
749 |
720 @param text the text to be completed (string) |
750 @param text the text to be completed (string) |
721 """ |
751 """ |
722 self.__sendCommand("{0}{1}\n".format(DebugProtocol.RequestCompletion, text)) |
752 self.__sendCommand("{0}{1}\n".format( |
|
753 DebugProtocol.RequestCompletion, text)) |
723 |
754 |
724 def remoteUTPrepare(self, fn, tn, tfn, failed, cov, covname, coverase): |
755 def remoteUTPrepare(self, fn, tn, tfn, failed, cov, covname, coverase): |
725 """ |
756 """ |
726 Public method to prepare a new unittest run. |
757 Public method to prepare a new unittest run. |
727 |
758 |
728 @param fn the filename to load (string) |
759 @param fn the filename to load (string) |
729 @param tn the testname to load (string) |
760 @param tn the testname to load (string) |
730 @param tfn the test function name to load tests from (string) |
761 @param tfn the test function name to load tests from (string) |
731 @param failed list of failed test, if only failed test should be run |
762 @param failed list of failed test, if only failed test should be run |
732 (list of strings) |
763 (list of strings) |
733 @param cov flag indicating collection of coverage data is requested (boolean) |
764 @param cov flag indicating collection of coverage data is requested |
|
765 (boolean) |
734 @param covname filename to be used to assemble the coverage caches |
766 @param covname filename to be used to assemble the coverage caches |
735 filename (string) |
767 filename (string) |
736 @param coverase flag indicating erasure of coverage data is requested (boolean) |
768 @param coverase flag indicating erasure of coverage data is requested |
|
769 (boolean) |
737 """ |
770 """ |
738 self.__scriptName = os.path.abspath(fn) |
771 self.__scriptName = os.path.abspath(fn) |
739 |
772 |
740 fn = self.translate(os.path.abspath(fn), False) |
773 fn = self.translate(os.path.abspath(fn), False) |
741 self.__sendCommand('{0}{1}|{2}|{3}|{4}|{5:d}|{6}|{7:d}\n'.format( |
774 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(evalArg) |
1016 testname, traceback, id = eval(evalArg) |
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(evalArg) |
1022 testname, traceback, id = eval(evalArg) |
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 |