a „oešã@s.ddlZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z ddl mZmZmZddlmZdaGdd„dƒZdd„Zd d „ZGd d „d e jƒZGd d„dƒZGdd„dƒZGdd„dƒZdd„Zdd„ZeZeZdd„Zdd„Z dd„Z!e"dk�r*e#dƒe!ƒe#de $¡e %¡fƒdS) éN)ÚadbÚaxdebugÚ codecontainerÚcontextsÚ documentsÚ expressionsÚgateways)Ú_wrapÚ _wrap_removeÚtrace)Úaxscriptc@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) ÚModuleTreeNodez'Helper class for building a module treecCs(|j}||_||_d|_t |¡|_dS©N)Ú__name__Z moduleNameÚmoduleÚrealNoderZSourceModuleContainerÚcont)ÚselfrZmodName©rú=C:\Program Files\Certbot\pkgs\win32comext\axdebug\debugger.pyÚ__init__s zModuleTreeNode.__init__cCs d|jS)Nz)r©rrrrÚ__repr__ szModuleTreeNode.__repr__cCs|j |¡dSr)rÚAttach)rZparentRealNoderrrr#szModuleTreeNode.AttachcCsd|_d|_d|_dSr)rrrrrrrÚClose&szModuleTreeNode.CloseN)rÚ __module__Ú __qualname__Ú__doc__rrrrrrrrr s r c Csö|rF|j}|o| |¡du}|rFt|dƒrFt tj |j¡d¡dv}|rò|ròt |ƒ}|||<||f|Ž}||_ t  |jd¡}|ddd…dkr |dd…}t  |dd…d¡} |} | rèt j| } t| ||||ƒ| |vrè|| j } | | ¡dS)NÚ__file__é)z.pydz.dllÚ.éÿÿÿÿér)rÚgetÚhasattrÚstringÚlowerÚosÚpathÚsplitextrr rÚsplitÚjoinÚsysÚmodulesÚ BuildModuler) rZ built_nodesÚrootNodeZcreate_node_fnÚcreate_node_argsZkeepÚnoderÚpartsÚparentZ parentNodeZ parentModulerrrr.,s.   ÿ r.cCs(ttj ¡ƒD]}t|||||ƒqdSr)Úlistr,r-Úvaluesr.)Z builtItemsr/Z create_noder0rrrrÚRefreshAllModulesMsr6c@s$eZdZdd„Zdd„Zdd„ZdS)ÚCodeContainerProvidercCs8||_tj |¡ttjƒ|_i|_|j  |j|¡dSr) Ú axdebuggerrr7rÚlenr,r-ZcurrentNumModulesÚnodesr6)rr8rrrrWs   zCodeContainerProvider.__init__cCstj ||¡Sr)rr7Ú FromFileName)rÚfnamerrrr;^sz"CodeContainerProvider.FromFileNamecCsFtj |¡d|_tdt|jƒƒ|j ¡D] }| ¡q.i|_dS)NzClosing %d nodes)rr7rr8Úprintr9r:r5)rr1rrrrgs   zCodeContainerProvider.CloseN)rrrrr;rrrrrr7Vs r7c@seZdZdd„Zdd„ZdS)ÚOriginalInterfaceMakercCs&|j ¡}| |¡|_| ¡}||fSr)ÚpdmZCreateApplicationZAddApplicationÚcookieÚ GetRootNode©rr?ÚappÚrootrrrÚMakeInterfacesqs  z%OriginalInterfaceMaker.MakeInterfacescCs| |j¡dSr)ZRemoveApplicationr@©rr?rrrÚCloseInterfaceswsz&OriginalInterfaceMaker.CloseInterfacesN©rrrrErGrrrrr>psr>c@seZdZdd„Zdd„ZdS)ÚSimpleHostStyleInterfaceMakercCs| ¡}| ¡}||fSr)ZGetDefaultApplicationrArBrrrrE|sz,SimpleHostStyleInterfaceMaker.MakeInterfacescCsdSrrrFrrrrG�sz-SimpleHostStyleInterfaceMaker.CloseInterfacesNrHrrrrrI{srIc@s6eZdZd dd„Zdd„Zdd„Zdd „Zd d „ZdS) Ú AXDebuggerNcCsœ|dur d}|durtƒ}t ¡|_t tjdtjtj ¡|_ |  |j ¡\|_ |_ |j  |¡||_tt ¡tjƒ}|j  |¡|_t|ƒ}|j |j |¡dS)NzPython Process)rIrZDebuggerÚ pydebuggerÚ pythoncomZCoCreateInstancerZCLSID_ProcessDebugManagerZ CLSCTX_ALLZIID_IProcessDebugManagerr?rErCrDZSetNameÚinterfaceMakerr rZProvideExpressionContextsZIID_IProvideExpressionContextsZ"AddGlobalExpressionContextProviderÚexpressionCookier7Z AttachApp)rrMZ processNameZexpressionProviderZ contProviderrrrr†s. ü þÿzAXDebugger.__init__cCsPz ddWnt ¡djj}Yn0|j ¡|j d|¡|j ¡dS)NrÚé) r,Úexc_infoÚtb_frameÚf_backrCZStartDebugSessionrKZSetupAXDebuggingÚ set_trace)rÚframerrrÚBreak¤s  zAXDebugger.BreakcCsR|j ¡|j |j¡|j ¡|j |j¡d|_d|_d|_d|_d|_ dSr) rKZResetAXDebuggingrMrGr?ZCloseApprCZ%RemoveGlobalExpressionContextProviderrNrDrrrrr²s  zAXDebugger.ClosecCst||j|j|fƒdSr)r6rDÚCreateApplicationNode)rr:ÚcontainerProviderrrrr6¾sÿzAXDebugger.RefreshAllModulescCs\|j ¡}t |j¡}t|tjƒ}||j_t  |¡}t|tj ƒ}|  |¡|  |j|¡|Sr) rCrWrZDebugDocumentTextrr rZIID_IDebugDocumentZ debugDocumentZDebugDocumentProviderZIID_IDebugDocumentProviderZSetDocumentProviderZAddCodeContainer)rr1rXrZdocumentZproviderrrrrWÃs      z AXDebugger.CreateApplicationNode)NN)rrrrrVrr6rWrrrrrJ…s   rJcCstdurtƒatSr)ÚcurrentDebuggerrJrrrrÚ_GetCurrentDebuggerÓsrZcCstƒ ¡dSr)rZrVrrrrrVÚsrVcCs d}d}dS)NrPzHi therer©ÚaÚbrrrÚdosomethingelseâsr^cCsd}d}tƒdS)NrrP)r^r[rrrÚ dosomethingçsr_cCs tƒtdƒtƒtdƒdS)Nz Waiting...ZDone)rVÚinputr_r=rrrrÚtestísraÚ__main__z'About to test the debugging interfaces!z %d/%d com objects still alive)&r'r%r,rLZwin32apiZwin32com.axdebugrrrrrrrZwin32com.axdebug.utilr r r Zwin32com.axscriptr rYr r.r6r7r>rIrJrZrVZbrkrTr^r_rarr=Z_GetInterfaceCountZ_GetGatewayCountrrrrÚs<$  !   N ÿÿ