def CreateApplicationNode(self, node, containerProvider):
        realNode = self.app.CreateApplicationNode()

        document = documents.DebugDocumentText(node.cont)
        document = _wrap(document, axdebug.IID_IDebugDocument)

        node.cont.debugDocument = document

        provider = documents.DebugDocumentProvider(document)
        provider = _wrap(provider, axdebug.IID_IDebugDocumentProvider)
        realNode.SetDocumentProvider(provider)

        containerProvider.AddCodeContainer(node.cont, realNode)
        return realNode
Beispiel #2
0
    def CreateApplicationNode(self, node, containerProvider):
        realNode = self.app.CreateApplicationNode()

        document = documents.DebugDocumentText(node.cont)
        document = _wrap(document, axdebug.IID_IDebugDocument)

        node.cont.debugDocument = document

        provider = documents.DebugDocumentProvider(document)
        provider = _wrap(provider, axdebug.IID_IDebugDocumentProvider)
        realNode.SetDocumentProvider(provider)

        containerProvider.AddCodeContainer(node.cont, realNode)
        return realNode
Beispiel #3
0
	def AddScriptBlock(self, codeBlock):
		# If we dont have debugging support, dont bother.
		cc = DebugCodeBlockContainer(codeBlock, self.scriptSiteDebug)
		if self.IsSimpleHost():
			document = documents.DebugDocumentText(cc)
			document = _wrap(document, axdebug.IID_IDebugDocument)
			provider = documents.DebugDocumentProvider(document)
			provider = _wrap(provider, axdebug.IID_IDebugDocumentProvider)
			cc.debugDocument = document
			newNode = self.debugApplication.CreateApplicationNode()
			newNode.SetDocumentProvider(provider)
			newNode.Attach(self.rootNode)
		else:
			newNode = None # Managed by smart host.
			self.codeContainers[cc.sourceContext] = cc
		self.ccProvider.AddCodeContainer(cc, newNode)
Beispiel #4
0
 def AddScriptBlock(self, codeBlock):
     # If we dont have debugging support, dont bother.
     cc = DebugCodeBlockContainer(codeBlock, self.scriptSiteDebug)
     if self.IsSimpleHost():
         document = documents.DebugDocumentText(cc)
         document = _wrap(document, axdebug.IID_IDebugDocument)
         provider = documents.DebugDocumentProvider(document)
         provider = _wrap(provider, axdebug.IID_IDebugDocumentProvider)
         cc.debugDocument = document
         newNode = self.debugApplication.CreateApplicationNode()
         newNode.SetDocumentProvider(provider)
         newNode.Attach(self.rootNode)
     else:
         newNode = None  # Managed by smart host.
         self.codeContainers[cc.sourceContext] = cc
     self.ccProvider.AddCodeContainer(cc, newNode)
Beispiel #5
0
    def __init__(self, interfaceMaker=None, processName=None):
        if processName is None:
            processName = "Python Process"
        if interfaceMaker is None:
            interfaceMaker = SimpleHostStyleInterfaceMaker()

        self.pydebugger = adb.Debugger()

        self.pdm = pythoncom.CoCreateInstance(
            axdebug.CLSID_ProcessDebugManager,
            None,
            pythoncom.CLSCTX_ALL,
            axdebug.IID_IProcessDebugManager,
        )

        self.app, self.root = interfaceMaker.MakeInterfaces(self.pdm)
        self.app.SetName(processName)
        self.interfaceMaker = interfaceMaker

        expressionProvider = _wrap(
            expressions.ProvideExpressionContexts(),
            axdebug.IID_IProvideExpressionContexts,
        )
        self.expressionCookie = self.app.AddGlobalExpressionContextProvider(
            expressionProvider)

        contProvider = CodeContainerProvider(self)
        self.pydebugger.AttachApp(self.app, contProvider)
Beispiel #6
0
	def EnumCodeContextsOfPosition(self, context, charOffset, numChars):
		trace("EnumCodeContextsOfPosition", context, charOffset, numChars)
		try:
			context = self.codeContainers[context].GetCodeContextAtPosition(charOffset)
		except KeyError:
			raise COMException(scode=winerror.E_UNEXPECTED)
		enum = EnumDebugCodeContexts([context])
		return _wrap(enum, axdebug.IID_IEnumDebugCodeContexts)
