diff options
author | Srikar Dronamraju <srikar@linux.vnet.ibm.com> | 2010-07-29 10:13:51 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-07-30 11:01:38 -0400 |
commit | 0e60836bbd392300198c5c2d918c18845428a1fe (patch) | |
tree | 80a2882bbae70e6f0679933bb44472fbcfb88993 /tools/perf/util/probe-event.c | |
parent | 73ae8f85fda49410a59d7b532ce69a0b811ef6d5 (diff) |
perf probe: Rename common fields/functions from kprobe to probe.
As a precursor for perf to support uprobes, rename fields/functions
that had kprobe in their name but can be shared across perf-kprobes
and perf-uprobes to probe.
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: "Frank Ch. Eigler" <fche@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jim Keniston <jkenisto@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mark Wielaard <mjw@redhat.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Naren A Devaiah <naren.devaiah@in.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <20100729141351.GG21723@linux.vnet.ibm.com>
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r-- | tools/perf/util/probe-event.c | 135 |
1 files changed, 69 insertions, 66 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 4445a1e7052f..2e665cb84055 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * probe-event.c : perf-probe definition to kprobe_events format converter | 2 | * probe-event.c : perf-probe definition to probe_events format converter |
3 | * | 3 | * |
4 | * Written by Masami Hiramatsu <mhiramat@redhat.com> | 4 | * Written by Masami Hiramatsu <mhiramat@redhat.com> |
5 | * | 5 | * |
@@ -120,8 +120,11 @@ static int open_vmlinux(void) | |||
120 | return open(machine.vmlinux_maps[MAP__FUNCTION]->dso->long_name, O_RDONLY); | 120 | return open(machine.vmlinux_maps[MAP__FUNCTION]->dso->long_name, O_RDONLY); |
121 | } | 121 | } |
122 | 122 | ||
123 | /* Convert trace point to probe point with debuginfo */ | 123 | /* |
124 | static int convert_to_perf_probe_point(struct kprobe_trace_point *tp, | 124 | * Convert trace point to probe point with debuginfo |
125 | * Currently only handles kprobes. | ||
126 | */ | ||
127 | static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp, | ||
125 | struct perf_probe_point *pp) | 128 | struct perf_probe_point *pp) |
126 | { | 129 | { |
127 | struct symbol *sym; | 130 | struct symbol *sym; |
@@ -151,8 +154,8 @@ static int convert_to_perf_probe_point(struct kprobe_trace_point *tp, | |||
151 | } | 154 | } |
152 | 155 | ||
153 | /* Try to find perf_probe_event with debuginfo */ | 156 | /* Try to find perf_probe_event with debuginfo */ |
154 | static int try_to_find_kprobe_trace_events(struct perf_probe_event *pev, | 157 | static int try_to_find_probe_trace_events(struct perf_probe_event *pev, |
155 | struct kprobe_trace_event **tevs, | 158 | struct probe_trace_event **tevs, |
156 | int max_tevs) | 159 | int max_tevs) |
157 | { | 160 | { |
158 | bool need_dwarf = perf_probe_event_need_dwarf(pev); | 161 | bool need_dwarf = perf_probe_event_need_dwarf(pev); |
@@ -169,11 +172,11 @@ static int try_to_find_kprobe_trace_events(struct perf_probe_event *pev, | |||
169 | } | 172 | } |
170 | 173 | ||
171 | /* Searching trace events corresponding to probe event */ | 174 | /* Searching trace events corresponding to probe event */ |
172 | ntevs = find_kprobe_trace_events(fd, pev, tevs, max_tevs); | 175 | ntevs = find_probe_trace_events(fd, pev, tevs, max_tevs); |
173 | close(fd); | 176 | close(fd); |
174 | 177 | ||
175 | if (ntevs > 0) { /* Succeeded to find trace events */ | 178 | if (ntevs > 0) { /* Succeeded to find trace events */ |
176 | pr_debug("find %d kprobe_trace_events.\n", ntevs); | 179 | pr_debug("find %d probe_trace_events.\n", ntevs); |
177 | return ntevs; | 180 | return ntevs; |
178 | } | 181 | } |
179 | 182 | ||
@@ -377,8 +380,8 @@ end: | |||
377 | 380 | ||
378 | #else /* !DWARF_SUPPORT */ | 381 | #else /* !DWARF_SUPPORT */ |
379 | 382 | ||
380 | static int convert_to_perf_probe_point(struct kprobe_trace_point *tp, | 383 | static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp, |
381 | struct perf_probe_point *pp) | 384 | struct perf_probe_point *pp) |
382 | { | 385 | { |
383 | pp->function = strdup(tp->symbol); | 386 | pp->function = strdup(tp->symbol); |
384 | if (pp->function == NULL) | 387 | if (pp->function == NULL) |
@@ -389,8 +392,8 @@ static int convert_to_perf_probe_point(struct kprobe_trace_point *tp, | |||
389 | return 0; | 392 | return 0; |
390 | } | 393 | } |
391 | 394 | ||
392 | static int try_to_find_kprobe_trace_events(struct perf_probe_event *pev, | 395 | static int try_to_find_probe_trace_events(struct perf_probe_event *pev, |
393 | struct kprobe_trace_event **tevs __unused, | 396 | struct probe_trace_event **tevs __unused, |
394 | int max_tevs __unused) | 397 | int max_tevs __unused) |
395 | { | 398 | { |
396 | if (perf_probe_event_need_dwarf(pev)) { | 399 | if (perf_probe_event_need_dwarf(pev)) { |
@@ -781,16 +784,17 @@ bool perf_probe_event_need_dwarf(struct perf_probe_event *pev) | |||
781 | return false; | 784 | return false; |
782 | } | 785 | } |
783 | 786 | ||
784 | /* Parse kprobe_events event into struct probe_point */ | 787 | /* Parse probe_events event into struct probe_point */ |
785 | int parse_kprobe_trace_command(const char *cmd, struct kprobe_trace_event *tev) | 788 | static int parse_probe_trace_command(const char *cmd, |
789 | struct probe_trace_event *tev) | ||
786 | { | 790 | { |
787 | struct kprobe_trace_point *tp = &tev->point; | 791 | struct probe_trace_point *tp = &tev->point; |
788 | char pr; | 792 | char pr; |
789 | char *p; | 793 | char *p; |
790 | int ret, i, argc; | 794 | int ret, i, argc; |
791 | char **argv; | 795 | char **argv; |
792 | 796 | ||
793 | pr_debug("Parsing kprobe_events: %s\n", cmd); | 797 | pr_debug("Parsing probe_events: %s\n", cmd); |
794 | argv = argv_split(cmd, &argc); | 798 | argv = argv_split(cmd, &argc); |
795 | if (!argv) { | 799 | if (!argv) { |
796 | pr_debug("Failed to split arguments.\n"); | 800 | pr_debug("Failed to split arguments.\n"); |
@@ -822,7 +826,7 @@ int parse_kprobe_trace_command(const char *cmd, struct kprobe_trace_event *tev) | |||
822 | tp->offset = 0; | 826 | tp->offset = 0; |
823 | 827 | ||
824 | tev->nargs = argc - 2; | 828 | tev->nargs = argc - 2; |
825 | tev->args = zalloc(sizeof(struct kprobe_trace_arg) * tev->nargs); | 829 | tev->args = zalloc(sizeof(struct probe_trace_arg) * tev->nargs); |
826 | if (tev->args == NULL) { | 830 | if (tev->args == NULL) { |
827 | ret = -ENOMEM; | 831 | ret = -ENOMEM; |
828 | goto out; | 832 | goto out; |
@@ -968,13 +972,13 @@ char *synthesize_perf_probe_command(struct perf_probe_event *pev) | |||
968 | } | 972 | } |
969 | #endif | 973 | #endif |
970 | 974 | ||
971 | static int __synthesize_kprobe_trace_arg_ref(struct kprobe_trace_arg_ref *ref, | 975 | static int __synthesize_probe_trace_arg_ref(struct probe_trace_arg_ref *ref, |
972 | char **buf, size_t *buflen, | 976 | char **buf, size_t *buflen, |
973 | int depth) | 977 | int depth) |
974 | { | 978 | { |
975 | int ret; | 979 | int ret; |
976 | if (ref->next) { | 980 | if (ref->next) { |
977 | depth = __synthesize_kprobe_trace_arg_ref(ref->next, buf, | 981 | depth = __synthesize_probe_trace_arg_ref(ref->next, buf, |
978 | buflen, depth + 1); | 982 | buflen, depth + 1); |
979 | if (depth < 0) | 983 | if (depth < 0) |
980 | goto out; | 984 | goto out; |
@@ -992,10 +996,10 @@ out: | |||
992 | 996 | ||
993 | } | 997 | } |
994 | 998 | ||
995 | static int synthesize_kprobe_trace_arg(struct kprobe_trace_arg *arg, | 999 | static int synthesize_probe_trace_arg(struct probe_trace_arg *arg, |
996 | char *buf, size_t buflen) | 1000 | char *buf, size_t buflen) |
997 | { | 1001 | { |
998 | struct kprobe_trace_arg_ref *ref = arg->ref; | 1002 | struct probe_trace_arg_ref *ref = arg->ref; |
999 | int ret, depth = 0; | 1003 | int ret, depth = 0; |
1000 | char *tmp = buf; | 1004 | char *tmp = buf; |
1001 | 1005 | ||
@@ -1015,7 +1019,7 @@ static int synthesize_kprobe_trace_arg(struct kprobe_trace_arg *arg, | |||
1015 | 1019 | ||
1016 | /* Dereferencing arguments */ | 1020 | /* Dereferencing arguments */ |
1017 | if (ref) { | 1021 | if (ref) { |
1018 | depth = __synthesize_kprobe_trace_arg_ref(ref, &buf, | 1022 | depth = __synthesize_probe_trace_arg_ref(ref, &buf, |
1019 | &buflen, 1); | 1023 | &buflen, 1); |
1020 | if (depth < 0) | 1024 | if (depth < 0) |
1021 | return depth; | 1025 | return depth; |
@@ -1051,9 +1055,9 @@ static int synthesize_kprobe_trace_arg(struct kprobe_trace_arg *arg, | |||
1051 | return buf - tmp; | 1055 | return buf - tmp; |
1052 | } | 1056 | } |
1053 | 1057 | ||
1054 | char *synthesize_kprobe_trace_command(struct kprobe_trace_event *tev) | 1058 | char *synthesize_probe_trace_command(struct probe_trace_event *tev) |
1055 | { | 1059 | { |
1056 | struct kprobe_trace_point *tp = &tev->point; | 1060 | struct probe_trace_point *tp = &tev->point; |
1057 | char *buf; | 1061 | char *buf; |
1058 | int i, len, ret; | 1062 | int i, len, ret; |
1059 | 1063 | ||
@@ -1069,7 +1073,7 @@ char *synthesize_kprobe_trace_command(struct kprobe_trace_event *tev) | |||
1069 | goto error; | 1073 | goto error; |
1070 | 1074 | ||
1071 | for (i = 0; i < tev->nargs; i++) { | 1075 | for (i = 0; i < tev->nargs; i++) { |
1072 | ret = synthesize_kprobe_trace_arg(&tev->args[i], buf + len, | 1076 | ret = synthesize_probe_trace_arg(&tev->args[i], buf + len, |
1073 | MAX_CMDLEN - len); | 1077 | MAX_CMDLEN - len); |
1074 | if (ret <= 0) | 1078 | if (ret <= 0) |
1075 | goto error; | 1079 | goto error; |
@@ -1082,7 +1086,7 @@ error: | |||
1082 | return NULL; | 1086 | return NULL; |
1083 | } | 1087 | } |
1084 | 1088 | ||
1085 | int convert_to_perf_probe_event(struct kprobe_trace_event *tev, | 1089 | static int convert_to_perf_probe_event(struct probe_trace_event *tev, |
1086 | struct perf_probe_event *pev) | 1090 | struct perf_probe_event *pev) |
1087 | { | 1091 | { |
1088 | char buf[64] = ""; | 1092 | char buf[64] = ""; |
@@ -1095,7 +1099,7 @@ int convert_to_perf_probe_event(struct kprobe_trace_event *tev, | |||
1095 | return -ENOMEM; | 1099 | return -ENOMEM; |
1096 | 1100 | ||
1097 | /* Convert trace_point to probe_point */ | 1101 | /* Convert trace_point to probe_point */ |
1098 | ret = convert_to_perf_probe_point(&tev->point, &pev->point); | 1102 | ret = kprobe_convert_to_perf_probe(&tev->point, &pev->point); |
1099 | if (ret < 0) | 1103 | if (ret < 0) |
1100 | return ret; | 1104 | return ret; |
1101 | 1105 | ||
@@ -1108,7 +1112,7 @@ int convert_to_perf_probe_event(struct kprobe_trace_event *tev, | |||
1108 | if (tev->args[i].name) | 1112 | if (tev->args[i].name) |
1109 | pev->args[i].name = strdup(tev->args[i].name); | 1113 | pev->args[i].name = strdup(tev->args[i].name); |
1110 | else { | 1114 | else { |
1111 | ret = synthesize_kprobe_trace_arg(&tev->args[i], | 1115 | ret = synthesize_probe_trace_arg(&tev->args[i], |
1112 | buf, 64); | 1116 | buf, 64); |
1113 | pev->args[i].name = strdup(buf); | 1117 | pev->args[i].name = strdup(buf); |
1114 | } | 1118 | } |
@@ -1159,9 +1163,9 @@ void clear_perf_probe_event(struct perf_probe_event *pev) | |||
1159 | memset(pev, 0, sizeof(*pev)); | 1163 | memset(pev, 0, sizeof(*pev)); |
1160 | } | 1164 | } |
1161 | 1165 | ||
1162 | void clear_kprobe_trace_event(struct kprobe_trace_event *tev) | 1166 | static void clear_probe_trace_event(struct probe_trace_event *tev) |
1163 | { | 1167 | { |
1164 | struct kprobe_trace_arg_ref *ref, *next; | 1168 | struct probe_trace_arg_ref *ref, *next; |
1165 | int i; | 1169 | int i; |
1166 | 1170 | ||
1167 | if (tev->event) | 1171 | if (tev->event) |
@@ -1222,7 +1226,7 @@ static int open_kprobe_events(bool readwrite) | |||
1222 | } | 1226 | } |
1223 | 1227 | ||
1224 | /* Get raw string list of current kprobe_events */ | 1228 | /* Get raw string list of current kprobe_events */ |
1225 | static struct strlist *get_kprobe_trace_command_rawlist(int fd) | 1229 | static struct strlist *get_probe_trace_command_rawlist(int fd) |
1226 | { | 1230 | { |
1227 | int ret, idx; | 1231 | int ret, idx; |
1228 | FILE *fp; | 1232 | FILE *fp; |
@@ -1290,7 +1294,7 @@ static int show_perf_probe_event(struct perf_probe_event *pev) | |||
1290 | int show_perf_probe_events(void) | 1294 | int show_perf_probe_events(void) |
1291 | { | 1295 | { |
1292 | int fd, ret; | 1296 | int fd, ret; |
1293 | struct kprobe_trace_event tev; | 1297 | struct probe_trace_event tev; |
1294 | struct perf_probe_event pev; | 1298 | struct perf_probe_event pev; |
1295 | struct strlist *rawlist; | 1299 | struct strlist *rawlist; |
1296 | struct str_node *ent; | 1300 | struct str_node *ent; |
@@ -1307,20 +1311,20 @@ int show_perf_probe_events(void) | |||
1307 | if (fd < 0) | 1311 | if (fd < 0) |
1308 | return fd; | 1312 | return fd; |
1309 | 1313 | ||
1310 | rawlist = get_kprobe_trace_command_rawlist(fd); | 1314 | rawlist = get_probe_trace_command_rawlist(fd); |
1311 | close(fd); | 1315 | close(fd); |
1312 | if (!rawlist) | 1316 | if (!rawlist) |
1313 | return -ENOENT; | 1317 | return -ENOENT; |
1314 | 1318 | ||
1315 | strlist__for_each(ent, rawlist) { | 1319 | strlist__for_each(ent, rawlist) { |
1316 | ret = parse_kprobe_trace_command(ent->s, &tev); | 1320 | ret = parse_probe_trace_command(ent->s, &tev); |
1317 | if (ret >= 0) { | 1321 | if (ret >= 0) { |
1318 | ret = convert_to_perf_probe_event(&tev, &pev); | 1322 | ret = convert_to_perf_probe_event(&tev, &pev); |
1319 | if (ret >= 0) | 1323 | if (ret >= 0) |
1320 | ret = show_perf_probe_event(&pev); | 1324 | ret = show_perf_probe_event(&pev); |
1321 | } | 1325 | } |
1322 | clear_perf_probe_event(&pev); | 1326 | clear_perf_probe_event(&pev); |
1323 | clear_kprobe_trace_event(&tev); | 1327 | clear_probe_trace_event(&tev); |
1324 | if (ret < 0) | 1328 | if (ret < 0) |
1325 | break; | 1329 | break; |
1326 | } | 1330 | } |
@@ -1330,20 +1334,19 @@ int show_perf_probe_events(void) | |||
1330 | } | 1334 | } |
1331 | 1335 | ||
1332 | /* Get current perf-probe event names */ | 1336 | /* Get current perf-probe event names */ |
1333 | static struct strlist *get_kprobe_trace_event_names(int fd, bool include_group) | 1337 | static struct strlist *get_probe_trace_event_names(int fd, bool include_group) |
1334 | { | 1338 | { |
1335 | char buf[128]; | 1339 | char buf[128]; |
1336 | struct strlist *sl, *rawlist; | 1340 | struct strlist *sl, *rawlist; |
1337 | struct str_node *ent; | 1341 | struct str_node *ent; |
1338 | struct kprobe_trace_event tev; | 1342 | struct probe_trace_event tev; |
1339 | int ret = 0; | 1343 | int ret = 0; |
1340 | 1344 | ||
1341 | memset(&tev, 0, sizeof(tev)); | 1345 | memset(&tev, 0, sizeof(tev)); |
1342 | 1346 | rawlist = get_probe_trace_command_rawlist(fd); | |
1343 | rawlist = get_kprobe_trace_command_rawlist(fd); | ||
1344 | sl = strlist__new(true, NULL); | 1347 | sl = strlist__new(true, NULL); |
1345 | strlist__for_each(ent, rawlist) { | 1348 | strlist__for_each(ent, rawlist) { |
1346 | ret = parse_kprobe_trace_command(ent->s, &tev); | 1349 | ret = parse_probe_trace_command(ent->s, &tev); |
1347 | if (ret < 0) | 1350 | if (ret < 0) |
1348 | break; | 1351 | break; |
1349 | if (include_group) { | 1352 | if (include_group) { |
@@ -1353,7 +1356,7 @@ static struct strlist *get_kprobe_trace_event_names(int fd, bool include_group) | |||
1353 | ret = strlist__add(sl, buf); | 1356 | ret = strlist__add(sl, buf); |
1354 | } else | 1357 | } else |
1355 | ret = strlist__add(sl, tev.event); | 1358 | ret = strlist__add(sl, tev.event); |
1356 | clear_kprobe_trace_event(&tev); | 1359 | clear_probe_trace_event(&tev); |
1357 | if (ret < 0) | 1360 | if (ret < 0) |
1358 | break; | 1361 | break; |
1359 | } | 1362 | } |
@@ -1366,13 +1369,13 @@ static struct strlist *get_kprobe_trace_event_names(int fd, bool include_group) | |||
1366 | return sl; | 1369 | return sl; |
1367 | } | 1370 | } |
1368 | 1371 | ||
1369 | static int write_kprobe_trace_event(int fd, struct kprobe_trace_event *tev) | 1372 | static int write_probe_trace_event(int fd, struct probe_trace_event *tev) |
1370 | { | 1373 | { |
1371 | int ret = 0; | 1374 | int ret = 0; |
1372 | char *buf = synthesize_kprobe_trace_command(tev); | 1375 | char *buf = synthesize_probe_trace_command(tev); |
1373 | 1376 | ||
1374 | if (!buf) { | 1377 | if (!buf) { |
1375 | pr_debug("Failed to synthesize kprobe trace event.\n"); | 1378 | pr_debug("Failed to synthesize probe trace event.\n"); |
1376 | return -EINVAL; | 1379 | return -EINVAL; |
1377 | } | 1380 | } |
1378 | 1381 | ||
@@ -1425,12 +1428,12 @@ static int get_new_event_name(char *buf, size_t len, const char *base, | |||
1425 | return ret; | 1428 | return ret; |
1426 | } | 1429 | } |
1427 | 1430 | ||
1428 | static int __add_kprobe_trace_events(struct perf_probe_event *pev, | 1431 | static int __add_probe_trace_events(struct perf_probe_event *pev, |
1429 | struct kprobe_trace_event *tevs, | 1432 | struct probe_trace_event *tevs, |
1430 | int ntevs, bool allow_suffix) | 1433 | int ntevs, bool allow_suffix) |
1431 | { | 1434 | { |
1432 | int i, fd, ret; | 1435 | int i, fd, ret; |
1433 | struct kprobe_trace_event *tev = NULL; | 1436 | struct probe_trace_event *tev = NULL; |
1434 | char buf[64]; | 1437 | char buf[64]; |
1435 | const char *event, *group; | 1438 | const char *event, *group; |
1436 | struct strlist *namelist; | 1439 | struct strlist *namelist; |
@@ -1439,7 +1442,7 @@ static int __add_kprobe_trace_events(struct perf_probe_event *pev, | |||
1439 | if (fd < 0) | 1442 | if (fd < 0) |
1440 | return fd; | 1443 | return fd; |
1441 | /* Get current event names */ | 1444 | /* Get current event names */ |
1442 | namelist = get_kprobe_trace_event_names(fd, false); | 1445 | namelist = get_probe_trace_event_names(fd, false); |
1443 | if (!namelist) { | 1446 | if (!namelist) { |
1444 | pr_debug("Failed to get current event list.\n"); | 1447 | pr_debug("Failed to get current event list.\n"); |
1445 | return -EIO; | 1448 | return -EIO; |
@@ -1474,7 +1477,7 @@ static int __add_kprobe_trace_events(struct perf_probe_event *pev, | |||
1474 | ret = -ENOMEM; | 1477 | ret = -ENOMEM; |
1475 | break; | 1478 | break; |
1476 | } | 1479 | } |
1477 | ret = write_kprobe_trace_event(fd, tev); | 1480 | ret = write_probe_trace_event(fd, tev); |
1478 | if (ret < 0) | 1481 | if (ret < 0) |
1479 | break; | 1482 | break; |
1480 | /* Add added event name to namelist */ | 1483 | /* Add added event name to namelist */ |
@@ -1511,21 +1514,21 @@ static int __add_kprobe_trace_events(struct perf_probe_event *pev, | |||
1511 | return ret; | 1514 | return ret; |
1512 | } | 1515 | } |
1513 | 1516 | ||
1514 | static int convert_to_kprobe_trace_events(struct perf_probe_event *pev, | 1517 | static int convert_to_probe_trace_events(struct perf_probe_event *pev, |
1515 | struct kprobe_trace_event **tevs, | 1518 | struct probe_trace_event **tevs, |
1516 | int max_tevs) | 1519 | int max_tevs) |
1517 | { | 1520 | { |
1518 | struct symbol *sym; | 1521 | struct symbol *sym; |
1519 | int ret = 0, i; | 1522 | int ret = 0, i; |
1520 | struct kprobe_trace_event *tev; | 1523 | struct probe_trace_event *tev; |
1521 | 1524 | ||
1522 | /* Convert perf_probe_event with debuginfo */ | 1525 | /* Convert perf_probe_event with debuginfo */ |
1523 | ret = try_to_find_kprobe_trace_events(pev, tevs, max_tevs); | 1526 | ret = try_to_find_probe_trace_events(pev, tevs, max_tevs); |
1524 | if (ret != 0) | 1527 | if (ret != 0) |
1525 | return ret; | 1528 | return ret; |
1526 | 1529 | ||
1527 | /* Allocate trace event buffer */ | 1530 | /* Allocate trace event buffer */ |
1528 | tev = *tevs = zalloc(sizeof(struct kprobe_trace_event)); | 1531 | tev = *tevs = zalloc(sizeof(struct probe_trace_event)); |
1529 | if (tev == NULL) | 1532 | if (tev == NULL) |
1530 | return -ENOMEM; | 1533 | return -ENOMEM; |
1531 | 1534 | ||
@@ -1538,7 +1541,7 @@ static int convert_to_kprobe_trace_events(struct perf_probe_event *pev, | |||
1538 | tev->point.offset = pev->point.offset; | 1541 | tev->point.offset = pev->point.offset; |
1539 | tev->nargs = pev->nargs; | 1542 | tev->nargs = pev->nargs; |
1540 | if (tev->nargs) { | 1543 | if (tev->nargs) { |
1541 | tev->args = zalloc(sizeof(struct kprobe_trace_arg) | 1544 | tev->args = zalloc(sizeof(struct probe_trace_arg) |
1542 | * tev->nargs); | 1545 | * tev->nargs); |
1543 | if (tev->args == NULL) { | 1546 | if (tev->args == NULL) { |
1544 | ret = -ENOMEM; | 1547 | ret = -ENOMEM; |
@@ -1579,7 +1582,7 @@ static int convert_to_kprobe_trace_events(struct perf_probe_event *pev, | |||
1579 | 1582 | ||
1580 | return 1; | 1583 | return 1; |
1581 | error: | 1584 | error: |
1582 | clear_kprobe_trace_event(tev); | 1585 | clear_probe_trace_event(tev); |
1583 | free(tev); | 1586 | free(tev); |
1584 | *tevs = NULL; | 1587 | *tevs = NULL; |
1585 | return ret; | 1588 | return ret; |
@@ -1587,7 +1590,7 @@ error: | |||
1587 | 1590 | ||
1588 | struct __event_package { | 1591 | struct __event_package { |
1589 | struct perf_probe_event *pev; | 1592 | struct perf_probe_event *pev; |
1590 | struct kprobe_trace_event *tevs; | 1593 | struct probe_trace_event *tevs; |
1591 | int ntevs; | 1594 | int ntevs; |
1592 | }; | 1595 | }; |
1593 | 1596 | ||
@@ -1610,7 +1613,7 @@ int add_perf_probe_events(struct perf_probe_event *pevs, int npevs, | |||
1610 | for (i = 0; i < npevs; i++) { | 1613 | for (i = 0; i < npevs; i++) { |
1611 | pkgs[i].pev = &pevs[i]; | 1614 | pkgs[i].pev = &pevs[i]; |
1612 | /* Convert with or without debuginfo */ | 1615 | /* Convert with or without debuginfo */ |
1613 | ret = convert_to_kprobe_trace_events(pkgs[i].pev, | 1616 | ret = convert_to_probe_trace_events(pkgs[i].pev, |
1614 | &pkgs[i].tevs, max_tevs); | 1617 | &pkgs[i].tevs, max_tevs); |
1615 | if (ret < 0) | 1618 | if (ret < 0) |
1616 | goto end; | 1619 | goto end; |
@@ -1619,24 +1622,24 @@ int add_perf_probe_events(struct perf_probe_event *pevs, int npevs, | |||
1619 | 1622 | ||
1620 | /* Loop 2: add all events */ | 1623 | /* Loop 2: add all events */ |
1621 | for (i = 0; i < npevs && ret >= 0; i++) | 1624 | for (i = 0; i < npevs && ret >= 0; i++) |
1622 | ret = __add_kprobe_trace_events(pkgs[i].pev, pkgs[i].tevs, | 1625 | ret = __add_probe_trace_events(pkgs[i].pev, pkgs[i].tevs, |
1623 | pkgs[i].ntevs, force_add); | 1626 | pkgs[i].ntevs, force_add); |
1624 | end: | 1627 | end: |
1625 | /* Loop 3: cleanup trace events */ | 1628 | /* Loop 3: cleanup trace events */ |
1626 | for (i = 0; i < npevs; i++) | 1629 | for (i = 0; i < npevs; i++) |
1627 | for (j = 0; j < pkgs[i].ntevs; j++) | 1630 | for (j = 0; j < pkgs[i].ntevs; j++) |
1628 | clear_kprobe_trace_event(&pkgs[i].tevs[j]); | 1631 | clear_probe_trace_event(&pkgs[i].tevs[j]); |
1629 | 1632 | ||
1630 | return ret; | 1633 | return ret; |
1631 | } | 1634 | } |
1632 | 1635 | ||
1633 | static int __del_trace_kprobe_event(int fd, struct str_node *ent) | 1636 | static int __del_trace_probe_event(int fd, struct str_node *ent) |
1634 | { | 1637 | { |
1635 | char *p; | 1638 | char *p; |
1636 | char buf[128]; | 1639 | char buf[128]; |
1637 | int ret; | 1640 | int ret; |
1638 | 1641 | ||
1639 | /* Convert from perf-probe event to trace-kprobe event */ | 1642 | /* Convert from perf-probe event to trace-probe event */ |
1640 | ret = e_snprintf(buf, 128, "-:%s", ent->s); | 1643 | ret = e_snprintf(buf, 128, "-:%s", ent->s); |
1641 | if (ret < 0) | 1644 | if (ret < 0) |
1642 | goto error; | 1645 | goto error; |
@@ -1662,7 +1665,7 @@ error: | |||
1662 | return ret; | 1665 | return ret; |
1663 | } | 1666 | } |
1664 | 1667 | ||
1665 | static int del_trace_kprobe_event(int fd, const char *group, | 1668 | static int del_trace_probe_event(int fd, const char *group, |
1666 | const char *event, struct strlist *namelist) | 1669 | const char *event, struct strlist *namelist) |
1667 | { | 1670 | { |
1668 | char buf[128]; | 1671 | char buf[128]; |
@@ -1679,7 +1682,7 @@ static int del_trace_kprobe_event(int fd, const char *group, | |||
1679 | strlist__for_each_safe(ent, n, namelist) | 1682 | strlist__for_each_safe(ent, n, namelist) |
1680 | if (strglobmatch(ent->s, buf)) { | 1683 | if (strglobmatch(ent->s, buf)) { |
1681 | found++; | 1684 | found++; |
1682 | ret = __del_trace_kprobe_event(fd, ent); | 1685 | ret = __del_trace_probe_event(fd, ent); |
1683 | if (ret < 0) | 1686 | if (ret < 0) |
1684 | break; | 1687 | break; |
1685 | strlist__remove(namelist, ent); | 1688 | strlist__remove(namelist, ent); |
@@ -1688,7 +1691,7 @@ static int del_trace_kprobe_event(int fd, const char *group, | |||
1688 | ent = strlist__find(namelist, buf); | 1691 | ent = strlist__find(namelist, buf); |
1689 | if (ent) { | 1692 | if (ent) { |
1690 | found++; | 1693 | found++; |
1691 | ret = __del_trace_kprobe_event(fd, ent); | 1694 | ret = __del_trace_probe_event(fd, ent); |
1692 | if (ret >= 0) | 1695 | if (ret >= 0) |
1693 | strlist__remove(namelist, ent); | 1696 | strlist__remove(namelist, ent); |
1694 | } | 1697 | } |
@@ -1712,7 +1715,7 @@ int del_perf_probe_events(struct strlist *dellist) | |||
1712 | return fd; | 1715 | return fd; |
1713 | 1716 | ||
1714 | /* Get current event names */ | 1717 | /* Get current event names */ |
1715 | namelist = get_kprobe_trace_event_names(fd, true); | 1718 | namelist = get_probe_trace_event_names(fd, true); |
1716 | if (namelist == NULL) | 1719 | if (namelist == NULL) |
1717 | return -EINVAL; | 1720 | return -EINVAL; |
1718 | 1721 | ||
@@ -1733,7 +1736,7 @@ int del_perf_probe_events(struct strlist *dellist) | |||
1733 | event = str; | 1736 | event = str; |
1734 | } | 1737 | } |
1735 | pr_debug("Group: %s, Event: %s\n", group, event); | 1738 | pr_debug("Group: %s, Event: %s\n", group, event); |
1736 | ret = del_trace_kprobe_event(fd, group, event, namelist); | 1739 | ret = del_trace_probe_event(fd, group, event, namelist); |
1737 | free(str); | 1740 | free(str); |
1738 | if (ret < 0) | 1741 | if (ret < 0) |
1739 | break; | 1742 | break; |