src/eric7/DebugClients/Python/DebugClientBase.py

branch
eric7
changeset 10542
e46910b0ce73
parent 10496
f9925e08dbce
child 10551
d80184d38152
--- a/src/eric7/DebugClients/Python/DebugClientBase.py	Fri Feb 02 13:33:55 2024 +0100
+++ b/src/eric7/DebugClients/Python/DebugClientBase.py	Fri Feb 02 14:33:16 2024 +0100
@@ -205,6 +205,8 @@
 
         self.callTraceOptimization = False
 
+        self.__debugeeExceptHook = None
+
     def getCoding(self):
         """
         Public method to return the current coding.
@@ -1240,6 +1242,22 @@
         """
         self.mainThread.user_exception((exctype, excval, exctb), True)
 
+        if self.__debugeeExceptHook is not None:
+            # call the exception hook of the program being debugged
+            self.__debugeeExceptHook(exctype, excval, exctb)
+
+    def checkExceptionHook(self):
+        """
+        Public method to check, that 'sys.excepthook' is still our hook.
+
+        If the exception hook has been changed by the program being debugger, save
+        that hook and set it to ours again. The program's hook is called in our
+        '__unhandled_exception()' method.
+        """
+        if sys.excepthook != self.__unhandled_exception:
+            self.__debugeeExceptHook = sys.excepthook
+            sys.excepthook = self.__unhandled_exception
+
     def __interceptSignals(self):
         """
         Private method to intercept common signals.

eric ide

mercurial