
    
hL                     z   S SK r S SKrS SKrS SKJrJrJrJrJr  S SK	J
r
  Sq " S S5      rS rS r " S S	\R                  5      r " S
 S5      r " S S5      r " S S5      rS rS r\r\rS rS rS r\S:X  a=  \" S5        \" 5         \" S\R8                  " 5        S\R:                  " 5        S35        gg)    N)adbaxdebugcodecontainer	documentsexpressions)_wrapc                   0    \ rS rSrSrS rS rS rS rSr	g)	ModuleTreeNode   z'Helper class for building a module treec                 x    UR                   nX l        Xl        S U l        [        R
                  " U5      U l        g N)__name__
moduleNamemodulerealNoder   SourceModuleContainercont)selfr   modNames      oC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\win32comext/axdebug/debugger.py__init__ModuleTreeNode.__init__   s.    //!!77?	    c                 "    SU R                    S3$ )Nz<ModuleTreeNode wrapping >)r   r   s    r   __repr__ModuleTreeNode.__repr__   s    *4;;-q99r   c                 :    U R                   R                  U5        g r   )r   Attach)r   parentRealNodes     r   r    ModuleTreeNode.Attach   s    ^,r   c                 .    S U l         S U l        S U l        g r   )r   r   r   r   s    r   CloseModuleTreeNode.Close   s    	r   )r   r   r   r   N)
r   
__module____qualname____firstlineno____doc__r   r   r    r$   __static_attributes__ r   r   r
   r
      s    1@:-r   r
   c                    U (       a}  U R                   nU=(       a    UR                  U 5      S L nU(       aN  [        U S5      (       a=  [        R                  R                  U R                  5      S   R                  5       S;  nU (       a  W(       a  [        U 5      nXaU '   U" U4U-   6 nXvl	        U R                   R                  S5      nUS   S S S:X  a  US S nSR                  US S 5      n	Un
U	(       a3  [        R                  U	   n[        XX#U5        X;   a  X   R                  n
UR                  U
5        g g g )N__file__   )z.pydz.dll.   r   )r   gethasattrospathsplitextr-   lowerr
   r   splitjoinsysmodulesBuildModuler    )r   built_nodesrootNodecreate_node_fncreate_node_argskeepnoder   partsparent
parentNodeparentModules               r   r<   r<   !   s,   90D8GFJ//77##FOO4Q7==? H D
 $f%"F!D7-=#=>  %%c*9Ra=J&#2JE%*%
;;v.L8EU *(6??
J) vr   c                 h    [         R                  R                  5        H  n[        X@XU5        M     g r   )r:   r;   valuesr<   )
builtItemsr>   create_noder@   r   s        r   RefreshAllModulesrK   B   s&    ++$$&F?OP 'r   c                   &    \ rS rSrS rS rS rSrg)CodeContainerProviderK   c                     Xl         [        R                  R                  U 5        [	        [
        R                  5      U l        0 U l        U R                   R                  U R                  U 5        g r   )

axdebuggerr   rM   r   lenr:   r;   currentNumModulesnodesrK   )r   rP   s     r   r   CodeContainerProvider.__init__L   sK    $''006!$S[[!1
))$**d;r   c                 @    [         R                  R                  X5      $ r   )r   rM   FromFileName)r   fnames     r   rV   "CodeContainerProvider.FromFileNameS   s     ..;;DHHr   c                    [         R                  R                  U 5        S U l        [	        S[        U R                  5       S35        U R                  R                  5        H  nUR                  5         M     0 U l        g )NzClosing z nodes)r   rM   r$   rP   printrQ   rS   rH   )r   rB   s     r   r$   CodeContainerProvider.Close\   s^    ''--d3TZZ)01JJ%%'DJJL (
r   )rP   rR   rS   N)r   r&   r'   r(   r   rV   r$   r*   r+   r   r   rM   rM   K   s    <Ir   rM   c                        \ rS rSrS rS rSrg)OriginalInterfaceMakere   c                     U R                   R                  5       nUR                  U5      U l        UR	                  5       nX#4$ r   )pdmCreateApplicationAddApplicationcookieGetRootNoder   r`   approots       r   MakeInterfaces%OriginalInterfaceMaker.MakeInterfacesf   s:    hh((*((- yr   c                 :    UR                  U R                  5        g r   )RemoveApplicationrc   r   r`   s     r   CloseInterfaces&OriginalInterfaceMaker.CloseInterfacesl   s    dkk*r   )rc   Nr   r&   r'   r(   rh   rm   r*   r+   r   r   r]   r]   e   s    +r   r]   c                        \ rS rSrS rS rSrg)SimpleHostStyleInterfaceMakerp   c                 H    UR                  5       nUR                  5       nX#4$ r   )GetDefaultApplicationrd   re   s       r   rh   ,SimpleHostStyleInterfaceMaker.MakeInterfacesq   s$    '') yr   c                     g r   r+   rl   s     r   rm   -SimpleHostStyleInterfaceMaker.CloseInterfacesv   s    r   r+   Nro   r+   r   r   rq   rq   p   s    
r   rq   c                   6    \ rS rSrS	S jrS rS rS rS rSr	g)

