Messages in this thread Patch in this message | | | Date | Wed, 29 Nov 2017 10:19:59 +0900 | From | Masami Hiramatsu <> | 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@firstfloor.org> wrote:
> From: Andi Kleen <ak@linux.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@linux.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@kernel.org>
| |