Current File : //usr/share/gdb/python/gdb/frames.pyo
�
�� Rc@s�dZddlZddlmZddlmZddlZddlZd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�ZdS(s2Internal functions for working with frame-filters.i����N(t
FrameIterator(tFrameDecoratorcCst|dd�S(sC Internal 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.
    tpriorityi(tgetattr(tfilter_item((s#/usr/share/gdb/python/gdb/frames.pytget_priorityscCs
||_dS(s� 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(RR((s#/usr/share/gdb/python/gdb/frames.pytset_priority-s	cCst|dt�S(sE Internal 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.
    tenabled(RtFalse(R((s#/usr/share/gdb/python/gdb/frames.pytget_enabled8scCs
||_dS(s� 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(Rtstate((s#/usr/share/gdb/python/gdb/frames.pytset_enabledNs
cCs�|dkrbtjj�}|tj�jj�}x+tj�D]}||jj�}|SWn|dkrutjS|dkr�tj�}|jSx*tj�D]}||jkr�|jSq�Wd|d}tj|��dS(s Internal 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.
    talltglobalt	progspaces)Cannot find frame-filter dictionary for 't'N(tgdbt
frame_filterstvaluestcurrent_progspacetobjfilestfilenametGdbError(tnamet	all_dictstobjfiletcptmsg((s#/usr/share/gdb/python/gdb/frames.pytreturn_listZs cCs�g}x'tj�D]}||jj�}qWtj�}||jj�}|tjj�}t|dtdt�}tt	|�}|S(s* 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.
    tkeytreverse(
RRRRRtsortedRtTruetfilterR	(tall_filtersRRtsorted_frame_filters((s#/usr/share/gdb/python/gdb/frames.pyt
_sort_list�s
		c
Cs
t�}t|�dkrdSt|�}tjt|�}x|D]}|j|�}qDW|dkr�d}t|�}t	j
�}x>|D]6}	||kr�|j�n|d}|j|	�q�Wt
|�S|dkr�d}n
|d}tj|||�}|S(s  Internal 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.  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.  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 change to execute, or None if no frame
        filters are registered.
    iii����N(R$tlentNoneRt	itertoolstimapRR!tabstcollectionstdequetpoplefttappendtitertislice(
tframet	frame_lowt
frame_hightsorted_listtframe_iteratortfftcounttslice_lengthtslicedt
frame_item((s#/usr/share/gdb/python/gdb/frames.pytexecute_frame_filters�s,	




	
(t__doc__Rtgdb.FrameIteratorRtgdb.FrameDecoratorRR'R*RRR	RRR$R:(((s#/usr/share/gdb/python/gdb/frames.pyt<module>s					+