lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM9d7chCGcPQrHbpX0aDWy127a=RG5uFRpVBQ4Lc+jYgRy5uLQ@mail.gmail.com>
Date: Tue, 9 Apr 2024 10:02:03 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Martin Rodriguez Reboredo <yakoyoku@...il.com>
Cc: Ian Rogers <irogers@...gle.com>, Peter Zijlstra <peterz@...radead.org>, 
	Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo <acme@...nel.org>, Mark Rutland <mark.rutland@....com>, 
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, 
	Adrian Hunter <adrian.hunter@...el.com>, linux-perf-users@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf srcline: Implement addr2line using libdw

Hello,

On Thu, Apr 4, 2024 at 5:10 PM Martin Rodriguez Reboredo
<yakoyoku@...il.com> wrote:
>
> On 4/1/24 8:31 PM, Namhyung Kim wrote:
> > [...]
> >
> > Thanks for doing this!  Yep, we could unset the env temporarily.
> >
> > As a general comment, perf has some helper functions for libdw
> > in util/dwarf-aux.[ch].  Please take a look and use/update them.
>
> Whoops! I haven't seen that file, thanks for mentioning it.
>
> > [...]
> >
> > Probably we can use cu_find_lineinfo().
>
> I could use that, I'll see.
>
> > [...]
> >
> >>> +static struct a2l_data *addr2line_init(const char *path)
> >
> > debuginfo__new()?
>
> `libdw_a2l_new` can be another option too.
>
> > [...]
> >
> >>> +static int get_inline_function(struct dso *dso, struct inline_node *node,
> >>> +                              struct symbol *sym)
> >>> +{
> >>> +       struct a2l_data *a2l = dso->a2l;
> >>> +       Dwarf_Addr addr = a2l->addr + a2l->bias;
> >>> +       Dwarf_Addr bias = 0;
> >>> +       Dwarf_Die *cudie = dwfl_module_addrdie(a2l->mod, addr, &bias);
> >>> +
> >>> +       Dwarf_Die *scopes = NULL;
> >>> +       int nscopes = dwarf_getscopes(cudie, addr - bias, &scopes);
> >
> > It's not clear to me how this dwarf_getscopes() and later
> > dwarf_getscopes_die() work together.  Can you please add some
> > comment?  Also we have die_get_scopes() and I think it's simpler.
>
> I think the first is to get the scopes at an address and the second is
> for the scopes with the addr offset at that DIE. Off the top of my head.
>
> > [...]
> >
> > Why not get the function name from the abstract origin?
>
> I'm not getting it, where's that abstract origin?

IIUC DW_TAG_inlined_subroutine has DW_AT_abstract_origin
to point to the original definition of the function.  It should have
the name of the function.

 <2><5ca8>: Abbrev Number: 40 (DW_TAG_inlined_subroutine)
    <5ca9>   DW_AT_abstract_origin: <0x5eeb>
    <5cad>   DW_AT_low_pc      : 0x24efc6
    <5cb5>   DW_AT_high_pc     : 0x2d
    <5cbd>   DW_AT_call_file   : 3
    <5cbe>   DW_AT_call_line   : 135
    <5cbf>   DW_AT_call_column : 9

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