
    xKgr                         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<                          yy)    )
namedtupleN)dedent)TestCaseoverride_configignore_internal_warnings)jitnjit)types)default_manager)NumbaDebugInfoWarningc                   4    e Zd ZdZd Zd Zd Zd Zd Zd Z	y)	TestDebugInfozF
    These tests only checks the compiled assembly for debuginfo.
    c                 F    |j                  |       |j                  |      S N)compileinspect_asmselffnsigs      ^/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/tests/test_debuginfo.py_getasmzTestDebugInfo._getasm   s    


3~~c""    c                     | j                  ||      }t        j                  d|t        j                        }|d u}| j	                  ||d|z         y )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    sO    ll23l'II)35tm*H3*NOr   c                 p    t        dd      d        }| j                  |t        j                  fd       y )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&   s5    	d%	(	 
)	 	Cekk^E:r   c                 p    t        dd      d        }| j                  |t        j                  fd       y )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-   s5    	d$	'	 
(	 	Cekk^D9r   c                    t        dd      5  t        d      d        }| j                  |t        j                  fd       t        dd      d	        }| j                  |t        j                  fd       d d d        y # 1 sw Y   y xY w)
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$  KK%++K= $e, -KK%++K> 544s   A,BBc                    t        d      d        t        d      d        t         fd       }t        dd      5   |t        j                        }d d d        | j	                  |j                  t        j                               |j                  |j                  d	         }t        j                  |      }|j                  |j                  d	      j                  j                  }|j                  D cg c]  }|j                  |k(  s| }}| j                  t!        |      d       |d	   }g }	|j"                  D ]K  }
|
j$                  D ]:  }|j&                  d
k(  s|	j)                  t+        |      j-                                < M d}d}j                  j                  d	      j                  j                  }|	D ]<  }|st/        j0                  d|      rd}|r t/        j0                  d| d|      s;d}> | j3                  |       | j3                  |       y # 1 sw Y   xY wc c}w )NT)forceinlinec                 ,    t        j                  |       S r   )mathsinr,   s    r   r>   z:TestDebugInfo.test_llvm_inliner_flag_conflict.<locals>.barG       88A;r   Fc                 ,    t        j                  |       S r   )rC   cosr,   s    r   bazz:TestDebugInfo.test_llvm_inliner_flag_conflict.<locals>.bazK   rE   r   c                 ,     |       } |       }||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   callz.*llvm.sin.f64.*z.*)r	   r   nppiassertPreciseEqualpy_funcinspect_llvm
signaturesllvmparse_assembly	overloadsfndescmangled_name	functionsnamer    lenblocksinstructionsopcodeappendstrstripr   match
assertTrue)r   r.   resultfull_irmodulerY   r-   funcsfuncf_namesblkstmt	found_sin	found_bazbaz_namer>   rH   s                  @@r   test_llvm_inliner_flag_conflictz-TestDebugInfo.test_llvm_inliner_flag_conflictB   s   
 
$		 
 	 
%	 	 
!	 
	 
	 0!4ZF 5 	BEE(:; ""3>>!#45$$W-}}S^^A./66CC",,?,q$,?UQ'Qx ;;C((;;&(NN3t9??#45 )  		==!23::GGA*<a!@ 	Bxj*;Q!? 		  		"	"E 54 @s   H0H=H=0H:N)
__name__
__module____qualname____doc__r   r%   r4   r7   r?   rn   r+   r   r   r   r      s&    #P;:?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y)TestDebugInfoEmissionz1 Tests that debug info is emitted correctly.
    	NUMBA_OPT0c                     t        dd      5  |j                  |       |j                  |      cd d d        S # 1 sw Y   y xY w)NOPTr   )r   r   rQ   r   s      r   _get_llvmirz!TestDebugInfoEmission._get_llvmir   s/    UA&JJsO??3' '&&s	   "9Ac                     | j                  ||      j                         }t        j                  d      }g }|D ]%  }|j	                  |      s|j                  |       ' |S )Nz![0-9]+ =.*)ry   
splitlinesr   r   ra   r^   )r   r   r   llmeta_remetadatalines          r   _get_metadataz#TestDebugInfoEmission._get_metadata   sY    b#&113**^,D}}T"%  r   c                     t               }t        j                  d      }|D ].  }|j                  |      }|s|j	                         \  }}|||<   0 |S )zdGets the map of DI label to md, e.g.
        '!33' -> '!{!"branch_weights", i32 1, i32 99}'
        z(![0-9]+) = (.*))dictr   r   ra   groups)r   r~   metadata_definition_mapmeta_definition_splitr   matcheddbg_valinfos           r   _get_metadata_mapz'TestDebugInfoEmission._get_metadata_map   s\     #'& "

