diff options
author | He Kuang <hekuang@huawei.com> | 2015-05-11 12:25:02 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-05-12 15:59:49 +0300 |
commit | fb9596d1731cc37da6489de439f8b876f3a12db2 (patch) | |
tree | 56cab9e7550431c1c5a2ef24aeaa37f87da1d628 /tools/perf/util/probe-finder.c | |
parent | ff8f695c0ec9d73d8a9f92fe634d6476ad74e3a1 (diff) | |
download | linux-fb9596d1731cc37da6489de439f8b876f3a12db2.tar.xz |
perf probe: Remove length limitation for showing available variables
Use struct strbuf instead of bare char[] to remove the length limitation
of variables in variable_list, so they will not disappear due to
overlength, and make preparation for adding more description for
variables.
Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1431336304-16863-1-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/probe-finder.c')
-rw-r--r-- | tools/perf/util/probe-finder.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 8b9e274f940c..d7c2e90ab4ce 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1255,14 +1255,11 @@ int debuginfo__find_trace_events(struct debuginfo *dbg, return (ret < 0) ? ret : tf.ntevs; } -#define MAX_VAR_LEN 64 - /* Collect available variables in this scope */ static int collect_variables_cb(Dwarf_Die *die_mem, void *data) { struct available_var_finder *af = data; struct variable_list *vl; - char buf[MAX_VAR_LEN]; int tag, ret; vl = &af->vls[af->nvls - 1]; @@ -1274,10 +1271,16 @@ static int collect_variables_cb(Dwarf_Die *die_mem, void *data) af->pf.fb_ops, &af->pf.sp_die, NULL); if (ret == 0) { - ret = die_get_varname(die_mem, buf, MAX_VAR_LEN); - pr_debug2("Add new var: %s\n", buf); - if (ret > 0) - strlist__add(vl->vars, buf); + struct strbuf buf; + + strbuf_init(&buf, 64); + ret = die_get_varname(die_mem, &buf); + pr_debug2("Add new var: %s\n", buf.buf); + if (ret == 0) { + strlist__add(vl->vars, + strbuf_detach(&buf, NULL)); + } + strbuf_release(&buf); } } |