From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@redhat.com>,
Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 09/13] perf probe: Fix to show lines of sys_ functions correctly
Date: Wed, 12 Aug 2015 13:39:57 -0300 [thread overview]
Message-ID: <1439397601-26918-10-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1439397601-26918-1-git-send-email-acme@kernel.org>
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
"perf probe --lines sys_poll" shows only the first line of sys_poll,
because the SYSCALL_DEFINE macro:
----
SYSCALL_DEFINE*(foo,...)
{
body;
}
----
is expanded as below (on debuginfo)
----
static inline int SYSC_foo(...)
{
body;
}
int SyS_foo(...) <- is an alias of sys_foo.
{
return SYSC_foo(...);
}
----
So, "perf probe --lines sys_foo" decodes SyS_foo function and it also skips
inlined functions(SYSC_foo) inside the target function because those functions
are usually defined somewhere else.
To fix this issue, this fix checks whether the inlined function is defined at
the same point of the target function, and if so, it doesn't skip the inline
function.
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20150812012406.11811.94691.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dwarf-aux.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index 57f3ef41c2bc..445f455dd377 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -734,15 +734,18 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data)
Dwarf_Lines *lines;
Dwarf_Line *line;
Dwarf_Addr addr;
- const char *fname;
+ const char *fname, *decf = NULL;
int lineno, ret = 0;
+ int decl = 0, inl;
Dwarf_Die die_mem, *cu_die;
size_t nlines, i;
/* Get the CU die */
- if (dwarf_tag(rt_die) != DW_TAG_compile_unit)
+ if (dwarf_tag(rt_die) != DW_TAG_compile_unit) {
cu_die = dwarf_diecu(rt_die, &die_mem, NULL, NULL);
- else
+ dwarf_decl_line(rt_die, &decl);
+ decf = dwarf_decl_file(rt_die);
+ } else
cu_die = rt_die;
if (!cu_die) {
pr_debug2("Failed to get CU from given DIE.\n");
@@ -773,9 +776,14 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data)
* The line is included in given function, and
* no inline block includes it.
*/
- if (!dwarf_haspc(rt_die, addr) ||
- die_find_inlinefunc(rt_die, addr, &die_mem))
+ if (!dwarf_haspc(rt_die, addr))
continue;
+ if (die_find_inlinefunc(rt_die, addr, &die_mem)) {
+ dwarf_decl_line(&die_mem, &inl);
+ if (inl != decl ||
+ decf != dwarf_decl_file(&die_mem))
+ continue;
+ }
/* Get source line */
fname = dwarf_linesrc(line, NULL, NULL);
--
2.1.0
next prev parent reply other threads:[~2015-08-12 16:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 16:39 [GIT PULL 00/13] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-08-12 16:39 ` [PATCH 01/13] perf trace: Associate some more syscall args with the getname beautifier Arnaldo Carvalho de Melo
2015-08-12 16:39 ` [PATCH 02/13] perf trace: Add missing clockid entries Arnaldo Carvalho de Melo
2015-08-12 16:39 ` [PATCH 03/13] perf sort: Check for SRCLINE_UNKNOWN case in "srcfile" processing Arnaldo Carvalho de Melo
2015-08-12 16:39 ` [PATCH 04/13] perf trace: Use the FD beautifier for socket syscall fds Arnaldo Carvalho de Melo
2015-08-12 16:39 ` [PATCH 05/13] perf trace: Beautify keyctl's option arg Arnaldo Carvalho de Melo
2015-08-12 16:39 ` [PATCH 06/13] perf ui browser: Introduce ui_browser__write_nstring() Arnaldo Carvalho de Melo
2015-08-12 16:39 ` [PATCH 07/13] perf ui browser: Introduce ui_browser__printf() Arnaldo Carvalho de Melo
2015-08-12 16:39 ` [PATCH 08/13] perf hists browser: Make ESC unzoom as well Arnaldo Carvalho de Melo
2015-08-12 16:39 ` Arnaldo Carvalho de Melo [this message]
2015-08-12 16:39 ` [PATCH 10/13] perf callchain: Per-event type selection support Arnaldo Carvalho de Melo
2015-08-12 16:39 ` [PATCH 11/13] perf callchain: Allow disabling call graphs per event Arnaldo Carvalho de Melo
2015-08-12 16:40 ` [PATCH 12/13] perf report: Show call graph from reference events Arnaldo Carvalho de Melo
2015-08-12 16:40 ` [PATCH 13/13] perf tests: Add tests to callgraph and time parse Arnaldo Carvalho de Melo
2015-08-13 7:25 ` [GIT PULL 00/13] perf/core improvements and fixes Ingo Molnar
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=1439397601-26918-10-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@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 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).