New set_trace for sys.breakpoint to reflect the changes in previous commit. debugger speed

Mon, 08 Aug 2016 22:50:36 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Mon, 08 Aug 2016 22:50:36 +0200
branch
debugger speed
changeset 5086
6cb8be573090
parent 5085
85dfb7886fb9
child 5087
59316f14216b

New set_trace for sys.breakpoint to reflect the changes in previous commit.

DebugClients/Python/DebugBase.py file | annotate | diff | comparison | revisions
DebugClients/Python3/DebugBase.py file | annotate | diff | comparison | revisions
--- a/DebugClients/Python/DebugBase.py	Mon Aug 08 22:38:07 2016 +0200
+++ b/DebugClients/Python/DebugBase.py	Mon Aug 08 22:50:36 2016 +0200
@@ -344,23 +344,27 @@
         Public method to start debugging from 'frame'.
 
         If frame is not specified, debugging starts from caller's frame.
+        Because of jump optimizations it's not possible to use sys.breakpoint()
+        as last instruction in a function or method.
         
-        @param frame frame to start debugging from
+        @keyparam frame frame to start debugging from
         @type frame object
         """
         if frame is None:
-            frame = sys._getframe().f_back
+            frame = sys._getframe().f_back  # Skip set_trace method
         
-        # stop at erics debugger frame
-        while frame:
-            if not self.__skipFrame(frame):
+        frame.f_trace = self.trace_dispatch
+        while frame is not None:
+            # stop at erics debugger frame
+            if frame.f_back.f_code == self._dbgClient.handleLine.func_code:
                 frame.f_trace = self.trace_dispatch
+                self.botframe = frame
+                self._dbgClient.mainFrame = frame
+                break
+            
             frame = frame.f_back
-            self.botframe = frame
-            if self.__skipFrame(frame):
-                break
         
-        self.set_step()
+        self.stop_everywhere = True
         sys.settrace(self.trace_dispatch)
         sys.setprofile(self._dbgClient.callTraceEnabled)
     
@@ -417,6 +421,7 @@
         # Here we only set a new stop frame if it is a normal continue.
         if not special:
             self._set_stopinfo(self.botframe, None)
+        
         # Disable tracing if not started in debug mode
         if not self._dbgClient.debugging:
             sys.settrace(None)
--- a/DebugClients/Python3/DebugBase.py	Mon Aug 08 22:38:07 2016 +0200
+++ b/DebugClients/Python3/DebugBase.py	Mon Aug 08 22:50:36 2016 +0200
@@ -362,23 +362,27 @@
         Public method to start debugging from 'frame'.
 
         If frame is not specified, debugging starts from caller's frame.
+        Because of jump optimizations it's not possible to use sys.breakpoint()
+        as last instruction in a function or method.
         
-        @param frame frame to start debugging from
+        @keyparam frame frame to start debugging from
         @type frame object
         """
         if frame is None:
-            frame = sys._getframe().f_back
+            frame = sys._getframe().f_back  # Skip set_trace method
         
-        # stop at erics debugger frame
-        while frame:
-            if not self.__skipFrame(frame):
+        frame.f_trace = self.trace_dispatch
+        while frame is not None:
+            # stop at erics debugger frame
+            if frame.f_back.f_code == self._dbgClient.handleLine.__code__:
                 frame.f_trace = self.trace_dispatch
+                self.botframe = frame
+                self._dbgClient.mainFrame = frame
+                break
+            
             frame = frame.f_back
-            self.botframe = frame
-            if self.__skipFrame(frame):
-                break
         
-        self.set_step()
+        self.stop_everywhere = True
         sys.settrace(self.trace_dispatch)
         sys.setprofile(self._dbgClient.callTraceEnabled)
     

eric ide

mercurial