Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1206083

Re: [BUGFIX PATCH perf/core ] perf-probe: Fix to show lines of sys_ functions correctly

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [BUGFIX PATCH perf/core ] perf-probe: Fix to show lines of sys_ functions correctly
Date 2015-08-12 15:30 +0200
Message-ID <pWEgq-5DF-7@gated-at.bofh.it> (permalink)
References <pWsoW-4OY-5@gated-at.bofh.it> <pWt1E-5Oa-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Wed, Aug 12, 2015 at 10:24:07AM +0900, Masami Hiramatsu escreveu:
> "perf probe --lines sys_poll" shows only the first line of
> sys_poll, because the SYSCALL_DEFINE macro
> ----

Thanks! Just try prefixing those ---- lines one space so that git-am
works on your messages :-)

Now to build and test, will report here the results.

Thanks again,

- Arnaldo

> 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>
> ---
>  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 57f3ef4..445f455 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);
>  
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

perf probe -L sys_select or sys_poll Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-11 16:20 +0200
  RE: perf probe -L sys_select or sys_poll 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-08-12 01:00 +0200
  RE: perf probe -L sys_select or sys_poll 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-08-12 02:50 +0200
    [BUGFIX PATCH perf/core ] perf-probe: Fix to show lines of sys_  functions correctly Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-08-12 03:30 +0200
      Re: [BUGFIX PATCH perf/core ] perf-probe: Fix to show lines of sys_  functions correctly Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-12 15:30 +0200
        Re: [BUGFIX PATCH perf/core ] perf-probe: Fix to show lines of sys_  functions correctly Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-12 15:50 +0200
          Re: [BUGFIX PATCH perf/core ] perf-probe: Fix to show lines of sys_  functions correctly 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-08-12 23:40 +0200
      [tip:perf/core] perf probe:   Fix to show lines of sys_ functions correctly tip-bot for Masami Hiramatsu <tipbot@zytor.com> - 2015-08-13 10:10 +0200

csiph-web