From: Masami Hiramatsu <mhiramat@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [BUGFIX PATCH V2 4/6] perf/probe: Fix to list probe event with correct line number
Date: Sat, 26 Oct 2019 18:00:55 +0900 [thread overview]
Message-ID: <157208045549.16551.8525171850902896682.stgit@devnote2> (raw)
In-Reply-To: <157208041894.16551.2733647209130045685.stgit@devnote2>
Since debuginfo__find_probe_point() uses dwarf_entrypc() for
finding the entry address of the function on which a probe is,
it will fail when the function DIE has only ranges attribute.
To fix this issue, use die_entrypc() instead of dwarf_entrypc().
Without this fix, perf probe -l shows incorrect offset.
# perf probe --force -a clear_tasks_mm_cpumask:0 clear_tasks_mm_cpumask:21
Added new events:
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask)
probe:clear_tasks_mm_cpumask_1 (on clear_tasks_mm_cpumask:21)
You can now use it in all perf tools, such as:
perf record -e probe:clear_tasks_mm_cpumask_1 -aR sleep 1
# perf probe -l
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask+18446744071579478000@linux-5.0.0/kernel/cpu.c)
probe:clear_tasks_mm_cpumask_1 (on clear_tasks_mm_cpumask+18446744071579478067@linux-5.0.0/kernel/cpu.c)
With this,
# perf probe -l
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask@linux-5.0.0/kernel/cpu.c)
probe:clear_tasks_mm_cpumask_1 (on clear_tasks_mm_cpumask:21@linux-5.0.0/kernel/cpu.c)
Fixes: 1d46ea2a6a40 ("perf probe: Fix listing incorrect line number with inline function")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
tools/perf/util/probe-finder.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 2fa932bcf960..88e17a4f5ac3 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1566,7 +1566,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr,
/* Get function entry information */
func = basefunc = dwarf_diename(&spdie);
if (!func ||
- dwarf_entrypc(&spdie, &baseaddr) != 0 ||
+ die_entrypc(&spdie, &baseaddr) != 0 ||
dwarf_decl_line(&spdie, &baseline) != 0) {
lineno = 0;
goto post;
@@ -1583,7 +1583,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr,
while (die_find_top_inlinefunc(&spdie, (Dwarf_Addr)addr,
&indie)) {
/* There is an inline function */
- if (dwarf_entrypc(&indie, &_addr) == 0 &&
+ if (die_entrypc(&indie, &_addr) == 0 &&
_addr == addr) {
/*
* addr is at an inline function entry.
next prev parent reply other threads:[~2019-10-26 9:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-26 9:00 [BUGFIX PATCH V2 0/6] perf/probe: Additional fixes for range only functions Masami Hiramatsu
2019-10-26 9:00 ` [BUGFIX PATCH V2 1/6] perf/probe: Fix wrong address verification Masami Hiramatsu
2019-10-26 9:00 ` [BUGFIX PATCH V2 2/6] perf/probe: Fix to probe a function which has no entry pc Masami Hiramatsu
2019-10-26 9:00 ` [BUGFIX PATCH V2 3/6] perf/probe: Fix to probe an inline " Masami Hiramatsu
2019-10-26 9:00 ` Masami Hiramatsu [this message]
2019-10-26 9:01 ` [BUGFIX PATCH V2 5/6] perf/probe: Fix to show inlined function callsite without entry_pc Masami Hiramatsu
2019-10-26 9:01 ` [BUGFIX PATCH V2 6/6] perf/probe: Fix to show ranges of variables in functions " Masami Hiramatsu
2019-10-28 14:16 ` [BUGFIX PATCH V2 0/6] perf/probe: Additional fixes for range only functions Arnaldo Carvalho de Melo
2019-10-28 14:53 ` Masami Hiramatsu
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=157208045549.16551.8525171850902896682.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.