+> ?D+11$7G ' 037'0	 
 '&r   c                     | j                  |      }t               }|j                         D ]F  }t        j                  d|      }|st        |j                  d            }|j                  |       H |S )Nz!DILocation\(line: (\d+),r:   )r   setvaluesr   ra   intgroupadd)r   r~   
md_def_maplinesmdr#   lns          r   _get_lines_from_debuginfoz/TestDebugInfoEmission._get_lines_from_debuginfo   sc    ++H5
##%B5r:A_		"	 &
 r   c                     t        d      d        }| j                  |d      }|d   }| j                  d|d d        | j                  d	|       | j                  d
|       y )NTr)   c                       y r   r+   r+   r   r   r.   z/TestDebugInfoEmission.test_DW_LANG.<locals>.foo       r   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   sq    	D		 
	 %%cr%2 }Ra01D#	%1=Ar   c           
      j   t        dd      d        }t        j                  f}| j                  ||      }| j	                  ||      }t        j                  |      }|j                  |j                  d      j                  j                  }|j                  D cg c]  }|j                  |k(  s| }}| j                  t        |      d       |d   }	|	j                  D cg c]  }| }
}| j!                  t        |
      d       |
d   }|j"                  D cg c]  }|j$                  dk7  s| }}h d	}d
}|D ]H  }|j$                  |v r!|j'                  |j$                         |r/d}2|s5|s8| j)                  d       J | j+                  |d       t-               }t/        j0                  d      }d}|D ]  }t3        |      }|j5                  |      }|s-d}| j7                  t9        |D cg c]  }||v  c}             N|j;                         }| j                  t        |      d       |d   }t=        |dd       }|dk\  r| j7                  ||k\         |}|j?                  |        tA        jB                  |      \  }}| jE                  |      }g d}|D cg c]
  }|dz   |z    }}tG        tI        |d       |      D ]  \  }}||   } | jK                  d| |        ! d}!t/        j0                  |!      }"|jM                         D ]g  }#|"j5                  |#      }|s|j;                         }| j                  t        |      d       t=        |d         }$|dz   }%| j                  |$|%        y | j)                  d       yc c}w c c}w c c}w c c}w c c}w )z: Tests that DILocation information is reasonable.
        Tnumpy)r)   error_modelc                 :    | 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!HHr   r   r   r:   rL   >   faddfdivfmulFzMath opcodes are not contiguouszMath opcodes were not foundz.*!dbg (![0-9]+).*$)zalloca zstore N)r   r:   r      r   c                     t        | dd        S Nr:   )r   r,   s    r   <lambda>z7TestDebugInfoEmission.test_DILocation.<locals>.<lambda>  s    s1QR5zr   )keyzline: z1.*!DILocalVariable\(name: "a",.*line: ([0-9]+),.*z%Assertion on DILocalVariable not made)'r	   r
   float64r   ry   rS   rT   rU   rR   rV   rW   rX   rY   r    rZ   r[   assertGreaterr\   r]   removefailassertFalser   r   r   r_   ra   rb   anyr   r   r   inspectgetsourcelinesr   zipsortedr   r   )&r   r.   r   r~   rd   re   rY   r-   rf   rg   r[   blockinstrs	op_expectstartedline2dbg
re_dbg_reffoundinstrinst_as_strr   acceptedr   r   int_dbg_valpysrcpysrc_line_startr   offsets
pyln_rangekline_nodilocation_infoexprmatch_local_var_aentrydbg_linedeflines&                                         r   test_DILocationz%TestDebugInfoEmission.test_DILocation   s    
Dg	.	 
/	2 }}%%cs%3""3C"0$$W-}}S^^A./66CC",,?,q$,?UQ'Qx![[)[![)3v;*q	 #//F/188v3E!/F,	Axx9$  *"Gw		;<  	$AB
 5ZZ 67
