pdb -> rdi conversion: be robust to zero itypes in function type parameter lists. was causing, in some cases, local variables to be incorrectly interpreted as parameters, because there was a (nonexistent) parameter to the function recorded in the type info.

This commit is contained in:
Ryan Fleury
2026-04-15 12:28:42 -07:00
parent 6a36382690
commit 8513ef8a4f
+21 -4
View File
@@ -2312,15 +2312,32 @@ p2r_convert(Arena *arena, P2R_ConvertParams *params)
CV_TypeId *arglist_itypes_base = (CV_TypeId *)(arglist+1);
U32 arglist_itypes_count = arglist->count;
// rjf: build param type array
RDIM_Type **params = push_array(arena, RDIM_Type *, arglist_itypes_count);
// rjf: count non-zero arguments
U32 arglist_itypes_nonzero_count = 0;
for(U32 idx = 0; idx < arglist_itypes_count; idx += 1)
{
params[idx] = p2r_type_ptr_from_itype(arglist_itypes_base[idx]);
if(arglist_itypes_base[idx] != 0)
{
arglist_itypes_nonzero_count += 1;
}
}
// rjf: build param type array
RDIM_Type **params = push_array(arena, RDIM_Type *, arglist_itypes_nonzero_count);
{
U64 dst_idx = 0;
for(U32 idx = 0; idx < arglist_itypes_count; idx += 1)
{
if(arglist_itypes_base[idx] != 0)
{
params[dst_idx] = p2r_type_ptr_from_itype(arglist_itypes_base[idx]);
dst_idx += 1;
}
}
}
// rjf: fill dst type
dst_type->count = arglist_itypes_count;
dst_type->count = arglist_itypes_nonzero_count;
dst_type->param_types = params;
}break;