Esempio n. 1
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)
Esempio n. 2
0
	def OnEnterScript(self):
		trace("OnEnterScript")
		try:
			1/0
		except:
			# Bit of a hack - reach into engine.
			baseFrame = sys.exc_info()[2].tb_frame.f_back
		self.adb.SetupAXDebugging(baseFrame)
Esempio n. 3
0
	def HandleRuntimeError( self ):
		"""Called by the engine when a runtime error occurs.  If we have a debugger,
		we let it know.
		
		The result is a boolean which indicates if the error handler should call
		IActiveScriptSite::OnScriptError()
		"""
#		if self.IsAnyHost:
#			site = _wrap(self, axdebug.IID_IActiveScriptSite)
#			breakResume, errorResume, fCallOnError = self.debugApplication(activeScriptErrorDebug, site)
			# Do something with these!
#		else:
		trace("HandleRuntimeError")
		fCallOnError = 1
		return fCallOnError
Esempio n. 4
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)
Esempio n. 5
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)
Esempio n. 6
0
 def GetScriptletTextAttributes(self, code, delim, flags):
     trace("GetScriptletTextAttributes", code, delim, flags)
     container = SourceCodeContainer(code, "<Temp Code Block>")
     return container.GetSyntaxColorAttributes()
Esempio n. 7
0
 def _query_interface_(self, iid):
     trace("DebuggerQI with", iid)
     return _wrap(self.debugMgr.scriptEngine, iid)
Esempio n. 8
0
 def OnLeaveScript(self):
     trace("OnLeaveScript")
     self.adb.ResetAXDebugging()
Esempio n. 9
0
 def _query_interface_for_debugger_(self, iid):
     if iid in self._debugger_interfaces_:
         return self.activeScriptDebug
     trace("DebugManager QI - unknown IID", iid)
     return 0
Esempio n. 10
0
	def GetScriptletTextAttributes(self, code, delim, flags):
		trace ("GetScriptletTextAttributes", code, delim, flags)
		container = SourceCodeContainer(code, "<Temp Code Block>")
		return container.GetSyntaxColorAttributes()
Esempio n. 11
0
	def _query_interface_(self, iid):
		trace("DebuggerQI with", iid)
		return _wrap(self.debugMgr.scriptEngine, iid)
Esempio n. 12
0
	def OnLeaveScript(self):
		trace("OnLeaveScript")
		self.adb.ResetAXDebugging()
Esempio n. 13
0
	def _query_interface_for_debugger_(self, iid):
		if iid in self._debugger_interfaces_:
			return self.activeScriptDebug
		trace("DebugManager QI - unknown IID", iid)
		return 0