Beispiel #7
0
	def EnumCodeContextsOfPosition(self, context, charOffset, numChars):
		trace("EnumCodeContextsOfPosition", context, charOffset, numChars)
		try:
			context = self.codeContainers[context].GetCodeContextAtPosition(charOffset)
		except KeyError:
			raise COMException(scode=winerror.E_UNEXPECTED)
		enum = EnumDebugCodeContexts([context])
		return _wrap(enum, axdebug.IID_IEnumDebugCodeContexts)
Beispiel #8
0
    def AttachApp(self, debugApplication, codeContainerProvider):
#               traceenter("AttachApp", debugApplication, codeContainerProvider)
        self.codeContainerProvider = codeContainerProvider
        self.debugApplication = debugApplication
        self.stackSniffer = _wrap(stackframe.DebugStackFrameSniffer(self), axdebug.IID_IDebugStackFrameSniffer)
        self.stackSnifferCookie = debugApplication.AddStackFrameSniffer(self.stackSniffer)
#               trace("StackFrameSniffer added (%d)" % self.stackSnifferCookie)

        # Connect to the application events.
        self.appEventConnection = win32com.client.connect.SimpleConnection(self.debugApplication, self, axdebug.IID_IRemoteDebugApplicationEvents)
Beispiel #9
0
    def AttachApp(self, debugApplication, codeContainerProvider):
#               traceenter("AttachApp", debugApplication, codeContainerProvider)
        self.codeContainerProvider = codeContainerProvider
        self.debugApplication = debugApplication
        self.stackSniffer = _wrap(stackframe.DebugStackFrameSniffer(self), axdebug.IID_IDebugStackFrameSniffer)
        self.stackSnifferCookie = debugApplication.AddStackFrameSniffer(self.stackSniffer)
#               trace("StackFrameSniffer added (%d)" % self.stackSnifferCookie)

        # Connect to the application events.
        self.appEventConnection = win32com.client.connect.SimpleConnection(self.debugApplication, self, axdebug.IID_IRemoteDebugApplicationEvents)
Beispiel #10
0
    def __init__(self, scriptEngine):
        self.scriptEngine = scriptEngine
        self.adb = adb.Debugger()
        self.rootNode = None
        self.debugApplication = None
        self.ccProvider = documents.CodeContainerProvider()
        try:
            self.scriptSiteDebug = scriptEngine.GetScriptSite(
                axdebug.IID_IActiveScriptSiteDebug)
        except pythoncom.com_error:
            # No debugger interface (ie, dumb host).  Do the extra work.
            trace("Scripting site has no debugger interface")
            self.scriptSiteDebug = None
        # Get the debug application object.
        self.debugApplication = None
        if self.scriptSiteDebug is not None:
            # Spec says that we should test for this, and if it fails revert to
            # PDM application.
            try:
                self.debugApplication = self.scriptSiteDebug.GetApplication()
                self.rootNode = self.scriptSiteDebug.GetRootApplicationNode()
            except pythoncom.com_error:
                self.debugApplication = None

        if self.debugApplication is None:
            # Try to get/create the default one
            # NOTE - Dont catch exceptions here - let the parent do it,
            # so it knows debug support is available.
            pdm = pythoncom.CoCreateInstance(
                axdebug.CLSID_ProcessDebugManager,
                None,
                pythoncom.CLSCTX_ALL,
                axdebug.IID_IProcessDebugManager,
            )
            self.debugApplication = pdm.GetDefaultApplication()
            self.rootNode = self.debugApplication.GetRootNode()

        assert (self.debugApplication
                is not None), "Need to have a DebugApplication object by now!"
        self.activeScriptDebug = None

        if self.debugApplication is not None:
            self.adb.AttachApp(self.debugApplication, self.ccProvider)
        self.codeContainers = {}
        self.activeScriptDebug = _wrap(
            ActiveScriptDebug(self, self.codeContainers),
            axdebug.IID_IActiveScriptDebug)
