Hi Arnaldo,
On Sat, Nov 11, 2023 at 10:55 AM Arnaldo Carvalho de Melo
<[email protected]> wrote:
>
> On Thu, Nov 9, 2023, 9:00 PM Namhyung Kim <[email protected]> wrote:
>>
>>
>> +static bool find_cu_die(struct debuginfo *di, u64 pc, Dwarf_Die *cu_die)
>> +{
>> + Dwarf_Off off, next_off;
>> + size_t header_size;
>> +
>> + if (dwarf_addrdie(di->dbg, pc, cu_die) != NULL)
>> + return cu_die;
>
> Isn't the return type a bool?
>
> Shouldn't be 'return true;'?
>
> Ends up like that as cu_die isn't NULL, but looks confusing.
Ok, will change.
>
>> +
>> + /*
>> + * There are some kernels don't have full aranges and contain only a few
>> + * aranges entries. Fallback to iterate all CU entries in .debug_info
>> + * in case it's missing.
>> + */
>> + off = 0;
>> + while (dwarf_nextcu(di->dbg, off, &next_off, &header_size,
>> + NULL, NULL, NULL) == 0) {
>> + if (dwarf_offdie(di->dbg, off + header_size, cu_die) &&
>> + dwarf_haspc(cu_die, pc))
>> + return true;
>> +
>> + off = next_off;
>> + }
>> + return false;
>> +}
>> +
>>
>> +struct annotated_data_type *find_data_type(struct map_symbol *ms, u64 ip,
>> + int reg, int offset)
>> +{
>> + struct annotated_data_type *result = NULL;
>> + struct dso *dso = ms->map->dso;
>> + struct debuginfo *di;
>> + Dwarf_Die type_die;
>> + struct strbuf sb;
>> + u64 pc;
>> +
>> + di = debuginfo__new(dso->long_name);
>> + if (di == NULL) {
>> + pr_debug("cannot get the debug info\n");
>
>
> Shouldn't inform the dso->long_name and function name to ease debugging?
Sounds good, I'll update it in the v3.
Thanks,
Namhyung