lkml.org 
[lkml]   [2017]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 05/12] perf, tools, probe: Print location for resolved variables
Date
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

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
\
 
 \ /
  Last update: 2017-11-28 01:26    [W:0.126 / U:21.756 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site