Debugger/DebugUI.py

branch
Py2 comp.
changeset 2677
3d4277929fb3
parent 2525
8b507a9a2d40
parent 2622
08cc2f31c983
child 2791
a9577f248f04
equal deleted inserted replaced
2670:e60ea6cb8e11 2677:3d4277929fb3
1029 (len(self.excList) and exceptionType in self.excList)))\ 1029 (len(self.excList) and exceptionType in self.excList)))\
1030 or exceptionType.startswith('unhandled'): 1030 or exceptionType.startswith('unhandled'):
1031 res = None 1031 res = None
1032 if stackTrace: 1032 if stackTrace:
1033 try: 1033 try:
1034 file, line = stackTrace[0] 1034 file, line = stackTrace[0][:2]
1035 source, encoding = Utilities.readEncodedFile(file) 1035 source, encoding = Utilities.readEncodedFile(file)
1036 source = source.splitlines(True) 1036 source = source.splitlines(True)
1037 if len(source) >= line and \ 1037 if len(source) >= line and \
1038 "__IGNORE_EXCEPTION__" in Utilities.extractLineFlags( 1038 "__IGNORE_EXCEPTION__" in Utilities.extractLineFlags(
1039 source[line - 1]): 1039 source[line - 1]):
1073 .format(exceptionType, 1073 .format(exceptionType,
1074 Utilities.html_encode(exceptionMessage))) 1074 Utilities.html_encode(exceptionMessage)))
1075 if res == E5MessageBox.Yes: 1075 if res == E5MessageBox.Yes:
1076 self.exceptionInterrupt.emit() 1076 self.exceptionInterrupt.emit()
1077 stack = [] 1077 stack = []
1078 for fn, ln in stackTrace: 1078 for fn, ln, func, args in stackTrace:
1079 stack.append((fn, ln, '')) 1079 stack.append((fn, ln, func, args))
1080 self.clientStack.emit(stack) 1080 self.clientStack.emit(stack)
1081 self.__getClientVariables() 1081 self.__getClientVariables()
1082 self.ui.setDebugProfile() 1082 self.ui.setDebugProfile()
1083 return 1083 return
1084 elif res == E5MessageBox.Ignore: 1084 elif res == E5MessageBox.Ignore:
1456 if not doNotStart: 1456 if not doNotStart:
1457 if runProject and self.project.getProjectType() == "E4Plugin": 1457 if runProject and self.project.getProjectType() == "E4Plugin":
1458 argv = '--plugin="{0}" {1}'.format(fn, argv) 1458 argv = '--plugin="{0}" {1}'.format(fn, argv)
1459 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1459 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1460 1460
1461 self.debugViewer.initCallStackViewer(runProject)
1462
1461 # Ask the client to open the new program. 1463 # Ask the client to open the new program.
1462 self.debugServer.remoteCoverage(fn, argv, wd, env, 1464 self.debugServer.remoteCoverage(fn, argv, wd, env,
1463 autoClearShell=self.autoClearShell, erase=eraseCoverage, 1465 autoClearShell=self.autoClearShell, erase=eraseCoverage,
1464 forProject=runProject, runInConsole=console, 1466 forProject=runProject, runInConsole=console,
1465 clientType=self.clientType) 1467 clientType=self.clientType)
1564 1566
1565 if not doNotStart: 1567 if not doNotStart:
1566 if runProject and self.project.getProjectType() == "E4Plugin": 1568 if runProject and self.project.getProjectType() == "E4Plugin":
1567 argv = '--plugin="{0}" {1}'.format(fn, argv) 1569 argv = '--plugin="{0}" {1}'.format(fn, argv)
1568 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1570 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1571
1572 self.debugViewer.initCallStackViewer(runProject)
1569 1573
1570 # Ask the client to open the new program. 1574 # Ask the client to open the new program.
1571 self.debugServer.remoteProfile(fn, argv, wd, env, 1575 self.debugServer.remoteProfile(fn, argv, wd, env,
1572 autoClearShell=self.autoClearShell, erase=eraseTimings, 1576 autoClearShell=self.autoClearShell, erase=eraseTimings,
1573 forProject=runProject, runInConsole=console, 1577 forProject=runProject, runInConsole=console,
1677 if not doNotStart: 1681 if not doNotStart:
1678 if runProject and self.project.getProjectType() == "E4Plugin": 1682 if runProject and self.project.getProjectType() == "E4Plugin":
1679 argv = '--plugin="{0}" {1}'.format(fn, argv) 1683 argv = '--plugin="{0}" {1}'.format(fn, argv)
1680 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1684 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1681 1685
1686 self.debugViewer.initCallStackViewer(runProject)
1687
1682 # Ask the client to open the new program. 1688 # Ask the client to open the new program.
1683 self.debugServer.remoteRun(fn, argv, wd, env, 1689 self.debugServer.remoteRun(fn, argv, wd, env,
1684 autoClearShell=self.autoClearShell, forProject=runProject, 1690 autoClearShell=self.autoClearShell, forProject=runProject,
1685 runInConsole=console, autoFork=forkAutomatically, 1691 runInConsole=console, autoFork=forkAutomatically,
1686 forkChild=forkIntoChild, clientType=self.clientType) 1692 forkChild=forkIntoChild, clientType=self.clientType)
1796 if not doNotStart: 1802 if not doNotStart:
1797 if debugProject and self.project.getProjectType() == "E4Plugin": 1803 if debugProject and self.project.getProjectType() == "E4Plugin":
1798 argv = '--plugin="{0}" {1}'.format(fn, argv) 1804 argv = '--plugin="{0}" {1}'.format(fn, argv)
1799 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1805 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1800 tracePython = True # override flag because it must be true 1806 tracePython = True # override flag because it must be true
1807
1808 self.debugViewer.initCallStackViewer(debugProject)
1801 1809
1802 # Ask the client to send call trace info 1810 # Ask the client to send call trace info
1803 enableCallTrace = self.debugViewer.isCallTraceEnabled() 1811 enableCallTrace = self.debugViewer.isCallTraceEnabled()
1804 self.debugViewer.clearCallTrace() 1812 self.debugViewer.clearCallTrace()
1805 self.debugViewer.setCallTraceToProjectMode(debugProject) 1813 self.debugViewer.setCallTraceToProjectMode(debugProject)
1853 if not doNotStart: 1861 if not doNotStart:
1854 if forProject and self.project.getProjectType() == "E4Plugin": 1862 if forProject and self.project.getProjectType() == "E4Plugin":
1855 argv = '--plugin="{0}" {1}'.format(fn, argv) 1863 argv = '--plugin="{0}" {1}'.format(fn, argv)
1856 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1864 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1857 1865
1866 self.debugViewer.initCallStackViewer(forProject)
1867
1858 if self.lastStartAction in [1, 2]: 1868 if self.lastStartAction in [1, 2]:
1859 # Ask the client to send call trace info 1869 # Ask the client to send call trace info
1860 enableCallTrace = self.debugViewer.isCallTraceEnabled() 1870 enableCallTrace = self.debugViewer.isCallTraceEnabled()
1861 self.debugViewer.clearCallTrace() 1871 self.debugViewer.clearCallTrace()
1862 self.debugViewer.setCallTraceToProjectMode(forProject) 1872 self.debugViewer.setCallTraceToProjectMode(forProject)
1917 # Set exception reporting 1927 # Set exception reporting
1918 self.setExceptionReporting(exc) 1928 self.setExceptionReporting(exc)
1919 1929
1920 # Signal that we have started a debugging session 1930 # Signal that we have started a debugging session
1921 self.debuggingStarted.emit(fn) 1931 self.debuggingStarted.emit(fn)
1932
1933 # Initialize the call stack viewer
1934 self.debugViewer.initCallStackViewer(False)
1922 1935
1923 def __continue(self): 1936 def __continue(self):
1924 """ 1937 """
1925 Private method to handle the Continue action. 1938 Private method to handle the Continue action.
1926 """ 1939 """

eric ide

mercurial