ó
—êé[c           @   sÑ   d  Z  d d l Z d d l Z d d l Z d d l Z d d d g Z d e f d „  ƒ  YZ d f  d „  ƒ  YZ d „  Z	 d f  d	 „  ƒ  YZ
 d
 „  Z d „  Z d e f d „  ƒ  YZ d „  Z d „  Z d „  Z d S(   s   Debugger basicsiÿÿÿÿNt   BdbQuitt   Bdbt
   Breakpointc           B   s   e  Z d  Z RS(   s   Exception to give up completely(   t   __name__t
   __module__t   __doc__(    (    (    s   /usr/lib/python2.7/bdb.pyR    
   s   c           B   s   e  Z d  Z d, d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z d „  Z d „  Z d „  Z d „  Z d, d „ Z d „  Z d „  Z d d, d, d „ Z d „  Z d „  Z d „  Z  d „  Z! d  „  Z" d! „  Z# d" „  Z$ d# „  Z% d$ „  Z& d% „  Z' d& d' „ Z( d, d, d( „ Z) d, d, d) „ Z* d* „  Z+ d+ „  Z, RS(-   sÕ   Generic Python debugger base class.

    This class takes care of details of the trace facility;
    a derived class should implement user interaction.
    The standard debugger class (pdb.Pdb) is an example.
    c         C   s:   | r t  | ƒ n d  |  _ i  |  _ i  |  _ d  |  _ d  S(   N(   t   sett   Nonet   skipt   breakst   fncachet   frame_returning(   t   selfR   (    (    s   /usr/lib/python2.7/bdb.pyt   __init__   s    		c         C   so   | d | d d !d k r | S|  j  j | ƒ } | sk t j j | ƒ } t j j | ƒ } | |  j  | <n  | S(   Nt   <i   iÿÿÿÿt   >(   R
   t   gett   ost   patht   abspatht   normcase(   R   t   filenamet   canonic(    (    s   /usr/lib/python2.7/bdb.pyR      s    c         C   s3   d d  l  } | j ƒ  d  |  _ |  j d  d  ƒ d  S(   Niÿÿÿÿ(   t	   linecachet
   checkcacheR   t   botframet   _set_stopinfo(   R   R   (    (    s   /usr/lib/python2.7/bdb.pyt   reset'   s    
	c         C   sÉ   |  j  r d  S| d k r& |  j | ƒ S| d k rB |  j | | ƒ S| d k r^ |  j | | ƒ S| d k rz |  j | | ƒ S| d k r� |  j S| d k r  |  j S| d k r³ |  j Sd Gt | ƒ GH|  j S(	   Nt   linet   callt   returnt	   exceptiont   c_callt   c_exceptiont   c_returns*   bdb.Bdb.dispatch: unknown debugging event:(   t   quittingt   dispatch_linet   dispatch_callt   dispatch_returnt   dispatch_exceptiont   trace_dispatcht   repr(   R   t   framet   eventt   arg(    (    s   /usr/lib/python2.7/bdb.pyR(   -   s$    	c         C   sG   |  j  | ƒ s |  j | ƒ r@ |  j | ƒ |  j r@ t ‚ q@ n  |  j S(   N(   t	   stop_heret
   break_heret	   user_lineR#   R    R(   (   R   R*   (    (    s   /usr/lib/python2.7/bdb.pyR$   A   s
    	 c         C   sm   |  j  d  k r" | j |  _  |  j S|  j | ƒ p= |  j | ƒ sD d  S|  j | | ƒ |  j rf t ‚ n  |  j S(   N(	   R   R   t   f_backR(   R-   t   break_anywheret	   user_callR#   R    (   R   R*   R,   (    (    s   /usr/lib/python2.7/bdb.pyR%   G   s    	 	c         C   sd   |  j  | ƒ s | |  j k r] z | |  _ |  j | | ƒ Wd  d  |  _ X|  j r] t ‚ q] n  |  j S(   N(   R-   t   returnframeR   t   user_returnR   R#   R    R(   (   R   R*   R,   (    (    s   /usr/lib/python2.7/bdb.pyR&   T   s    	
	 c         C   s;   |  j  | ƒ r4 |  j | | ƒ |  j r4 t ‚ q4 n  |  j S(   N(   R-   t   user_exceptionR#   R    R(   (   R   R*   R,   (    (    s   /usr/lib/python2.7/bdb.pyR'   ^   s
    	 c         C   s.   x' |  j  D] } t j | | ƒ r
 t Sq
 Wt S(   N(   R   t   fnmatcht   Truet   False(   R   t   module_namet   pattern(    (    s   /usr/lib/python2.7/bdb.pyt   is_skipped_moduleh   s    c         C   sœ   |  j  r( |  j | j j d ƒ ƒ r( t S| |  j k rZ |  j d k rJ t S| j |  j k Sx; | d  k	 r— | |  j k	 r— | |  j	 k r‹ t
 S| j } q] Wt S(   NR   iÿÿÿÿ(   R   R;   t	   f_globalsR   R8   t	   stopframet
   stoplinenot   f_linenoR   R   R7   R0   (   R   R*   (    (    s   /usr/lib/python2.7/bdb.pyR-   n   s    	c         C   sÈ   |  j  | j j ƒ } | |  j k r( t S| j } | |  j | k rj | j j } | |  j | k rj t Sn  t | | | ƒ \ } } | rÀ | j |  _	 | r¼ | j
 r¼ |  j t | j ƒ ƒ n  t St Sd  S(   N(   R   t   f_codet   co_filenameR	   R8   R?   t   co_firstlinenot	   effectivet   numbert	   currentbpt	   temporaryt   do_cleart   strR7   (   R   R*   R   t   linenot   bpt   flag(    (    s   /usr/lib/python2.7/bdb.pyR.   ~   s    	c         C   s   t  d ‚ d  S(   Ns)   subclass of bdb must implement do_clear()(   t   NotImplementedError(   R   R,   (    (    s   /usr/lib/python2.7/bdb.pyRG   ”   s    c         C   s   |  j  | j j ƒ |  j k S(   N(   R   R@   RA   R	   (   R   R*   (    (    s   /usr/lib/python2.7/bdb.pyR1   —   s    c         C   s   d S(   sn   This method is called when there is the remote possibility
        that we ever need to stop in this function.N(    (   R   R*   t   argument_list(    (    s   /usr/lib/python2.7/bdb.pyR2   �   s    c         C   s   d S(   s9   This method is called when we stop or break at this line.N(    (   R   R*   (    (    s   /usr/lib/python2.7/bdb.pyR/   ¢   s    c         C   s   d S(   s5   This method is called when a return trap is set here.N(    (   R   R*   t   return_value(    (    s   /usr/lib/python2.7/bdb.pyR4   ¦   s    c         C   s   | \ } } } d  S(   N(    (   R   R*   t   exc_infot   exc_typet	   exc_valuet   exc_traceback(    (    s   /usr/lib/python2.7/bdb.pyR5   ª   s    i    c         C   s(   | |  _  | |  _ d |  _ | |  _ d  S(   Ni    (   R=   R3   R#   R>   (   R   R=   R3   R>   (    (    s   /usr/lib/python2.7/bdb.pyR   °   s    			c         C   s   |  j  | | | j d ƒ d S(   sx   Stop when the line with the line no greater than the current one is
        reached or when returning from current framei   N(   R   R?   (   R   R*   (    (    s   /usr/lib/python2.7/bdb.pyt	   set_until»   s    c         C   sK   |  j  r7 |  j  j } | r7 | j r7 |  j | _ q7 n  |  j d d ƒ d S(   s   Stop after one line of code.N(   R   R0   t   f_traceR(   R   R   (   R   t   caller_frame(    (    s   /usr/lib/python2.7/bdb.pyt   set_stepÀ   s
    	c         C   s   |  j  | d ƒ d S(   s2   Stop on the next line in or below the given frame.N(   R   R   (   R   R*   (    (    s   /usr/lib/python2.7/bdb.pyt   set_nextÌ   s    c         C   s   |  j  | j | ƒ d S(   s)   Stop when returning from the given frame.N(   R   R0   (   R   R*   (    (    s   /usr/lib/python2.7/bdb.pyt
   set_returnÐ   s    c         C   sq   | d k r t j ƒ  j } n  |  j ƒ  x( | rR |  j | _ | |  _ | j } q+ W|  j ƒ  t j	 |  j ƒ d S(   sp   Start debugging from `frame`.

        If frame is not specified, debugging starts from caller's frame.
        N(
   R   t   syst	   _getframeR0   R   R(   RT   R   RV   t   settrace(   R   R*   (    (    s   /usr/lib/python2.7/bdb.pyt	   set_traceÔ   s    
		
c         C   sm   |  j  |  j d  d ƒ |  j si t j d  ƒ t j ƒ  j } x+ | re | |  j k	 re | ` | j } q> Wn  d  S(   Niÿÿÿÿ(	   R   R   R   R	   RY   R[   RZ   R0   RT   (   R   R*   (    (    s   /usr/lib/python2.7/bdb.pyt   set_continueã   s    	c         C   s/   |  j  |  _ d  |  _ d |  _ t j d  ƒ d  S(   Ni   (   R   R=   R   R3   R#   RY   R[   (   R   (    (    s   /usr/lib/python2.7/bdb.pyt   set_quitî   s    		c   
      C   s¥   |  j  | ƒ } d d  l } | j | | ƒ } | sA d | | f S| |  j k r` g  |  j | <n  |  j | } | | k r‰ | j | ƒ n  t | | | | | ƒ }	 d  S(   Niÿÿÿÿs   Line %s:%d does not exist(   R   R   t   getlineR	   t   appendR   (
   R   R   RI   RF   t   condt   funcnameR   R   t   listRJ   (    (    s   /usr/lib/python2.7/bdb.pyt	   set_breakû   s    c         C   sJ   | | f t  j k r, |  j | j | ƒ n  |  j | sF |  j | =n  d  S(   N(   R   t   bplistR	   t   remove(   R   R   RI   (    (    s   /usr/lib/python2.7/bdb.pyt   _prune_breaks
  s    c         C   s„   |  j  | ƒ } | |  j k r& d | S| |  j | k rG d | | f Sx& t j | | f D] } | j ƒ  q\ W|  j | | ƒ d  S(   Ns   There are no breakpoints in %ss   There is no breakpoint at %s:%d(   R   R	   R   Re   t   deleteMeRg   (   R   R   RI   RJ   (    (    s   /usr/lib/python2.7/bdb.pyt   clear_break  s    c         C   s{   y t  | ƒ } Wn d | SXy t j | } Wn t k
 rH d | SX| sW d | S| j ƒ  |  j | j | j ƒ d  S(   Ns"   Non-numeric breakpoint number (%s)s#   Breakpoint number (%d) out of ranges   Breakpoint (%d) already deleted(   t   intR   t
   bpbynumbert
   IndexErrorRh   Rg   t   fileR   (   R   R,   RD   RJ   (    (    s   /usr/lib/python2.7/bdb.pyt   clear_bpbynumber  s    		
c         C   sz   |  j  | ƒ } | |  j k r& d | SxC |  j | D]4 } t j | | f } x | D] } | j ƒ  qT Wq4 W|  j | =d  S(   Ns   There are no breakpoints in %s(   R   R	   R   Re   Rh   (   R   R   R   t   blistRJ   (    (    s   /usr/lib/python2.7/bdb.pyt   clear_all_file_breaks+  s    c         C   sA   |  j  s d Sx$ t j D] } | r | j ƒ  q q Wi  |  _  d  S(   Ns   There are no breakpoints(   R	   R   Rk   Rh   (   R   RJ   (    (    s   /usr/lib/python2.7/bdb.pyt   clear_all_breaks5  s    	c         C   s/   |  j  | ƒ } | |  j k o. | |  j | k S(   N(   R   R	   (   R   R   RI   (    (    s   /usr/lib/python2.7/bdb.pyt	   get_break=  s    c         C   sH   |  j  | ƒ } | |  j k rD | |  j | k rD t j | | f pG g  S(   N(   R   R	   R   Re   (   R   R   RI   (    (    s   /usr/lib/python2.7/bdb.pyt
   get_breaksB  s    c         C   s1   |  j  | ƒ } | |  j k r) |  j | Sg  Sd  S(   N(   R   R	   (   R   R   (    (    s   /usr/lib/python2.7/bdb.pyt   get_file_breaksH  s    c         C   s   |  j  S(   N(   R	   (   R   (    (    s   /usr/lib/python2.7/bdb.pyt   get_all_breaksO  s    c         C   sö   g  } | r' | j  | k r' | j } n  xB | d  k	 rk | j | | j f ƒ | |  j k r_ Pn  | j } q* W| j ƒ  t d t	 | ƒ d ƒ } x2 | d  k	 rÃ | j | j  | j
 f ƒ | j } q’ W| d  k rì t d t	 | ƒ d ƒ } n  | | f S(   Ni    i   (   t   tb_framet   tb_nextR   R`   R?   R   R0   t   reverset   maxt   lent	   tb_lineno(   R   t   ft   tt   stackt   i(    (    s   /usr/lib/python2.7/bdb.pyt	   get_stackU  s     
s   : c         C   s2  d d  l  } d d  l } | \ } } |  j | j j ƒ } d | | f } | j j rh | | j j } n
 | d } d | j k r‘ | j d }	 n d  }	 |	 r³ | | j |	 ƒ } n
 | d } d | j k rù | j d }
 | d } | | j |
 ƒ } n  | j | | | j	 ƒ } | r.| | | j
 ƒ  } n  | S(   Niÿÿÿÿs   %s(%r)s   <lambda>t   __args__s   ()t
   __return__s   ->(   R   R)   R   R@   RA   t   co_namet   f_localsR   R_   R<   t   strip(   R   t   frame_linenot   lprefixR   R)   R*   RI   R   t   st   argst   rvR   (    (    s   /usr/lib/python2.7/bdb.pyt   format_stack_entryi  s*    


 c         B   s¶   | d  k r$ d d  l } | j } n  | d  k r9 | } n  |  j ƒ  e j |  j ƒ e | e j	 ƒ sr | d } n  z& y | | | UWn e
 k
 r– n XWd  d |  _ e j d  ƒ Xd  S(   Niÿÿÿÿs   
i   (   R   t   __main__t   __dict__R   RY   R[   R(   t
   isinstancet   typest   CodeTypeR    R#   (   R   t   cmdt   globalst   localsRŒ   (    (    s   /usr/lib/python2.7/bdb.pyt   run…  s     	
 	c         C   s¼   | d  k r$ d d  l } | j } n  | d  k r9 | } n  |  j ƒ  t j |  j ƒ t | t j	 ƒ sr | d } n  z, y t
 | | | ƒ SWn t k
 rœ n XWd  d |  _ t j d  ƒ Xd  S(   Niÿÿÿÿs   
i   (   R   RŒ   R�   R   RY   R[   R(   RŽ   R�   R�   t   evalR    R#   (   R   t   exprR’   R“   RŒ   (    (    s   /usr/lib/python2.7/bdb.pyt   runeval—  s     	
 	c         C   s   |  j  | | | ƒ d  S(   N(   R”   (   R   R‘   R’   R“   (    (    s   /usr/lib/python2.7/bdb.pyt   runctx©  s    c         O   si   |  j  ƒ  t j |  j ƒ d  } z+ y | | | Ž  } Wn t k
 rI n XWd  d |  _ t j d  ƒ X| S(   Ni   (   R   RY   R[   R(   R   R    R#   (   R   t   funcR‰   t   kwdst   res(    (    s   /usr/lib/python2.7/bdb.pyt   runcall¯  s    
 	N(-   R   R   R   R   R   R   R   R(   R$   R%   R&   R'   R;   R-   R.   RG   R1   R2   R/   R4   R5   R   RS   RV   RW   RX   R\   R]   R^   Rd   Rg   Ri   Rn   Rp   Rq   Rr   Rs   Rt   Ru   R€   R‹   R”   R—   R˜   Rœ   (    (    (    s   /usr/lib/python2.7/bdb.pyR      sV   	
					
	
																			
							c           C   s   t  ƒ  j ƒ  d  S(   N(   R   R\   (    (    (    s   /usr/lib/python2.7/bdb.pyR\   ½  s    c           B   s\   e  Z d  Z d Z i  Z d g Z d d d d „ Z d „  Z d „  Z	 d „  Z
 d d „ Z RS(	   s”  Breakpoint class

    Implements temporary breakpoints, ignore counts, disabling and
    (re)-enabling, and conditionals.

    Breakpoints are indexed by number through bpbynumber and by
    the file,line tuple using bplist.  The former points to a
    single instance of class Breakpoint.  The latter points to a
    list of such instances since there may be more than one
    breakpoint per line.

    i   i    c         C   sÉ   | |  _  d  |  _ | |  _ | |  _ | |  _ | |  _ d |  _ d |  _ d |  _	 t
 j |  _ t
 j d t
 _ |  j j |  ƒ | | f |  j k r¯ |  j | | f j |  ƒ n |  g |  j | | f <d  S(   Ni   i    (   Rb   R   t   func_first_executable_lineRm   R   RF   Ra   t   enabledt   ignoret   hitsR   t   nextRD   Rk   R`   Re   (   R   Rm   R   RF   Ra   Rb   (    (    s   /usr/lib/python2.7/bdb.pyR   Ù  s    									c         C   sT   |  j  |  j f } d  |  j |  j <|  j | j |  ƒ |  j | sP |  j | =n  d  S(   N(   Rm   R   R   Rk   RD   Re   Rf   (   R   t   index(    (    s   /usr/lib/python2.7/bdb.pyRh   î  s
    c         C   s   d |  _  d  S(   Ni   (   Rž   (   R   (    (    s   /usr/lib/python2.7/bdb.pyt   enableö  s    c         C   s   d |  _  d  S(   Ni    (   Rž   (   R   (    (    s   /usr/lib/python2.7/bdb.pyt   disableù  s    c         C   sõ   | d  k r t j } n  |  j r* d } n d } |  j rF | d } n
 | d } | d |  j | |  j |  j f IJ|  j r“ | d |  j f IJn  |  j	 r° | d |  j	 IJn  |  j
 rñ |  j
 d k rÑ d	 } n d
 } | d |  j
 | f IJn  d  S(   Ns   del  s   keep s   yes  s   no   s   %-4dbreakpoint   %s at %s:%ds   	stop only if %ss   	ignore next %d hitsi   Rˆ   t    s!   	breakpoint already hit %d time%s(   R   RY   t   stdoutRF   Rž   RD   Rm   R   Ra   RŸ   R    (   R   t   outt   dispt   ss(    (    s   /usr/lib/python2.7/bdb.pyt   bpprintü  s(    			
			 	N(   R   R   R   R¡   Re   R   Rk   R   Rh   R£   R¤   Rª   (    (    (    s   /usr/lib/python2.7/bdb.pyR   Á  s   				c         C   sn   |  j  s# |  j | j k r t St S| j j |  j  k r< t S|  j sT | j |  _ n  |  j | j k rj t St S(   s;   Check whether we should break here because of `b.funcname`.(   Rb   R   R?   R8   R7   R@   Rƒ   R�   (   t   bR*   (    (    s   /usr/lib/python2.7/bdb.pyt   checkfuncname  s    		c         C   s  t  j |  | f } xt d t | ƒ ƒ D]ê } | | } | j d k rN q) n  t | | ƒ sc q) n  | j d | _ | j s® | j d k r¡ | j d | _ q) q| d f Sq) yT t	 | j | j
 | j ƒ } | r| j d k rô | j d | _ q| d f Sn  Wq) | d f SXq) Wd S(   sô   Determine which breakpoint for this file:line is to be acted upon.

    Called only if we know there is a bpt at this
    location.  Returns breakpoint that was triggered and a flag
    that indicates if it is ok to delete a temporary bp.

    i    i   N(   NN(   R   Re   t   rangeRz   Rž   R¬   R    Ra   RŸ   R•   R<   R„   R   (   Rm   R   R*   t	   possiblesR   R«   t   val(    (    s   /usr/lib/python2.7/bdb.pyRC   1  s.    
	t   Tdbc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s,   | j  j } | s d } n  d G| G| GHd  S(   Ns   ???s   +++ call(   R@   Rƒ   (   R   R*   R‰   t   name(    (    s   /usr/lib/python2.7/bdb.pyR2   g  s     	c         C   s}   d d  l  } | j j } | s' d } n  |  j | j j ƒ } | j | | j | j ƒ } d G| G| j G| Gd G| j ƒ  GHd  S(   Niÿÿÿÿs   ???s   +++t   :(	   R   R@   Rƒ   R   RA   R_   R?   R<   R…   (   R   R*   R   R±   t   fnR   (    (    s   /usr/lib/python2.7/bdb.pyR/   k  s     	c         C   s   d G| GHd  S(   Ns
   +++ return(    (   R   R*   t   retval(    (    s   /usr/lib/python2.7/bdb.pyR4   r  s    c         C   s   d G| GH|  j  ƒ  d  S(   Ns   +++ exception(   R]   (   R   R*   t	   exc_stuff(    (    s   /usr/lib/python2.7/bdb.pyR5   t  s    	(   R   R   R2   R/   R4   R5   (    (    (    s   /usr/lib/python2.7/bdb.pyR°   f  s   			c         C   s*   d G|  Gd GHt  |  d ƒ } d G| GHd  S(   Ns   foo(t   )i
   s   bar returned(   t   bar(   t   nt   x(    (    s   /usr/lib/python2.7/bdb.pyt   foox  s    c         C   s   d G|  Gd GH|  d S(   Ns   bar(R¶   i   (    (   t   a(    (    s   /usr/lib/python2.7/bdb.pyR·   }  s    c          C   s   t  ƒ  }  |  j d ƒ d  S(   Ns   import bdb; bdb.foo(10)(   R°   R”   (   R}   (    (    s   /usr/lib/python2.7/bdb.pyt   test�  s    	(   R   R6   RY   R   R�   t   __all__t	   ExceptionR    R   R\   R   R¬   RC   R°   Rº   R·   R¼   (    (    (    s   /usr/lib/python2.7/bdb.pyt   <module>   s    ÿ °	T		5		