[Idle-dev] CVS: idle Debugger.py,1.16,1.17

Chui Tey teyc@users.sourceforge.net
Thu, 12 Dec 2002 12:53:22 -0800


Update of /cvsroot/idlefork/idle
In directory sc8-pr-cvs1:/tmp/cvs-serv971

Modified Files:
	Debugger.py 
Log Message:
Prevent debugger from stepping into Idle rpc code

Index: Debugger.py
===================================================================
RCS file: /cvsroot/idlefork/idle/Debugger.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** Debugger.py	2 Dec 2002 04:41:29 -0000	1.16
--- Debugger.py	12 Dec 2002 20:53:19 -0000	1.17
***************
*** 14,24 ****
  
      def user_line(self, frame):
!         # get the currently executing function
!         ##print>>sys.__stderr__, "*function: ", frame.f_code.co_name
!         ##print>>sys.__stderr__, "*file: ", frame.f_code.co_filename        
!         ##print>>sys.__stderr__, "*line number: ", frame.f_code.co_firstlineno
          co_filename = frame.f_code.co_filename
          co_name = frame.f_code.co_name 
          try:
              func = frame.f_locals[co_name]
              if getattr(func, "DebuggerStepThrough", 0):
--- 14,34 ----
  
      def user_line(self, frame):
! 
          co_filename = frame.f_code.co_filename
          co_name = frame.f_code.co_name 
+ 
+         ## print>>sys.__stderr__, "*function: ", frame.f_code.co_name
+         ## print>>sys.__stderr__, "*file: ", frame.f_code.co_filename        
+         ## print>>sys.__stderr__, "*line number: ", frame.f_code.co_firstlineno
+         ## print>>sys.__stderr__, "*name: ", co_name
+         ## print>>sys.__stderr__, "*function: ", frame.f_locals.get(co_name,None)
+ 
          try:
+             # XXX 12 Dec 2002 CGT TO DO: Find way to get a reference to the
+             # XXX currently running function. If the function has an 
+             #     attribute called "DebuggerStepThrough", prevent the debugger
+             #     from stepping through Idle code. The following doesn't work
+             #     in instance methods. Hard coded some workarounds.
+ 
              func = frame.f_locals[co_name]
              if getattr(func, "DebuggerStepThrough", 0):
***************
*** 28,32 ****
          except:
              pass
!         if co_filename in ('rpc.py', '<string>'):
              self.set_step()
              return
--- 38,44 ----
          except:
              pass
! 
!         # workaround for the problem above
!         if co_filename in (r'.\rpc.py', 'rpc.py','<string>'):
              self.set_step()
              return