DebugClients/Python/DebugClientBase.py

branch
debugger fine grinding
changeset 5540
40992b7a60a9
parent 5536
d28e800f2810
child 5551
16f9a0bccda1
--- a/DebugClients/Python/DebugClientBase.py	Sat Feb 18 21:54:09 2017 +0100
+++ b/DebugClients/Python/DebugClientBase.py	Sun Feb 19 22:13:48 2017 +0100
@@ -494,8 +494,7 @@
             code = self.__compileFileSource(self.running)
             if code:
                 sys.setprofile(self.callTraceEnabled)
-                res = self.mainThread.run(code, self.debugMod.__dict__)
-                self.progTerminated(res)
+                self.mainThread.run(code, self.debugMod.__dict__, debug=True)
 
         elif method == "RequestRun":
             sys.argv = []
@@ -529,13 +528,7 @@
             res = 0
             code = self.__compileFileSource(self.running)
             if code:
-                try:
-                    exec(code, self.debugMod.__dict__)
-                except SystemExit as exc:
-                    res = exc.code
-                    atexit._run_exitfuncs()
-                self.writestream.flush()
-                self.progTerminated(res)
+                self.mainThread.run(code, self.debugMod.__dict__, debug=False)
 
         elif method == "RequestCoverage":
             from coverage import coverage
@@ -567,17 +560,10 @@
             code = self.__compileFileSource(sys.argv[0])
             if code:
                 self.running = sys.argv[0]
-                res = 0
                 self.cover.start()
-                try:
-                    exec(code, self.debugMod.__dict__)
-                except SystemExit as exc:
-                    res = exc.code
-                    atexit._run_exitfuncs()
+                self.mainThread.run(code, self.debugMod.__dict__, debug=False)
                 self.cover.stop()
                 self.cover.save()
-                self.writestream.flush()
-                self.progTerminated(res)
         
         elif method == "RequestProfile":
             sys.setprofile(None)
@@ -618,12 +604,15 @@
                 res = 0
                 try:
                     self.prof.run(script)
+                    atexit._run_exitfuncs()
                 except SystemExit as exc:
                     res = exc.code
-                    
-                atexit._run_exitfuncs()
+                    atexit._run_exitfuncs()
+                except Exception:
+                    excinfo = sys.exc_info()
+                    self.__unhandled_exception(*excinfo)
+                
                 self.prof.save()
-                self.writestream.flush()
                 self.progTerminated(res)
         
         elif method == "ExecuteStatement":

eric ide

mercurial