AXDebuggerz   Nc                 z   Uc  SnUc
  [        5       n[        R                  " 5       U l        [        R
                  " [        R                  S [        R                  [        R                  5      U l
        UR                  U R                  5      u  U l        U l        U R                  R                  U5        Xl        [!        ["        R$                  " 5       [        R&                  5      nU R                  R)                  U5      U l        [-        U 5      nU R                  R/                  U R                  U5        g )NzPython Process)rq   r   Debugger
pydebugger	pythoncomCoCreateInstancer   CLSID_ProcessDebugManager
CLSCTX_ALLIID_IProcessDebugManagerr`   rh   rf   rg   SetNameinterfaceMakerr   r   ProvideExpressionContextsIID_IProvideExpressionContexts"AddGlobalExpressionContextProviderexpressionCookierM   	AttachApp)r   r   processNameexpressionProvidercontProviders        r   r   AXDebugger.__init__{   s    *K!:<N,,.----  ,,	
 -;;DHHE$)%,"11322
 !% K K!
 -T2!!$((L9r   c                     SS-     U R                  R                  5         U R                  R                  S W5        U R                  R                  5         g !   [         R                  " 5       S   R                  R                  n N= f)Nr.       )	r:   exc_infotb_framef_backrf   StartDebugSessionr}   SetupAXDebugging	set_trace)r   frames     r   BreakAXDebugger.Break   si    	6F
 	""$ 	((u5!!#	6LLN1%..55Es   A .Bc                 F   U R                   R                  5         U R                  R                  U R                  5        U R                   R                  5         U R                  R                  U R                  5        S U l        S U l        S U l        S U l         S U l	        g r   )
r}   ResetAXDebuggingr   rm   r`   CloseApprf   %RemoveGlobalExpressionContextProviderr   rg   r   s    r   r$   AXDebugger.Close   sv    ((*++DHH5  "66t7L7LM $	r   c                 H    [        XR                  U R                  U45        g r   )rK   rg   CreateApplicationNode)r   rS   containerProviders      r   rK   AXDebugger.RefreshAllModules   s    99d88;L:N	
r   c                    U R                   R                  5       n[        R                  " UR                  5      n[        U[        R                  5      nXAR                  l        [        R                  " U5      n[        U[        R                  5      nUR                  U5        UR                  UR                  U5        U$ r   )rf   r   r   DebugDocumentTextr   r   r   IID_IDebugDocumentdebugDocumentDebugDocumentProviderIID_IDebugDocumentProviderSetDocumentProviderAddCodeContainer)r   rB   r   r   documentproviders         r   r    AXDebugger.CreateApplicationNode   s    88113..tyy97#=#=>"*		228<7#E#EF$$X.**499h?r   )rf   r   r   r`   r}   rg   )NN)
r   r&   r'   r(   r   r   r$   rK   r   r*   r+   r   r   ry   ry   z   s    :<$


r   ry   c                  0    [         c
  [        5       q [         $ r   )currentDebuggerry   r+   r   r   _GetCurrentDebuggerr      s    $,r   c                  4    [        5       R                  5         g r   )r   r   r+   r   r   r   r      s    !r   c                      Sn Sng )Nr   zHi therer+   abs     r   dosomethingelser      s    	AAr   c                       Sn Sn[        5         g )Nr.   r   )r   r   s     r   dosomethingr      s    	A	Ar   c                  X    [        5         [        S5        [        5         [        S5        g )Nz
Waiting...Done)r   inputr   rZ   r+   r   r   testr      s    	G	,M	&Mr   __main__z'About to test the debugging interfaces! /z com objects still alive)r4   r:   r~   win32com.axdebugr   r   r   r   r   win32com.axdebug.utilr   r   r
   r<   rK   rM   r]   rq   ry   r   r   brkr   r   r   r   r   rZ   _GetInterfaceCount_GetGatewayCountr+   r   r   <module>r      s    	 
  P P ' , BQI;; 4+ + K K\" 	
 z	
34F	
I((*+1Y-G-G-I,JJbc r   