linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
To: Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf srcline: Implement addr2line using libdw
Date: Thu, 4 Apr 2024 21:09:51 -0300	[thread overview]
Message-ID: <3485d1b1-7824-4e62-82b4-ed52360122dd@gmail.com> (raw)
In-Reply-To: <CAM9d7cjgfQpo6dgV4f5Wm4shVpknzP4_m36AkTwaUaF4jLrV1w@mail.gmail.com>

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?

> [...]

  reply	other threads:[~2024-04-05  0:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-01 16:08 [PATCH] perf srcline: Implement addr2line using libdw Martin Rodriguez Reboredo
2024-04-01 16:56 ` Ian Rogers
2024-04-01 23:31   ` Namhyung Kim
2024-04-05  0:09     ` Martin Rodriguez Reboredo [this message]
2024-04-09 17:02       ` Namhyung Kim
2024-04-04 23:53   ` Martin Rodriguez Reboredo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3485d1b1-7824-4e62-82b4-ed52360122dd@gmail.com \
    --to=yakoyoku@gmail.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).