def SetupAXDebugging(self, baseFrame = None, userFrame = None): """Get ready for potential debugging. Must be called on the thread that is being debugged. """ # userFrame is for non AXScript debugging. This is the first frame of the # users code. if userFrame is None: userFrame = baseFrame else: # We have missed the "dispatch_call" function, so set this up now! userFrame.f_locals['__axstack_address__'] = axdebug.GetStackAddress() traceenter("SetupAXDebugging", self) self._threadprotectlock.acquire() try: thisThread = win32api.GetCurrentThreadId() if self.debuggingThread is None: self.debuggingThread = thisThread else: if self.debuggingThread!=thisThread: trace("SetupAXDebugging called on other thread - ignored!") return # push our context. self.recursiveData.insert(0, (self.logicalbotframe,self.stopframe, self.currentframe,self.debuggingThreadStateHandle)) finally: self._threadprotectlock.release() trace("SetupAXDebugging has base frame as", _dumpf(baseFrame)) self.botframe = baseFrame self.stopframe = userFrame self.logicalbotframe = baseFrame self.currentframe = None self.debuggingThreadStateHandle = axdebug.GetThreadStateHandle() self._BreakFlagsChanged()
def __init__(self, debugger): infos = [] frame = debugger.currentframe # print "Stack check" while frame: # print " Checking frame", frame.f_code.co_filename, frame.f_lineno-1, frame.f_trace, # Get a DebugCodeContext for the stack frame. If we fail, then it # is not debuggable, and therefore not worth displaying. cc = debugger.codeContainerProvider.FromFileName( frame.f_code.co_filename) if cc is not None: try: address = frame.f_locals["__axstack_address__"] except KeyError: # print "Couldnt find stack address for",frame.f_code.co_filename, frame.f_lineno-1 # Use this one, even tho it is wrong :-( address = axdebug.GetStackAddress() frameInfo = ( DebugStackFrame(frame, frame.f_lineno - 1, cc), address, address + 1, 0, None, ) infos.append(frameInfo) # print "- Kept!" # else: # print "- rejected" frame = frame.f_back gateways.EnumDebugStackFrames.__init__(self, infos, 0)
def dispatch_call(self, frame, arg): traceenter("dispatch_call",_dumpf(frame)) frame.f_locals['__axstack_address__'] = axdebug.GetStackAddress() if frame is self.botframe: trace("dispatch_call is self.botframe - returning tracer") return self.trace_dispatch # Not our bottom frame. If we have a document for it, # then trace it, otherwise run at full speed. if self.codeContainerProvider.FromFileName(frame.f_code.co_filename) is None: trace("dispatch_call has no document for", _dumpf(frame), "- skipping trace!") ## sys.settrace(None) return None return self.trace_dispatch