Пример #1
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)
Пример #2
0
def TestSmartHelper():
    pdm = pythoncom.CoCreateInstance(
        axdebug.CLSID_ProcessDebugManager,
        None,
        pythoncom.CLSCTX_ALL,
        axdebug.IID_IProcessDebugManager,
    )
    app = pdm.CreateApplication()
    app.SetName("Python Process")

    pydebugger = adb.Debugger()

    nodes = BuildModuleTree()

    all_real_nodes = CreateDebugDocumentHelperNodes(pdm, app, nodes)
    root = app.GetRootNode()
    AttachParentNodes(root, nodes, all_real_nodes)

    pydebugger.AttachApp(app)
    cookie = pdm.AddApplication(app)
    input("Waiting...")
    ttest.test()

    pdm.RemoveApplication(cookie)
    print("Done")
Пример #3
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)