����JFIF��`�`�����Viewing File: /lib/python3.9/site-packages/elftools/ehabi/__pycache__/ehabiinfo.cpython-39.opt-1.pyc
a

�#�_ �@s�ddlmZddlmZddlmZddlmZGdd�de�Z	Gdd	�d	e�Z
Gd
d�de
�ZGdd
�d
e
�ZGdd�de
�Z
dd�ZdS)�)�struct_parse�)�EHABIBytecodeDecoder)�EHABI_INDEX_ENTRY_SIZE)�EHABIStructsc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�	EHABIInfoa ARM exception handler abi information class.

        Parameters:

            arm_idx_section:
                elf.sections.Section object, section which type is SHT_ARM_EXIDX.

            little_endian:
                bool, endianness of elf file.
    cCs||_t|�|_d|_dS�N)�_arm_idx_sectionr�_struct�
_num_entry)�selfZarm_idx_sectionZ
little_endian�r
�</usr/lib/python3.9/site-packages/elftools/ehabi/ehabiinfo.py�__init__s
zEHABIInfo.__init__cCs|jjSr)r	�name�rr
r
r�section_name"szEHABIInfo.section_namecCs
|jdS)NZ	sh_offset)r	rr
r
r�section_offset%szEHABIInfo.section_offsetcCs |jdur|jdt|_|jS)z; Number of exception handler entry in the section.
        NZsh_size)rr	rrr
r
r�	num_entry(s
zEHABIInfo.num_entryc
Csn||��krtd||jf��|��|t}t|jj|jj	|�}|d|d}}|d@dkrlt
d|�St||��|t�}|dkr�t|�S|d@dk�r&t||��|td�}t|jj
|jj	|�}|d}|d@dkr�t|t||��S|d	@dk�rt
d
|�S|d?d@}|dk�rL|d
@d?|d@d?|d@g}	t|||	�S|dk�s`|dk�r|d?d@}
|d?d@|d?d@g}	|jj	�|d�t|
�D]d}t|jj
|jj	�d}|	�|d?d@�|	�|d?d@�|	�|d?d@�|	�|d?d@��q�t|||	|d�St
d||f�SnD|d@dk�r@t
d
|�S|d
@d?|d@d?|d@g}	t|d|	�SdS)zX Get the exception handler entry at index #n. (EHABIEntry object or a subclass)
        zInvalid entry %d/%d�word0�word1l�z-Corrupt ARM exception handler table entry: %xr�ipz)Corrupt ARM compact model table entry: %x��i��i���r)�eh_table_offsetz/Unknown ARM compact model %d at table entry: %xiN)r�
IndexErrorrrrrr
ZEH_index_structr	�stream�CorruptEHABIEntry�arm_expand_prel31�CannotUnwindEHABIEntryZEH_table_struct�GenericEHABIEntry�
EHABIEntry�seek�range�append)
r�nZeh_index_entry_offsetZ
eh_index_datarr�function_offsetrZ	per_indexZopcodeZ	more_word�i�rr
r
r�	get_entry/sL
zEHABIInfo.get_entryN)	�__name__�
__module__�__qualname__�__doc__rrrrr-r
r
r
rrsrc@s*eZdZdZddd�Zdd�Zd	d
�ZdS)r%a� Exception handler abi entry.

        Accessible attributes:

            function_offset:
                Integer.
                None if corrupt. (Reference: CorruptEHABIEntry)

            personality:
                Integer.
                None if corrupt or unwindable. (Reference: CorruptEHABIEntry, CannotUnwindEHABIEntry)
                0/1/2 for ARM personality compact format.
                Others for generic personality.

            bytecode_array:
                Integer array.
                None if corrupt or unwindable or generic personality.
                (Reference: CorruptEHABIEntry, CannotUnwindEHABIEntry, GenericEHABIEntry)

            eh_table_offset:
                Integer.
                Only entries who point to .ARM.extab contains this field, otherwise return None.

            unwindable:
                bool. Whether this function is unwindable.

            corrupt:
                bool. Whether this entry is corrupt.

    NTFcCs(||_||_||_||_||_||_dSr)r*�personality�bytecode_arrayr�
unwindable�corrupt)rr*r2r3rr4r5r
r
rr�szEHABIEntry.__init__cCs|jrt|j�jSdSdSr)r3rZmnemonic_arrayrr
r
r�mnmemonic_array�szEHABIEntry.mnmemonic_arraycCs&d|j|j|jrd|jnd|jfS)Nz@<EHABIEntry function_offset=0x%x, personality=%d, %sbytecode=%s>zeh_table_offset=0x%x, �)r*r2rr3rr
r
r�__repr__�s�zEHABIEntry.__repr__)NTF)r.r/r0r1rr6r8r
r
r
rr%hs#�
r%cs(eZdZdZ�fdd�Zdd�Z�ZS)r!z= This entry is corrupt. Attribute #corrupt will be True.
    cs"tt|�jddddd�||_dS)NT)r*r2r3r5)�superr!r�reason)rr:��	__class__r
rr�s�zCorruptEHABIEntry.__init__cCs
d|jS)Nz<CorruptEHABIEntry reason=%s>)r:rr
r
rr8�szCorruptEHABIEntry.__repr__�r.r/r0r1rr8�
__classcell__r
r
r;rr!�sr!cs(eZdZdZ�fdd�Zdd�Z�ZS)r#zJ This function cannot be unwind. Attribute #unwindable will be False.
    cstt|�j|dddd�dS)NF)r2r3r4)r9r#r)rr*r;r
rr�s�zCannotUnwindEHABIEntry.__init__cCs
d|jS)Nz-<CannotUnwindEHABIEntry function_offset=0x%x>)r*rr
r
rr8�szCannotUnwindEHABIEntry.__repr__r=r
r
r;rr#�sr#cs(eZdZdZ�fdd�Zdd�Z�ZS)r$zg This entry is generic model rather than ARM compact model.Attribute #bytecode_array will be None.
    cstt|�j||dd�dS)N)r3)r9r$r)rr*r2r;r
rr�szGenericEHABIEntry.__init__cCsd|j|jfS)Nz:<GenericEHABIEntry function_offset=0x%x, personality=0x%x>)r*r2rr
r
rr8�szGenericEHABIEntry.__repr__r=r
r
r;rr$�sr$cCs$|d@}|d@r|dO}||d@S)zG
       address: uint32
       place: uint32
       return: uint64
    i���il��l����r
)ZaddressZplace�locationr
r
rr"�sr"N)Zcommon.utilsr�decoderrZ	constantsrZstructsr�objectrr%r!r#r$r"r
r
r
r�<module>
sW<

Back to Directory �������}�!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������������������������������������������������������������� ������w�!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz������������������������������������������������������������������������ ��?��_��+��?��(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(�����