
    d	                     @    d dl mZmZ  G d de      Z G d de      Zy)   )struct_parsedwarf_assertc                   "    e Zd ZdZd Zd Zd Zy)AbbrevTablez, Represents a DWARF abbreviation table.
    c                 X    || _         || _        || _        | j                         | _        y)aQ   Create new abbreviation table. Parses the actual table from the
            stream and stores it internally.

            structs:
                A DWARFStructs instance for parsing the data

            stream, offset:
                The stream and offset into the stream where this abbreviation
                table lives.
        N)structsstreamoffset_parse_abbrev_table_abbrev_map)selfr   r	   r
   s       </usr/lib/python3/dist-packages/elftools/dwarf/abbrevtable.py__init__zAbbrevTable.__init__   s*     335    c                      | j                   |   S )zq Get the AbbrevDecl for a given code. Raise KeyError if no
            declaration for this code exists.
        )r   )r   codes     r   
get_abbrevzAbbrevTable.get_abbrev    s     %%r   c                 8   i }| j                   j                  | j                         	 t        | j                  j                  d      | j                         }|dk(  r	 |S t        | j                  j                  | j                         }t        ||      ||<   s)z0 Parse the abbrev table from the stream
         )structr	       )r	   seekr
   r   r   Dwarf_uleb128Dwarf_abbrev_declaration
AbbrevDecl)r   map	decl_codedeclarations       r   r   zAbbrevTable._parse_abbrev_table&   s     %$||11"5{{$I A~
 
	 '||<<{{$K (	;?C	N r   N)__name__
__module____qualname____doc__r   r   r    r   r   r   r      s    6"&r   r   c                   (    e Zd ZdZd Zd Zd Zd Zy)r   z Wraps a parsed abbreviation declaration, exposing its fields with
        dict-like access, and adding some convenience methods.

        The abbreviation declaration represents an "entry" that points to it.
    c                      || _         || _        y N)r   decl)r   r   r'   s      r   r   zAbbrevDecl.__init__>   s    		r   c                     | d   dk(  S )z' Does the entry have children?
        children_flagDW_CHILDREN_yesr#   )r   s    r   has_childrenzAbbrevDecl.has_childrenB   s     O$(999r   c              #   T   K   | d   D ]  }|j                   |j                  f  yw)zh Iterate over the attribute specifications for the entry. Yield
            (name, form) pairs.
        	attr_specN)nameform)r   r-   s     r   iter_attr_specszAbbrevDecl.iter_attr_specsG   s/      k* 	1I..)..00	1s   &(c                      | j                   |   S r&   )r'   )r   entrys     r   __getitem__zAbbrevDecl.__getitem__N   s    yyr   N)r   r    r!   r"   r   r+   r0   r3   r#   r   r   r   r   8   s    
:
1 r   r   N)common.utilsr   r   objectr   r   r#   r   r   <module>r6      s#    6)& )X   r   