Debugger/DebuggerInterfacePython.py

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

eric ide

mercurial