
    J/PhRr                        d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dl	Z	d dl
Z
d dlmZmZmZ d dlmZmZ d dlmZ d dlmZ d dlmZ d dlmZ  G d	 d
e          Z G d de          Zedk    r e	j                     dS dS )    )
namedtupleN)dedent)TestCaseoverride_configignore_internal_warnings)jitnjit)types)default_manager)NumbaDebugInfoWarningc                   6    e Zd ZdZd Zd Zd Zd Zd Zd Z	dS )	TestDebugInfozF
    These tests only checks the compiled assembly for debuginfo.
    c                 V    |                     |           |                    |          S N)compileinspect_asmselffnsigs      Z/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/tests/test_debuginfo.py_getasmzTestDebugInfo._getasm   s#    


3~~c"""    c                     |                      ||          }t          j        d|t          j                  }|d u}|                     ||d|z             d S )Nr   z\.section.+debugzdebug info not found in:
%s)msg)r   researchIassertEqual)r   r   r   expectasmmgots          r   _checkzTestDebugInfo._check    s]    ll23l''I)355tm*H3*NOOOOOr   c                     t          dd          d             }|                     |t          j        fd           d S )NTFnopythondebugc                     | S r    xs    r   fooz3TestDebugInfo.test_no_debuginfo_in_asm.<locals>.foo'       Hr   r   r!   r   r%   r
   int32r   r.   s     r   test_no_debuginfo_in_asmz&TestDebugInfo.test_no_debuginfo_in_asm&   sM    	d%	(	(	(	 	 
)	(	 	Cek^E:::::r   c                     t          dd          d             }|                     |t          j        fd           d S )NTr'   c                     | S r   r+   r,   s    r   r.   z0TestDebugInfo.test_debuginfo_in_asm.<locals>.foo.   r/   r   r0   r1   r3   s     r   test_debuginfo_in_asmz#TestDebugInfo.test_debuginfo_in_asm-   sM    	d$	'	'	'	 	 
(	'	 	Cek^D99999r   c                 J   t          dd          5  t          d          d             }|                     |t          j        fd           t          dd          d	             }|                     |t          j        fd           d d d            d S # 1 swxY w Y   d S )
NDEBUGINFO_DEFAULT   T)r(   c                     | S r   r+   r,   s    r   r.   z4TestDebugInfo.test_environment_override.<locals>.foo7       r   r0   Fr'   c                     | S r   r+   r,   s    r   barz4TestDebugInfo.test_environment_override.<locals>.bar=   r<   r   )r   r   r%   r
   r2   )r   r.   r>   s      r   test_environment_overridez'TestDebugInfo.test_environment_override4   s    0!44 	? 	?$   KK%+K=== $e,,,  -,KK%+K>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?s   A:BBBc                 ^   t          d          d             t          d          d             t           fd            }t          dd          5   |t          j                  }d d d            n# 1 swxY w Y   |                     ||                    t          j                             |                    |j        d	                   }t          j	        |          }|j
        |j        d	                  j        j        fd
|j        D             }|                     t          |          d           |d	         }g }|j        D ]K}|j        D ]A}	|	j        dk    r4|                    t)          |	                                                     BLd}
d}j
        j        d	                  j        j        }|D ]8}|
st-          j        d|          rd}
|st-          j        d| d|          rd}9|                     |
           |                     |           d S )NT)forceinlinec                 *    t          j        |           S r   )mathsinr,   s    r   r>   z:TestDebugInfo.test_llvm_inliner_flag_conflict.<locals>.barG       8A;;r   Fc                 *    t          j        |           S r   )rC   cosr,   s    r   bazz:TestDebugInfo.test_llvm_inliner_flag_conflict.<locals>.bazK   rE   r   c                 8     |           } |           }||fS r   r+   )r-   abr>   rH   s      r   r.   z:TestDebugInfo.test_llvm_inliner_flag_conflict.<locals>.fooO   s&    AAAAa4Kr   r9   r:   r   c                 *    g | ]}|j         k    |S r+   name.0r-   rN   s     r   
<listcomp>zATestDebugInfo.test_llvm_inliner_flag_conflict.<locals>.<listcomp>_        ???q$r   callz.*llvm.sin.f64.*z.*)r	   r   nppiassertPreciseEqualpy_funcinspect_llvm
signaturesllvmparse_assembly	overloadsfndescmangled_name	functionsr    lenblocksinstructionsopcodeappendstrstripr   match
assertTrue)r   r.   resultfull_irmodulefuncsfuncf_namesblkstmt	found_sin	found_bazbaz_namer-   r>   rH   rN   s                 @@@r   test_llvm_inliner_flag_conflictz-TestDebugInfo.test_llvm_inliner_flag_conflictB   s   
 
$				 	 
 		 
%	 	 	 	 	 
!	 	 
	 	 	 	 	 
	 0!44 	  	 SZZF	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	BE(:(:;;; ""3>!#455$W--}S^A./6C????F,???UQ'''Qx ; 	6 	6C( 6 6;&((NN3t99??#4#45556 		=!23:G 	! 	!A !*<a!@!@ ! 	 !*;x*;*;*;Q!?!? ! 		"""	"""""s   A;;A?A?N)
__name__
__module____qualname____doc__r   r%   r4   r7   r?   rt   r+   r   r   r   r      s{         # # #P P P; ; ;: : :? ? ?6# 6# 6# 6# 6#r   r   c                       e Zd ZdZddiZd Zd Zd Zd Zd Z	d	 Z
 ej        e
          d             Z ej        e
          d             Zd Zd Zd Zd Zd Zd Zd Zd ZdS )TestDebugInfoEmissionz1 Tests that debug info is emitted correctly.
    	NUMBA_OPT0c                     t          dd          5  |                    |           |                    |          cd d d            S # 1 swxY w Y   d S )NOPTr   )r   r   rX   r   s      r   _get_llvmirz!TestDebugInfoEmission._get_llvmir   s    UA&& 	( 	(JJsOOO??3''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   *AAAc                     |                      ||                                          }t          j        d          }g }|D ],}|                    |          r|                    |           -|S )Nz![0-9]+ =.*)r   
splitlinesr   r   rg   rd   )r   r   r   llmeta_remetadatalines          r   _get_metadataz#TestDebugInfoEmission._get_metadata   sr    b#&&1133*^,, 	& 	&D}}T"" &%%%r   c                     t                      }t          j        d          }|D ]5}|                    |          }|r|                                \  }}|||<   6|S )zdGets the map of DI label to md, e.g.
        '!33' -> '!{!"branch_weights", i32 1, i32 99}'
        z(![0-9]+) = (.*))dictr   r   rg   groups)r   r   metadata_definition_mapmeta_definition_splitr   matcheddbg_valinfos           r   _get_metadata_mapz'TestDebugInfoEmission._get_metadata_map   sn     #'&& "
+> ? ? 	8 	8D+11$77G 8 ' 0 037'0&&r   c                    |                      |          }t                      }|                                D ]P}t          j        d|          }|r7t          |                    d                    }|                    |           Q|S )Nz!DILocation\(line: (\d+),r:   )r   setvaluesr   rg   intgroupadd)r   r   
md_def_maplinesmdr#   lns          r   _get_lines_from_debuginfoz/TestDebugInfoEmission._get_lines_from_debuginfo   s}    ++H55
##%% 	 	B5r::A __		"r   c                 
   t          d          d             }|                     |d          }|d         }|                     d|d d                    |                     d	|           |                     d
|           d S )NTr)   c                      d S r   r+   r+   r   r   r.   z/TestDebugInfoEmission.test_DW_LANG.<locals>.foo       Dr   r+   r   r   z!0   z,!DICompileUnit(language: DW_LANG_C_plus_pluszproducer: "clang (Numba)")r	   r   r    assertIn)r   r.   r   DICompileUnits       r   test_DW_LANGz"TestDebugInfoEmission.test_DW_LANG   s    	D				 	 
		 %%cr%22 }RaR0111D#	% 	% 	%1=AAAAAr   c                   #$% t          dd          d             }t          j        f}|                     ||          }|                     ||          }t          j        |          }|j        |j        d                  j	        j
        $$fd|j        D             }|                     t          |          d           |d         }d	 |j        D             }|                     t          |          d           |d         }	d
 |	j        D             }
h d}d}|
D ]C}|j        |v r|                    |j                   |sd}*|r|r|                     d           D|                     |d           t+                      }t-          j        d          }d}|
D ]}t1          |          #|                    #          }|s1d}|                     t7          #fd|D                                  Y|                                }|                     t          |          d           |d         }t;          |dd                   }|dk    r|                     ||k               |}|                    |           t?          j         |          \  }%| !                    |          }g d}%fd|D             }tE          tG          |d           |          D ]&\  }}||         }| $                    d| |           'd}t-          j        |          }|%                                D ]} |                    |           }|rj|                                }|                     t          |          d           t;          |d                   }!%dz   }"|                     |!|"            dS |                     d           dS )z: Tests that DILocation information is reasonable.
        Tnumpy)r)   error_modelc                 B    | dz   }|dz  }||z  }t          |           |S )NgGz?gQ@)print)rJ   rK   cds       r   r.   z2TestDebugInfoEmission.test_DILocation.<locals>.foo   s-    DADAAA!HHHHr   r   r   c                 *    g | ]}|j         k    |S r+   rM   rO   s     r   rQ   z9TestDebugInfoEmission.test_DILocation.<locals>.<listcomp>   rR   r   r:   c                     g | ]}|S r+   r+   rP   r-   s     r   rQ   z9TestDebugInfoEmission.test_DILocation.<locals>.<listcomp>       )))!)))r   c                 $    g | ]}|j         d v|S ))rS   loadstore)rc   r   s     r   rQ   z9TestDebugInfoEmission.test_DILocation.<locals>.<listcomp>   s5     - - -18+4, 4,! 4, 4, 4,r   >   faddfdivfmulFzMath opcodes are not contiguouszMath opcodes were not foundz.*!dbg (![0-9]+).*$)zalloca zstore c                     g | ]}|v S r+   r+   )rP   r-   inst_as_strs     r   rQ   z9TestDebugInfoEmission.test_DILocation.<locals>.<listcomp>   s    $H$H$H!Q+%5$H$H$Hr   N)r   r:   r      c                      g | ]
}d z   |z   S )r   r+   )rP   r-   pysrc_line_starts     r   rQ   z9TestDebugInfoEmission.test_DILocation.<locals>.<listcomp>  s$    @@@1&*Q.@@@r   c                 0    t          | dd                    S Nr:   )r   r,   s    r   <lambda>z7TestDebugInfoEmission.test_DILocation.<locals>.<lambda>  s    s1QRR5zz r   )keyzline: z1.*!DILocalVariable\(name: "a",.*line: ([0-9]+),.*z%Assertion on DILocalVariable not made)&r	   r
   float64r   r   rZ   r[   r\   rY   r]   r^   r_   r    r`   ra   assertGreaterrb   rc   removefailassertFalser   r   r   re   rg   rh   anyr   r   r   inspectgetsourcelinesr   zipsortedr   r   )&r   r.   r   r   rj   rk   rl   rm   ra   blockinstrs	op_expectstartedr-   line2dbg
re_dbg_reffoundinstrr   acceptedr   r   int_dbg_valpysrcr   offsets
pyln_rangekline_nodilocation_infoexprmatch_local_var_aentrydbg_linedefliner   rN   r   s&                                      @@@r   test_DILocationz%TestDebugInfoEmission.test_DILocation   sT    
Dg	.	.	.	 	 
/	.	2 }%%cs%33""3C"00$W--}S^A./6C????F,???UQ'''Qx))T[)))3v;;***q	- -U/ - - -,,,	 	= 	=Ax9$$  *** #"G =w =		;<<<$ABBB
 55Z 677
 	" 	"Ee**K &&{33G  1$H$H$H$Hx$H$H$H I IJJJ^^%%FS[[!,,,QiGgabbk**Kzzu 4555E LL!!!!")"8"="= #'"8"8"B"B
  
 A@@@@@@
  x5I5I J J J *, , 	? 	?LQ5a8OMM,7,,o>>>> DJt,,,3355 	? 	?E'--e44G 	 ))  Va000vay>> +Q.  7333	 II=>>>>>r   )envvarsc                    t          d          d             } |d           |                    |j        d                   }t          j        |          }|j        |j        d                  j        j        fd|j        D             }| 	                    t          |          d           |d         }d |j        D             }| 	                    t          |          d	           |\  }}d
 |j        D             }	|	d         }
| 	                    |
j        d           d |
j        D             }| 	                    t          |          d           |d         }t          |                              d          d                                         }| 	                    ||j                   |                     t          |
                              |                     d S )NTr   c                     | dz   S r   r+   rJ   s    r   r.   z<TestDebugInfoEmission.test_DILocation_entry_blk.<locals>.fooA  s    q5Lr   {   r   c                 *    g | ]}|j         k    |S r+   rM   rO   s     r   rQ   zCTestDebugInfoEmission.test_DILocation_entry_blk.<locals>.<listcomp>U  rR   r   r:   c                     g | ]}|S r+   r+   r   s     r   rQ   zCTestDebugInfoEmission.test_DILocation_entry_blk.<locals>.<listcomp>X  r   r   r   c                     g | ]}|S r+   r+   r   s     r   rQ   zCTestDebugInfoEmission.test_DILocation_entry_blk.<locals>.<listcomp>^  s    ;;;Qq;;;r   r   brc                     g | ]}|S r+   r+   r   s     r   rQ   zCTestDebugInfoEmission.test_DILocation_entry_blk.<locals>.<listcomp>a  s    222q222r   :)r	   rX   rY   rZ   r[   r\   r]   r^   r_   r    r`   ra   rb   rc   operandsre   splitrf   rN   rh   endswith)r   r.   rj   rk   rl   rm   ra   entry_block
body_blockentry_instrujmpujmp_operandstarget_datatargetrN   s                 @r   test_DILocation_entry_blkz/TestDebugInfoEmission.test_DILocation_entry_blk1  s     
D				 	 
		C""3>!#455 $W--}S^A./6C????F,???UQ'''Qx))T[)))Va((("(Z <;+":;;;2d+++22DM222]++Q///#A&[!!'',,Q/5577111D		**62233333r   c                    t          d          d             t          d          fd            }t          j        ddd         f}|                     ||          }d}|                                D ]F}|                                }|                    d	          r|                     |d
           |dz  }G|                     |d           dS )z This tests that decref's generated from `ir.Del`s as variables go
        out of scope do not have debuginfo associated with them (the location of
        `ir.Del` is an implementation detail).
        Tr   c                      d S r   r+   r,   s    r   sinkz:TestDebugInfoEmission.test_DILocation_decref.<locals>.sinkq  r   r   c                 ^    | | f}| d         dk    r |           dS |d         d         }|S )Nr      r+   )rJ   r-   zr   s      r   r.   z9TestDebugInfoEmission.test_DILocation_decref.<locals>.foov  s=    AAtqyyQr!QAHr   Nr:   r   r   zcall void @NRT_decrefz.*meminfo\.[0-9]+\)$)	r	   r
   r   r   r   rf   
startswithassertRegexr   )r   r.   r   rj   countr   line_strippedr   s          @r   test_DILocation_decrefz,TestDebugInfoEmission.test_DILocation_decrefj  s    
D				 	 
		 
D				 	 	 	 
		 }SSqS!#""3C"00 &&(( 	 	D JJLLM''(?@@   '>???
5!$$$$$r   c                 ^   t          d          d             }t          j        f}|                     ||          }t	          j        |          \  }}d}t          j        |          }t                      }|D ]x}	|	                    |	          }
|
r_|

                                }|                     t          |          d           |                    t          |d                              y|                     t          |          d           |                     ||           d	S )
z Tests that DILocation information for undefined vars is associated
        with the line of the function definition (so it ends up in the prologue)
        Tr   c                 (    | r
| dk    rd}|S |dz  }|S )Nr   r:   r+   )nr   s     r   r.   z<TestDebugInfoEmission.test_DILocation_undefined.<locals>.foo  s-     q55A Qr   r   z:.*!DILocalVariable\(name: "c\$?[0-9]?",.*line: ([0-9]+),.*r:   r   r   N)r	   r
   intpr   r   r   r   r   r   rg   r   r    r`   r   r   r   )r   r.   r   r   r   r   r   matcherassociated_linesr   rg   r   s               r   test_DILocation_undefinedz/TestDebugInfoEmission.test_DILocation_undefined  s+    
D				 	 
		 zm%%cs%33")"8"="=L*T""55 	5 	5BMM"%%E 5  Va000 $$S^^444-..222&(899999r   c                 "   t          d          d             }t          j        f}|                     ||          }t	          j        |          \  }}d}t          j        |          }t                      }|D ]x}	|	                    |	          }
|
r_|

                                }|                     t          |          d           |                    t          |d                              y|                     t          |          d           t                      }t          |          D ]!\  }}d	|v r|                    ||z              "|                     t          |          d           |                     ||           d
S )zi Tests that DILocation information for versions of variables matches
        up to their definition site.Tr   c                 $    | rd}nd}d}d}d}d}|S )N   r:   r   r      r+   )r  r   py310_defeat1py310_defeat2py310_defeat3py310_defeat4s         r   r.   zFTestDebugInfoEmission.test_DILocation_versioned_variables.<locals>.foo  s/     MMMMHr   r   z9.*!DILocalVariable\(name: "c\$[0-9]?",.*line: ([0-9]+),.*r:   r   r   zc = N)r	   r
   r  r   r   r   r   r   r   rg   r   r    r`   r   r   	enumerate)r   r.   r   r   r   r   r   r  r  r   rg   r   py_linesixpylns                  r   #test_DILocation_versioned_variablesz9TestDebugInfoEmission.test_DILocation_versioned_variables  s    
D			
	 
	 
	
	 zm%%cs%33")"8"="= L*T""55 	5 	5BMM"%%E 5  Va000 $$S^^444-..222 55!%(( 	4 	4HB~~R"22333X*** 	)844444r   c                    t          dd          }t          j         |ddd          t          j         |ddd          t          j         |dd	d
          t          j         |ddd
          t          j         |ddd
          t          j         |ddd
          t          j         |dd	d          t          j	         |ddd          t          j
         |ddd          t          j         |ddd          t          j         |ddd          t          j         |ddd          i}|                                D ]4\  }t          d          fd            }|                     |d          }|                     |          }|                                D ]\  }}d|v r
||         }	 nJ d            t%          j        d |	                                          d         }
||
         }d!|j        v r2d"|j         d#|j         d$|j         d%}|                     ||           |j        dk    rd&nd'}d(|j         d)|j         d*| d+| d,|j         
}|                     ||           6d-S ).z@ Tests that dwarf info is correctly emitted for numeric scalars.DIzname bits encodingfloat32    DW_ATE_floatr   @   int8   DW_ATE_signedint16   r2   int64uint8DW_ATE_unsigneduint16uint32uint64	complex64DW_TAG_structure_type
complex128   Tr   c                       d          } | S )N
   r+   )rJ   tys    r   r.   z7TestDebugInfoEmission.test_numeric_scalars.<locals>.foo  s    BrFFr   r+   r   DILocalVariable(name: "a"r   missing DILocalVariable 'a'.*type: (![0-9]+).*DW_ATEz!DIBasicType(name: "	", size: z, encoding: )floatdoublezdistinct !DICompositeType(tag: z	, name: "z ({z, z})", size: N)r   rT   r  r   r  r  r2   r  r  r!  r"  r#  r$  r&  itemsr	   r   r   r   rg   r   encodingrN   bitsr    r   )r   r  
type_infos
dwarf_infor.   r   r   r   vlvartype_marker	type_declexpectedraw_fltr*  s                 @r   test_numeric_scalarsz*TestDebugInfoEmission.test_numeric_scalars  s    233j""YN"C"Cj""YN"C"Cgrr&!_==h7B @ @h7B @ @h7B @ @h7A/@ A AiHb2C!D!DiHb2C!D!DiHb2C!D!DlBB{B'>%@ %@mRRc(?&A &AC
 )..00 !	3 !	3NB
     ))#2)66H&*&<&<X&F&F#/5577 8 81.!33215DE 4 87777(#8$??FFHHKK/<I:...@:? @ @%/_@ @)3)<@ @ @   H5555 &0_%:%:''7$.$77 7&0o7 7 #*7 7 .57 7 &0_	7 7
 h	2222C!	3 !	3r   c           
         t          d          d             }|                     |d          }|                     |          }|                                D ]\  }}d|v r
||         } nJ d            t	          j        d	|                                          d         }||         }|                     d
|           |                     dt          t          j
        d d d d df                    |           t	          j        d          }	|	                    |                                          }
|                     t          |
          d           |
d         }||         }d}t	          j        |          }|                    |                                          }|                     |d u           t          j        t          j
        d d d d df                   }|                     t          |          t          |j                             t          j        j        }d| d}d| d| d}d| d| dd|z   d| d	}|||||||d}d}t	          j        |          }t)          |j                  D ]\  }}|||                  }|                     d|           |                     d| d|           |                    |          }|                                }|                     t          |          d           |d         }||         }|                     |||                    d S )NTr   c                  F    t          j        dt           j                  } | S )N)r   r   )dtype)rT   onesr   r   s    r   r.   z.TestDebugInfoEmission.test_arrays.<locals>.foo  s    bj111AHr   r+   r   r+  r   r,  r-  z+!DICompositeType(tag: DW_TAG_structure_typezname: "r:   z.*elements: (![0-9]+),.*zN!{(![0-9]+), (![0-9]+), (![0-9]+), (![0-9]+), (![0-9]+), (![0-9]+), (![0-9]+)}zC!DIDerivedType\(tag: DW_TAG_pointer_type, baseType: ![0-9]+, size: z\)z!DIBasicType\(name: "intr/  z, encoding: DW_ATE_signed\)z>!DICompositeType\(tag: DW_TAG_array_type, name: "UniTuple\(intz x 2\) \(\[2 x iz \]\)", baseType: ![0-9]+, size: r   z), elements: ![0-9]+, identifier: "\[2 x iz\]"\))meminfoparentnitemsitemsizedatashapestridesz*!DIDerivedType\(.*, baseType: (![0-9]+),.*DIDerivedType")r	   r   r   r3  r   rg   r   r   re   r
   r   r   r    r`   assertIsNotNoner   lookup_fieldsr  bitwidthr  r   )r   r.   r   r   r   r8  r9  r:  r;  match_elementselem_matches
elem_matchstruct_markersstruct_patternmatch_structstruct_member_matches
data_modelptr_sizeptr_reint_re	utuple_rer<  base_type_patternbase_type_matcherr  fieldderived_typebase_type_matchbase_type_matchesbase_type_marker	data_types                                  r   test_arraysz!TestDebugInfoEmission.test_arrays  s   	D				 	 
		 %%cr%22"&"8"8"B"B+1133 	4 	4DAq*a//.q1 0 43333h4d;;BBDDQG+K8	 	CYOOO<EM!!!SSqS&$9 : :<<iHHH $?@@%++I66==??\**A...!!_
 1<@z.11 , 2 2> B B I I K K2$>???$+EM!!!SSqS&,ABB
233S9K5L5LMMM:&</7< < </h / / / / /=-5= ="*= =  !8|= = .6	= = =	
  &$$ &"&(* * JJ'899":#566 		9 		9IB23H3LMLMM/<888MM,E,,,l;;;/55lCCO / 6 6 8 8S!233Q77703/0@AIY8888		9 		9r   c           	           fd}d }d } t          d          |          } t          dd          |          } t          ddd          |          }|j        j        }i }t          d|d	z   ht	                      t	          d
g                    ||<   t          t	          t          |dz   |dz                       t	          d
g          t	                                ||<   t          d|d	z   ht	          dg          t	          d
g                    ||<    |            }	|                                D ]\  }
}                     |
j                  5   |
            } 	                    ||	            	                     ||
          |d                     ||
          }|d         } 	                    ||z  |           |d         } 
                    ||z             d d d            n# 1 swxY w Y   d S )Nc                 t                         | | j        d                   }                    |          }|S )Nr   )r   rY   r   )r   r   r   r   s      r   get_debug_lineszATestDebugInfoEmission.test_debug_optnone.<locals>.get_debug_lines[  s7    ))"bmA.>??H228<<ELr   c                     | j         | j        d                  }|j        }|j                            |j        j                  } t          d                    | j	                  
                                          }|S )Nr       )r\   rY   library_final_moduleget_functionr]   r^   r   join
attributesr   )r   creslibattrss       r   get_func_attrsz@TestDebugInfoEmission.test_debug_optnone.<locals>.get_func_attrs`  sc    <a 01D,C"//0HIIB		"-00668899ELr   c                  <    d} d}t          |           D ]}||z  }|S )Nr)  r   )range)r  r   is      r   r.   z5TestDebugInfoEmission.test_debug_optnone.<locals>.foog  s1    AA1XX  QHr   Tr   )r)   _dbg_optnone)r)   rv  rA   r   r  s   optnone)r   must_have_attrsmust_not_have_attrsr:      s   alwaysinliner   rw  rx  )r	   __code__co_firstlinenor   r   rt  r3  subTesttargetoptionsr    r   )r   rg  rr  r.   	foo_debugfoo_debug_optnonefoo_debug_optnone_inline	firstlineexpected_infoexpected_retudtr<  r$   rq  	must_havemust_not_haves   `               r   test_debug_optnonez(TestDebugInfoEmission.test_debug_optnoneZ  s   	 	 	 	 	
	 	 		 	 	 %Dt$$$S))	?Dt$???DD$:4d48$: $: $::=$? $?  L/	#'i!m$EE #ZL 1 1	$
 $
 $
i  ,0eIM9q=99::-- #	,
 ,
 ,
'( 37 i!m$ 122 #ZL 1 13
 3
 3
./ suu*0022 	8 	8MCc/00 8 8cee  l333   !5!5x7HIII 's++$%67	  !2I>>> ()> ?  !67778 8 8 8 8 8 8 8 8 8 8 8 8 8 8	8 	8s    BG>>H	H	c                    t          d          dd            }t          dd          5   |             d d d            n# 1 swxY w Y   |                     |t          j        d           f          }|                     |          }g }|D ]}d|v r|                    |           |                     t          |          d           |	                                }t          j        d|          }|                     |           |                                }|                     t          |          d           |d	         }	||	         }
t          j        d
|
          }|                     |           |                                }|                     t          |          d           d |d	                             d          D             d         }||         }d}|                     ||           t          j        ||                                          d	         }||         }|                     |d           d S )NTr   c                     d S r   r+   )missings    r   r.   z3TestDebugInfoEmission.test_omitted_arg.<locals>.foo  r   r   r9   r:   r   DISubroutineTypez(.*!DISubroutineType\(types: ([!0-9]+)\)$r   z!{(.*)}c                 6    g | ]}|                                 S r+   )rf   r   s     r   rQ   z:TestDebugInfoEmission.test_omitted_arg.<locals>.<listcomp>  s     JJJ1QWWYYJJJr   ,r   zy^.*!DICompositeType\(tag: DW_TAG_structure_type, name: "Anonymous struct \({}\)", elements: (![0-9]+), identifier: "{}"\)z!{}r   )r	   r   r   r
   Omittedr   rd   r    r`   popr   rg   rL  r   r   r   )r   r.   r   r   
tmp_disubrr   disubrdisubr_matcheddisubr_groupsdisubr_metadisubr_typesdisubr_types_matcheddisubr_types_groups	md_fn_argarg_tyexpected_arg_ty
md_base_tybase_tys                     r   test_omitted_argz&TestDebugInfoEmission.test_omitted_arg  s   	D				 	 	 
		 0!44 	 	CEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 %%cd0C0C/E%FF"&"8"8"B"B 
 	& 	&B!R''!!"%%%Z!,,,!!"M"(* *^,,,&--//]++Q///#A& /{;!x
LAA^,,,299;;0111555 KJ(;A(>(D(DS(I(IJJJ2N	(3< 	111Xov66==??B
)*55*****s   AA	Ac                    d}t                      }t          t          |          i |            t          d          |d                   }t	          j        d          5 }t	          j        dt                     t                        |             d d d            n# 1 swxY w Y   | 	                    t          |          d           |d         }| 	                    |j        t                     t          |j                  }|                     d	|           |                     t          |j                  |           d S )
Nz1
        def foo():
            return 1
        Tr   r.   recordalwaysr:   r   z"Could not find source for function)r   execr   r	   warningscatch_warningssimplefilterr   r   r    r`   categoryre   messager   rW   )r   strsrclr.   wr   r   s          r   test_missing_sourcez)TestDebugInfoEmission.test_missing_source  sc    FFVF^^R###dqx(($D111 	Q!(,ABBB$&&&CEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 	Q###!)>???%-  :C@@@c#+&&,,,,,s   #3B""B&)B&c                    t          d          d             }t          j        d          5 }t          j        dt                     t                        |             d d d            n# 1 swxY w Y   |                     t          |          d           |                     ||j	        d                   }| 
                    |          }|                     t          |          d           d S )NTr   c                      dS r   r+   r+   r   r   r.   zCTestDebugInfoEmission.test_irregularly_indented_source.<locals>.foo  s	     1r   r  r  r   r:   )r	   r  r  r  r   r   r    r`   r   rY   r   )r   r.   r  r   r   s        r    test_irregularly_indented_sourcez6TestDebugInfoEmission.test_irregularly_indented_source  s)   	D				 	 
		 $D111 	Q!(,ABBB$&&&CEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	Q###%%c3>!+<==..x88UQ'''''s   3A..A25A2N)ru   rv   rw   rx   _NUMBA_OPT_0_ENVr   r   r   r   r   r   r   run_test_in_subprocessr   r   r  r  r>  rd  r  r  r  r  r+   r   r   rz   rz   {   si         $S)( ( (
  ' ' '
 
 
B B Bz? z? z?x %X$-=>>>64 64 ?>64p %X$-=>>>% % ?>%@: : :@,5 ,5 ,5\53 53 53nH9 H9 H9T?8 ?8 ?8B-+ -+ -+^- - -.( ( ( ( (r   rz   __main__)collectionsr   r   r   r   rT   rC   textwrapr   unittestr  numba.tests.supportr   r   r   numbar   r	   
numba.corer
   numba.core.datamodelr   numba.core.errorsr   llvmlite.bindingbindingrZ   r   rz   ru   mainr+   r   r   <module>r     s   " " " " " "  				             ; ; ; ; ; ; ; ; ; ;               0 0 0 0 0 0 3 3 3 3 3 3      a# a# a# a# a#H a# a# a#Hx	( x	( x	( x	( x	(H x	( x	( x	(v zHMOOOOO r   