
bc        	   @   s  d  Z  d d l Z d d l Z d d l Z d d l Z d d l m Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d e f d     YZ e   Z d e _ e j Z d d d	 d
 d d d d d g	 Z d   Z d Z d	 e j e j f d     YZ e e d  Z e e d  Z d   Z d   Z d   Z e d  Z d   Z d Z d   Z d   Z  d   Z! e" d k rd d l# Z# e# j!   n  d S(   s   A Python debugger.iN(   t   Reprt   Restartc           B   s   e  Z d  Z RS(   sB   Causes a debugger to be restarted for the debugged python program.(   t   __name__t
   __module__t   __doc__(    (    (    s   /usr/lib/python2.7/pdb.pyR      s   i   t   runt   pmt   Pdbt   runevalt   runctxt   runcallt	   set_tracet   post_mortemt   helpc         C   s   t  j d t  j |    } y t |  } Wn t k
 r@ d  SXd } d  } xL | j   } | d k rl Pn  | j |  r |  | | f } Pn  | d } qP W| j   | S(   Ns   def\s+%s\s*[(]i   t    (	   t   ret   compilet   escapet   opent   IOErrort   Nonet   readlinet   matcht   close(   t   funcnamet   filenamet   cret   fpt   linenot   answert   line(    (    s   /usr/lib/python2.7/pdb.pyt   find_function   s"    
s   
-> c           B   sD  e  Z d  dl dl dl 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 e j j Z d   Z d d  Z d   Z e Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" e" Z# d   Z$ e$ Z% e$ Z& d   Z' e' Z( d   Z) e) Z* d    Z+ e+ Z, d!   Z- e- Z. d"   Z/ e/ Z0 d#   Z1 e1 Z2 d$   Z3 e3 Z4 d%   Z5 e5 Z6 Z7 d&   Z8 e8 Z9 d'   Z: d(   Z; e; Z< e; Z= d)   Z> d*   Z? e? Z@ d+   ZA eA ZB d,   ZC d-   ZD d.   ZE d/   ZF eF ZG d0   ZH d1   ZI d2   ZJ d3 d4 d5 d6 d7 d8 g ZK d9   ZL eM d:  ZN d;   ZO d<   ZP d=   ZQ d>   ZR eR ZS d?   ZT d@   ZU dA   ZV dB   ZW dC   ZX dD   ZY dE   ZZ dF   Z[ dG   Z\ dH   Z] dI   Z^ dJ   Z_ dK   Z` dL   Za dM   Zb dN   Zc dO   Zd dP   Ze dQ   Zf dR   Zg dS   Zh dT   Zi dU   Zj dV   Zk dW   Zl dX   Zm dY   Zn dZ   Zo d[   Zp d\   Zq d]   Zr d^   Zs d_   Zt d`   Zu da   Zv ev Zw db   Zx dc   Zy ey Zz dd   Z{ de   Z| df   Z} dg   Z~ dh   Z di   Z dj   Z dk   Z RS(m   t   tabc   	      C   s  t  j j |  d | t j j |  | | |  | rA d |  _ n  d |  _ i  |  _ d |  _ d |  _	 y d d  l
 } Wn t k
 r n Xg  |  _ d t j k rt j d } y t t j j | d   } Wn t k
 r qXx$ | j   D] } |  j j |  q W| j   n  y t d  } Wn t k
 r8n2 Xx$ | j   D] } |  j j |  qFW| j   i  |  _ i  |  _ i  |  _ t |  _ d  |  _ d  S(   Nt   skipi    s   (Pdb) R   it   HOMEs   .pdbrc(   t   bdbt   Bdbt   __init__t   cmdt   Cmdt   use_rawinputt   promptt   aliasest
   mainpyfilet   _wait_for_mainpyfileR   t   ImportErrort   rcLinest   ost   environR   t   patht   joinR   t	   readlinest   appendR   t   commandst   commands_dopromptt   commands_silentt   Falset   commands_definingR   t   commands_bnum(	   t   selft   completekeyt   stdint   stdoutR!   R   t   envHomet   rcFileR   (    (    s   /usr/lib/python2.7/pdb.pyR%   =   sD    					
				c         C   s   t  j j |   |  j   d  S(   N(   R#   R$   t   resett   forget(   R;   (    (    s   /usr/lib/python2.7/pdb.pyRA   k   s    c         C   s(   d  |  _ g  |  _ d |  _ d  |  _ d  S(   Ni    (   R   R   t   stackt   curindext   curframe(   R;   (    (    s   /usr/lib/python2.7/pdb.pyRB   o   s    			c         C   s\   |  j    |  j | |  \ |  _ |  _ |  j |  j d |  _ |  j j |  _ |  j   d  S(   Ni    (   RB   t	   get_stackRC   RD   RE   t   f_localst   curframe_localst   execRcLines(   R;   t   ft   t(    (    s   /usr/lib/python2.7/pdb.pyt   setupu   s
    
c         C   so   |  j  rk |  j  } g  |  _  xM | D]B } | d  } t |  d k r" | d d k r" |  j |  q" q" Wn  d  S(   Nii    t   #(   R.   t   lent   onecmd(   R;   R.   R   (    (    s   /usr/lib/python2.7/pdb.pyRI      s    			
"c         C   s@   |  j  r d S|  j |  r< |  j d IJ|  j | d  n  d S(   sn   This method is called when there is the remote possibility
        that we ever need to stop in this function.Ns   --Call--(   R,   t	   stop_hereR>   t   interactionR   (   R;   t   framet   argument_list(    (    s   /usr/lib/python2.7/pdb.pyt	   user_call   s
    	c         C   sl   |  j  rF |  j |  j | j j  k s6 | j d k r: d Sd |  _  n  |  j |  rh |  j | d  n  d S(   s;   This function is called when we stop or break at this line.i    N(	   R,   R+   t   canonict   f_codet   co_filenamet   f_linenot   bp_commandsRQ   R   (   R;   RR   (    (    s   /usr/lib/python2.7/pdb.pyt	   user_line   s    	c         C   s   t  |  d t  r |  j |  j k r |  j } d |  _ |  j } |  j | d  x" |  j | D] } |  j |  q] W| |  _ |  j | s |  j	 |  j
 |  j  n  |  j | r |  j   n  |  j   d Sd S(   s   Call every command that was set for the current active breakpoint
        (if there is one).

        Returns True if the normal interaction function must be called,
        False otherwise.t	   currentbpi    Ni   (   t   getattrR8   R[   R5   t   lastcmdRL   R   RO   R7   t   print_stack_entryRC   RD   R6   t   cmdloopRB   (   R;   RR   R[   t   lastcmd_backR   (    (    s   /usr/lib/python2.7/pdb.pyRY      s     				
c         C   s;   |  j  r d S| | j d <|  j d IJ|  j | d  d S(   s7   This function is called when a return trap is set here.Nt
   __return__s
   --Return--(   R,   RG   R>   RQ   R   (   R;   RR   t   return_value(    (    s   /usr/lib/python2.7/pdb.pyt   user_return   s
    	c         C   s   |  j  r d S| \ } } } | | f | j d <t |  t d  k rP | } n	 | j } |  j | d It |  IJ|  j | |  d S(   so   This function is called if an exception occurs,
        but only if we are to stop at or just below this level.Nt   __exception__R   t   :(   R,   RG   t   typeR   R>   t	   _safereprRQ   (   R;   RR   t   exc_infot   exc_typet	   exc_valuet   exc_tracebackt   exc_type_name(    (    s   /usr/lib/python2.7/pdb.pyt   user_exception   s    			c         C   s?   |  j  | |  |  j |  j |  j  |  j   |  j   d  S(   N(   RL   R^   RC   RD   R_   RB   (   R;   RR   t	   traceback(    (    s   /usr/lib/python2.7/pdb.pyRQ      s    
c         C   s   | d k	 r t |  GHn  d S(   s{   Custom displayhook for the exec in default(), which prevents
        assignment of the _ variable in the builtins.
        N(   R   t   repr(   R;   t   obj(    (    s   /usr/lib/python2.7/pdb.pyt   displayhook   s    c         B   s#  | d  d k r | d } n  |  j  } |  j j } y e | d d d  } e j } e j } e j } z2 |  j e _ |  j e _ |  j e _ | | | UWd  | e _ | e _ | e _ XWnd e j   d  \ } }	 e	 |  e	 d  k r | }
 n	 | j
 }
 |  j d I|
 d	 I|	 IJn Xd  S(
   Ni   t   !s   
s   <stdin>t   singlei   R   s   ***Re   (   RH   RE   t	   f_globalsR   t   sysR>   R=   Rq   Rh   Rf   R   (   R;   R   t   localst   globalst   codet   save_stdoutt
   save_stdint   save_displayhookRK   t   vRl   (    (    s   /usr/lib/python2.7/pdb.pyt   default   s.     								c         C   s  | j    s | S| j   } x | d |  j k r |  j | d } d } x8 | d D], } | j d t |  |  } | d } qT W| j d d j | d   } | j   } q W| d d k r| j d  } | d k r| | d j   } |  j j	 |  | |  j
   } qn  | S(	   s*   Handle alias expansion and ';;' separator.i    i   t   %s   %*t    t   aliass   ;;i   (   t   stript   splitR*   t   replacet   strR2   t   findt   lstript   cmdqueueR4   t   rstrip(   R;   R   t   argst   iit   tmpArgt   markert   next(    (    s   /usr/lib/python2.7/pdb.pyt   precmd   s&    	c         C   s-   |  j  s t j j |  |  S|  j |  Sd S(   s   Interpret the argument as though it had been typed in response
        to the prompt.

        Checks whether this line is typed at the normal prompt or in
        a breakpoint command list definition.
        N(   R9   R&   R'   RO   t   handle_command_def(   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyRO     s    	c         C   s   |  j  |  \ } } } | s" d S| d k rB t |  j |  j <d S| d k r[ g  |  _ d S|  j |  j } | r | j | d |  n | j |  y t |  d |  } Wn t k
 r |  j	 } n X| j
 |  j k r t |  j |  j <g  |  _ d Sd S(   s8   Handles one command line during command list definition.Nt   silentt   endi   R   t   do_(   t	   parselinet   TrueR7   R:   R   R5   R4   R\   t   AttributeErrorR}   t	   func_namet   commands_resumingR8   R6   (   R;   R   R&   t   argt   cmdlistt   func(    (    s   /usr/lib/python2.7/pdb.pyR     s,    		c         C   s   | s t  t j j  d } n( y t |  } Wn |  j d IJd SX| |  _ g  |  j | <t |  j	 | <t
 |  j | <|  j } d |  _ t |  _ z |  j   Wd t
 |  _ | |  _ Xd S(   s   Defines a list of commands associated to a breakpoint.

        Those commands will be executed whenever the breakpoint causes
        the program to stop execution.i   s/   Usage : commands [bnum]
        ...
        endNs   (com) (   RN   R#   t
   Breakpointt
   bpbynumbert   intR>   R:   R5   R   R6   R8   R7   R)   R9   R_   (   R;   R   t   bnumt   prompt_back(    (    s   /usr/lib/python2.7/pdb.pyt   do_commands=  s$    					i    c         C   s   | sS |  j  rO |  j d IJx0 t j j D] } | r) | j |  j  q) q) Wn  d  Sd  } d  } d  } | j d  } | d k r | | d j   } | |  j	   } n  | j
 d  } d  }	 | d k rn| |  j	   } |  j |  }
 |
 s|  j d It |  I|  j d IJd  S|
 } | | d j   } y t |  } Wq|t k
 rj} |  j d I| IJd  SXny t |  } Wn t k
 r{y t | |  j j |  j  } Wn | } n XyC t | d	  r| j } n  | j } | j }	 | j } | j } Wq||  j |  \ } } } | sb|  j d
 I|  j t |  I|  j d IJ|  j d IJd  S| }	 t |  } q|Xn X| s|  j   } n  |  j | |  } | r|  j | | | | |	  } | r|  j d I| IJq|  j | |  d } |  j d | j | j | j  f IJn  d  S(   Ns!   Num Type         Disp Enb   Wheret   ,i    i   Re   s   *** s   not found from sys.paths   *** Bad lineno:t   im_funcs   *** The specified objects   is not a functions    or was not found along sys.path.s   ***is   Breakpoint %d at %s:%d(!   t   breaksR>   R#   R   R   t   bpprintR   R   R   R   t   rfindt   lookupmoduleRo   R   t
   ValueErrort   evalRE   Rt   RH   t   hasattrR   t	   func_codet   co_namet   co_firstlinenoRW   t   lineinfot   defaultFilet	   checklinet	   set_breakt
   get_breakst   numbert   fileR   (   R;   R   t	   temporaryt   bpR   R   t   condt   commat   colonR   RJ   t   msgR   Rx   t   okt   lnR   t   err(    (    s   /usr/lib/python2.7/pdb.pyt   do_breakX  s    		
			 c         C   s4   |  j  j j } | d k r0 |  j r0 |  j } n  | S(   s   Produce a reasonable default.s   <string>(   RE   RV   RW   R+   (   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyR     s    c         C   s   |  j  | d  d  S(   Ni   (   R   (   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt	   do_tbreak  s    c   
      C   s"  d } | j d  } t |  d k r: | d j   } n) t |  d k r_ | d j   } n | S| d k rs | S| j d  } | d d k r | d =t |  d k r | Sn  |  j   } t |  d k r | d } n, |  j | d  } | r | } n  | d } t | |  }	 |	 p!| S(	   Nt   'i   i    i   R   t   .R;   (   NNN(   R   R   RN   R   R   R   R   (
   R;   t
   identifiert   failedt   idstringt   idt   partst   fnamet   itemRJ   R   (    (    s   /usr/lib/python2.7/pdb.pyR     s.     	
c         C   s   t  |  d  r |  j j n d	 } t j | | |  } | sM |  j d IJd S| j   } | s | d d k s | d  d k s | d  d k r |  j d IJd S| S(
   s   Check whether specified line seems to be executable.

        Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
        line or EOF). Warning: testing is not comprehensive.
        RE   s   End of filei    RM   i   s   """s   '''s   *** Blank or commentN(   R   RE   Rt   R   t	   linecachet   getlineR>   R   (   R;   R   R   t   globsR   (    (    s   /usr/lib/python2.7/pdb.pyR     s    ! c         C   s   | j    } x | D] } y t |  } Wn% t k
 rP |  j d | IJq n Xd | k ot t t j j  k  n s |  j d I| IJq n  t j j | } | r | j   q q Wd  S(   Ns#   Breakpoint index %r is not a numberi    s   No breakpoint numbered(	   R   R   R   R>   RN   R#   R   R   t   enable(   R;   R   R   t   iR   (    (    s   /usr/lib/python2.7/pdb.pyt	   do_enable  s    (c         C   s   | j    } x | D] } y t |  } Wn% t k
 rP |  j d | IJq n Xd | k ot t t j j  k  n s |  j d I| IJq n  t j j | } | r | j   q q Wd  S(   Ns#   Breakpoint index %r is not a numberi    s   No breakpoint numbered(	   R   R   R   R>   RN   R#   R   R   t   disable(   R;   R   R   R   R   (    (    s   /usr/lib/python2.7/pdb.pyt
   do_disable  s    (c         C   s   | j  d d  } y t | d j    } Wn' t k
 rU |  j d | d IJd  SXy | d } Wn d  } n Xy t j j | } Wn' t	 k
 r |  j d | d IJd  SX| r | | _
 | s |  j d I| I|  j d IJq n  d  S(   NR   i   i    s#   Breakpoint index %r is not a numbers    Breakpoint index %r is not validR   s   is now unconditional.(   R   R   R   R   R>   R   R#   R   R   t
   IndexErrorR   (   R;   R   R   t   bpnumR   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_condition  s*    
	c         C   s?  | j    } y t | d j    } Wn' t k
 rO |  j d | d IJd SXy t | d j    } Wn d } n Xy t j j | } Wn' t k
 r |  j d | d IJd SX| r;| | _	 | d k rd } | d k r | d | } n
 | d } |  j | d	 | IJq;|  j d
 I|  j | Id IJn  d S(   s*   arg is bp number followed by ignore count.i    s#   Breakpoint index %r is not a numberNi   s    Breakpoint index %r is not valids   Will ignore next s   %d crossingss
   1 crossings    of breakpoint %d.s   Will stop next time breakpoints   is reached.(
   R   R   R   R   R>   R#   R   R   R   t   ignore(   R;   R   R   R   t   countR   t   reply(    (    s   /usr/lib/python2.7/pdb.pyt	   do_ignore(  s4    
	
c         C   s  | s_ y t  d  } Wn t k
 r/ d } n X| j   j   } | d k r[ |  j   n  d Sd | k r | j d  } | |  } | | d } y t |  } Wn t k
 r d | } n X|  j | |  } | r |  j	 d	 I| IJn  d S| j
   } x | D] } y t |  } Wn% t k
 rB|  j	 d
 | IJqn Xd | k oft t j j  k  n s|  j	 d I| IJqn  |  j |  } | r|  j	 d	 I| IJq|  j	 d I| IJqWd S(   s   Three possibilities, tried in this order:
        clear -> clear all breaks, ask for confirmation
        clear file:lineno -> clear all breaks at file:lineno
        clear bpno bpno ... -> clear breakpoints by numbers   Clear all breaks? t   not   yt   yesNRe   i   s   Invalid line number (%s)s   ***s#   Breakpoint index %r is not a numberi    s   No breakpoint numbereds   Deleted breakpoint(   R   R   (   t	   raw_inputt   EOFErrorR   t   lowert   clear_all_breaksR   R   R   t   clear_breakR>   R   RN   R#   R   R   t   clear_bpbynumber(   R;   R   R   R   R   R   R   t
   numberlist(    (    s   /usr/lib/python2.7/pdb.pyt   do_clearH  sF    

 (c         C   s   |  j    d  S(   N(   t   print_stack_trace(   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_whereu  s    c         C   sy   |  j  d k r |  j d IJnV |  j  d |  _  |  j |  j  d |  _ |  j j |  _ |  j |  j |  j   d  |  _ d  S(   Ni    s   *** Oldest framei   (	   RD   R>   RC   RE   RG   RH   R^   R   R   (   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_upz  s    c         C   s   |  j  d t |  j  k r, |  j d IJnV |  j  d |  _  |  j |  j  d |  _ |  j j |  _ |  j |  j |  j   d  |  _	 d  S(   Ni   s   *** Newest framei    (
   RD   RN   RC   R>   RE   RG   RH   R^   R   R   (   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_down  s    c         C   s   |  j  |  j  d S(   Ni   (   t	   set_untilRE   (   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_until  s    c         C   s   |  j    d S(   Ni   (   t   set_step(   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_step  s    
c         C   s   |  j  |  j  d S(   Ni   (   t   set_nextRE   (   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_next  s    c         C   sN   | rD d d l  } t j d d !} | j |  t _ | t j d *n  t  d S(   s   Restart program by raising an exception to be caught in the main
        debugger loop.  If arguments were given, set them in sys.argv.iNi    i   (   t   shlexRu   t   argvR   R   (   R;   R   R   t   argv0(    (    s   /usr/lib/python2.7/pdb.pyt   do_run  s    c         C   s   |  j  |  j  d S(   Ni   (   t
   set_returnRE   (   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt	   do_return  s    c         C   s   |  j    d S(   Ni   (   t   set_continue(   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_continue  s    
c         C   s   |  j  d t |  j  k r- |  j d IJd  Sy t |  } Wn t k
 r] |  j d IJnu XyK | |  j _ |  j |  j  d | f |  j |  j  <|  j |  j |  j   Wn& t k
 r } |  j d I| IJn Xd  S(   Ni   s-   *** You can only jump within the bottom frames.   *** The 'jump' command requires a line number.i    s   *** Jump failed:(	   RD   RN   RC   R>   R   R   RE   RX   R^   (   R;   R   t   e(    (    s   /usr/lib/python2.7/pdb.pyt   do_jump  s    $c         C   s   t  j d   |  j j } |  j } t |  j |  j |  j	  } d |  j
 j   | _
 |  j	 d IJt  j | j | | | f  |  j	 d IJt  j |  j  | j |  _ d  S(   Ns   (%s) s   ENTERING RECURSIVE DEBUGGERs   LEAVING RECURSIVE DEBUGGER(   Ru   t   settraceR   RE   Rt   RH   R   R<   R=   R>   R)   R   t   call_tracingR   t   trace_dispatchR]   (   R;   R   Rw   Rv   t   p(    (    s   /usr/lib/python2.7/pdb.pyt   do_debug  s    	c         C   s   d |  _  |  j   d S(   Ni   (   t   _user_requested_quitt   set_quit(   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_quit  s    	
c         C   s   |  j  Jd |  _ |  j   d S(   Ni   (   R>   R   R   (   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_EOF  s    	
c         C   s   |  j  j } |  j } | j } | j d @r8 | d } n  | j d @rR | d } n  xa t |  D]S } | j | } |  j | Id I| | k r |  j | | IJq_ |  j d IJq_ Wd  S(   Ni   i   i   t   =s   *** undefined ***(   RE   RV   RH   t   co_argcountt   co_flagst   ranget   co_varnamesR>   (   R;   R   t   cot   dictt   nR   t   name(    (    s   /usr/lib/python2.7/pdb.pyt   do_args  s    		   c         C   s7   d |  j  k r& |  j |  j  d IJn |  j d IJd  S(   NRa   s   *** Not yet returned!(   RH   R>   (   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt	   do_retval  s    c         C   s   y t  | |  j j |  j  SWnd t j   d  \ } } t | t  rQ | } n	 | j } |  j	 d I| d It
 |  IJ  n Xd  S(   Ni   s   ***Re   (   R   RE   Rt   RH   Ru   Rh   t
   isinstanceR   R   R>   Ro   (   R;   R   RK   R|   Rl   (    (    s   /usr/lib/python2.7/pdb.pyt   _getval  s    		#c         C   s.   y  |  j  t |  j |   IJWn n Xd  S(   N(   R>   Ro   R  (   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_p  s     c         C   s.   y  t  j  |  j |  |  j  Wn n Xd  S(   N(   t   pprintR  R>   (   R;   R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_pp  s     c   
      C   s2  d |  _  d  } | r y t | i  i   } t |  t d  k r | \ } } t |  } t |  } | | k  r | | } q n t d t |  d  } Wq |  j d It |  IJd  SXn8 |  j d  k r t d |  j	 j
 d  } n |  j d } | d  k r| d } n  |  j	 j j } |  j |  } y x t | | d  D] } t j | | |  j	 j  } | s|  j d IJPqIt |  j d  }	 t |	  d k  r|	 d	 }	 n  | | k r|	 d
 }	 n
 |	 d	 }	 | |  j	 j
 k r|	 d }	 n  |  j |	 d | I| |  _ qIWWn t k
 r-n Xd  S(   Nt   listi   i   s   *** Error in argument:i
   s   [EOF]i   i   R   t   Bs   ->s   	(    (   R]   R   R   Rf   R   t   maxR>   Ro   R   RE   RX   RV   RW   t   get_file_breaksR  R   R   Rt   t   rjustRN   t   KeyboardInterrupt(
   R;   R   t   lastt   xt   firstR   t	   breaklistR   R   t   s(    (    s   /usr/lib/python2.7/pdb.pyt   do_list  sR    	  
c         C   s  y t  | |  j j |  j  } Wnk t j   d  \ } } t |  t d  k r\ | } n	 | j } |  j d I| d It	 |  IJd  SXd  } y | j } Wn n X| r |  j d I| j IJd  Sy | j j } Wn n X| r|  j d I| j IJd  S|  j t |  IJd  S(   Ni   R   s   ***Re   t   Functiont   Method(   R   RE   Rt   RH   Ru   Rh   Rf   R   R>   Ro   R   R   R   R   (   R;   R   t   valueRK   R|   Rl   Rx   (    (    s   /usr/lib/python2.7/pdb.pyt	   do_whatis<  s4    		#    c         C   s   | j    } t |  d k rj |  j j   } | j   x, | D]$ } |  j d | |  j | f IJq> Wd  S| d |  j k r t |  d k r |  j d | d |  j | d f IJn d j | d  |  j | d <d  S(   Ni    s   %s = %si   R   (   R   RN   R*   t   keyst   sortR>   R2   (   R;   R   R   R  R   (    (    s   /usr/lib/python2.7/pdb.pyt   do_aliasW  s    
"%)c         C   sJ   | j    } t |  d k r" d  S| d |  j k rF |  j | d =n  d  S(   Ni    (   R   RN   R*   (   R;   R   R   (    (    s   /usr/lib/python2.7/pdb.pyt
   do_unaliasd  s
     R   R   R   R   R   R   c         C   s=   y% x |  j  D] } |  j |  q WWn t k
 r8 n Xd  S(   N(   RC   R^   R  (   R;   t   frame_lineno(    (    s   /usr/lib/python2.7/pdb.pyR   v  s
    c         C   sU   | \ } } | |  j  k r+ |  j d In |  j d I|  j |  j | |  IJd  S(   Nt   >R   (   RE   R>   t   format_stack_entry(   R;   R#  t   prompt_prefixRR   R   (    (    s   /usr/lib/python2.7/pdb.pyR^   }  s    c         C   s   |  j    d  S(   N(   t   help_h(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt	   help_help  s    c         C   s   |  j  d IJd  S(   Ns   h(elp)
Without argument, print the list of available commands.
With a command name as argument, print help about that command
"help pdb" pipes the full documentation file to the $PAGER
"help exec" gives help on the ! command(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyR'    s    c         C   s   |  j    d  S(   N(   t   help_w(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt
   help_where  s    c         C   s   |  j  d IJd  S(   Ns   w(here)
Print a stack trace, with the most recent frame at the bottom.
An arrow indicates the "current frame", which determines the
context of most commands.  'bt' is an alias for this command.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyR)    s    c         C   s   |  j    d  S(   N(   t   help_d(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt	   help_down  s    c         C   s   |  j  d IJd  S(   NsS   d(own)
Move the current frame one level down in the stack trace
(to a newer frame).(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyR+    s    c         C   s   |  j    d  S(   N(   t   help_u(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_up  s    c         C   s   |  j  d IJd  S(   NsP   u(p)
Move the current frame one level up in the stack trace
(to an older frame).(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyR-    s    c         C   s   |  j    d  S(   N(   t   help_b(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt
   help_break  s    c         C   s   |  j  d IJd  S(   NsF  b(reak) ([file:]lineno | function) [, condition]
With a line number argument, set a break there in the current
file.  With a function name, set a break at first executable line
of that function.  Without argument, list all breaks.  If a second
argument is present, it is a string specifying an expression
which must evaluate to true before the breakpoint is honored.

The line number may be prefixed with a filename and a colon,
to specify a breakpoint in another file (probably one that
hasn't been loaded yet).  The file is searched for on sys.path;
the .py suffix may be omitted.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyR/    s    
c         C   s   |  j    d  S(   N(   t   help_cl(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt
   help_clear  s    c         C   s   |  j  d IJ|  j  d IJd  S(   Ns   cl(ear) filename:linenos  cl(ear) [bpnumber [bpnumber...]]
With a space separated list of breakpoint numbers, clear
those breakpoints.  Without argument, clear all breaks (but
first ask confirmation).  With a filename:lineno argument,
clear all breaks at that line in that file.

Note that the argument is different from previous versions of
the debugger (in python distributions 1.5.1 and before) where
a linenumber was used instead of either filename:lineno or
breakpoint numbers.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyR1    s    	c         C   s   |  j  d IJd  S(   NsJ   tbreak  same arguments as break, but breakpoint
is removed when first hit.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_tbreak  s    c         C   s   |  j  d IJd  S(   Nse   enable bpnumber [bpnumber ...]
Enables the breakpoints given as a space separated list of
bp numbers.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_enable  s    c         C   s   |  j  d IJd  S(   Nsg   disable bpnumber [bpnumber ...]
Disables the breakpoints given as a space separated list of
bp numbers.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_disable  s    c         C   s   |  j  d IJd  S(   Ns(  ignore bpnumber count
Sets the ignore count for the given breakpoint number.  A breakpoint
becomes active when the ignore count is zero.  When non-zero, the
count is decremented each time the breakpoint is reached and the
breakpoint is not disabled and any associated condition evaluates
to true.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_ignore  s    c         C   s   |  j  d IJd  S(   Ns   condition bpnumber str_condition
str_condition is a string specifying an expression which
must evaluate to true before the breakpoint is honored.
If str_condition is absent, any existing condition is removed;
i.e., the breakpoint is made unconditional.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_condition  s    c         C   s   |  j    d  S(   N(   t   help_s(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt	   help_step  s    c         C   s   |  j  d IJd  S(   Ns   s(tep)
Execute the current line, stop at the first possible occasion
(either in a function that is called or in the current function).(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyR8    s    c         C   s   |  j    d  S(   N(   t   help_unt(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt
   help_until  s    c         C   s	   d GHd  S(   Ns   unt(il)
Continue execution until the line with a number greater than the current
one is reached or until the current frame returns(    (   R;   (    (    s   /usr/lib/python2.7/pdb.pyR:    s    c         C   s   |  j    d  S(   N(   t   help_n(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt	   help_next  s    c         C   s   |  j  d IJd  S(   Ns_   n(ext)
Continue execution until the next line in the current function
is reached or it returns.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyR<    s    c         C   s   |  j    d  S(   N(   t   help_r(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_return  s    c         C   s   |  j  d IJd  S(   Ns?   r(eturn)
Continue execution until the current function returns.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyR>    s    c         C   s   |  j    d  S(   N(   t   help_c(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_continue
  s    c         C   s   |  j    d  S(   N(   R@  (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt	   help_cont  s    c         C   s   |  j  d IJd  S(   NsL   c(ont(inue))
Continue execution, only stop when a breakpoint is encountered.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyR@    s    c         C   s   |  j    d  S(   N(   t   help_j(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt	   help_jump  s    c         C   s   |  j  d IJd  S(   Ns6   j(ump) lineno
Set the next line that will be executed.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyRC    s    c         C   s   |  j  d IJd  S(   Ns   debug code
Enter a recursive debugger that steps through the code argument
(which is an arbitrary expression or statement to be executed
in the current environment).(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt
   help_debug  s    c         C   s   |  j    d  S(   N(   t   help_l(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt	   help_list!  s    c         C   s   |  j  d IJd  S(   Ns8  l(ist) [first [,last]]
List source code for the current file.
Without arguments, list 11 lines around the current line
or continue the previous listing.
With one argument, list 11 lines starting at that line.
With two arguments, list the given range;
if the second argument is less than the first, it is a count.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyRF  $  s    c         C   s   |  j    d  S(   N(   t   help_a(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt	   help_args-  s    c         C   s   |  j  d IJd  S(   Ns3   a(rgs)
Print the arguments of the current function.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyRH  0  s    c         C   s   |  j  d IJd  S(   Ns/   p expression
Print the value of the expression.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_p4  s    c         C   s   |  j  d IJd  S(   Ns7   pp expression
Pretty-print the value of the expression.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_pp8  s    c         C   s   |  j  d IJd  S(   Ns[  (!) statement
Execute the (one-line) statement in the context of
the current stack frame.
The exclamation point can be omitted unless the first word
of the statement resembles a debugger command.
To assign to a global variable you must always prefix the
command with a 'global' command, e.g.:
(Pdb) global list_options; list_options = ['-l']
(Pdb)(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt	   help_exec<  s    c         C   s	   d GHd  S(   Ns   run [args...]
Restart the debugged python program. If a string is supplied, it is
split with "shlex" and the result is used as the new sys.argv.
History, breakpoints, actions and debugger options are preserved.
"restart" is an alias for "run".(    (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_runG  s    c         C   s   |  j    d  S(   N(   t   help_q(   R;   (    (    s   /usr/lib/python2.7/pdb.pyt	   help_quitP  s    c         C   s   |  j  d IJd  S(   NsO   q(uit) or exit - Quit from the debugger.
The program being executed is aborted.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyRN  S  s    c         C   s   |  j  d IJd  S(   Ns+   whatis arg
Prints the type of the argument.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_whatisY  s    c         C   s   |  j  d IJd  S(   Ns,   EOF
Handles the receipt of EOF as a command.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_EOF]  s    c         C   s   |  j  d IJd  S(   Ns  alias [name [command [parameter parameter ...]]]
Creates an alias called 'name' the executes 'command'.  The command
must *not* be enclosed in quotes.  Replaceable parameters are
indicated by %1, %2, and so on, while %* is replaced by all the
parameters.  If no command is given, the current alias for name
is shown. If no name is given, all aliases are listed.

Aliases may be nested and can contain anything that can be
legally typed at the pdb prompt.  Note!  You *can* override
internal pdb commands with aliases!  Those internal commands
are then hidden until the alias is removed.  Aliasing is recursively
applied to the first word of the command line; all other words
in the line are left alone.

Some useful aliases (especially when placed in the .pdbrc file) are:

#Print instance variables (usage "pi classInst")
alias pi for k in %1.__dict__.keys(): print "%1.",k,"=",%1.__dict__[k]

#Print instance variables in self
alias ps pi self
(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt
   help_aliasa  s    c         C   s   |  j  d IJd  S(   Ns)   unalias name
Deletes the specified alias.(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_unaliasy  s    c         C   s   |  j  d IJd  S(   Ns  commands [bpnumber]
(com) ...
(com) end
(Pdb)

Specify a list of commands for breakpoint number bpnumber.  The
commands themselves appear on the following lines.  Type a line
containing just 'end' to terminate the commands.

To remove all commands from a breakpoint, type commands and
follow it immediately with  end; that is, give no commands.

With no bpnumber argument, commands refers to the last
breakpoint set.

You can use breakpoint commands to start your program up again.
Simply use the continue command, or step, or any other
command that resumes execution.

Specifying any command resuming execution (currently continue,
step, next, return, jump, quit and their abbreviations) terminates
the command list (as if that command was immediately followed by end).
This is because any time you resume execution
(even with a simple next or step), you may encounter
another breakpoint--which could have its own command list, leading to
ambiguities about which list to execute.

   If you use the 'silent' command in the command list, the
usual message about stopping at a breakpoint is not printed.  This may
be desirable for breakpoints that are to print a specific message and
then continue.  If none of the other commands print anything, you
see no sign that the breakpoint was reached.
(   R>   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_commands}  s     c         C   s   t    d  S(   N(   R   (   R;   (    (    s   /usr/lib/python2.7/pdb.pyt   help_pdb  s    c         C   s$  t  j j |  r( t  j j |  r( | St  j j t j d |  } t  j j |  rr |  j |  |  j k rr | St  j j |  \ } } | d k r | d } n  t  j j |  r | Sxd t j D]Y } x% t  j j	 |  r t  j
 |  } q Wt  j j | |  } t  j j |  r | Sq Wd S(   s   Helper function for break/clear parsing -- may be overridden.

        lookupmodule() translates (possibly incomplete) file or module name
        into an absolute file name.
        i    R   s   .pyN(   R/   R1   t   isabst   existsR2   Ru   RU   R+   t   splitextt   islinkt   readlinkR   (   R;   R   RJ   t   roott   extt   dirnamet   fullname(    (    s   /usr/lib/python2.7/pdb.pyR     s"    $*c         C   s}   d d  l  } | j j   | j j i d d 6| d 6t d 6 d |  _ |  j |  |  _ d |  _ d | } |  j	 |  d  S(	   Nit   __main__R   t   __file__t   __builtins__i   i    s   execfile(%r)(
   R_  t   __dict__t   cleart   updateRa  R,   RU   R+   R   R   (   R;   R   R_  t	   statement(    (    s   /usr/lib/python2.7/pdb.pyt
   _runscript  s    		
N(   R   R   R   R%   RA   RB   RL   RI   RT   RZ   RY   Rc   Rm   RQ   Rq   R}   R   RO   R   R&   R'   t   do_helpt   do_hR   R   R   t   do_bR   R   R   R   R   R   R   R   t   do_clR   t   do_wt   do_btR   t   do_uR   t   do_dR   t   do_untR   t   do_sR   t   do_nR   t
   do_restartR   t   do_rR   t   do_ct   do_contR   t   do_jR   R   t   do_qt   do_exitR   R  t   do_aR	  t   do_rvR  R  R  R  t   do_lR  R!  R"  R   R   t   line_prefixR^   R(  R'  R*  R)  t   help_btR,  R+  R.  R-  R0  R/  R2  R1  R3  R4  R5  R6  R7  R9  R8  R;  R:  R=  R<  R?  R>  RA  RB  R@  RD  RC  RE  RG  RF  RI  RH  RJ  RK  RL  RM  t   help_restartRO  RN  t	   help_exitRP  RQ  RR  RS  RT  RU  R   Rf  (    (    (    s   /usr/lib/python2.7/pdb.pyR   ;   s   .							
									 	S			!					 	+									
		
										,			
																																																#		c         C   s   t    j |  | |  d  S(   N(   R   R   (   Re  Rw   Rv   (    (    s   /usr/lib/python2.7/pdb.pyR     s    c         C   s   t    j |  | |  S(   N(   R   R   (   t
   expressionRw   Rv   (    (    s   /usr/lib/python2.7/pdb.pyR     s    c         C   s   t  |  | |  d  S(   N(   R   (   Re  Rw   Rv   (    (    s   /usr/lib/python2.7/pdb.pyR	     s    c          O   s   t    j |  |   S(   N(   R   R
   (   R   t   kwds(    (    s   /usr/lib/python2.7/pdb.pyR
     s    c           C   s   t    j t j   j  d  S(   N(   R   R   Ru   t	   _getframet   f_back(    (    (    s   /usr/lib/python2.7/pdb.pyR     s    c         C   sa   |  d  k r: t j   d }  |  d  k r: t d   q: n  t   } | j   | j d  |   d  S(   Ni   sA   A valid traceback must be passed if no exception is being handled(   R   Ru   Rh   R   R   RA   RQ   (   RK   R   (    (    s   /usr/lib/python2.7/pdb.pyR     s    	
c           C   s   t  t j  d  S(   N(   R   Ru   t   last_traceback(    (    (    s   /usr/lib/python2.7/pdb.pyR     s    s   import x; x.main()c           C   s   t  t  d  S(   N(   R   t   TESTCMD(    (    (    s   /usr/lib/python2.7/pdb.pyt   test  s    c          C   sq   xj t  j D]V }  t j j |  d  } t j j |  r
 t j d |  } | r\ d G| GHn  Pq
 q
 Wd Gd GHd  S(   Ns   pdb.docs   ${PAGER-more} s   *** Pager exit status:s)   Sorry, can't find the help file "pdb.doc"s   along the Python search path(   Ru   R1   R/   R2   RW  t   system(   R]  R^  t   sts(    (    s   /usr/lib/python2.7/pdb.pyR     s     c          C   s  t  j d s! t  j d d k r6 d GHt  j d  n  t  j d }  t j j |   sr d G|  Gd GHt  j d  n  t  j d =t j j |   t  j d <t   } x t ry# | j	 |   | j
 r Pn  d	 GHWq t k
 rd
 G|  Gd GHd d j t  j d  GHq t k
 r&d Gt  j   d GHq t k
 rMt j   t  j d  q t j   d GHd GHt  j   d } | j d  |  d |  d GHq Xq Wd  S(   Ni   s   --helps   -hs"   usage: pdb.py scriptfile [arg] ...i   s   Error:s   does not existi    s*   The program finished and will be restartedt
   Restartings   with arguments:s   	R   s0   The program exited via sys.exit(). Exit status: s2   Uncaught exception. Entering post mortem debuggings1   Running 'cont' or 'step' will restart the programs#   Post mortem debugger finished. The s    will be restarted(   s   --helps   -h(   Ru   R   t   exitR/   R1   RW  R]  R   R   Rf  R   R   R2   t
   SystemExitRh   t   SyntaxErrorRn   t	   print_excRQ   R   (   R+   t   pdbRK   (    (    s   /usr/lib/python2.7/pdb.pyt   main  sB    !
				

R_  ($   R   Ru   R   R&   R#   Ro   R    R/   R   R  Rn   t	   ExceptionR   t   _reprt	   maxstringRg   t   __all__R   R|  R$   R'   R   R   R   R   R	   R
   R   R   R   R  R  R   R  R   R  (    (    (    s   /usr/lib/python2.7/pdb.pyt   <module>   sH   				    							/