Ee*K &&{3G 1x$Hx!Q+%5x$H IJ^^%FS[!,QiGgabk*Kzu 45E LL!' * #*"8"8"= #'"8"8"B

 9@@1&*Q.
@  x5I J *,LQ5a8OMMF7),o>, DJJt,,335E'--e4G )  Va0vay> +Q.  73 6 II=>k @ *
 G4 %I4 As*   N3N'	N! N&5N&:N+.N0)envvarsc                    t        d      d        } |d       |j                  |j                  d         }t        j                  |      }|j
                  |j                  d      j                  j                  }|j                  D cg c]  }|j                  |k(  s| }}| j                  t        |      d       |d   }|j                  D cg c]  }| }}| j                  t        |      d       |\  }	}
|	j                  D cg c]  }| }}|d   }| j                  |j                  d	       |j                  D cg c]  }| }}| j                  t        |      d       |d   }t!        |      j#                  d
      d   j%                         }| j                  ||
j                         | j'                  t!        |      j)                  |             y c c}w c c}w c c}w c c}w )NTr   c                     | dz   S r   r+   rJ   s    r   r.   z<TestDebugInfoEmission.test_DILocation_entry_blk.<locals>.foo@  s    q5Lr   {   r   r:   r   r   br:)r	   rQ   rR   rS   rT   rU   rV   rW   rX   rY   r    rZ   r[   r\   r]   operandsr_   splitr`   rb   endswith)r   r.   rd   re   rY   r-   rf   rg   r[   entry_block
body_blockentry_instrujmpujmp_operandstarget_datatargets                   r   test_DILocation_entry_blkz/TestDebugInfoEmission.test_DILocation_entry_blk0  s     
D		 
	C""3>>!#45 $$W-}}S^^A./66CC",,?,q$,?UQ'Qx![[)[![)Va("(Z #.":":;":Qq":;2d+$(MM2MqM2]+Q/#A&[!'',Q/5571D	**623' @ * < 3s   G$!G$	G)	G.	G3c                 j   t        d      d        t        d      fd       }t        j                  ddd   f}| j                  ||      }d}|j	                         D ];  }|j                         }|j                  d	      s%| j                  |d
       |dz  }= | j                  |d       y)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                       y r   r+   r,   s    r   sinkz:TestDebugInfoEmission.test_DILocation_decref.<locals>.sinkp  r   r   c                 B    | | f}| d   dk(  r	 |       y|d   d   }|S )Nr      r+   )rJ   r-   zr   s      r   r.   z9TestDebugInfoEmission.test_DILocation_decref.<locals>.foou  s3    AAtqyQ!QAHr   Nr:   r   r   zcall void @NRT_decrefz.*meminfo\.[0-9]+\)$)	r	   r
   r   ry   r{   r`   
startswithassertRegexr   )r   r.   r   rd   countr   line_strippedr   s          @r   test_DILocation_decrefz,TestDebugInfoEmission.test_DILocation_decrefi  s     
D		 
	 
D		 
	 }}SqS!#""3C"0 &&(D JJLM''(?@  '>?
	 )
 	5!$r   c                    t        d      d        }t        j                  f}| j                  ||      }t	        j
                  |      \  }}d}t        j                  |      }t               }|D ]^  }	|j                  |	      }
|
s|
j                         }| j                  t        |      d       |j                  t        |d                ` | j                  t        |      d       | j                  ||       y	)
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kD  rd}S dz  }|S )Nr   r:   r+   )nr   s     r   r.   z<TestDebugInfoEmission.test_DILocation_undefined.<locals>.foo  s&    q5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   ra   r   r    rZ   r   r   r   )r   r.   r   r~   r   r   r   matcherassociated_linesr   ra   r   s               r   test_DILocation_undefinedz/TestDebugInfoEmission.test_DILocation_undefined  s     
D		 
	 zzm%%cs%3")"8"8"=L**T"5BMM"%E  Va0 $$S^4  	-.2&(89r   c                    t        d      d        }t        j                  f}| j                  ||      }t	        j
                  |      \  }}d}t        j                  |      }t               }|D ]^  }	|j                  |	      }
