diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2010-05-19 15:57:49 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-07-05 17:51:33 -0400 |
commit | b7dcb857cc3eb89136111fefe89780129c1af1d7 (patch) | |
tree | 21350796c508db4fb782f3e61eb63f62c3527f69 /tools/perf/util/probe-event.c | |
parent | b2a3c12b7442247c440f7083d48ef05716753ec1 (diff) |
perf probe: Support static and global variables
Add static and global variables support to perf probe.
This allows user to trace non-local variables (and
structure members) at probe points.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20100519195749.2885.17451.stgit@localhost6.localdomain6>
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r-- | tools/perf/util/probe-event.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 351baa9a3695..09cf5465e10a 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -926,6 +926,7 @@ out: | |||
926 | static int synthesize_kprobe_trace_arg(struct kprobe_trace_arg *arg, | 926 | static int synthesize_kprobe_trace_arg(struct kprobe_trace_arg *arg, |
927 | char *buf, size_t buflen) | 927 | char *buf, size_t buflen) |
928 | { | 928 | { |
929 | struct kprobe_trace_arg_ref *ref = arg->ref; | ||
929 | int ret, depth = 0; | 930 | int ret, depth = 0; |
930 | char *tmp = buf; | 931 | char *tmp = buf; |
931 | 932 | ||
@@ -939,16 +940,24 @@ static int synthesize_kprobe_trace_arg(struct kprobe_trace_arg *arg, | |||
939 | buf += ret; | 940 | buf += ret; |
940 | buflen -= ret; | 941 | buflen -= ret; |
941 | 942 | ||
943 | /* Special case: @XXX */ | ||
944 | if (arg->value[0] == '@' && arg->ref) | ||
945 | ref = ref->next; | ||
946 | |||
942 | /* Dereferencing arguments */ | 947 | /* Dereferencing arguments */ |
943 | if (arg->ref) { | 948 | if (ref) { |
944 | depth = __synthesize_kprobe_trace_arg_ref(arg->ref, &buf, | 949 | depth = __synthesize_kprobe_trace_arg_ref(ref, &buf, |
945 | &buflen, 1); | 950 | &buflen, 1); |
946 | if (depth < 0) | 951 | if (depth < 0) |
947 | return depth; | 952 | return depth; |
948 | } | 953 | } |
949 | 954 | ||
950 | /* Print argument value */ | 955 | /* Print argument value */ |
951 | ret = e_snprintf(buf, buflen, "%s", arg->value); | 956 | if (arg->value[0] == '@' && arg->ref) |
957 | ret = e_snprintf(buf, buflen, "%s%+ld", arg->value, | ||
958 | arg->ref->offset); | ||
959 | else | ||
960 | ret = e_snprintf(buf, buflen, "%s", arg->value); | ||
952 | if (ret < 0) | 961 | if (ret < 0) |
953 | return ret; | 962 | return ret; |
954 | buf += ret; | 963 | buf += ret; |