Ë
    Öùd/%  ã                   ó>   — d dl mZ ddlmZ ddlmZ  G d„ de«      Zy)	é    )Úbisect_righté   )ÚDIEé   )Údwarf_assertc                   ób   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Ze	d„ «       Z
d„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zy)ÚCompileUnita»   A DWARF compilation unit (CU).

            A normal compilation unit typically represents the text and data
            contributed to an executable by a single relocatable object file.
            It may be derived from several source files,
            including pre-processed "include files"

        Serves as a container and context to DIEs that describe objects and code
        belonging to a compilation unit.

        CU header entries can be accessed as dict keys from this object, i.e.
           cu = CompileUnit(...)
           cu['version']  # version field of the CU header

        To get the top-level DIE describing the compilation unit, call the
        get_top_DIE method.
    c                 ót   — || _         || _        || _        || _        || _        d| _        g | _        g | _        y)a»   header:
                CU header for this compile unit

            dwarfinfo:
                The DWARFInfo context object which created this one

            structs:
                A DWARFStructs instance suitable for this compile unit

            cu_offset:
                Offset in the stream to the beginning of this CU (its header)

            cu_die_offset:
                Offset in the stream of the top DIE of this CU
        N)Ú	dwarfinfoÚheaderÚstructsÚ	cu_offsetÚcu_die_offsetÚ_abbrev_tableÚ_dielistÚ_diemap)Úselfr   r   r   r   r   s         ú</usr/lib/python3/dist-packages/elftools/dwarf/compileunit.pyÚ__init__zCompileUnit.__init__    sD   € ð  #ˆŒØˆŒØˆŒØ"ˆŒØ*ˆÔð "ˆÔð ˆŒð ˆ�ó    c                 ó.   — | j                   j                  S )z5 Get the DWARF format (32 or 64) for this CU
        )r   Údwarf_format©r   s    r   r   zCompileUnit.dwarf_formatE   s   € ð �|‰|×(Ñ(Ð(r   c                 óx   — | j                   €#| j                  j                  | d   «      | _         | j                   S )zE Get the abbreviation table (AbbrevTable object) for this CU
        Údebug_abbrev_offset)r   r   Úget_abbrev_tabler   s    r   r   zCompileUnit.get_abbrev_tableJ   s<   € ð ×ÑÐ%Ø!%§¡×!@Ñ!@ØÐ*Ñ+ó"-ˆDÔà×!Ñ!Ð!r   c                 ód  — t        | j                  «      dkD  r| j                  d   S t        | | j                  j
                  j                  | j                  ¬«      }| j                  j                  d|«       | j                  j                  d| j                  «       |j                  «        |S )zo Get the top DIE (which is either a DW_TAG_compile_unit or
            DW_TAG_partial_unit) of this CU
        r   ©ÚcuÚstreamÚoffset)
Úlenr   r   r   r   Údebug_info_secr    r   ÚinsertÚ_translate_indirect_attributes)r   Útops     r   Úget_top_DIEzCompileUnit.get_top_DIER   sŽ   € ô ˆt�|‰|Ó˜qÒ Ø—=‘= Ñ#Ð#äØØ—~‘~×4Ñ4×;Ñ;Ø×)Ñ)ô+ˆð
 	�‰×Ñ˜Q Ô$Ø�‰×Ñ˜A˜t×1Ñ1Ô2à×*Ñ*Ô,àˆ
r   c                 ó2   — t        | j                  «      dkD  S )zv Returns whether the top DIE in this CU has already been parsed and cached.
            No parsing on demand!
        r   )r"   r   r   s    r   Úhas_top_DIEzCompileUnit.has_top_DIEh   s   € ô �4—<‘<Ó  1Ñ$Ð$r   c                 óB   — | d   | j                   j                  «       z   S )NÚunit_length)r   Úinitial_length_field_sizer   s    r   ÚsizezCompileUnit.sizen   s   € à�MÑ" T§\¡\×%KÑ%KÓ%MÑMÐMr   c                 óº   — t        | j                  |cxk  xr | j                  | j                  z   k  nc d|›d| j                  ›�«       | j	                  |«      S )a¤   Obtain a DIE contained in this CU from a reference.

            refaddr:
                The offset into the .debug_info section, which must be
                contained in this CU or a DWARFError will be raised.

            When using a reference class attribute with a form that is
            relative to the compile unit, add unit add the compile unit's
            .cu_addr before calling this function.
        zrefaddr z not in DIE range of CU )r   r   r   r-   Ú_get_cached_DIE)r   Úrefaddrs     r   Úget_DIE_from_refaddrz CompileUnit.get_DIE_from_refaddrr   sM   € ô 	Ø×Ñ 'ÖF¨D¯N©N¸T¿Y¹YÑ,FÔFøÚ6=¸t¿~º~ÐNô	Pð ×#Ñ# GÓ,Ð,r   c                 ó@   — | j                  | j                  «       «      S )zƒ Iterate over all the DIEs in the CU, in order of their appearance.
            Note that null DIEs will also be returned.
        )Ú_iter_DIE_subtreer'   r   s    r   Ú	iter_DIEszCompileUnit.iter_DIEs„   s   € ð ×%Ñ% d×&6Ñ&6Ó&8Ó9Ð9r   c              #   ó   K  — |j                   sy|j                  |j                  z   }	 | j                  |«      }|j	                  |«       |j                  «       r||_        y|–— |j                   s||j                  z  }nÈd|j                  v rk|j                  d   }|j                  dv r|j                  | j                  z   }nƒ|j                  dk(  r|j                  }ngt        d|j                  z  «      ‚|j                  €| j                  |«      D ]  }Œ |j                  j                  |j                  j                  z   }�Œ$­w)zÙ Given a DIE, yields either its children, without null DIE list
            terminator, or nothing, if that DIE has no children.

            The null DIE terminator is saved in that DIE when iteration ended.
        NÚDW_AT_sibling)ÚDW_FORM_ref1ÚDW_FORM_ref2ÚDW_FORM_ref4ÚDW_FORM_ref8ÚDW_FORM_refÚDW_FORM_ref_udataÚDW_FORM_ref_addrzsibling in form %s)Úhas_childrenr!   r-   r/   Ú
