[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAM9d7chUNfAnLB-Hwry8M1d1Nb+YH3jf3ySmTZJoC0NYeqDAdA@mail.gmail.com>
Date: Mon, 20 Nov 2023 12:43:00 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-perf-users <linux-perf-users@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Stephane Eranian <eranian@...gle.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Linux Trace Devel <linux-trace-devel@...r.kernel.org>,
linux-toolchains@...r.kernel.org
Subject: Re: [PATCH 12/52] perf annotate-data: Add find_data_type()
Hi Arnaldo,
On Sat, Nov 11, 2023 at 10:55 AM Arnaldo Carvalho de Melo
<arnaldo.melo@...il.com> wrote:
>
> On Thu, Nov 9, 2023, 9:00 PM Namhyung Kim <namhyung@...nel.org> 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
Powered by blists - more mailing lists