aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/probe-event.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-04-30 03:58:05 -0400
committerIngo Molnar <mingo@elte.hu>2010-04-30 03:58:05 -0400
commitbc4b473f1aa2ef785ccfd890a24a1de5a6660f98 (patch)
tree77bbea692517ae4723b575631222bf715b4a1eb1 /tools/perf/util/probe-event.c
parent3ca50496c2677a2b3fdd3ede86660fd1433beac6 (diff)
parent1c6a800cde3b818fd8320b5d402f2d77d2948c00 (diff)
Merge branch 'perf' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/core
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r--tools/perf/util/probe-event.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 9ded38ced234..914c67095d96 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -72,8 +72,7 @@ static int e_snprintf(char *str, size_t size, const char *format, ...)
72} 72}
73 73
74static char *synthesize_perf_probe_point(struct perf_probe_point *pp); 74static char *synthesize_perf_probe_point(struct perf_probe_point *pp);
75static struct map_groups kmap_groups; 75static struct machine machine;
76static struct map *kmaps[MAP__NR_TYPES];
77 76
78/* Initialize symbol maps and path of vmlinux */ 77/* Initialize symbol maps and path of vmlinux */
79static int init_vmlinux(void) 78static int init_vmlinux(void)
@@ -92,12 +91,15 @@ static int init_vmlinux(void)
92 goto out; 91 goto out;
93 } 92 }
94 93
94 ret = machine__init(&machine, "/", 0);
95 if (ret < 0)
96 goto out;
97
95 kernel = dso__new_kernel(symbol_conf.vmlinux_name); 98 kernel = dso__new_kernel(symbol_conf.vmlinux_name);
96 if (kernel == NULL) 99 if (kernel == NULL)
97 die("Failed to create kernel dso."); 100 die("Failed to create kernel dso.");
98 101
99 map_groups__init(&kmap_groups); 102 ret = __machine__create_kernel_maps(&machine, kernel);
100 ret = __map_groups__create_kernel_maps(&kmap_groups, kmaps, kernel);
101 if (ret < 0) 103 if (ret < 0)
102 pr_debug("Failed to create kernel maps.\n"); 104 pr_debug("Failed to create kernel maps.\n");
103 105
@@ -110,12 +112,12 @@ out:
110#ifdef DWARF_SUPPORT 112#ifdef DWARF_SUPPORT
111static int open_vmlinux(void) 113static int open_vmlinux(void)
112{ 114{
113 if (map__load(kmaps[MAP__FUNCTION], NULL) < 0) { 115 if (map__load(machine.vmlinux_maps[MAP__FUNCTION], NULL) < 0) {
114 pr_debug("Failed to load kernel map.\n"); 116 pr_debug("Failed to load kernel map.\n");
115 return -EINVAL; 117 return -EINVAL;
116 } 118 }
117 pr_debug("Try to open %s\n", kmaps[MAP__FUNCTION]->dso->long_name); 119 pr_debug("Try to open %s\n", machine.vmlinux_maps[MAP__FUNCTION]->dso->long_name);
118 return open(kmaps[MAP__FUNCTION]->dso->long_name, O_RDONLY); 120 return open(machine.vmlinux_maps[MAP__FUNCTION]->dso->long_name, O_RDONLY);
119} 121}
120 122
121/* Convert trace point to probe point with debuginfo */ 123/* Convert trace point to probe point with debuginfo */
@@ -125,7 +127,7 @@ static int convert_to_perf_probe_point(struct kprobe_trace_point *tp,
125 struct symbol *sym; 127 struct symbol *sym;
126 int fd, ret = -ENOENT; 128 int fd, ret = -ENOENT;
127 129
128 sym = map__find_symbol_by_name(kmaps[MAP__FUNCTION], 130 sym = map__find_symbol_by_name(machine.vmlinux_maps[MAP__FUNCTION],
129 tp->symbol, NULL); 131 tp->symbol, NULL);
130 if (sym) { 132 if (sym) {
131 fd = open_vmlinux(); 133 fd = open_vmlinux();
@@ -1466,7 +1468,7 @@ static int convert_to_kprobe_trace_events(struct perf_probe_event *pev,
1466 } 1468 }
1467 1469
1468 /* Currently just checking function name from symbol map */ 1470 /* Currently just checking function name from symbol map */
1469 sym = map__find_symbol_by_name(kmaps[MAP__FUNCTION], 1471 sym = map__find_symbol_by_name(machine.vmlinux_maps[MAP__FUNCTION],
1470 tev->point.symbol, NULL); 1472 tev->point.symbol, NULL);
1471 if (!sym) { 1473 if (!sym) {
1472 pr_warning("Kernel symbol \'%s\' not found.\n", 1474 pr_warning("Kernel symbol \'%s\' not found.\n",