diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2011-08-11 15:03:05 +0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-08-12 16:29:34 +0400 |
commit | f182e3e13ca71b64b40fab1aef31fa6a78271648 (patch) | |
tree | 6432a921ffc434d475093dca76bca745f9bc10b9 /tools/perf/builtin-timechart.c | |
parent | 221d061182b8ff5507d5768aeeecbc74f01c5dfa (diff) | |
download | linux-f182e3e13ca71b64b40fab1aef31fa6a78271648.tar.xz |
perf probe: Avoid searching variables in intermediate scopes
Fix variable searching logic to search one in inner than local scope or
global(CU) scope. In the other words, skip searching in intermediate
scopes.
e.g., in the following code,
int var1;
void inline infunc(int i)
{
i++; <--- [A]
}
void func(void)
{
int var1, var2;
infunc(var2);
}
At [A], "var1" should point the global variable "var1", however, if user
mis-typed as "var2", variable search should be failed. However, current
logic searches variable infunc() scope, global scope, and then func()
scope. Thus, it can find "var2" variable in func() scope. This may not
be what user expects.
So, it would better not search outer scopes except outermost (compile
unit) scope which contains only global variables, when it failed to find
given variable in local scope.
E.g.
Without this:
$ perf probe -V pre_schedule --externs > without.vars
With this:
$ perf probe -V pre_schedule --externs > with.vars
Check the diff:
$ diff without.vars with.vars
88d87
< int cpu
133d131
< long unsigned int* switch_count
These vars are actually in the scope of schedule(), the caller of
pre_schedule().
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20110811110305.19900.94374.stgit@fedora15
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-timechart.c')
0 files changed, 0 insertions, 0 deletions