|
s|
j                         }| j                  t        |      d       |j                  t        |d                ` | j                  t        |      d       t               }t        |      D ]  \  }}d	|v s|j                  ||z            | j                  t        |      d       | j                  ||       y
)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   ra   r   r    rZ   r   r   	enumerate)r   r.   r   r~   r   r   r   r   r   r   ra   r   py_linesixpylns                  r   #test_DILocation_versioned_variablesz9TestDebugInfoEmission.test_DILocation_versioned_variables  s7    
D	
	 

	 zzm%%cs%3")"8"8"= L**T"5BMM"%E  Va0 $$S^4  	-.2 5!%(HB~R"223 ) 	X* 	)8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}|j                         D ]3  \  }t        d      fd       }| j!                  |d      }| j#                  |      }|j                         D ]  \  }}d|v s||   }	 n J d       t%        j&                  d |	      j)                         d   }
||
   }d!|j*                  v r=d"|j,                   d#|j.                   d$|j*                   d%}| j1                  ||       |j.                  dk(  rd&nd'}d(|j*                   d)|j,                   d*| d+| d,|j.                   
}| j3                  ||       6 y-).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    rF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   rM   r  r   r  r	  r2   r  r  r  r  r  r  r  itemsr	   r   r   r   ra   r   encodingrY   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  sz    23jj"YN"Cjj"YN"Cggr&!_=hh7B @hh7B @hh7B @hh7A/@ AiiHb2C!DiiHb2C!DiiHb2C!DllB{B'>%@mmRc(?&AC
 )..0NB
  ))#2)6H&*&<&<X&F#/5571.!3215D 8
 877q((#8$?FFHKK/<I:...2:??2C D%%/__$5 6))3)<)<(=Q@   H5 &0__%:'$$.$7$7#8 9&&0oo%6 7"")"WI 6%%/__$5	7
 h	2C 1r   c           
         t        d      d        }| j                  |d      }| j                  |      }|j                         D ]  \  }}d|v s||   } n J d       t	        j
                  d	|      j                         d   }||   }| j                  d
|       | j                  dt        t        j                  d d d d df          |       t	        j                  d      }	|	j                  |      j                         }
| j                  t        |
      d       |
d   }||   }d}t	        j                  |      }|j                  |      j                         }| j                  |d u       t        j                   t        j                  d d d d df         }| j                  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 ]  \  }}|||      }| j                  d|       | j                  d| d|       |j                  |      }|j                         }| j                  t        |      d       |d   }||   }| j+                  |||           y )NTr   c                  P    t        j                  dt         j                        } | S )N)r   r   )dtype)rM   onesr   r   s    r   r.   z.TestDebugInfoEmission.test_arrays.<locals>.foo  s    bjj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   r   r   ra   r   r   r_   r
   r   r   r    rZ   assertIsNotNoner   lookup_fieldsr   bitwidthr   r   )r   r.   r~   r   r   r%  r&  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"&"8"8"B+113DAq*a/.q1 4
 4331hh4d;BBDQG+K8	 	CYOEMM!SqS&$9 :;<iH $?@%++I6==?\*A.!!_
 1<@zz.1 , 2 2> B I I K2$>?$++EMM!SqS&,AB
23S9K9K5LM::&&//7j<-hZy
 K/ /--5J 7""* , 8|n ---5Je	=	
  &$$ &"&(* JJJ'89":#5#56IB23H3LMLMM/<8MMGE7!,l;/55lCO / 6 6 8S!23Q703/0@AIY8 7r   c           	      V     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            ||<    |       }	|j                         D ]  \  }
} j                  |
j                        5   |
       } j                  ||	        j                   ||
      |d           ||
      }|d   } j                  ||z  |       |d   } j                  ||z         d d d         y # 1 sw Y   xY w)Nc                 h    j                  | | j                  d         }j                  |      }|S )Nr   )r   rR   r   )r   r~   r   r   s      r   get_debug_lineszATestDebugInfoEmission.test_debug_optnone.<locals>.get_debug_linesZ  s3    ))"bmmA.>?H228<ELr   c                    | j                   | j                  d      }|j                  }|j                  j	                  |j
                  j                        } t        dj                  | j                        j                               }|S )Nr       )rU   rR   library_final_moduleget_functionrV   rW   r   join
attributesr   )r   creslibattrss       r   get_func_attrsz@TestDebugInfoEmission.test_debug_optnone.<locals>.get_func_attrs_  sg    <<a 01D,,C""//0H0HIB		"--06689ELr   c                  8    d} d}t        |       D ]  }||z  }	 |S )Nr  r   )range)r   r   is      r   r.   z5TestDebugInfoEmission.test_debug_optnone.<locals>.foof  s(    AA1XQ Hr   Tr   )r)   _dbg_optnone)r)   rc  rA   r   r   s   optnone)r   must_have_attrsmust_not_have_attrsr:      s   alwaysinliner   rd  re  )r	   __code__co_firstlinenor   r   ra  r   subTesttargetoptionsr    r   )r   rT  r_  r.   	foo_debugfoo_debug_optnonefoo_debug_optnone_inline	firstlineexpected_infoexpected_retudtr)  r$   r^  	must_havemust_not_haves   `               r   test_debug_optnonez(TestDebugInfoEmission.test_debug_optnoneY  s   	
		 %Dt$S)	?Dt$?D$:4d48$::=$?  LL//	#'i!m$E #ZL 1	$
