Ë
    Öùd:/  ã                   óx   — d dl Z d dlZd dlmZ ddlmZmZ ddl­  edd«      Z G d	„ d
e	«      Z
 G d„ de	«      Zy)é    N)Ú
namedtupleé   )Ústruct_parseÚdwarf_asserté   )Ú*ÚLineProgramEntryzcommand is_extended args statec                   ó   — e Zd ZdZd„ Zd„ Zy)Ú	LineStatezú Represents a line program state (or a "row" in the matrix
        describing debug location information for addresses).
        The instance variables of this class are the "state machine registers"
        described in section 6.2.2 of DWARFv3
    c                 ó¬   — d| _         d| _        d| _        d| _        d| _        || _        d| _        d| _        d| _        d| _	        d| _
        d| _        y )Nr   r   F)ÚaddressÚfileÚlineÚcolumnÚop_indexÚis_stmtÚbasic_blockÚend_sequenceÚprologue_endÚepilogue_beginÚisaÚdiscriminator)ÚselfÚdefault_is_stmts     ú</usr/lib/python3/dist-packages/elftools/dwarf/lineprogram.pyÚ__init__zLineState.__init__1   s[   € ØˆŒØˆŒ	ØˆŒ	ØˆŒØˆŒØ&ˆŒØ ˆÔØ!ˆÔØ!ˆÔØ#ˆÔØˆŒØˆÕó    c           
      óÔ   — dt        | «      z  g}|j                  d| j                  z  «       dD ]#  }|j                  d|›dt        | |«      ›�«       Œ% dj	                  |«      dz   S )Nz<LineState %x:z  address = 0x%x)
r   r   r   r   r   r   r   r   r   r   z  z = ú
z>
)ÚidÚappendr   ÚgetattrÚjoin)r   ÚaÚattrs      r   Ú__repr__zLineState.__repr__?   sk   € Ø¤ 4£Ñ(Ð)ˆØ	�‰Ð# d§l¡lÑ2Ô3ð&ò 	@ˆDð �HŠH¢D¬'°$¸Ô*=Ð>Õ?ð	@ð �y‰y˜‹|˜eÑ#Ð#r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r&   © r   r   r   r   +   s   „ ñò
ó$r   r   c                   ó(   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zy)ÚLineProgramzý Builds a "line table", which is essentially the matrix described
        in section 6.2 of DWARFv3. It's a list of LineState objects,
        sorted by increasing address, so it can be used to obtain the
        state information for each address.
    c                 óX   — || _         || _        || _        || _        || _        d| _        y)a´  
            header:
                The header of this line program. Note: LineProgram may modify
                its header by appending file entries if DW_LNE_define_file
                instructions are encountered.

            stream:
                The stream this program can be read from.

            structs:
                A DWARFStructs instance suitable for this line program

            program_{start|end}_offset:
                Offset in the debug_line section stream where this program
                starts (the actual program, after the header), and where it
                ends.
                The actual range includes start but not end: [start, end - 1]
        N)ÚstreamÚheaderÚstructsÚprogram_start_offsetÚprogram_end_offsetÚ_decoded_entries)r   r0   r/   r1   r2   r3   s         r   r   zLineProgram.__init__O   s1   € ð( ˆŒØˆŒØˆŒØ$8ˆÔ!Ø"4ˆÔØ $ˆÕr   c                 ó\   — | j                   €| j                  «       | _         | j                   S )aÉ   Get the decoded entries for this line program. Return a list of
            LineProgramEntry objects.
            Note that this contains more information than absolutely required
            for the line table. The line table can be easily extracted from
            the list of entries by looking only at entries with non-None
            state. The extra information is mainly for the purposes of display
            with readelf and debugging.
        )r4   Ú_decode_line_program)r   s    r   Úget_entrieszLineProgram.get_entriesj   s-   € ð × Ñ Ð(Ø$(×$=Ñ$=Ó$?ˆDÔ!Ø×$Ñ$Ð$r   c                 ó    — | j                   |   S )z6 Implement dict-like access to header entries
        )r0   )r   Únames     r   Ú__getitem__zLineProgram.__getitem__y   s   € ð �{‰{˜4Ñ Ð r   c                 óˆ  ‡‡— g Št        | j                  d   «      Šdˆˆfd„	}dˆfd„	}| j                  }|| j                  k  �r|t	        | j
                  j                  d«      | j                  |«      }|| j                  d   k\  r”| d   }|| d   z
  }|| d   z  }| d	   ‰j                  |z   |z  z  }‰xj                  |z  c_	        ‰j                  |z   |z  ‰_        | d
   || d   z  z   }	‰xj                  |	z  c_
         |||	|‰j                  g«       �n{|dk(  �r¬t	        | j
                  j                  d«      | j                  «      }
t	        | j
                  j                  d«      | j                  «      }|t        k(  r3d‰_        d‰_         ||g d¬«       t        | j                  d   «      Š�nÛ|t        k(  rDt	        | j
                  j!                  d«      | j                  «      }|‰_	         |||gd¬«       �nŽ|t"        k(  rLt	        | j
                  j$                  | j                  «      }| d   j'                  |«        |||gd¬«       �n9|t(        k(  r8t	        | j
                  j                  d«      | j                  «      }|‰_        �nø| j                  j-                  |
