mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
1. Update debugger to not trace RPC code even when calling Queue and
threading modules. Can debug user code which imports these modules, though. 2. Re-enable debugger in PyShell. 3. Remove old code implementing previous approaches to this issue. M Debugger.py M PyShell.py M rpc.py
This commit is contained in:
parent
9f545c489a
commit
57bfe5dc5a
3 changed files with 17 additions and 33 deletions
|
@ -13,43 +13,29 @@ class Idb(bdb.Bdb):
|
||||||
bdb.Bdb.__init__(self)
|
bdb.Bdb.__init__(self)
|
||||||
|
|
||||||
def user_line(self, frame):
|
def user_line(self, frame):
|
||||||
|
if self.in_rpc_code(frame):
|
||||||
co_filename = frame.f_code.co_filename
|
self.set_step()
|
||||||
## co_name = frame.f_code.co_name
|
return
|
||||||
|
|
||||||
## 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):
|
|
||||||
## print "XXXX DEBUGGER STEPPING THROUGH"
|
|
||||||
## self.set_step()
|
|
||||||
## return
|
|
||||||
## except:
|
|
||||||
## pass
|
|
||||||
|
|
||||||
# workaround for the problem above
|
|
||||||
exclude = ('rpc.py', 'threading.py', '<string>')
|
|
||||||
for rpcfile in exclude:
|
|
||||||
if co_filename.count(rpcfile):
|
|
||||||
self.set_step()
|
|
||||||
return
|
|
||||||
message = self.__frame2message(frame)
|
message = self.__frame2message(frame)
|
||||||
self.gui.interaction(message, frame)
|
self.gui.interaction(message, frame)
|
||||||
|
|
||||||
def user_exception(self, frame, info):
|
def user_exception(self, frame, info):
|
||||||
|
if self.in_rpc_code(frame):
|
||||||
|
self.set_step()
|
||||||
|
return
|
||||||
message = self.__frame2message(frame)
|
message = self.__frame2message(frame)
|
||||||
self.gui.interaction(message, frame, info)
|
self.gui.interaction(message, frame, info)
|
||||||
|
|
||||||
|
def in_rpc_code(self, frame):
|
||||||
|
if frame.f_code.co_filename.count('rpc.py'):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
prev_frame = frame.f_back
|
||||||
|
if prev_frame.f_code.co_filename.count('Debugger.py'):
|
||||||
|
# (that test will catch both Debugger.py and RemoteDebugger.py)
|
||||||
|
return False
|
||||||
|
return self.in_rpc_code(prev_frame)
|
||||||
|
|
||||||
def __frame2message(self, frame):
|
def __frame2message(self, frame):
|
||||||
code = frame.f_code
|
code = frame.f_code
|
||||||
filename = code.co_filename
|
filename = code.co_filename
|
||||||
|
|
|
@ -690,7 +690,7 @@ class PyShell(OutputWindow):
|
||||||
text.bind("<<beginning-of-line>>", self.home_callback)
|
text.bind("<<beginning-of-line>>", self.home_callback)
|
||||||
text.bind("<<end-of-file>>", self.eof_callback)
|
text.bind("<<end-of-file>>", self.eof_callback)
|
||||||
text.bind("<<open-stack-viewer>>", self.open_stack_viewer)
|
text.bind("<<open-stack-viewer>>", self.open_stack_viewer)
|
||||||
##text.bind("<<toggle-debugger>>", self.toggle_debugger)
|
text.bind("<<toggle-debugger>>", self.toggle_debugger)
|
||||||
text.bind("<<open-python-shell>>", self.flist.open_shell)
|
text.bind("<<open-python-shell>>", self.flist.open_shell)
|
||||||
text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer)
|
text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer)
|
||||||
text.bind("<<view-restart>>", self.view_restart_mark)
|
text.bind("<<view-restart>>", self.view_restart_mark)
|
||||||
|
|
|
@ -558,8 +558,6 @@ class RPCProxy:
|
||||||
if not self.__attributes.has_key(name):
|
if not self.__attributes.has_key(name):
|
||||||
raise AttributeError, name
|
raise AttributeError, name
|
||||||
|
|
||||||
__getattr__.DebuggerStepThrough = 1
|
|
||||||
|
|
||||||
def __getattributes(self):
|
def __getattributes(self):
|
||||||
self.__attributes = self.sockio.remotecall(self.oid,
|
self.__attributes = self.sockio.remotecall(self.oid,
|
||||||
"__attributes__", (), {})
|
"__attributes__", (), {})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue