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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 29 Nov 2017 10:19:59 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Andi Kleen <andi@...stfloor.org>
Cc:     acme@...nel.org, jolsa@...nel.org, mhiramat@...nel.org,
        adrian.hunter@...el.com, linux-kernel@...r.kernel.org,
        Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 05/12] perf, tools, probe: Print location for resolved
 variables

On Mon, 27 Nov 2017 16:23:14 -0800
Andi Kleen <andi@...stfloor.org> wrote:

> From: Andi Kleen <ak@...ux.intel.com>
> 
> Print the location, e.g. the register, for resolved variables
> with perf probe -V. This is useful for debugging, and manually
> making sense of disassembly. I also have some scripts
> which can make use of this information.
> 
> Before:
> 
> % perf probe  -x  ./tsrc/tstruct  -V  main+20
> Available variables at main+20
>         @<main+20>
>                 struct str*     xp
> 
> After:
> 
> % perf probe  -x  ./tsrc/tstruct  -V  main+20
> Available variables at main+20
>         @<main+20>
>                 struct str*     xp      %ax
> 

Sounds good :)
For clearly separating it from variable name,
I would like to see as below;

 % perf probe  -x  ./tsrc/tstruct  -V  main+20
 Available variables at main+20
         @<main+20>
                 struct str*     xp      // %ax


Thank you,

> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> ---
>  tools/perf/util/probe-finder.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 0149428d453e..699f29d8a28e 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -1369,6 +1369,7 @@ static int collect_variables_cb(Dwarf_Die *die_mem, void *data)
>  	if (tag == DW_TAG_formal_parameter ||
>  	    tag == DW_TAG_variable) {
>  		struct probe_trace_arg ta;
> +		struct probe_trace_arg_ref *ref;
>  
>  		memset(&ta, 0, sizeof(struct probe_trace_arg));
>  		ret = convert_variable_location(die_mem, af->pf.addr,
> @@ -1401,6 +1402,10 @@ static int collect_variables_cb(Dwarf_Die *die_mem, void *data)
>  							die_mem, &buf);
>  			}
>  
> +			strbuf_addf(&buf, "\t%s", ta.value);
> +			for (ref = ta.ref; ref; ref = ref->next)
> +				strbuf_addf(&buf, " off %ld", ref->offset);
> +
>  			pr_debug("Add new var: %s\n", buf.buf);
>  			if (ret2 == 0) {
>  				struct str_node *sn;
> -- 
> 2.13.6
> 


-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