dz
  t.        j0                  «       �nÉ|t2        k(  r ||g «       �nµ|t4        k(  rbt	        | j
                  j                  d«      | j                  «      }|| j                  d	   z  }‰xj                  |z  c_	         |||g«       �nJ|t6        k(  rFt	        | j
                  j9                  d«      | j                  «      }‰xj                  |z  c_
        �nû|t:        k(  rBt	        | j
                  j                  d«      | j                  «      }|‰_         |||g«       �n°|t>        k(  rBt	        | j
                  j                  d«      | j                  «      }|‰_          |||g«       �ne|tB        k(  r‰j                   ‰_         ||g «       �n?|tD        k(  rd‰_#         ||g «       �n$|tH        k(  r6d| d   z
  }|| d   z  | d	   z  }‰xj                  |z  c_	         |||g«       nå|tJ        k(  rOt	        | j
                  jM                  d«      | j                  «      }‰xj                  |z  c_	         |||g«       n�|tN        k(  rd‰_(         ||g «       ns|tR        k(  rd‰_*         ||g «       nY|tV        k(  rAt	        | j
                  j                  d«      | j                  «      }|‰_,         |||g«       nt[        dd|›�«       | j                  j]                  «       }|| j                  k  r�Œ|‰S )Nr   Fc           
      óž   •— ‰j                  t        | ||t        j                  ‰«      «      «       d‰_        d‰_        d‰_        d‰_        y )Nr   F)r!   r	   Úcopyr   r   r   r   )ÚcmdÚargsÚis_extendedÚentriesÚstates      €€r   Úadd_entry_new_statez=LineProgram._decode_line_program.<locals>.add_entry_new_state‚   sK   ø€ ð �N‰NÔ+Ø�[ $¬¯	©	°%Ó(8ó:ô ;à"#ˆEÔØ %ˆEÔØ!&ˆEÔØ#(ˆEÕ r   c                 ó@   •— ‰j                  t        | ||d «      «       y )N)r!   r	   )r>   r?   r@   rA   s      €r   Úadd_entry_old_statez=LineProgram._decode_line_program.<locals>.add_entry_old_stateŒ   s   ø€ à�N‰NÔ+¨C°¸dÀDÓIÕJr   Ú Úopcode_baseÚ"maximum_operations_per_instructionÚ
line_rangeÚminimum_instruction_lengthÚ	line_baser   T)r@   Ú
file_entryr   éÿ   z&Invalid standard line program opcode: )F)/r   r0   r2   r3   r   r1   ÚDwarf_uint8r/   r   r   r   ÚDwarf_uleb128ÚDW_LNE_end_sequencer   r   ÚDW_LNE_set_addressÚDwarf_target_addrÚDW_LNE_define_fileÚDwarf_lineprog_file_entryr!   ÚDW_LNE_set_discriminatorr   ÚseekÚosÚSEEK_CURÚDW_LNS_copyÚDW_LNS_advance_pcÚDW_LNS_advance_lineÚDwarf_sleb128ÚDW_LNS_set_filer   ÚDW_LNS_set_columnr   ÚDW_LNS_negate_stmtÚDW_LNS_set_basic_blockr   ÚDW_LNS_const_add_pcÚDW_LNS_fixed_advance_pcÚDwarf_uint16ÚDW_LNS_set_prologue_endr   ÚDW_LNS_set_epilogue_beginr   ÚDW_LNS_set_isar   r   Útell)r   rC   rE   ÚoffsetÚopcoderH   Úadjusted_opcodeÚoperation_advanceÚaddress_addendÚline_addendÚinst_lenÚ	ex_opcodeÚoperandrA   rB   s                @@r   r6   z LineProgram._decode_line_program~   s>  ù€ ØˆÜ˜$Ÿ+™+Ð&7Ñ8Ó9ˆö	)õ	Kð ×*Ñ*ˆØ�t×.Ñ.Ó.Ü!Ø—‘×(Ñ(¨Ó,Ø—‘ØóˆFð ˜Ÿ™ ]Ñ3Ò3à59Ð:^Ñ5_Ð2Ø"(¨4°Ñ+>Ñ">�Ø$3°t¸LÑ7IÑ$IÐ!àÐ5Ñ6ØŸ.™.Ð+<Ñ<Ø<ñ=ñ>ð ð —’ Ñ/•Ø"'§.¡.Ð3DÑ"DÐHjÑ!j�”Ø" ;Ñ/°?ÀTÈ,ÑEWÑ3WÑX�Ø—
’
˜kÑ)•
Ù#Ø˜[¨.¸%¿.¹.ÐIöKà˜1“ô (¨¯©×(BÑ(BÀ2Ó(FØ(,¯©ó5�ä(¨¯©×)AÑ)AÀ"Ó)EØ)-¯©ó6�	ð Ô 3Ò3Ø)-�EÔ&Ø$%�E”MÙ'¨	°2À4ÕHä% d§k¡kÐ2CÑ&DÓE’EØÔ"4Ò4Ü*¨4¯<©<×+IÑ+IÈ"Ó+MØ+/¯;©;ó8�Gà$+�E”MÙ'¨	°G°9È$×OØÔ"4Ò4Ü*ØŸ™×>Ñ>ÀÇÁóM�Gà˜Ñ&×-Ñ-¨gÔ6Ù'¨	°G°9È$×OØÔ":Ò:Ü*¨4¯<©<×+EÑ+EÀbÓ+IØ+/¯;©;ó8�Gà*1�EÖ'ð —K‘K×$Ñ$ X°¡\´2·;±;Ö?ð œ[Ò(Ù'¨°Ö3ØÔ0Ò0Ü*¨4¯<©<×+EÑ+EÀbÓ+IØ+/¯;©;ó8�Gð   $§+¡+Ð.JÑ"KÑKð #à—M’M ^Ñ3•MÙ'¨°Ð0@ÖAØÔ2Ò2Ü*¨4¯<©<×+EÑ+EÀbÓ+IØ+/¯;©;ó8�Gà—J’J 'Ñ)—JØœÒ.Ü*¨4¯<©<×+EÑ+EÀbÓ+IØ+/¯;©;ó8�Gà!(�E”JÙ'¨°°	Ö:ØÔ0Ò0Ü*¨4¯<©<×+EÑ+EÀbÓ+IØ+/¯;©;ó8�Gà#*�E”LÙ'¨°°	Ö:ØÔ1Ò1Ø(-¯©Ð$5�E”MÙ'¨°Ö3ØÔ5Ò5Ø(,�EÔ%Ù'¨°Ö3ØÔ2Ò2Ø&)¨D°Ñ,?Ñ&?�OØ'6¸$¸|Ñ:LÑ'LØ&*Ð+GÑ&Hñ'I�Nà—M’M ^Ñ3•MÙ'¨°Ð0@ÕAØÔ6Ò6Ü*¨4¯<©<×+DÑ+DÀRÓ+HØ+/¯;©;ó8�Gà—M’M WÑ,•MÙ'¨°°	Õ:ØÔ6Ò6Ø)-�EÔ&Ù'¨°Õ3ØÔ8Ò8Ø+/�EÔ(Ù'¨°Õ3Øœ~Ò-Ü*¨4¯<©<×+EÑ+EÀbÓ+IØ+/¯;©;ó8�Gà '�E”IÙ'¨°°	Õ:ä ¡Ùð)!ô "à—[‘[×%Ñ%Ó'ˆFði �t×.Ñ.Ô.ðj ˆr   N)r'   r(   r)   r*   r   r7   r:   r6   r+   r   r   r-   r-   I   s   „ ñò
%ò6%ò!ó
Hr   r-   )rW   r=   Úcollectionsr   Úcommon.utilsr   r   Ú	constantsr	   Úobjectr   r-   r+   r   r   ú<module>ru      sC   ðó 
Û Ý "ç 5Ü ñ2 ØÐ8ó:Ð ô$�ô $ô<}�&õ }r   