Current File : //kunden/usr/share/gdb/python/gdb/__pycache__/FrameDecorator.cpython-39.opt-1.pyc
a

ɱZh�-�@s\ddlZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	e�ZGd
d�de�ZdS)�Nc@s\eZdZdZdd�Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dS)�_FrameDecoratorBasezBase class of frame decorators.cCs
||_dS�N)�_base)�self�base�r�+/usr/share/gdb/python/gdb/FrameDecorator.py�__init__sz_FrameDecoratorBase.__init__cCs:|��}|jr2|jjr2|��tjks2|��tjkr6dSdS)zIInternal utility to determine if the frame is special or
        limited.TF)�find_sal�symtab�filename�type�gdb�DUMMY_FRAME�SIGTRAMP_FRAME)�frame�salrrrZ__is_limited_frames����z&_FrameDecoratorBase.__is_limited_framecCst|jd�r|j��SdS)zLReturn any elided frames that this class might be
        wrapping, or None.�elidedN)�hasattrrr�rrrrr-s
z_FrameDecoratorBase.elidedcCsjt|jtj�s$t|jd�r$|j��S|��}|��tjkr>dS|��tj	krPdS|�
�}t|t�sfd}|S)a�Return the name of the frame's function or an address of
        the function of the frame.  First determine if this is a
        special frame.  If not, try to determine filename from GDB's
        frame internal function API.  Finally, if a name cannot be
        determined return the address.  If this function returns an
        address, GDB will attempt to determine the function name from
        its internal minimal symbols store (for example, for inferiors
        without debug-info).�functionz<function called from gdb>z<signal handler called>z???)�
isinstancerrZFramerr�inferior_framer
rr�name�str)rr�funcrrrr5s

z_FrameDecoratorBase.functioncCs&t|jd�r|j��S|��}|��S)z$Return the address of the frame's pc�address)rrrr�pc�rrrrrrSs
z_FrameDecoratorBase.addresscCs<t|jd�r|j��S|��}|�|�r,dSt|�}|��S)aReturn an iterable of frame arguments for this frame, if
        any.  The iterable object contains objects conforming with the
        Symbol/Value interface.  If there are no frame arguments, or
        if this frame is deemed to be a special case, return None.�
frame_argsN)rrrr�%_FrameDecoratorBase__is_limited_frame�	FrameVars�fetch_frame_args�rr�argsrrrr\s

z_FrameDecoratorBase.frame_argscCs<t|jd�r|j��S|��}|�|�r,dSt|�}|��S)�Return an iterable of local variables for this frame, if
        any.  The iterable object contains objects conforming with the
        Symbol/Value interface.  If there are no frame locals, or if
        this frame is deemed to be a special case, return None.�frame_localsN)rrr&rr r!�fetch_frame_localsr#rrrr&ls

z _FrameDecoratorBase.frame_localscCsFt|jd�r|j��S|��}|�|�r,dS|��}|r>|jSdSdS)z�Return line number information associated with the frame's
        pc.  If symbol table/line information does not exist, or if
        this frame is deemed to be a special case, return None�lineN)rrr(rr r
�rrrrrrr(|s

z_FrameDecoratorBase.linecCst|jd�r|j��S|jS)z7Return the gdb.Frame underpinning this frame decorator.r)rrrrrrrr�s
z"_FrameDecoratorBase.inferior_frameN)�__name__�
__module__�__qualname__�__doc__r	�staticmethodr rrrrr&r(rrrrrrs
	rc@seZdZdZdd�ZdS)�FrameDecoratora�Basic implementation of a Frame Decorator

    This base frame decorator decorates a frame or another frame
    decorator, and provides convenience methods.  If this object is
    wrapping a frame decorator, defer to that wrapped object's method
    if it has one.  This allows for frame decorators that have
    sub-classed FrameDecorator object, but also wrap other frame
    decorators on the same frame to correctly execute.

    E.g

    If the result of frame filters running means we have one gdb.Frame
    wrapped by multiple frame decorators, all sub-classed from
    FrameDecorator, the resulting hierarchy will be:

    Decorator1
      -- (wraps) Decorator2
        -- (wraps) FrameDecorator
          -- (wraps) gdb.Frame

    In this case we have two frame decorators, both of which are
    sub-classed from FrameDecorator.  If Decorator1 just overrides the
    'function' method, then all of the other methods are carried out
    by the super-class FrameDecorator.  But Decorator2 may have
    overriden other methods, so FrameDecorator will look at the
    'base' parameter and defer to that class's methods.  And so on,
    down the chain.cCsRt|jd�r|j��S|��}|��}|jr4|jjsF|��}t�|�S|jjSdS�z�Return the filename associated with this frame, detecting
        and returning the appropriate library name is this is a shared
        library.rN)	rrrrr
rrrZ
solib_name)rrrrrrrr�s

zFrameDecorator.filenameN)r*r+r,r-rrrrrr/�sr/c@s eZdZdZdd�Zdd�ZdS)�DAPFrameDecoratorzVLike FrameDecorator, but has slightly different results
    for the "filename" method.cCs>t|jd�r|j��S|��}|��}|jdur:|j��SdSr0)rrrrr
r�fullnamer)rrrr�s


zDAPFrameDecorator.filenamecCs0t|jd�r|j��S|��}t|�}|�d�S)r%r&T)rrr&rr!r'r#rrrr&�s

zDAPFrameDecorator.frame_localsN)r*r+r,r-rr&rrrrr1�sr1c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SymValueWrapperzkA container class conforming to the Symbol/Value interface
    which holds frame locals or frame arguments.cCs||_||_dSr)r�sym)rr�symbolrrrr	�szSymValueWrapper.__init__cCs|jdurdS|j�|j�S)z5Return the value associated with this symbol, or NoneN)rZread_varr4rrrr�value�s
zSymValueWrapper.valuecCs|jS)zOReturn the symbol, or Python text, associated with this
        symbol, or None)r4rrrrr5�szSymValueWrapper.symbolN)r*r+r,r-r	r6r5rrrrr3�sr3c@s*eZdZdZdd�Zd
dd�Zdd�Zd	S)r!zOUtility class to fetch and store frame local variables, or
    frame arguments.cCs
||_dSr)rrrrrr	szFrameVars.__init__FcCs�g}|j}z|��}Wnty,d}Yn0d}|dur�|js�|jrHq�|D]*}|jr^|sfqLn|jsfqL|�t||��qL|j	dur�|s�q�d}|�
�}|dur�q�z|��}Wq�ty�d}Yq�0q2|j}q2|S)z�Public utility method to fetch frame local variables for
        the stored frame.  Frame arguments are not fetched.  If there
        are no frame local variables, return an empty list.NFT)r�block�RuntimeError�	is_global�	is_static�is_argumentZis_variable�appendr3rZstatic_link�
superblock)rZfollow_linkZlvarsrr7Ztraversed_linkr4rrrr's<

zFrameVars.fetch_frame_localscCszg}z|j��}Wnty(d}Yn0|durv|jsv|jr@qv|D]}|jsPqD|�td|��qD|jdurnqv|j	}q*|S)z�Public utility method to fetch frame arguments for the
        stored frame.  Frame arguments are the only type fetched.  If
        there are no frame argument variables, return an empty list.N)
rr7r8r9r:r;r<r3rr=)rr$r7r4rrrr"4s 

zFrameVars.fetch_frame_argsN)F)r*r+r,r-r	r'r"rrrrr!�s
/r!)r�objectrr/r1r3r!rrrr�<module>s.