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

ɱZh�$�@s�dZddlZddlmZddlmZmZddlZddlZdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�ZdS)z2Internal functions for working with frame-filters.�N)�
FrameIterator)�FrameDecorator�DAPFrameDecoratorcCst|dd�S)aBInternal worker function to return the frame-filter's priority
    from a frame filter object.  This is a fail free function as it is
    used in sorting and filtering.  If a badly implemented frame
    filter does not implement the priority attribute, return zero
    (otherwise sorting/filtering will fail and prevent other frame
    filters from executing).

    Arguments:
        filter_item: An object conforming to the frame filter
                     interface.

    Returns:
        The priority of the frame filter from the "priority"
        attribute, or zero.
    �priorityr��getattr��filter_item�r
�#/usr/share/gdb/python/gdb/frames.py�get_prioritysrcCs
||_dS)z�Internal worker function to set the frame-filter's priority.

    Arguments:
        filter_item: An object conforming to the frame filter
                     interface.
        priority: The priority to assign as an integer.
    N)r)r	rr
r
r�set_priority/s	r
cCst|dd�S)aDInternal worker function to return a filter's enabled state
    from a frame filter object.  This is a fail free function as it is
    used in sorting and filtering.  If a badly implemented frame
    filter does not implement the enabled attribute, return False
    (otherwise sorting/filtering will fail and prevent other frame
    filters from executing).

    Arguments:
        filter_item: An object conforming to the frame filter
                     interface.

    Returns:
        The enabled state of the frame filter from the "enabled"
        attribute, or False.
    �enabledFrrr
r
r�get_enabled;srcCs
||_dS)z�Internal Worker function to set the frame-filter's enabled
    state.

    Arguments:
        filter_item: An object conforming to the frame filter
                     interface.
        state: True or False, depending on desired state.
    N)r)r	�stater
r
r�set_enabledRs
rcCs�|dkrPtj��}t��j��}t�||�}t��D]}t�||j���}q4|S|dkr^tjS|dkrtt��}|jSt��D]}||jkr||jSq|d|d}t�|��dS)aInternal Worker function to return the frame filter
    dictionary, depending on the name supplied as an argument.  If the
    name is not "all", "global" or "progspace", it is assumed to name
    an object-file.

    Arguments:
        name: The name of the list, as specified by GDB user commands.

    Returns:
        A dictionary object for a single specified dictionary, or a
        list containing all the items for "all"

    Raises:
        gdb.GdbError:  A dictionary of that name cannot be found.
    �all�globalZ	progspacez)Cannot find frame-filter dictionary for '�'N)	�gdbZ
frame_filters�valuesZcurrent_progspace�	itertools�chainZobjfiles�filenameZGdbError)�name�glob�progZreturn_iterZobjfileZcp�msgr
r
r�return_list_s"

rcCs$td�}t|tdd�}tt|�}|S)a)Internal Worker function to merge all known frame-filter
    lists, prune any filters with the state set to "disabled", and
    sort the list on the frame-filter's "priority" attribute.

    Returns:
        sorted_list: A sorted, pruned list of frame filters to
                     execute.
    rT)�key�reverse)r�sortedr�filterr)Zall_filtersZsorted_frame_filtersr
r
r�
_sort_list�s

r#cCs�tt��}|st|�dkrdSt|�}|r0t}nt}t||�}|D]}|�|�}qB|dkr�d}t|�}	t	�
�}
|D]&}||	kr�|
��|d}|
�|�qrt
|
�S|dkr�d}n|d}t�|||�}
|
S)Nr����)�listr#�lenrrr�mapr"�abs�collections�deque�popleft�append�iterr�islice)�frame�	frame_low�
frame_highZ
dap_semanticsZsorted_list�frame_iterator�	decoratorZff�countZslice_lengthZslicedZ
frame_itemr
r
r�_frame_iterator�s2

r6cCst|||d�S)a/Helper function that will execute the chain of frame filters.
    Each filter is executed in priority order.  After the execution
    completes, slice the iterator to frame_low - frame_high range.  An
    iterator is always returned.  The iterator will always yield
    frame decorator objects, but note that these decorators have
    slightly different semantics from the ordinary ones: they will
    always return a fully-qualified 'filename' (if possible) and will
    never substitute the objfile name.

    Arguments:
        frame: The initial frame.

        frame_low: The low range of the slice, counting from 0.  If
        this is a negative integer then it indicates a backward slice
        (ie bt -4) which counts backward from the last frame in the
        backtrace.

        frame_high: The high range of the slice, inclusive.  If this
        is -1 then it indicates all frames until the end of the stack
        from frame_low.

    Returns:
        frame_iterator: The sliced iterator after all frame
        filters have had a chance to execute.
    T�r6�r0r1r2r
r
rr3�sr3cCst|||d�S)aDInternal function called from GDB that will execute the chain
    of frame filters.  Each filter is executed in priority order.
    After the execution completes, slice the iterator to frame_low -
    frame_high range.

    Arguments:
        frame: The initial frame.

        frame_low: The low range of the slice, counting from 0.  If
        this is a negative integer then it indicates a backward slice
        (ie bt -4) which counts backward from the last frame in the
        backtrace.

        frame_high: The high range of the slice, inclusive.  If this
        is -1 then it indicates all frames until the end of the stack
        from frame_low.

    Returns:
        frame_iterator: The sliced iterator after all frame
        filters have had a chance to execute, or None if no frame
        filters are registered.

    Fr7r8r
r
r�execute_frame_filters�sr9)�__doc__rZgdb.FrameIteratorrZgdb.FrameDecoratorrrrr*rr
rrrr#r6r3r9r
r
r
r�<module>s
.7