aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>2011-03-30 05:25:41 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-04-05 14:34:53 -0400
commit7d21635ac5c78abe162fb3f56b37c30bcbfa019f (patch)
treed7c63e666d8df20ac395b557f738b37ac33764e3 /tools/perf
parentfd1edb3aa2c1d92618d8f0c6d15d44ea41fcac6a (diff)
perf probe: Fix to ensure function declared file
Fix to ensure function declared file matches given file name. This fixes a potential bug. As I've commented on Lin Ming's fastpath enhancement, decl_file should be checked on each probe point if user gives a probe point as func@file. Cc: 2nddept-manager@sdl.hitachi.co.jp Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Lin Ming <ming.m.lin@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <20110330092541.2132.3584.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>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/probe-finder.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 194f9e2a3285..3bcd140b4545 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1395,6 +1395,10 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data)
1395 !die_compare_name(sp_die, pp->function)) 1395 !die_compare_name(sp_die, pp->function))
1396 return DWARF_CB_OK; 1396 return DWARF_CB_OK;
1397 1397
1398 /* Check declared file */
1399 if (pp->file && strtailcmp(pp->file, dwarf_decl_file(sp_die)))
1400 return DWARF_CB_OK;
1401
1398 pf->fname = dwarf_decl_file(sp_die); 1402 pf->fname = dwarf_decl_file(sp_die);
1399 if (pp->line) { /* Function relative line */ 1403 if (pp->line) { /* Function relative line */
1400 dwarf_decl_line(sp_die, &pf->lno); 1404 dwarf_decl_line(sp_die, &pf->lno);
@@ -1840,6 +1844,10 @@ static int line_range_search_cb(Dwarf_Die *sp_die, void *data)
1840 struct line_finder *lf = param->data; 1844 struct line_finder *lf = param->data;
1841 struct line_range *lr = lf->lr; 1845 struct line_range *lr = lf->lr;
1842 1846
1847 /* Check declared file */
1848 if (lr->file && strtailcmp(lr->file, dwarf_decl_file(sp_die)))
1849 return DWARF_CB_OK;
1850
1843 if (dwarf_tag(sp_die) == DW_TAG_subprogram && 1851 if (dwarf_tag(sp_die) == DW_TAG_subprogram &&
1844 die_compare_name(sp_die, lr->function)) { 1852 die_compare_name(sp_die, lr->function)) {
1845 lf->fname = dwarf_decl_file(sp_die); 1853 lf->fname = dwarf_decl_file(sp_die);