set_parentÚis_nullÚ_terminatorÚ
attributesÚformÚvaluer   ÚNotImplementedErrorÚiter_DIE_children)r   ÚdieÚ
cur_offsetÚchildÚsiblingÚ_s         r   rF   zCompileUnit.iter_DIE_childrenŠ   s=  è ø€ ð ×ÒØð —Z‘Z #§(¡(Ñ*ˆ
àØ×(Ñ(¨Ó4ˆEà×Ñ˜SÔ!à�}‰}ŒØ"'�”ØàŠKà×%Ò%Ø˜eŸj™jÑ(‘
Ø  E×$4Ñ$4Ñ4Ø×*Ñ*¨?Ñ;�Ø—<‘<ð $Hñ Hð ")§¡°·±Ñ!?‘JØ—\‘\Ð%7Ò7Ø!(§¡‘Jä-Ð.BÀWÇ\Á\Ñ.QÓRÐRð ×$Ñ$Ð,Ø!×3Ñ3°EÓ:ò ˜Øðð #×.Ñ.×5Ñ5¸×8IÑ8I×8NÑ8NÑN�
ñK ùs   ‚EEc                 ó    — | j                   |   S )z6 Implement dict-like access to header entries
        )r   )r   Únames     r   Ú__getitem__zCompileUnit.__getitem__À   s   € ð �{‰{˜4Ñ Ð r   c              #   ó(  K  — |j                   dk(  r'| j                  j                  r|j                  d«      }|–— |j                  rH|j                  «       D ]&  }|j                  j                  |«      D ]  }|–— Œ Œ( |j                  –— yy­w)zp Given a DIE, this yields it with its subtree including null DIEs
            (child list terminators).
        ÚDW_TAG_imported_unitÚDW_AT_importN)	Útagr   Úsupplementary_dwarfinfoÚget_DIE_from_attributer>   Úiter_childrenr   r3   rA   )r   rG   ÚcÚds       r   r3   zCompileUnit._iter_DIE_subtreeÅ   s‹   è ø€ ð �7‰7Ð,Ò,°·±×1WÒ1WØ×,Ñ,¨^Ó<ˆCØŠ	Ø×ÒØ×&Ñ&Ó(ò �ØŸ™×1Ñ1°!Ó4ò �AØ“Gñðð —/‘/Ó!ð	 ùs   ‚BBc                 óD  — | j                  «       j                  }t        | j                  |«      }|| j                  |dz
     k(  r| j                  |dz
     }|S t        | ||¬«      }| j                  j                  ||«       | j                  j                  ||«       |S )a�   Given a DIE offset, look it up in the cache.  If not present,
            parse the DIE and insert it into the cache.

            offset:
                The offset of the DIE in the debug_info section to retrieve.

            The stream reference is copied from the top DIE.  The top die will
            also be parsed and cached if needed.

            See also get_DIE_from_refaddr(self, refaddr).
        r   r   )r'   r    r   r   r   r   r$   )r   r!   Útop_die_streamÚirG   s        r   r/   zCompileUnit._get_cached_DIEÔ   s—   € ð ×)Ñ)Ó+×2Ñ2ˆô ˜Ÿ™ vÓ.ˆð
 �T—\‘\ ! a¡%Ñ(Ò(Ø—-‘-  A¡Ñ&ˆCð ˆ
ô	 ˜ n¸VÔDˆCØ�M‰M× Ñ   CÔ(Ø�L‰L×Ñ  6Ô*àˆ
r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r'   r)   Úpropertyr-   r1   r4   rF   rN   r3   r/   © r   r   r	   r	      sW   „ ñò"#òJ)ò
"òò,%ð ñNó ðNò-ò$:ò2Oòl!ò
"ó!r   r	   N)Úbisectr   rG   r   Úcommon.utilsr   Úobjectr	   r`   r   r   ú<module>rd      s   ðõ  Ý Ý 'ôg�&õ gr   