Beispiel #11
0
    def __init__(self, interfaceMaker = None, processName = None):
        if processName is None: processName = "Python Process"
        if interfaceMaker is None: interfaceMaker = SimpleHostStyleInterfaceMaker()

        self.pydebugger = adb.Debugger()

        self.pdm=pythoncom.CoCreateInstance(axdebug.CLSID_ProcessDebugManager,None,pythoncom.CLSCTX_ALL, axdebug.IID_IProcessDebugManager)

        self.app, self.root = interfaceMaker.MakeInterfaces(self.pdm)
        self.app.SetName(processName)
        self.interfaceMaker = interfaceMaker

        expressionProvider = _wrap(expressions.ProvideExpressionContexts(), axdebug.IID_IProvideExpressionContexts)
        self.expressionCookie = self.app.AddGlobalExpressionContextProvider(expressionProvider)

        contProvider = CodeContainerProvider(self)
        self.pydebugger.AttachApp(self.app, contProvider)
Beispiel #12
0
	def __init__(self, scriptEngine):
		self.scriptEngine = scriptEngine
		self.adb = adb.Debugger()
		self.rootNode = None
		self.debugApplication = None
		self.ccProvider = documents.CodeContainerProvider()
		try:
			self.scriptSiteDebug = scriptEngine.GetScriptSite(axdebug.IID_IActiveScriptSiteDebug)
		except pythoncom.com_error:
			# No debugger interface (ie, dumb host).  Do the extra work.
			trace("Scripting site has no debugger interface")
			self.scriptSiteDebug = None
		# Get the debug application object.
		self.debugApplication = None
		if self.scriptSiteDebug is not None:
			# Spec says that we should test for this, and if it fails revert to
			# PDM application.
			try:
				self.debugApplication = self.scriptSiteDebug.GetApplication()
				self.rootNode = self.scriptSiteDebug.GetRootApplicationNode()
			except pythoncom.com_error:
				self.debugApplication = None
				
		if self.debugApplication is None:
			# Try to get/create the default one
			# NOTE - Dont catch exceptions here - let the parent do it,
			# so it knows debug support is available.
			pdm=pythoncom.CoCreateInstance(axdebug.CLSID_ProcessDebugManager,None,pythoncom.CLSCTX_ALL, axdebug.IID_IProcessDebugManager)
			self.debugApplication = pdm.GetDefaultApplication()
			self.rootNode = self.debugApplication.GetRootNode()
			
		assert self.debugApplication is not None, "Need to have a DebugApplication object by now!"
		self.activeScriptDebug = None

		if self.debugApplication is not None:
			self.adb.AttachApp(self.debugApplication, self.ccProvider)
		self.codeContainers = {}
		self.activeScriptDebug = _wrap(ActiveScriptDebug(self, self.codeContainers), axdebug.IID_IActiveScriptDebug)
Beispiel #13
0
 def FindConnectionPoint(self, iid):
     # Find a connection we support.  Only support the single event interface.
     if iid==axdebug.IID_IDebugDocumentTextEvents:
         return _wrap(self)
     raise Exception(scode=winerror.E_NOINTERFACE) # ??
Beispiel #14
0
 def GetConnectionPointContainer(self):
     return _wrap(self)
Beispiel #15
0
 def FindConnectionPoint(self, iid):
     # Find a connection we support.  Only support the single event interface.
     if iid == axdebug.IID_IDebugDocumentTextEvents:
         return _wrap(self)
     raise Exception(scode=winerror.E_NOINTERFACE)  # ??
Beispiel #16
0
 def GetConnectionPointContainer(self):
     return _wrap(self)
Beispiel #17
0
 def _query_interface_(self, iid):
     trace("DebuggerQI with", iid)
     return _wrap(self.debugMgr.scriptEngine, iid)
Beispiel #18
0
	def _query_interface_(self, iid):
		trace("DebuggerQI with", iid)
		return _wrap(self.debugMgr.scriptEngine, iid)