Debugger/DebuggerInterfacePython3.py

changeset 1171
1ffefa5ca226
parent 1166
a94b0a2fafd7
child 1499
b4d0457afb15
equal deleted inserted replaced
1170:a3731e520b28 1171:1ffefa5ca226
83 self.translateLocal = \ 83 self.translateLocal = \
84 Preferences.getDebugger("PathTranslationLocal") 84 Preferences.getDebugger("PathTranslationLocal")
85 self.translate = self.__remoteTranslation 85 self.translate = self.__remoteTranslation
86 else: 86 else:
87 self.translate = self.__identityTranslation 87 self.translate = self.__identityTranslation
88
89 # attribute to remember the name of the executed script
90 self.__scriptName = ""
88 91
89 def __identityTranslation(self, fn, remote2local=True): 92 def __identityTranslation(self, fn, remote2local=True):
90 """ 93 """
91 Private method to perform the identity path translation. 94 Private method to perform the identity path translation.
92 95
428 at the first executable line (boolean) 431 at the first executable line (boolean)
429 @keyparam autoFork flag indicating the automatic fork mode (boolean) 432 @keyparam autoFork flag indicating the automatic fork mode (boolean)
430 @keyparam forkChild flag indicating to debug the child after forking (boolean) 433 @keyparam forkChild flag indicating to debug the child after forking (boolean)
431 """ 434 """
432 self.__autoContinue = autoContinue 435 self.__autoContinue = autoContinue
436 self.__scriptName = os.path.abspath(fn)
433 437
434 wd = self.translate(wd, False) 438 wd = self.translate(wd, False)
435 fn = self.translate(os.path.abspath(fn), False) 439 fn = self.translate(os.path.abspath(fn), False)
436 self.__sendCommand('{0}{1}\n'.format( 440 self.__sendCommand('{0}{1}\n'.format(
437 DebugProtocol.RequestForkMode, repr((autoFork, forkChild)))) 441 DebugProtocol.RequestForkMode, repr((autoFork, forkChild))))
447 @param argv the commandline arguments to pass to the program (string) 451 @param argv the commandline arguments to pass to the program (string)
448 @param wd the working directory for the program (string) 452 @param wd the working directory for the program (string)
449 @keyparam autoFork flag indicating the automatic fork mode (boolean) 453 @keyparam autoFork flag indicating the automatic fork mode (boolean)
450 @keyparam forkChild flag indicating to debug the child after forking (boolean) 454 @keyparam forkChild flag indicating to debug the child after forking (boolean)
451 """ 455 """
456 self.__scriptName = os.path.abspath(fn)
457
452 wd = self.translate(wd, False) 458 wd = self.translate(wd, False)
453 fn = self.translate(os.path.abspath(fn), False) 459 fn = self.translate(os.path.abspath(fn), False)
454 self.__sendCommand('{0}{1}\n'.format( 460 self.__sendCommand('{0}{1}\n'.format(
455 DebugProtocol.RequestForkMode, repr((autoFork, forkChild)))) 461 DebugProtocol.RequestForkMode, repr((autoFork, forkChild))))
456 self.__sendCommand('{0}{1}|{2}|{3}\n'.format( 462 self.__sendCommand('{0}{1}|{2}|{3}\n'.format(
464 @param argv the commandline arguments to pass to the program (string) 470 @param argv the commandline arguments to pass to the program (string)
465 @param wd the working directory for the program (string) 471 @param wd the working directory for the program (string)
466 @keyparam erase flag indicating that coverage info should be 472 @keyparam erase flag indicating that coverage info should be
467 cleared first (boolean) 473 cleared first (boolean)
468 """ 474 """
475 self.__scriptName = os.path.abspath(fn)
476
469 wd = self.translate(wd, False) 477 wd = self.translate(wd, False)
470 fn = self.translate(os.path.abspath(fn), False) 478 fn = self.translate(os.path.abspath(fn), False)
471 self.__sendCommand('{0}{1}@@{2}@@{3}@@{4:d}\n'.format( 479 self.__sendCommand('{0}{1}@@{2}@@{3}@@{4:d}\n'.format(
472 DebugProtocol.RequestCoverage, wd, fn, str(Utilities.parseOptionString(argv)), 480 DebugProtocol.RequestCoverage, wd, fn, str(Utilities.parseOptionString(argv)),
473 erase)) 481 erase))
479 @param fn the filename to run (string) 487 @param fn the filename to run (string)
480 @param argv the commandline arguments to pass to the program (string) 488 @param argv the commandline arguments to pass to the program (string)
481 @param wd the working directory for the program (string) 489 @param wd the working directory for the program (string)
482 @keyparam erase flag indicating that timing info should be cleared first (boolean) 490 @keyparam erase flag indicating that timing info should be cleared first (boolean)
483 """ 491 """
492 self.__scriptName = os.path.abspath(fn)
493
484 wd = self.translate(wd, False) 494 wd = self.translate(wd, False)
485 fn = self.translate(os.path.abspath(fn), False) 495 fn = self.translate(os.path.abspath(fn), False)
486 self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format( 496 self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format(
487 DebugProtocol.RequestProfile, wd, fn, 497 DebugProtocol.RequestProfile, wd, fn,
488 str(Utilities.parseOptionString(argv)), erase)) 498 str(Utilities.parseOptionString(argv)), erase))
703 @param cov flag indicating collection of coverage data is requested 713 @param cov flag indicating collection of coverage data is requested
704 @param covname filename to be used to assemble the coverage caches 714 @param covname filename to be used to assemble the coverage caches
705 filename 715 filename
706 @param coverase flag indicating erasure of coverage data is requested 716 @param coverase flag indicating erasure of coverage data is requested
707 """ 717 """
718 self.__scriptName = os.path.abspath(fn)
719
708 fn = self.translate(os.path.abspath(fn), False) 720 fn = self.translate(os.path.abspath(fn), False)
709 self.__sendCommand('{0}{1}|{2}|{3}|{4:d}|{5}|{6:d}\n'.format( 721 self.__sendCommand('{0}{1}|{2}|{3}|{4:d}|{5}|{6:d}\n'.format(
710 DebugProtocol.RequestUTPrepare, fn, tn, tfn, cov, covname, coverase)) 722 DebugProtocol.RequestUTPrepare, fn, tn, tfn, cov, covname, coverase))
711 723
712 def remoteUTRun(self): 724 def remoteUTRun(self):
829 exclist = eval(exc) 841 exclist = eval(exc)
830 exctype = exclist[0] 842 exctype = exclist[0]
831 excmessage = exclist[1] 843 excmessage = exclist[1]
832 stack = exclist[2:] 844 stack = exclist[2:]
833 if stack and stack[0] and stack[0][0] == "<string>": 845 if stack and stack[0] and stack[0][0] == "<string>":
834 stack = [] 846 for stackEntry in stack:
847 if stackEntry[0] == "<string>":
848 stackEntry[0] = self.__scriptName
849 else:
850 break
835 except (IndexError, ValueError, SyntaxError): 851 except (IndexError, ValueError, SyntaxError):
836 exctype = None 852 exctype = None
837 excmessage = '' 853 excmessage = ''
838 stack = [] 854 stack = []
839 self.debugServer.signalClientException(exctype, excmessage, stack) 855 self.debugServer.signalClientException(exctype, excmessage, stack)
855 cn = 0 871 cn = 0
856 self.debugServer.signalClientSyntaxError(message, fn, ln, cn) 872 self.debugServer.signalClientSyntaxError(message, fn, ln, cn)
857 continue 873 continue
858 874
859 if resp == DebugProtocol.ResponseExit: 875 if resp == DebugProtocol.ResponseExit:
876 self.__scriptName = ""
860 self.debugServer.signalClientExit(line[eoc:-1]) 877 self.debugServer.signalClientExit(line[eoc:-1])
861 continue 878 continue
862 879
863 if resp == DebugProtocol.ResponseClearBreak: 880 if resp == DebugProtocol.ResponseClearBreak:
864 fn, lineno = line[eoc:-1].split(',') 881 fn, lineno = line[eoc:-1].split(',')

eric ide

mercurial