2 %parse-param {struct list_head *list_all}
3 %parse-param {struct list_head *list_event}
4 %parse-param {int *idx}
10 #include <linux/compiler.h>
11 #include <linux/list.h>
14 #include "parse-events.h"
16 extern int parse_events_lex (void);
18 #define ABORT_ON(val) \
26 %token PE_VALUE PE_VALUE_SYM PE_RAW PE_TERM
28 %token PE_MODIFIER_EVENT PE_MODIFIER_BP
29 %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT
30 %token PE_PREFIX_MEM PE_PREFIX_RAW
33 %type <num> PE_VALUE_SYM
37 %type <str> PE_NAME_CACHE_TYPE
38 %type <str> PE_NAME_CACHE_OP_RESULT
39 %type <str> PE_MODIFIER_EVENT
40 %type <str> PE_MODIFIER_BP
41 %type <head> event_config
42 %type <term> event_term
48 struct list_head *head;
49 struct parse_events__term *term;
54 events ',' event | event
57 event_def PE_MODIFIER_EVENT
60 * Apply modifier on all events added by single event definition
61 * (there could be more events added for multiple tracepoint
62 * definitions via '*?'.
64 ABORT_ON(parse_events_modifier(list_event, $2));
65 parse_events_update_lists(list_event, list_all);
70 parse_events_update_lists(list_event, list_all);
73 event_def: event_pmu |
75 event_legacy_cache sep_dc |
77 event_legacy_tracepoint sep_dc |
78 event_legacy_numeric sep_dc |
79 event_legacy_raw sep_dc
82 PE_NAME '/' event_config '/'
84 ABORT_ON(parse_events_add_pmu(list_event, idx, $1, $3));
85 parse_events__free_terms($3);
89 PE_VALUE_SYM '/' event_config '/'
92 int config = $1 & 255;
94 ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, $3));
95 parse_events__free_terms($3);
98 PE_VALUE_SYM sep_slash_dc
101 int config = $1 & 255;
103 ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, NULL));
107 PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT
109 ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, $5));
112 PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT
114 ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, NULL));
119 ABORT_ON(parse_events_add_cache(list_event, idx, $1, NULL, NULL));
123 PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
125 ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, $4));
128 PE_PREFIX_MEM PE_VALUE sep_dc
130 ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, NULL));
133 event_legacy_tracepoint:
136 ABORT_ON(parse_events_add_tracepoint(list_event, idx, $1, $3));
139 event_legacy_numeric:
140 PE_VALUE ':' PE_VALUE
142 ABORT_ON(parse_events_add_numeric(list_event, idx, $1, $3, NULL));
148 ABORT_ON(parse_events_add_numeric(list_event, idx, PERF_TYPE_RAW, $1, NULL));
152 event_config ',' event_term
154 struct list_head *head = $1;
155 struct parse_events__term *term = $3;
158 list_add_tail(&term->list, head);
164 struct list_head *head = malloc(sizeof(*head));
165 struct parse_events__term *term = $1;
168 INIT_LIST_HEAD(head);
169 list_add_tail(&term->list, head);
176 struct parse_events__term *term;
178 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_STR,
185 struct parse_events__term *term;
187 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM,
194 struct parse_events__term *term;
196 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM,
203 struct parse_events__term *term;
205 ABORT_ON(parse_events__new_term(&term, $1, NULL, NULL, $3));
211 struct parse_events__term *term;
213 ABORT_ON(parse_events__new_term(&term, $1, NULL, NULL, 1));
219 sep_slash_dc: '/' | ':' |
223 void parse_events_error(struct list_head *list_all __used,
224 struct list_head *list_event __used,
226 char const *msg __used)