Tue, 23 Aug 2022 16:20:08 +0200
Debugger
- added capability to suppress reporting of unhandled exceptions
--- a/docs/changelog Mon Aug 22 19:08:56 2022 +0200 +++ b/docs/changelog Tue Aug 23 16:20:08 2022 +0200 @@ -7,6 +7,8 @@ -- updated imports checker to support banned module patterns -- updated the annotations checker to support more cases -- updated the simplifications checker to support more cases +- Debugger + -- added capability to suppress reporting of unhandled exceptions - MicroPython -- added capability to connect to devices for which only the serial port name is available
--- a/src/eric7/Debugger/DebugUI.py Mon Aug 22 19:08:56 2022 +0200 +++ b/src/eric7/Debugger/DebugUI.py Tue Aug 23 16:20:08 2022 +0200 @@ -114,6 +114,9 @@ self.exceptions = Preferences.toBool( Preferences.getSettings().value("DebugInfo/ReportExceptions", True) ) + self.unhandledExceptions = Preferences.toBool( + Preferences.getSettings().value("DebugInfo/ReportUnhandledExceptions", True) + ) self.autoClearShell = Preferences.toBool( Preferences.getSettings().value("DebugInfo/AutoClearShell", True) ) @@ -976,13 +979,17 @@ self.envHistory.remove(envStr) self.envHistory.insert(0, envStr) - def setExceptionReporting(self, exceptions): + def setExceptionReporting(self, exceptions, unhandledExceptions=True): """ Public slot to initialize the exception reporting flag. - @param exceptions flag indicating exception reporting status (boolean) + @param exceptions flag indicating exception reporting status + @type bool + @param unhandledExceptions flag indicating to always report unhandled exceptions + @type bool """ self.exceptions = exceptions + self.unhandledExceptions = unhandledExceptions def setExcList(self, excList): """ @@ -1197,6 +1204,9 @@ "DebugInfo/ReportExceptions", self.exceptions ) Preferences.getSettings().setValue( + "DebugInfo/ReportUnhandledExceptions", self.unhandledExceptions + ) + Preferences.getSettings().setValue( "DebugInfo/AutoClearShell", self.autoClearShell ) Preferences.getSettings().setValue("DebugInfo/TracePython", self.tracePython) @@ -1445,7 +1455,7 @@ not len(self.excList) or (len(self.excList) and exceptionType in self.excList) ) - ) or exceptionType.startswith("unhandled"): + ) or (self.unhandledExceptions and exceptionType.startswith("unhandled")): res = None if stackTrace: with contextlib.suppress(UnicodeError, OSError): @@ -1955,6 +1965,7 @@ self.wdHistory, self.envHistory, self.exceptions, + self.unhandledExceptions, self.ui, 2, autoClearShell=self.autoClearShell, @@ -1971,6 +1982,7 @@ wd, env, exceptions, + unhandledExceptions, clearShell, console, ) = dlg.getData() @@ -2053,6 +2065,7 @@ # Save the exception flags self.exceptions = exceptions + self.unhandledExceptions = unhandledExceptions # Save the erase coverage flag self.eraseCoverage = eraseCoverage @@ -2156,6 +2169,7 @@ self.wdHistory, self.envHistory, self.exceptions, + self.unhandledExceptions, self.ui, 3, autoClearShell=self.autoClearShell, @@ -2172,6 +2186,7 @@ wd, env, exceptions, + unhandledExceptions, clearShell, console, ) = dlg.getData() @@ -2254,6 +2269,7 @@ # Save the exception flags self.exceptions = exceptions + self.unhandledExceptions = unhandledExceptions # Save the erase timing flag self.eraseTimings = eraseTimings @@ -2353,6 +2369,7 @@ self.wdHistory, self.envHistory, self.exceptions, + self.unhandledExceptions, self.ui, 1, autoClearShell=self.autoClearShell, @@ -2369,6 +2386,7 @@ wd, env, exceptions, + unhandledExceptions, clearShell, console, ) = dlg.getData() @@ -2450,6 +2468,7 @@ # Save the exception flags self.exceptions = exceptions + self.unhandledExceptions = unhandledExceptions # Save the clear interpreter flag self.autoClearShell = clearShell @@ -2545,6 +2564,7 @@ self.wdHistory, self.envHistory, self.exceptions, + self.unhandledExceptions, self.ui, 0, tracePython=self.tracePython, @@ -2565,6 +2585,7 @@ wd, env, exceptions, + unhandledExceptions, clearShell, console, ) = dlg.getData() @@ -2656,6 +2677,7 @@ # Save the exception flags self.exceptions = exceptions + self.unhandledExceptions = unhandledExceptions # Save the tracePython flag self.tracePython = tracePython
--- a/src/eric7/Debugger/StartCoverageDialog.ui Mon Aug 22 19:08:56 2022 +0200 +++ b/src/eric7/Debugger/StartCoverageDialog.ui Tue Aug 23 16:20:08 2022 +0200 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>550</width> - <height>327</height> + <width>600</width> + <height>357</height> </rect> </property> <property name="windowTitle"> @@ -238,6 +238,19 @@ </widget> </item> <item row="0" column="1"> + <widget class="QCheckBox" name="unhandledExceptionCheckBox"> + <property name="toolTip"> + <string>Uncheck to disable reporting of unhandled exceptions</string> + </property> + <property name="text"> + <string>Always report unhandled exceptions</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> <widget class="QCheckBox" name="clearShellCheckBox"> <property name="toolTip"> <string>Select to clear the display of the interpreter window</string> @@ -253,7 +266,7 @@ </property> </widget> </item> - <item row="1" column="0"> + <item row="1" column="1"> <widget class="QCheckBox" name="consoleCheckBox"> <property name="toolTip"> <string>Select to start the debugger in a console window</string> @@ -267,7 +280,7 @@ </property> </widget> </item> - <item row="1" column="1"> + <item row="2" column="0"> <widget class="QCheckBox" name="eraseCheckBox"> <property name="toolTip"> <string>Select this to erase the collected coverage information</string> @@ -316,6 +329,7 @@ <tabstop>globalOverrideGroup</tabstop> <tabstop>redirectCheckBox</tabstop> <tabstop>exceptionCheckBox</tabstop> + <tabstop>unhandledExceptionCheckBox</tabstop> <tabstop>clearShellCheckBox</tabstop> <tabstop>consoleCheckBox</tabstop> <tabstop>eraseCheckBox</tabstop>
--- a/src/eric7/Debugger/StartDebugDialog.ui Mon Aug 22 19:08:56 2022 +0200 +++ b/src/eric7/Debugger/StartDebugDialog.ui Tue Aug 23 16:20:08 2022 +0200 @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>550</width> + <width>600</width> <height>434</height> </rect> </property> @@ -214,6 +214,69 @@ </item> <item> <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QCheckBox" name="exceptionCheckBox"> + <property name="toolTip"> + <string>Uncheck to disable exception reporting</string> + </property> + <property name="whatsThis"> + <string><b>Report exceptions</b> +<p>Uncheck this in order to disable exception reporting.</p></string> + </property> + <property name="text"> + <string>Report exceptions</string> + </property> + <property name="shortcut"> + <string>Alt+E</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QCheckBox" name="unhandledExceptionCheckBox"> + <property name="toolTip"> + <string>Uncheck to disable reporting of unhandled exceptions</string> + </property> + <property name="text"> + <string>Always report unhandled exceptions</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QCheckBox" name="clearShellCheckBox"> + <property name="toolTip"> + <string>Select to clear the display of the interpreter window</string> + </property> + <property name="whatsThis"> + <string><b>Clear interpreter window</b><p>This clears the display of the interpreter window before starting the debug client.</p></string> + </property> + <property name="text"> + <string>Clear interpreter window</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="consoleCheckBox"> + <property name="toolTip"> + <string>Select to start the debugger in a console window</string> + </property> + <property name="whatsThis"> + <string><b>Start in console</b> +<p>Select to start the debugger in a console window. The console command has to be configured on the Debugger-&gt;General page</p></string> + </property> + <property name="text"> + <string>Start in console</string> + </property> + </widget> + </item> <item row="2" column="0"> <widget class="QCheckBox" name="tracePythonCheckBox"> <property name="toolTip"> @@ -243,56 +306,6 @@ </property> </widget> </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="clearShellCheckBox"> - <property name="toolTip"> - <string>Select to clear the display of the interpreter window</string> - </property> - <property name="whatsThis"> - <string><b>Clear interpreter window</b><p>This clears the display of the interpreter window before starting the debug client.</p></string> - </property> - <property name="text"> - <string>Clear interpreter window</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QCheckBox" name="exceptionCheckBox"> - <property name="toolTip"> - <string>Uncheck to disable exception reporting</string> - </property> - <property name="whatsThis"> - <string><b>Report exceptions</b> -<p>Uncheck this in order to disable exception reporting.</p></string> - </property> - <property name="text"> - <string>Report exceptions</string> - </property> - <property name="shortcut"> - <string>Alt+E</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QCheckBox" name="consoleCheckBox"> - <property name="toolTip"> - <string>Select to start the debugger in a console window</string> - </property> - <property name="whatsThis"> - <string><b>Start in console</b> -<p>Select to start the debugger in a console window. The console command has to be configured on the Debugger-&gt;General page</p></string> - </property> - <property name="text"> - <string>Start in console</string> - </property> - </widget> - </item> </layout> </item> <item> @@ -381,6 +394,7 @@ <tabstop>globalOverrideGroup</tabstop> <tabstop>redirectCheckBox</tabstop> <tabstop>exceptionCheckBox</tabstop> + <tabstop>unhandledExceptionCheckBox</tabstop> <tabstop>clearShellCheckBox</tabstop> <tabstop>consoleCheckBox</tabstop> <tabstop>tracePythonCheckBox</tabstop>
--- a/src/eric7/Debugger/StartDialog.py Mon Aug 22 19:08:56 2022 +0200 +++ b/src/eric7/Debugger/StartDialog.py Tue Aug 23 16:20:08 2022 +0200 @@ -35,6 +35,7 @@ wdList, envList, exceptions, + unhandledExceptions, parent=None, dialogType=0, modfuncList=None, @@ -64,6 +65,8 @@ @type list of str @param exceptions exception reporting flag @type bool + @param unhandledExceptions flag indicating to always report unhandled exceptions + @type bool @param parent parent widget of this dialog @type QWidget @param dialogType type of the start dialog @@ -174,6 +177,7 @@ self.ui.environmentCombo.clear() self.ui.environmentCombo.addItems(envList) self.ui.exceptionCheckBox.setChecked(exceptions) + self.ui.unhandledExceptionCheckBox.setChecked(unhandledExceptions) self.ui.clearShellCheckBox.setChecked(autoClearShell) self.ui.consoleCheckBox.setEnabled( Preferences.getDebugger("ConsoleDbgCommand") != "" @@ -229,9 +233,9 @@ Public method to retrieve the data entered into this dialog. @return a tuple of virtual environment, script name, argv, workdir, - environment, exceptions flag, clear interpreter flag and run in - console flag - @rtype tuple of (str, str, str, str, str, bool, bool, bool) + environment, exceptions flag, unhandled exceptions flag, clear interpreter + flag and run in console flag + @rtype tuple of (str, str, str, str, str, bool, bool, bool, bool) """ cmdLine = self.ui.cmdlineCombo.currentText() workdir = self.ui.workdirPicker.currentText(toNative=False) @@ -250,6 +254,7 @@ workdir, environment, self.ui.exceptionCheckBox.isChecked(), + self.ui.unhandledExceptionCheckBox.isChecked(), self.ui.clearShellCheckBox.isChecked(), self.ui.consoleCheckBox.isChecked(), )
--- a/src/eric7/Debugger/StartProfileDialog.ui Mon Aug 22 19:08:56 2022 +0200 +++ b/src/eric7/Debugger/StartProfileDialog.ui Tue Aug 23 16:20:08 2022 +0200 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>550</width> - <height>327</height> + <width>600</width> + <height>357</height> </rect> </property> <property name="windowTitle"> @@ -235,6 +235,19 @@ </widget> </item> <item row="0" column="1"> + <widget class="QCheckBox" name="unhandledExceptionCheckBox"> + <property name="toolTip"> + <string>Uncheck to disable reporting of unhandled exceptions</string> + </property> + <property name="text"> + <string>Always report unhandled exceptions</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> <widget class="QCheckBox" name="clearShellCheckBox"> <property name="toolTip"> <string>Select to clear the display of the interpreter window</string> @@ -250,7 +263,7 @@ </property> </widget> </item> - <item row="1" column="0"> + <item row="1" column="1"> <widget class="QCheckBox" name="consoleCheckBox"> <property name="toolTip"> <string>Select to start the debugger in a console window</string> @@ -264,7 +277,7 @@ </property> </widget> </item> - <item row="1" column="1"> + <item row="2" column="0"> <widget class="QCheckBox" name="eraseCheckBox"> <property name="toolTip"> <string>Select this to erase the collected timing data</string> @@ -313,6 +326,7 @@ <tabstop>globalOverrideGroup</tabstop> <tabstop>redirectCheckBox</tabstop> <tabstop>exceptionCheckBox</tabstop> + <tabstop>unhandledExceptionCheckBox</tabstop> <tabstop>clearShellCheckBox</tabstop> <tabstop>consoleCheckBox</tabstop> <tabstop>eraseCheckBox</tabstop>
--- a/src/eric7/Debugger/StartRunDialog.ui Mon Aug 22 19:08:56 2022 +0200 +++ b/src/eric7/Debugger/StartRunDialog.ui Tue Aug 23 16:20:08 2022 +0200 @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>550</width> + <width>600</width> <height>327</height> </rect> </property> @@ -234,7 +234,21 @@ </property> </widget> </item> - <item row="0" column="1"> + <item row="1" column="1"> + <widget class="QCheckBox" name="consoleCheckBox"> + <property name="toolTip"> + <string>Select to start the debugger in a console window</string> + </property> + <property name="whatsThis"> + <string><b>Start in console</b> +<p>Select to start the debugger in a console window. The console command has to be configured on the Debugger-&gt;General page</p></string> + </property> + <property name="text"> + <string>Start in console</string> + </property> + </widget> + </item> + <item row="1" column="0"> <widget class="QCheckBox" name="clearShellCheckBox"> <property name="toolTip"> <string>Select to clear the display of the interpreter window</string> @@ -250,17 +264,16 @@ </property> </widget> </item> - <item row="1" column="0"> - <widget class="QCheckBox" name="consoleCheckBox"> + <item row="0" column="1"> + <widget class="QCheckBox" name="unhandledExceptionCheckBox"> <property name="toolTip"> - <string>Select to start the debugger in a console window</string> - </property> - <property name="whatsThis"> - <string><b>Start in console</b> -<p>Select to start the debugger in a console window. The console command has to be configured on the Debugger-&gt;General page</p></string> + <string>Uncheck to disable reporting of unhandled exceptions</string> </property> <property name="text"> - <string>Start in console</string> + <string>Always report unhandled exceptions</string> + </property> + <property name="checked"> + <bool>true</bool> </property> </widget> </item> @@ -296,6 +309,7 @@ <tabstop>globalOverrideGroup</tabstop> <tabstop>redirectCheckBox</tabstop> <tabstop>exceptionCheckBox</tabstop> + <tabstop>unhandledExceptionCheckBox</tabstop> <tabstop>clearShellCheckBox</tabstop> <tabstop>consoleCheckBox</tabstop> </tabstops>