177 self.passive = False # used to indicate the passive mode |
177 self.passive = False # used to indicate the passive mode |
178 self.running = None |
178 self.running = None |
179 self.test = None |
179 self.test = None |
180 self.debugging = False |
180 self.debugging = False |
181 self.multiprocessSupport = False |
181 self.multiprocessSupport = False |
|
182 self.reportAllExceptions = False |
182 self.noDebugList = [] |
183 self.noDebugList = [] |
183 |
184 |
184 self.readstream = None |
185 self.readstream = None |
185 self.writestream = None |
186 self.writestream = None |
186 self.errorstream = None |
187 self.errorstream = None |
266 with contextlib.suppress(Exception): # secok |
267 with contextlib.suppress(Exception): # secok |
267 self.set_quit() |
268 self.set_quit() |
268 |
269 |
269 self.debugging = False |
270 self.debugging = False |
270 self.multiprocessSupport = False |
271 self.multiprocessSupport = False |
|
272 self.reportAllExceptions = False |
271 self.noDebugList = [] |
273 self.noDebugList = [] |
272 |
274 |
273 # make sure we close down our end of the socket |
275 # make sure we close down our end of the socket |
274 # might be overkill as normally stdin, stdout and stderr |
276 # might be overkill as normally stdin, stdout and stderr |
275 # SHOULD be closed on exit, but it does not hurt to do it here |
277 # SHOULD be closed on exit, but it does not hurt to do it here |
468 os.chdir(params["workdir"]) |
470 os.chdir(params["workdir"]) |
469 |
471 |
470 self.running = sys.argv[0] |
472 self.running = sys.argv[0] |
471 self.debugging = True |
473 self.debugging = True |
472 self.multiprocessSupport = params["multiprocess"] |
474 self.multiprocessSupport = params["multiprocess"] |
|
475 self.reportAllExceptions = params["reportAllExceptions"] |
473 |
476 |
474 self.threads.clear() |
477 self.threads.clear() |
475 self.attachThread(mainThread=True) |
478 self.attachThread(mainThread=True) |
476 |
479 |
477 # set the system exception handling function to ensure, that |
480 # set the system exception handling function to ensure, that |
995 "characternumber": charno, |
998 "characternumber": charno, |
996 "threadName": threadName, |
999 "threadName": threadName, |
997 }, |
1000 }, |
998 ) |
1001 ) |
999 |
1002 |
1000 def sendPassiveStartup(self, filename, exceptions): |
1003 def sendPassiveStartup(self, filename, reportAllExceptions): |
1001 """ |
1004 """ |
1002 Public method to send the passive start information. |
1005 Public method to send the passive start information. |
1003 |
1006 |
1004 @param filename name of the script |
1007 @param filename name of the script |
1005 @type str |
1008 @type str |
1006 @param exceptions flag to enable exception reporting of the IDE |
1009 @param reportAllExceptions flag to enable reporting of all exceptions |
1007 @type bool |
1010 @type bool |
1008 """ |
1011 """ |
1009 self.sendJsonCommand( |
1012 self.sendJsonCommand( |
1010 "PassiveStartup", |
1013 "PassiveStartup", |
1011 { |
1014 { |
1012 "filename": filename, |
1015 "filename": filename, |
1013 "exceptions": exceptions, |
1016 "reportAllExceptions": reportAllExceptions, |
1014 }, |
1017 }, |
1015 ) |
1018 ) |
1016 |
1019 |
1017 def sendDebuggerId(self): |
1020 def sendDebuggerId(self): |
1018 """ |
1021 """ |
1780 @type str |
1783 @type str |
1781 @param port portnumber of the debug server |
1784 @param port portnumber of the debug server |
1782 @type int |
1785 @type int |
1783 @param enableTrace flag to enable the tracing function |
1786 @param enableTrace flag to enable the tracing function |
1784 @type bool |
1787 @type bool |
1785 @param exceptions flag to enable exception reporting of the IDE |
1788 @param reportAllExceptions flag indicating to report all exceptions |
|
1789 instead of unhandled exceptions only |
1786 @type bool |
1790 @type bool |
1787 @param tracePython flag to enable tracing into the Python library |
1791 @param tracePython flag to enable tracing into the Python library |
1788 @type bool |
1792 @type bool |
1789 @param redirect flag indicating redirection of stdin, stdout and |
1793 @param redirect flag indicating redirection of stdin, stdout and |
1790 stderr |
1794 stderr |
1818 # setup the debugger variables |
1822 # setup the debugger variables |
1819 self._fncache = {} |
1823 self._fncache = {} |
1820 self.dircache = [] |
1824 self.dircache = [] |
1821 self.debugging = True |
1825 self.debugging = True |
1822 |
1826 |
|
1827 # all exceptions reporting |
|
1828 self.reportAllExceptions = reportAllExceptions |
|
1829 |
1823 self.attachThread(mainThread=True) |
1830 self.attachThread(mainThread=True) |
1824 self.mainThread.tracePythonLibs(tracePython) |
1831 self.mainThread.tracePythonLibs(tracePython) |
1825 |
1832 |
1826 # set the system exception handling function to ensure, that |
1833 # set the system exception handling function to ensure, that |
1827 # we report on all unhandled exceptions |
1834 # we report on all unhandled exceptions |
1856 @type str |
1863 @type str |
1857 @param host hostname of the debug server |
1864 @param host hostname of the debug server |
1858 @type str |
1865 @type str |
1859 @param port portnumber of the debug server |
1866 @param port portnumber of the debug server |
1860 @type int |
1867 @type int |
1861 @param exceptions flag to enable exception reporting of the IDE |
|
1862 @type bool |
|
1863 @param tracePython flag to enable tracing into the Python library |
1868 @param tracePython flag to enable tracing into the Python library |
1864 @type bool |
1869 @type bool |
1865 @param redirect flag indicating redirection of stdin, stdout and |
1870 @param redirect flag indicating redirection of stdin, stdout and |
1866 stderr |
1871 stderr |
1867 @type bool |
1872 @type bool |
1868 @param passive flag indicating a passive debugging session |
1873 @param passive flag indicating a passive debugging session |
1869 @type bool |
1874 @type bool |
1870 @param multiprocessSupport flag indicating to enable multiprocess |
1875 @param multiprocessSupport flag indicating to enable multiprocess |
1871 debugging support |
1876 debugging support |
|
1877 @type bool |
|
1878 @param reportAllExceptions flag indicating to report all exceptions instead |
|
1879 of unhandled exceptions only |
1872 @type bool |
1880 @type bool |
1873 @param callTraceOptimization flag indicating to speed up function/method |
1881 @param callTraceOptimization flag indicating to speed up function/method |
1874 call tracing |
1882 call tracing |
1875 @type bool |
1883 @type bool |
1876 @param codeStr string containing Python code to execute |
1884 @param codeStr string containing Python code to execute |
1912 os.chdir(wd) |
1920 os.chdir(wd) |
1913 self.running = sys.argv[0] |
1921 self.running = sys.argv[0] |
1914 self.__setCoding(self.running) |
1922 self.__setCoding(self.running) |
1915 self.debugging = True |
1923 self.debugging = True |
1916 self.multiprocessSupport = multiprocessSupport |
1924 self.multiprocessSupport = multiprocessSupport |
|
1925 self.reportAllExceptions = reportAllExceptions |
1917 self.callTraceOptimization = callTraceOptimization |
1926 self.callTraceOptimization = callTraceOptimization |
1918 |
1927 |
1919 self.passive = passive |
1928 self.passive = passive |
1920 if passive: |
1929 if passive: |
1921 self.sendPassiveStartup(self.running, exceptions) |
1930 self.sendPassiveStartup(self.running, reportAllExceptions) |
1922 |
1931 |
1923 self.attachThread(mainThread=True) |
1932 self.attachThread(mainThread=True) |
1924 self.mainThread.tracePythonLibs(tracePython) |
1933 self.mainThread.tracePythonLibs(tracePython) |
1925 |
1934 |
1926 # set the system exception handling function to ensure, that |
1935 # set the system exception handling function to ensure, that |
2039 elif args[0] == "--no-passive": |
2045 elif args[0] == "--no-passive": |
2040 passive = False |
2046 passive = False |
2041 del args[0] |
2047 del args[0] |
2042 elif args[0] == "--multiprocess": |
2048 elif args[0] == "--multiprocess": |
2043 multiprocess = True |
2049 multiprocess = True |
|
2050 del args[0] |
|
2051 elif args[0] == "--report-exceptions": |
|
2052 reportAllExceptions = True |
2044 del args[0] |
2053 del args[0] |
2045 elif args[0] == "--call-trace-optimization": |
2054 elif args[0] == "--call-trace-optimization": |
2046 callTraceOptimization = True |
2055 callTraceOptimization = True |
2047 del args[0] |
2056 del args[0] |
2048 elif args[0] in ("-c", "--code"): |
2057 elif args[0] in ("-c", "--code"): |
2081 res = self.startProgInDebugger( |
2090 res = self.startProgInDebugger( |
2082 args, |
2091 args, |
2083 wd, |
2092 wd, |
2084 host, |
2093 host, |
2085 port, |
2094 port, |
2086 exceptions=exceptions, |
|
2087 tracePython=tracePython, |
2095 tracePython=tracePython, |
2088 redirect=redirect, |
2096 redirect=redirect, |
2089 passive=passive, |
2097 passive=passive, |
2090 multiprocessSupport=multiprocess, |
2098 multiprocessSupport=multiprocess, |
|
2099 reportAllExceptions=reportAllExceptions, |
2091 callTraceOptimization=callTraceOptimization, |
2100 callTraceOptimization=callTraceOptimization, |
2092 codeStr=codeStr, |
2101 codeStr=codeStr, |
2093 scriptModule=scriptModule, |
2102 scriptModule=scriptModule, |
2094 ) |
2103 ) |
2095 sys.exit(res) |
2104 sys.exit(res) |