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

ɱZhK�@s:dZddlZGdd�de�ZGdd�de�Zd
dd	�ZdS)z.Unwinder class and register_unwinder function.�Nc@sFeZdZdZdd�Zedd��Zedd��Zejdd��Zd	d
�Z	dS)�UnwinderaBase class (or a template) for frame unwinders written in Python.

    An unwinder has a single method __call__ and the attributes
    described below.

    Attributes:
        name: The name of the unwinder.
        enabled: A boolean indicating whether the unwinder is enabled.
    cCs*t|t�stdt|���||_d|_dS)z\Constructor.

        Args:
            name: An identifying name for the unwinder.
        zincorrect type for name: %sTN)�
isinstance�str�	TypeError�type�_name�_enabled)�self�name�r�%/usr/share/gdb/python/gdb/unwinder.py�__init__ s
zUnwinder.__init__cCs|jS�N)r�r	rrrr
-sz
Unwinder.namecCs|jSr)rrrrr�enabled1szUnwinder.enabledcCs,t|t�stdt|���||_t��dS)Nz(incorrect type for enabled attribute: %s)r�boolrrr�gdb�invalidate_cached_frames)r	�valuerrrr5s
cCstd��dS)z�GDB calls this method to unwind a frame.

        Arguments:
            pending_frame: gdb.PendingFrame instance.

        Returns:
            gdb.UnwindInfo instance.
        zUnwinder __call__.N)�NotImplementedError)r	Z
pending_framerrr�__call__<s	zUnwinder.__call__N)
�__name__�
__module__�__qualname__�__doc__r
�propertyr
r�setterrrrrrrs




rc@s>eZdZdZddd�Zedd��Zedd��Zed	d
��ZdS)�FrameIdz�A Frame-ID class for use when creating gdb.UnwindInfo objects.

    Attributes (all read-only):
        pc: Program counter value.
        sp: The stack-pointer value.
        special: An alternative stack-pointer value, can be None.NcCs||_||_||_dSr)�_sp�_pc�_special)r	�sp�pc�specialrrrr
PszFrameId.__init__cCs|jSr)rrrrrr!Usz
FrameId.spcCs|jSr)rrrrrr"Ysz
FrameId.pccCs|jSr)r rrrrr#]szFrameId.special)N)	rrrrr
rr!r"r#rrrrrHs


rFcCs�|dur(t�d�r"t�d|j�t}nBt|tj�s@t|tj�rbt�d�rjt�d|j|jf�ntd��d}|j	D]4}|j|jkr�|r�|j	|=nt
d|j��|d7}qt|j	�d|�t��dS)	a~Register unwinder in given locus.

    The unwinder is prepended to the locus's unwinders list. Unwinder
    name should be unique.

    Arguments:
        locus: Either an objfile, progspace, or None (in which case
               the unwinder is registered globally).
        unwinder: An object of a gdb.Unwinder subclass
        replace: If True, replaces existing unwinder with the same name.
                 Otherwise, raises exception if unwinder with the same
                 name already exists.

    Returns:
        Nothing.

    Raises:
        RuntimeError: Unwinder name is not unique
        TypeError: Bad locus type
    N�verbosez#Registering global %s unwinder ...
z#Registering %s unwinder for %s ...
z4locus should be gdb.Objfile or gdb.Progspace or NonerzUnwinder %s already exists.�)
rZ	parameter�writer
rZObjfileZ	Progspace�filenamerZframe_unwinders�RuntimeError�insertr)ZlocusZunwinder�replace�iZneedlerrr�register_unwinderbs&

�


r,)F)rr�objectrrr,rrrr�<module>s3