i  ,0eIM9q=9:- #	,
'( 37 i!m$ 12 #ZL 13
./ u*002MCc//0e  l3   !5x7HI 's+$%67	  !2I> ()> ?  !67 10 300s   $A0FF(	c                    t        d      dd       }t        dd      5   |        d d d        | j                  |t        j                  d       f      }| j                  |      }g }|D ]  }d|v s|j                  |        | j                  t        |      d       |j                         }t        j                  d|      }| j                  |       |j                         }| j                  t        |      d       |d	   }	||	   }
t        j                  d
|
      }| j                  |       |j                         }| j                  t        |      d       |d	   j                  d      D cg c]  }|j                          c}d   }||   }d}| j!                  ||       t        j                  ||      j                         d	   }||   }| j                  |d       y # 1 sw Y   xY wc c}w )NTr   c                      y r   r+   )missings    r   r.   z3TestDebugInfoEmission.test_omitted_arg.<locals>.foo  r   r   r9   r:   r   DISubroutineTypez(.*!DISubroutineType\(types: ([!0-9]+)\)$r   z!{(.*)},r   zy^.*!DICompositeType\(tag: DW_TAG_structure_type, name: "Anonymous struct \({}\)", elements: (![0-9]+), identifier: "{}"\)z!{}r   )r	   r   r   r
   Omittedr   r^   r    rZ   popr   ra   r9  r   r   r`   r   )r   r.   r~   r   
tmp_disubrr   disubrdisubr_matcheddisubr_groupsdisubr_metadisubr_typesdisubr_types_matcheddisubr_types_groupsr-   	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E 5 %%cd0C/E%F"&"8"8"B 
B!R'!!"%  	Z!,!"M"(*^,&--/]+Q/#A& /{;!xx
LA^,299;0115 )<A(>(D(DS(IJ(I1QWWY(IJ2N	(3< 	1XXov6==?B
)*55*M 54: Ks   G+6G8+G5c                 6   d}t               }t        t        |      i |        t        d      |d         }t	        j
                  d      5 }t	        j                  dt               t                 |        d d d        | j                  t              d       |d   }| j                  |j                  t               t        |j                        }| j                  d	|       | j                  t        |j                        |       y # 1 sw Y   xY w)
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    rZ   categoryr_   messager   rP   )r   strsrclr.   wr   r   s          r   test_missing_sourcez)TestDebugInfoEmission.test_missing_source  s     FVF^R#dqx($$D1Q!!(,AB$&E 2
 	Q#!)>?%-- :C@c#++&, 21s   ,DDc                    t        d      d        }t        j                  d      5 }t        j                  dt               t                 |        d d d        | j                  t              d       | j                  ||j                  d         }| j                  |      }| j                  t        |      d       y # 1 sw Y   pxY w)NTr   c                       yr   r+   r+   r   r   r.   zCTestDebugInfoEmission.test_irregularly_indented_source.<locals>.foo  s     r   r  r  r   r:   )r	   r  r  r  r   r   r    rZ   r   rR   r   )r   r.   r  r~   r   s        r    test_irregularly_indented_sourcez6TestDebugInfoEmission.test_irregularly_indented_source  s    	D		 
	 $$D1Q!!(,AB$&E 2 	Q#%%c3>>!+<=..x8UQ' 21s   ,CCN)ro   rp   rq   rr   _NUMBA_OPT_0_ENVry   r   r   r   r   r   r   run_test_in_subprocessr   r   r   r   r+  rQ  rt  r  r  r  r+   r   r   rt   rt   {   s     $S)(
'
By?v %X$$-=>64 ?64p %X$$-=>% ?%@:@,5\53nH9T?8B-+^-.(r   rt   __main__)collectionsr   r   r   r   rM   rC   textwrapr   unittestr  numba.tests.supportr   r   r   numbar   r	   
numba.corer
   numba.core.datamodelr   numba.core.errorsr   llvmlite.bindingbindingrS   r   rt   ro   mainr+   r   r   <module>r     sn    "  	     ; ;   0 3 a#H a#Hw	(H w	(t zHMMO r   