probe-event.c (1f3736c9c833e40ac4d3a8dc6d661e341df8a259) probe-event.c (8d993d96901f55d26e083390aae80fd02cbff7aa)
1/*
2 * probe-event.c : perf-probe definition to probe_events format converter
3 *
4 * Written by Masami Hiramatsu <mhiramat@redhat.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 1192 unchanged lines hidden (view full) ---

1201static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
1202{
1203 struct perf_probe_point *pp = &pev->point;
1204 char *ptr, *tmp;
1205 char c, nc = 0;
1206 bool file_spec = false;
1207 /*
1208 * <Syntax>
1/*
2 * probe-event.c : perf-probe definition to probe_events format converter
3 *
4 * Written by Masami Hiramatsu <mhiramat@redhat.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 1192 unchanged lines hidden (view full) ---

1201static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
1202{
1203 struct perf_probe_point *pp = &pev->point;
1204 char *ptr, *tmp;
1205 char c, nc = 0;
1206 bool file_spec = false;
1207 /*
1208 * <Syntax>
1209 * perf probe [EVENT=]SRC[:LN|;PTN]
1210 * perf probe [EVENT=]FUNC[@SRC][+OFFS|%return|:LN|;PAT]
1211 *
1212 * TODO:Group name support
1209 * perf probe [GRP:][EVENT=]SRC[:LN|;PTN]
1210 * perf probe [GRP:][EVENT=]FUNC[@SRC][+OFFS|%return|:LN|;PAT]
1213 */
1214 if (!arg)
1215 return -EINVAL;
1216
1217 ptr = strpbrk(arg, ";=@+%");
1218 if (ptr && *ptr == '=') { /* Event name */
1219 *ptr = '\0';
1220 tmp = ptr + 1;
1211 */
1212 if (!arg)
1213 return -EINVAL;
1214
1215 ptr = strpbrk(arg, ";=@+%");
1216 if (ptr && *ptr == '=') { /* Event name */
1217 *ptr = '\0';
1218 tmp = ptr + 1;
1221 if (strchr(arg, ':')) {
1222 semantic_error("Group name is not supported yet.\n");
1223 return -ENOTSUP;
1224 }
1219 ptr = strchr(arg, ':');
1220 if (ptr) {
1221 *ptr = '\0';
1222 if (!is_c_func_name(arg))
1223 goto not_fname;
1224 pev->group = strdup(arg);
1225 if (!pev->group)
1226 return -ENOMEM;
1227 arg = ptr + 1;
1228 } else
1229 pev->group = NULL;
1225 if (!is_c_func_name(arg)) {
1230 if (!is_c_func_name(arg)) {
1231not_fname:
1226 semantic_error("%s is bad for event name -it must "
1227 "follow C symbol-naming rule.\n", arg);
1228 return -EINVAL;
1229 }
1230 pev->event = strdup(arg);
1231 if (pev->event == NULL)
1232 return -ENOMEM;
1232 semantic_error("%s is bad for event name -it must "
1233 "follow C symbol-naming rule.\n", arg);
1234 return -EINVAL;
1235 }
1236 pev->event = strdup(arg);
1237 if (pev->event == NULL)
1238 return -ENOMEM;
1233 pev->group = NULL;
1234 arg = tmp;
1235 }
1236
1237 /*
1238 * Check arg is function or file name and copy it.
1239 *
1240 * We consider arg to be a file spec if and only if it satisfies
1241 * all of the below criteria::

--- 1883 unchanged lines hidden ---
1239 arg = tmp;
1240 }
1241
1242 /*
1243 * Check arg is function or file name and copy it.
1244 *
1245 * We consider arg to be a file spec if and only if it satisfies
1246 * all of the below criteria::

--- 1883 unchanged lines hidden ---