Commit 87d650be authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf tools: Add symbolic events support for parse_events_error

Allowing symbolic events processing to report back error.

  $ perf record -e 'cycles/period=krava/' ls
  event syntax error: '../period=krava/'
                                 \___ expected numeric value

  $ perf record -e 'cycles/name=1/' ls
  event syntax error: '..es/name=1/'
                                 \___ expected string value
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1429729824-13932-10-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 492d9774
...@@ -625,7 +625,8 @@ static int config_attr(struct perf_event_attr *attr, ...@@ -625,7 +625,8 @@ static int config_attr(struct perf_event_attr *attr,
return 0; return 0;
} }
int parse_events_add_numeric(struct list_head *list, int *idx, int parse_events_add_numeric(struct parse_events_evlist *data,
struct list_head *list,
u32 type, u64 config, u32 type, u64 config,
struct list_head *head_config) struct list_head *head_config)
{ {
...@@ -636,10 +637,10 @@ int parse_events_add_numeric(struct list_head *list, int *idx, ...@@ -636,10 +637,10 @@ int parse_events_add_numeric(struct list_head *list, int *idx,
attr.config = config; attr.config = config;
if (head_config && if (head_config &&
config_attr(&attr, head_config, NULL)) config_attr(&attr, head_config, data->error))
return -EINVAL; return -EINVAL;
return add_event(list, idx, &attr, NULL); return add_event(list, &data->idx, &attr, NULL);
} }
static int parse_events__is_name_term(struct parse_events_term *term) static int parse_events__is_name_term(struct parse_events_term *term)
......
...@@ -108,7 +108,8 @@ int parse_events__modifier_group(struct list_head *list, char *event_mod); ...@@ -108,7 +108,8 @@ int parse_events__modifier_group(struct list_head *list, char *event_mod);
int parse_events_name(struct list_head *list, char *name); int parse_events_name(struct list_head *list, char *name);
int parse_events_add_tracepoint(struct list_head *list, int *idx, int parse_events_add_tracepoint(struct list_head *list, int *idx,
char *sys, char *event); char *sys, char *event);
int parse_events_add_numeric(struct list_head *list, int *idx, int parse_events_add_numeric(struct parse_events_evlist *data,
struct list_head *list,
u32 type, u64 config, u32 type, u64 config,
struct list_head *head_config); struct list_head *head_config);
int parse_events_add_cache(struct list_head *list, int *idx, int parse_events_add_cache(struct list_head *list, int *idx,
......
...@@ -274,8 +274,7 @@ value_sym '/' event_config '/' ...@@ -274,8 +274,7 @@ value_sym '/' event_config '/'
int config = $1 & 255; int config = $1 & 255;
ALLOC_LIST(list); ALLOC_LIST(list);
ABORT_ON(parse_events_add_numeric(list, &data->idx, ABORT_ON(parse_events_add_numeric(data, list, type, config, $3));
type, config, $3));
parse_events__free_terms($3); parse_events__free_terms($3);
$$ = list; $$ = list;
} }
...@@ -288,8 +287,7 @@ value_sym sep_slash_dc ...@@ -288,8 +287,7 @@ value_sym sep_slash_dc
int config = $1 & 255; int config = $1 & 255;
ALLOC_LIST(list); ALLOC_LIST(list);
ABORT_ON(parse_events_add_numeric(list, &data->idx, ABORT_ON(parse_events_add_numeric(data, list, type, config, NULL));
type, config, NULL));
$$ = list; $$ = list;
} }
...@@ -405,7 +403,7 @@ PE_VALUE ':' PE_VALUE ...@@ -405,7 +403,7 @@ PE_VALUE ':' PE_VALUE
struct list_head *list; struct list_head *list;
ALLOC_LIST(list); ALLOC_LIST(list);
ABORT_ON(parse_events_add_numeric(list, &data->idx, (u32)$1, $3, NULL)); ABORT_ON(parse_events_add_numeric(data, list, (u32)$1, $3, NULL));
$$ = list; $$ = list;
} }
...@@ -416,8 +414,7 @@ PE_RAW ...@@ -416,8 +414,7 @@ PE_RAW
struct list_head *list; struct list_head *list;
ALLOC_LIST(list); ALLOC_LIST(list);
ABORT_ON(parse_events_add_numeric(list, &data->idx, ABORT_ON(parse_events_add_numeric(data, list, PERF_TYPE_RAW, $1, NULL));
PERF_TYPE_RAW, $1, NULL));
$$ = list; $$ = list;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment