Commit 367e94c10092469c896a226a77ef13cf6da757e4

Authored by Masami Hiramatsu
Committed by Arnaldo Carvalho de Melo
1 parent 04ddd04b04

perf probe: Fix handling of arguments names

Don't make argument names from raw parameters (means the parameters are written
in kprobe-tracer syntax), because the argument syntax may include special
characters.  Just leave it, then kprobe-tracer gives a new name.

Reported-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20100827113859.22882.75598.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Showing 1 changed file with 19 additions and 13 deletions Side-by-side Diff

tools/perf/util/probe-finder.c
... ... @@ -686,6 +686,25 @@
686 686 char buf[32], *ptr;
687 687 int ret, nscopes;
688 688  
  689 + if (!is_c_varname(pf->pvar->var)) {
  690 + /* Copy raw parameters */
  691 + pf->tvar->value = strdup(pf->pvar->var);
  692 + if (pf->tvar->value == NULL)
  693 + return -ENOMEM;
  694 + if (pf->pvar->type) {
  695 + pf->tvar->type = strdup(pf->pvar->type);
  696 + if (pf->tvar->type == NULL)
  697 + return -ENOMEM;
  698 + }
  699 + if (pf->pvar->name) {
  700 + pf->tvar->name = strdup(pf->pvar->name);
  701 + if (pf->tvar->name == NULL)
  702 + return -ENOMEM;
  703 + } else
  704 + pf->tvar->name = NULL;
  705 + return 0;
  706 + }
  707 +
689 708 if (pf->pvar->name)
690 709 pf->tvar->name = strdup(pf->pvar->name);
691 710 else {
... ... @@ -699,19 +718,6 @@
699 718 }
700 719 if (pf->tvar->name == NULL)
701 720 return -ENOMEM;
702   -
703   - if (!is_c_varname(pf->pvar->var)) {
704   - /* Copy raw parameters */
705   - pf->tvar->value = strdup(pf->pvar->var);
706   - if (pf->tvar->value == NULL)
707   - return -ENOMEM;
708   - if (pf->pvar->type) {
709   - pf->tvar->type = strdup(pf->pvar->type);
710   - if (pf->tvar->type == NULL)
711   - return -ENOMEM;
712   - }
713   - return 0;
714   - }
715 721  
716 722 pr_debug("Searching '%s' variable in context.\n",
717 723 pf->pvar->var);