Re: [PATCH v1] perf test type profiling: Remote typedef on struct

From: Gary Guo

Date: Tue Apr 14 2026 - 10:43:57 EST


On Tue Mar 31, 2026 at 8:22 PM BST, Dmitry Dolgov wrote:
>> On Mon, Mar 30, 2026 at 11:42:25PM -0700, Namhyung Kim wrote:
>>
>> We have this:
>>
>> Dwarf_Die *die_get_real_type(Dwarf_Die *vr_die, Dwarf_Die *die_mem)
>> {
>> do {
>> vr_die = __die_get_real_type(vr_die, die_mem);
>> } while (vr_die && dwarf_tag(vr_die) == DW_TAG_typedef);
>>
>> return vr_die;
>> }
>
> Indeed, I didn't finish the analysis, fooled that the diff was solving
> the issue. Adding DW_TAG_typedef into __die_get_real_type still fixes
> the problem, but due to different reasons:
>
> * check_variable calls __die_get_real_type directly at the beginning and
> stores the result in type_die, which is the result of the function.
>
> * if it doesn't resolve DW_TAG_typedef, the flow goes into the
> die_get_real_type, which stores the result in the local variable
> sized_type. But it never copied into the type_die, and never returned
> as a result of the check_variable.
>
> Hence we either need to add DW_TAG_typedef into __die_get_real_type, or
> copy sized_type into type_die. After some testing both seems to be
> achieving the goal.

Why is the code in `check_variable` resolving typedefs itself instead of using
`die_get_real_type` instead?

Best,
Gary