~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/util/parse-events.y

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/perf/util/parse-events.y (Version linux-6.12-rc7) and /tools/perf/util/parse-events.y (Version linux-5.16.20)


  1 %define api.pure full                               1 %define api.pure full
  2 %parse-param {void *_parse_state}                   2 %parse-param {void *_parse_state}
  3 %parse-param {void *scanner}                        3 %parse-param {void *scanner}
  4 %lex-param {void* scanner}                          4 %lex-param {void* scanner}
  5 %locations                                          5 %locations
  6                                                     6 
  7 %{                                                  7 %{
  8                                                     8 
  9 #ifndef NDEBUG                                 << 
 10 #define YYDEBUG 1                                   9 #define YYDEBUG 1
 11 #endif                                         << 
 12                                                    10 
 13 #include <errno.h>                             !!  11 #include <fnmatch.h>
                                                   >>  12 #include <stdio.h>
 14 #include <linux/compiler.h>                        13 #include <linux/compiler.h>
 15 #include <linux/types.h>                           14 #include <linux/types.h>
                                                   >>  15 #include <linux/zalloc.h>
 16 #include "pmu.h"                                   16 #include "pmu.h"
 17 #include "pmus.h"                              << 
 18 #include "evsel.h"                                 17 #include "evsel.h"
 19 #include "parse-events.h"                          18 #include "parse-events.h"
 20 #include "parse-events-bison.h"                    19 #include "parse-events-bison.h"
 21                                                    20 
 22 int parse_events_lex(YYSTYPE * yylval_param, Y << 
 23 void parse_events_error(YYLTYPE *loc, void *pa     21 void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg);
 24                                                    22 
 25 #define PE_ABORT(val) \                        !!  23 #define ABORT_ON(val) \
 26 do { \                                             24 do { \
 27         if (val == -ENOMEM) \                  !!  25         if (val) \
 28                 YYNOMEM; \                     !!  26                 YYABORT; \
 29         YYABORT; \                             << 
 30 } while (0)                                        27 } while (0)
 31                                                    28 
 32 static struct list_head* alloc_list(void)          29 static struct list_head* alloc_list(void)
 33 {                                                  30 {
 34         struct list_head *list;                    31         struct list_head *list;
 35                                                    32 
 36         list = malloc(sizeof(*list));              33         list = malloc(sizeof(*list));
 37         if (!list)                                 34         if (!list)
 38                 return NULL;                       35                 return NULL;
 39                                                    36 
 40         INIT_LIST_HEAD(list);                      37         INIT_LIST_HEAD(list);
 41         return list;                               38         return list;
 42 }                                                  39 }
 43                                                    40 
 44 static void free_list_evsel(struct list_head*      41 static void free_list_evsel(struct list_head* list_evsel)
 45 {                                                  42 {
 46         struct evsel *evsel, *tmp;                 43         struct evsel *evsel, *tmp;
 47                                                    44 
 48         list_for_each_entry_safe(evsel, tmp, l     45         list_for_each_entry_safe(evsel, tmp, list_evsel, core.node) {
 49                 list_del_init(&evsel->core.nod     46                 list_del_init(&evsel->core.node);
 50                 evsel__delete(evsel);              47                 evsel__delete(evsel);
 51         }                                          48         }
 52         free(list_evsel);                          49         free(list_evsel);
 53 }                                                  50 }
 54                                                    51 
                                                   >>  52 static void inc_group_count(struct list_head *list,
                                                   >>  53                        struct parse_events_state *parse_state)
                                                   >>  54 {
                                                   >>  55         /* Count groups only have more than 1 members */
                                                   >>  56         if (!list_is_last(list->next, list))
                                                   >>  57                 parse_state->nr_groups++;
                                                   >>  58 }
                                                   >>  59 
 55 %}                                                 60 %}
 56                                                    61 
 57 %token PE_START_EVENTS PE_START_TERMS              62 %token PE_START_EVENTS PE_START_TERMS
 58 %token PE_VALUE PE_VALUE_SYM_HW PE_VALUE_SYM_S !!  63 %token PE_VALUE PE_VALUE_SYM_HW PE_VALUE_SYM_SW PE_RAW PE_TERM
 59 %token PE_VALUE_SYM_TOOL                           64 %token PE_VALUE_SYM_TOOL
 60 %token PE_EVENT_NAME                               65 %token PE_EVENT_NAME
 61 %token PE_RAW PE_NAME                          !!  66 %token PE_NAME
 62 %token PE_MODIFIER_EVENT PE_MODIFIER_BP PE_BP_ !!  67 %token PE_BPF_OBJECT PE_BPF_SOURCE
 63 %token PE_LEGACY_CACHE                         !!  68 %token PE_MODIFIER_EVENT PE_MODIFIER_BP
 64 %token PE_PREFIX_MEM                           !!  69 %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT
                                                   >>  70 %token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
 65 %token PE_ERROR                                    71 %token PE_ERROR
                                                   >>  72 %token PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
                                                   >>  73 %token PE_ARRAY_ALL PE_ARRAY_RANGE
 66 %token PE_DRV_CFG_TERM                             74 %token PE_DRV_CFG_TERM
 67 %token PE_TERM_HW                              << 
 68 %type <num> PE_VALUE                               75 %type <num> PE_VALUE
 69 %type <num> PE_VALUE_SYM_HW                        76 %type <num> PE_VALUE_SYM_HW
 70 %type <num> PE_VALUE_SYM_SW                        77 %type <num> PE_VALUE_SYM_SW
 71 %type <num> PE_VALUE_SYM_TOOL                      78 %type <num> PE_VALUE_SYM_TOOL
 72 %type <mod> PE_MODIFIER_EVENT                  !!  79 %type <num> PE_RAW
 73 %type <term_type> PE_TERM                      !!  80 %type <num> PE_TERM
 74 %type <num> value_sym                              81 %type <num> value_sym
 75 %type <str> PE_RAW                             << 
 76 %type <str> PE_NAME                                82 %type <str> PE_NAME
 77 %type <str> PE_LEGACY_CACHE                    !!  83 %type <str> PE_BPF_OBJECT
                                                   >>  84 %type <str> PE_BPF_SOURCE
                                                   >>  85 %type <str> PE_NAME_CACHE_TYPE
                                                   >>  86 %type <str> PE_NAME_CACHE_OP_RESULT
                                                   >>  87 %type <str> PE_MODIFIER_EVENT
 78 %type <str> PE_MODIFIER_BP                         88 %type <str> PE_MODIFIER_BP
 79 %type <str> PE_EVENT_NAME                          89 %type <str> PE_EVENT_NAME
                                                   >>  90 %type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
 80 %type <str> PE_DRV_CFG_TERM                        91 %type <str> PE_DRV_CFG_TERM
 81 %type <str> name_or_raw                        !!  92 %type <str> event_pmu_name
 82 %destructor { free ($$); } <str>                   93 %destructor { free ($$); } <str>
 83 %type <term> event_term                            94 %type <term> event_term
 84 %destructor { parse_events_term__delete ($$);      95 %destructor { parse_events_term__delete ($$); } <term>
 85 %type <list_terms> event_config                    96 %type <list_terms> event_config
 86 %type <list_terms> opt_event_config                97 %type <list_terms> opt_event_config
 87 %type <list_terms> opt_pmu_config                  98 %type <list_terms> opt_pmu_config
 88 %destructor { parse_events_terms__delete ($$);     99 %destructor { parse_events_terms__delete ($$); } <list_terms>
 89 %type <list_evsel> event_pmu                      100 %type <list_evsel> event_pmu
 90 %type <list_evsel> event_legacy_symbol            101 %type <list_evsel> event_legacy_symbol
 91 %type <list_evsel> event_legacy_cache             102 %type <list_evsel> event_legacy_cache
 92 %type <list_evsel> event_legacy_mem               103 %type <list_evsel> event_legacy_mem
 93 %type <list_evsel> event_legacy_tracepoint        104 %type <list_evsel> event_legacy_tracepoint
 94 %type <list_evsel> event_legacy_numeric           105 %type <list_evsel> event_legacy_numeric
 95 %type <list_evsel> event_legacy_raw               106 %type <list_evsel> event_legacy_raw
                                                   >> 107 %type <list_evsel> event_bpf_file
 96 %type <list_evsel> event_def                      108 %type <list_evsel> event_def
 97 %type <list_evsel> event_mod                      109 %type <list_evsel> event_mod
 98 %type <list_evsel> event_name                     110 %type <list_evsel> event_name
 99 %type <list_evsel> event                          111 %type <list_evsel> event
100 %type <list_evsel> events                         112 %type <list_evsel> events
101 %type <list_evsel> group_def                      113 %type <list_evsel> group_def
102 %type <list_evsel> group                          114 %type <list_evsel> group
103 %type <list_evsel> groups                         115 %type <list_evsel> groups
104 %destructor { free_list_evsel ($$); } <list_ev    116 %destructor { free_list_evsel ($$); } <list_evsel>
105 %type <tracepoint_name> tracepoint_name           117 %type <tracepoint_name> tracepoint_name
106 %destructor { free ($$.sys); free ($$.event);     118 %destructor { free ($$.sys); free ($$.event); } <tracepoint_name>
107 %type <hardware_term> PE_TERM_HW               !! 119 %type <array> array
108 %destructor { free ($$.str); } <hardware_term> !! 120 %type <array> array_term
                                                   >> 121 %type <array> array_terms
                                                   >> 122 %destructor { free ($$.ranges); } <array>
109                                                   123 
110 %union                                            124 %union
111 {                                                 125 {
112         char *str;                                126         char *str;
113         u64 num;                                  127         u64 num;
114         struct parse_events_modifier mod;      << 
115         enum parse_events__term_type term_type << 
116         struct list_head *list_evsel;             128         struct list_head *list_evsel;
117         struct parse_events_terms *list_terms; !! 129         struct list_head *list_terms;
118         struct parse_events_term *term;           130         struct parse_events_term *term;
119         struct tracepoint_name {                  131         struct tracepoint_name {
120                 char *sys;                        132                 char *sys;
121                 char *event;                      133                 char *event;
122         } tracepoint_name;                        134         } tracepoint_name;
123         struct hardware_term {                 !! 135         struct parse_events_array array;
124                 char *str;                     << 
125                 u64 num;                       << 
126         } hardware_term;                       << 
127 }                                                 136 }
128 %%                                                137 %%
129                                                   138 
130  /*                                            << 
131   * Entry points. We are either parsing events << 
132   * parsing is used for parsing events in sysf << 
133   */                                           << 
134 start:                                            139 start:
135 PE_START_EVENTS start_events                      140 PE_START_EVENTS start_events
136 |                                                 141 |
137 PE_START_TERMS  start_terms                       142 PE_START_TERMS  start_terms
138                                                   143 
139 start_events: groups                              144 start_events: groups
140 {                                                 145 {
141         /* Take the parsed events, groups.. an << 
142         struct list_head *groups  = $1;        << 
143         struct parse_events_state *parse_state    146         struct parse_events_state *parse_state = _parse_state;
144                                                   147 
145         list_splice_tail(groups, &parse_state- !! 148         /* frees $1 */
146         free(groups);                          !! 149         parse_events_update_lists($1, &parse_state->list);
147 }                                                 150 }
148                                                   151 
149 groups: /* A list of groups or events. */      !! 152 groups:
150 groups ',' group                                  153 groups ',' group
151 {                                                 154 {
152         /* Merge group into the list of events !! 155         struct list_head *list  = $1;
153         struct list_head *groups  = $1;        !! 156         struct list_head *group = $3;
154         struct list_head *group  = $3;         !! 157 
155                                                !! 158         /* frees $3 */
156         list_splice_tail(group, groups);       !! 159         parse_events_update_lists(group, list);
157         free(group);                           !! 160         $$ = list;
158         $$ = groups;                           << 
159 }                                                 161 }
160 |                                                 162 |
161 groups ',' event                                  163 groups ',' event
162 {                                                 164 {
163         /* Merge event into the list of events !! 165         struct list_head *list  = $1;
164         struct list_head *groups  = $1;        << 
165         struct list_head *event = $3;             166         struct list_head *event = $3;
166                                                   167 
167                                                !! 168         /* frees $3 */
168         list_splice_tail(event, groups);       !! 169         parse_events_update_lists(event, list);
169         free(event);                           !! 170         $$ = list;
170         $$ = groups;                           << 
171 }                                                 171 }
172 |                                                 172 |
173 group                                             173 group
174 |                                                 174 |
175 event                                             175 event
176                                                   176 
177 group:                                            177 group:
178 group_def ':' PE_MODIFIER_EVENT                   178 group_def ':' PE_MODIFIER_EVENT
179 {                                                 179 {
180         /* Apply the modifier to the events in << 
181         struct list_head *list = $1;              180         struct list_head *list = $1;
182         int err;                                  181         int err;
183                                                   182 
184         err = parse_events__modifier_group(_pa !! 183         err = parse_events__modifier_group(list, $3);
185         if (err)                               !! 184         free($3);
                                                   >> 185         if (err) {
                                                   >> 186                 struct parse_events_state *parse_state = _parse_state;
                                                   >> 187                 struct parse_events_error *error = parse_state->error;
                                                   >> 188 
                                                   >> 189                 parse_events_error__handle(error, @3.first_column,
                                                   >> 190                                            strdup("Bad modifier"), NULL);
                                                   >> 191                 free_list_evsel(list);
186                 YYABORT;                          192                 YYABORT;
                                                   >> 193         }
187         $$ = list;                                194         $$ = list;
188 }                                                 195 }
189 |                                                 196 |
190 group_def                                         197 group_def
191                                                   198 
192 group_def:                                        199 group_def:
193 PE_NAME '{' events '}'                            200 PE_NAME '{' events '}'
194 {                                                 201 {
195         struct list_head *list = $3;              202         struct list_head *list = $3;
196                                                   203 
197         /*                                     !! 204         inc_group_count(list, _parse_state);
198          * Set the first entry of list to be t !! 205         parse_events__set_leader($1, list, _parse_state);
199          * the leader to $1 taking ownership.  !! 206         free($1);
200          */                                    << 
201         parse_events__set_leader($1, list);    << 
202         $$ = list;                                207         $$ = list;
203 }                                                 208 }
204 |                                                 209 |
205 '{' events '}'                                    210 '{' events '}'
206 {                                                 211 {
207         struct list_head *list = $2;              212         struct list_head *list = $2;
208                                                   213 
209         /* Set the first entry of list to be t !! 214         inc_group_count(list, _parse_state);
210         parse_events__set_leader(NULL, list);  !! 215         parse_events__set_leader(NULL, list, _parse_state);
211         $$ = list;                                216         $$ = list;
212 }                                                 217 }
213                                                   218 
214 events:                                           219 events:
215 events ',' event                                  220 events ',' event
216 {                                                 221 {
217         struct list_head *events  = $1;        << 
218         struct list_head *event = $3;             222         struct list_head *event = $3;
                                                   >> 223         struct list_head *list  = $1;
219                                                   224 
220         list_splice_tail(event, events);       !! 225         /* frees $3 */
221         free(event);                           !! 226         parse_events_update_lists(event, list);
222         $$ = events;                           !! 227         $$ = list;
223 }                                                 228 }
224 |                                                 229 |
225 event                                             230 event
226                                                   231 
227 event: event_mod                                  232 event: event_mod
228                                                   233 
229 event_mod:                                        234 event_mod:
230 event_name PE_MODIFIER_EVENT                      235 event_name PE_MODIFIER_EVENT
231 {                                                 236 {
232         struct list_head *list = $1;              237         struct list_head *list = $1;
233         int err;                                  238         int err;
234                                                   239 
235         /*                                        240         /*
236          * Apply modifier on all events added     241          * Apply modifier on all events added by single event definition
237          * (there could be more events added f    242          * (there could be more events added for multiple tracepoint
238          * definitions via '*?'.                  243          * definitions via '*?'.
239          */                                       244          */
240         err = parse_events__modifier_event(_pa !! 245         err = parse_events__modifier_event(list, $2, false);
241         if (err)                               !! 246         free($2);
                                                   >> 247         if (err) {
                                                   >> 248                 struct parse_events_state *parse_state = _parse_state;
                                                   >> 249                 struct parse_events_error *error = parse_state->error;
                                                   >> 250 
                                                   >> 251                 parse_events_error__handle(error, @2.first_column,
                                                   >> 252                                            strdup("Bad modifier"), NULL);
                                                   >> 253                 free_list_evsel(list);
242                 YYABORT;                          254                 YYABORT;
                                                   >> 255         }
243         $$ = list;                                256         $$ = list;
244 }                                                 257 }
245 |                                                 258 |
246 event_name                                        259 event_name
247                                                   260 
248 event_name:                                       261 event_name:
249 PE_EVENT_NAME event_def                           262 PE_EVENT_NAME event_def
250 {                                                 263 {
251         /*                                     !! 264         int err;
252          * When an event is parsed the text is << 
253          * the event is set to the str of PE_E << 
254          * no name was on an event via a term, << 
255          * taking ownership of the allocation. << 
256          */                                    << 
257         int err = parse_events__set_default_na << 
258                                                   265 
                                                   >> 266         err = parse_events_name($2, $1);
                                                   >> 267         free($1);
259         if (err) {                                268         if (err) {
260                 free_list_evsel($2);              269                 free_list_evsel($2);
261                 YYNOMEM;                       !! 270                 YYABORT;
262         }                                         271         }
263         $$ = $2;                                  272         $$ = $2;
264 }                                                 273 }
265 |                                                 274 |
266 event_def                                         275 event_def
267                                                   276 
268 event_def: event_pmu |                            277 event_def: event_pmu |
269            event_legacy_symbol |                  278            event_legacy_symbol |
270            event_legacy_cache sep_dc |            279            event_legacy_cache sep_dc |
271            event_legacy_mem sep_dc |           !! 280            event_legacy_mem |
272            event_legacy_tracepoint sep_dc |       281            event_legacy_tracepoint sep_dc |
273            event_legacy_numeric sep_dc |          282            event_legacy_numeric sep_dc |
274            event_legacy_raw sep_dc             !! 283            event_legacy_raw sep_dc |
                                                   >> 284            event_bpf_file
                                                   >> 285 
                                                   >> 286 event_pmu_name:
                                                   >> 287 PE_NAME | PE_PMU_EVENT_PRE
275                                                   288 
276 event_pmu:                                        289 event_pmu:
277 PE_NAME opt_pmu_config                         !! 290 event_pmu_name opt_pmu_config
278 {                                                 291 {
279         /* List of created evsels. */          !! 292         struct parse_events_state *parse_state = _parse_state;
280         struct list_head *list = NULL;         !! 293         struct parse_events_error *error = parse_state->error;
281         int err = parse_events_multi_pmu_add_o !! 294         struct list_head *list = NULL, *orig_terms = NULL, *terms= NULL;
                                                   >> 295         char *pattern = NULL;
                                                   >> 296 
                                                   >> 297 #define CLEANUP_YYABORT                                 \
                                                   >> 298         do {                                            \
                                                   >> 299                 parse_events_terms__delete($2);         \
                                                   >> 300                 parse_events_terms__delete(orig_terms); \
                                                   >> 301                 free(list);                             \
                                                   >> 302                 free($1);                               \
                                                   >> 303                 free(pattern);                          \
                                                   >> 304                 YYABORT;                                \
                                                   >> 305         } while(0)
                                                   >> 306 
                                                   >> 307         if (parse_events_copy_term_list($2, &orig_terms))
                                                   >> 308                 CLEANUP_YYABORT;
                                                   >> 309 
                                                   >> 310         if (error)
                                                   >> 311                 error->idx = @1.first_column;
282                                                   312 
                                                   >> 313         list = alloc_list();
                                                   >> 314         if (!list)
                                                   >> 315                 CLEANUP_YYABORT;
                                                   >> 316         if (parse_events_add_pmu(_parse_state, list, $1, $2, false, false)) {
                                                   >> 317                 struct perf_pmu *pmu = NULL;
                                                   >> 318                 int ok = 0;
                                                   >> 319 
                                                   >> 320                 if (asprintf(&pattern, "%s*", $1) < 0)
                                                   >> 321                         CLEANUP_YYABORT;
                                                   >> 322 
                                                   >> 323                 while ((pmu = perf_pmu__scan(pmu)) != NULL) {
                                                   >> 324                         char *name = pmu->name;
                                                   >> 325 
                                                   >> 326                         if (!strncmp(name, "uncore_", 7) &&
                                                   >> 327                             strncmp($1, "uncore_", 7))
                                                   >> 328                                 name += 7;
                                                   >> 329                         if (!perf_pmu__match(pattern, name, $1) ||
                                                   >> 330                             !perf_pmu__match(pattern, pmu->alias_name, $1)) {
                                                   >> 331                                 if (parse_events_copy_term_list(orig_terms, &terms))
                                                   >> 332                                         CLEANUP_YYABORT;
                                                   >> 333                                 if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms, true, false))
                                                   >> 334                                         ok++;
                                                   >> 335                                 parse_events_terms__delete(terms);
                                                   >> 336                         }
                                                   >> 337                 }
                                                   >> 338 
                                                   >> 339                 if (!ok)
                                                   >> 340                         CLEANUP_YYABORT;
                                                   >> 341         }
283         parse_events_terms__delete($2);           342         parse_events_terms__delete($2);
                                                   >> 343         parse_events_terms__delete(orig_terms);
                                                   >> 344         free(pattern);
284         free($1);                                 345         free($1);
285         if (err)                               << 
286                 PE_ABORT(err);                 << 
287         $$ = list;                                346         $$ = list;
                                                   >> 347 #undef CLEANUP_YYABORT
288 }                                                 348 }
289 |                                                 349 |
290 PE_NAME sep_dc                                 !! 350 PE_KERNEL_PMU_EVENT sep_dc
291 {                                                 351 {
292         struct list_head *list;                   352         struct list_head *list;
293         int err;                                  353         int err;
294                                                   354 
295         err = parse_events_multi_pmu_add(_pars !! 355         err = parse_events_multi_pmu_add(_parse_state, $1, NULL, &list);
296         if (err < 0) {                         !! 356         free($1);
297                 struct parse_events_state *par !! 357         if (err < 0)
298                 struct parse_events_error *err !! 358                 YYABORT;
299                 char *help;                    !! 359         $$ = list;
                                                   >> 360 }
                                                   >> 361 |
                                                   >> 362 PE_KERNEL_PMU_EVENT opt_pmu_config
                                                   >> 363 {
                                                   >> 364         struct list_head *list;
                                                   >> 365         int err;
300                                                   366 
301                 if (asprintf(&help, "Unable to !! 367         /* frees $2 */
302                         help = NULL;           !! 368         err = parse_events_multi_pmu_add(_parse_state, $1, $2, &list);
303                 parse_events_error__handle(err !! 369         free($1);
304                 free($1);                      !! 370         if (err < 0)
305                 PE_ABORT(err);                 !! 371                 YYABORT;
                                                   >> 372         $$ = list;
                                                   >> 373 }
                                                   >> 374 |
                                                   >> 375 PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc
                                                   >> 376 {
                                                   >> 377         struct list_head *list;
                                                   >> 378         char pmu_name[128];
                                                   >> 379 
                                                   >> 380         snprintf(pmu_name, sizeof(pmu_name), "%s-%s", $1, $3);
                                                   >> 381         free($1);
                                                   >> 382         free($3);
                                                   >> 383         if (parse_events_multi_pmu_add(_parse_state, pmu_name, NULL, &list) < 0)
                                                   >> 384                 YYABORT;
                                                   >> 385         $$ = list;
                                                   >> 386 }
                                                   >> 387 |
                                                   >> 388 PE_PMU_EVENT_FAKE sep_dc
                                                   >> 389 {
                                                   >> 390         struct list_head *list;
                                                   >> 391         int err;
                                                   >> 392 
                                                   >> 393         list = alloc_list();
                                                   >> 394         if (!list)
                                                   >> 395                 YYABORT;
                                                   >> 396 
                                                   >> 397         err = parse_events_add_pmu(_parse_state, list, $1, NULL, false, false);
                                                   >> 398         free($1);
                                                   >> 399         if (err < 0) {
                                                   >> 400                 free(list);
                                                   >> 401                 YYABORT;
306         }                                         402         }
                                                   >> 403         $$ = list;
                                                   >> 404 }
                                                   >> 405 |
                                                   >> 406 PE_PMU_EVENT_FAKE opt_pmu_config
                                                   >> 407 {
                                                   >> 408         struct list_head *list;
                                                   >> 409         int err;
                                                   >> 410 
                                                   >> 411         list = alloc_list();
                                                   >> 412         if (!list)
                                                   >> 413                 YYABORT;
                                                   >> 414 
                                                   >> 415         err = parse_events_add_pmu(_parse_state, list, $1, $2, false, false);
307         free($1);                                 416         free($1);
                                                   >> 417         parse_events_terms__delete($2);
                                                   >> 418         if (err < 0) {
                                                   >> 419                 free(list);
                                                   >> 420                 YYABORT;
                                                   >> 421         }
308         $$ = list;                                422         $$ = list;
309 }                                                 423 }
310                                                   424 
311 value_sym:                                        425 value_sym:
312 PE_VALUE_SYM_HW                                   426 PE_VALUE_SYM_HW
313 |                                                 427 |
314 PE_VALUE_SYM_SW                                   428 PE_VALUE_SYM_SW
315                                                   429 
316 event_legacy_symbol:                              430 event_legacy_symbol:
317 value_sym '/' event_config '/'                    431 value_sym '/' event_config '/'
318 {                                                 432 {
319         struct list_head *list;                   433         struct list_head *list;
320         int type = $1 >> 16;                      434         int type = $1 >> 16;
321         int config = $1 & 255;                    435         int config = $1 & 255;
322         int err;                                  436         int err;
323         bool wildcard = (type == PERF_TYPE_HAR << 
324                                                   437 
325         list = alloc_list();                      438         list = alloc_list();
326         if (!list)                             !! 439         ABORT_ON(!list);
327                 YYNOMEM;                       !! 440         err = parse_events_add_numeric(_parse_state, list, type, config, $3);
328         err = parse_events_add_numeric(_parse_ << 
329         parse_events_terms__delete($3);           441         parse_events_terms__delete($3);
330         if (err) {                                442         if (err) {
331                 free_list_evsel(list);            443                 free_list_evsel(list);
332                 PE_ABORT(err);                 !! 444                 YYABORT;
333         }                                         445         }
334         $$ = list;                                446         $$ = list;
335 }                                                 447 }
336 |                                                 448 |
337 value_sym sep_slash_slash_dc                      449 value_sym sep_slash_slash_dc
338 {                                                 450 {
339         struct list_head *list;                   451         struct list_head *list;
340         int type = $1 >> 16;                      452         int type = $1 >> 16;
341         int config = $1 & 255;                    453         int config = $1 & 255;
342         bool wildcard = (type == PERF_TYPE_HAR << 
343         int err;                               << 
344                                                   454 
345         list = alloc_list();                      455         list = alloc_list();
346         if (!list)                             !! 456         ABORT_ON(!list);
347                 YYNOMEM;                       !! 457         ABORT_ON(parse_events_add_numeric(_parse_state, list, type, config, NULL));
348         err = parse_events_add_numeric(_parse_ << 
349         if (err)                               << 
350                 PE_ABORT(err);                 << 
351         $$ = list;                                458         $$ = list;
352 }                                                 459 }
353 |                                                 460 |
354 PE_VALUE_SYM_TOOL sep_slash_slash_dc              461 PE_VALUE_SYM_TOOL sep_slash_slash_dc
355 {                                                 462 {
356         struct list_head *list;                   463         struct list_head *list;
357         int err;                               << 
358                                                   464 
359         list = alloc_list();                      465         list = alloc_list();
360         if (!list)                             !! 466         ABORT_ON(!list);
361                 YYNOMEM;                       !! 467         ABORT_ON(parse_events_add_tool(_parse_state, list, $1));
362         err = parse_events_add_tool(_parse_sta << 
363         if (err)                               << 
364                 YYNOMEM;                       << 
365         $$ = list;                                468         $$ = list;
366 }                                                 469 }
367                                                   470 
368 event_legacy_cache:                               471 event_legacy_cache:
369 PE_LEGACY_CACHE opt_event_config               !! 472 PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT opt_event_config
370 {                                                 473 {
371         struct parse_events_state *parse_state    474         struct parse_events_state *parse_state = _parse_state;
                                                   >> 475         struct parse_events_error *error = parse_state->error;
372         struct list_head *list;                   476         struct list_head *list;
373         int err;                                  477         int err;
374                                                   478 
375         list = alloc_list();                      479         list = alloc_list();
376         if (!list)                             !! 480         ABORT_ON(!list);
377                 YYNOMEM;                       !! 481         err = parse_events_add_cache(list, &parse_state->idx, $1, $3, $5, error, $6,
                                                   >> 482                                      parse_state);
                                                   >> 483         parse_events_terms__delete($6);
                                                   >> 484         free($1);
                                                   >> 485         free($3);
                                                   >> 486         free($5);
                                                   >> 487         if (err) {
                                                   >> 488                 free_list_evsel(list);
                                                   >> 489                 YYABORT;
                                                   >> 490         }
                                                   >> 491         $$ = list;
                                                   >> 492 }
                                                   >> 493 |
                                                   >> 494 PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT opt_event_config
                                                   >> 495 {
                                                   >> 496         struct parse_events_state *parse_state = _parse_state;
                                                   >> 497         struct parse_events_error *error = parse_state->error;
                                                   >> 498         struct list_head *list;
                                                   >> 499         int err;
378                                                   500 
379         err = parse_events_add_cache(list, &pa !! 501         list = alloc_list();
                                                   >> 502         ABORT_ON(!list);
                                                   >> 503         err = parse_events_add_cache(list, &parse_state->idx, $1, $3, NULL, error, $4,
                                                   >> 504                                      parse_state);
                                                   >> 505         parse_events_terms__delete($4);
                                                   >> 506         free($1);
                                                   >> 507         free($3);
                                                   >> 508         if (err) {
                                                   >> 509                 free_list_evsel(list);
                                                   >> 510                 YYABORT;
                                                   >> 511         }
                                                   >> 512         $$ = list;
                                                   >> 513 }
                                                   >> 514 |
                                                   >> 515 PE_NAME_CACHE_TYPE opt_event_config
                                                   >> 516 {
                                                   >> 517         struct parse_events_state *parse_state = _parse_state;
                                                   >> 518         struct parse_events_error *error = parse_state->error;
                                                   >> 519         struct list_head *list;
                                                   >> 520         int err;
380                                                   521 
                                                   >> 522         list = alloc_list();
                                                   >> 523         ABORT_ON(!list);
                                                   >> 524         err = parse_events_add_cache(list, &parse_state->idx, $1, NULL, NULL, error, $2,
                                                   >> 525                                      parse_state);
381         parse_events_terms__delete($2);           526         parse_events_terms__delete($2);
382         free($1);                                 527         free($1);
383         if (err) {                                528         if (err) {
384                 free_list_evsel(list);            529                 free_list_evsel(list);
385                 PE_ABORT(err);                 !! 530                 YYABORT;
386         }                                         531         }
387         $$ = list;                                532         $$ = list;
388 }                                                 533 }
389                                                   534 
390 event_legacy_mem:                                 535 event_legacy_mem:
391 PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE !! 536 PE_PREFIX_MEM PE_VALUE '/' PE_VALUE ':' PE_MODIFIER_BP sep_dc
392 {                                                 537 {
                                                   >> 538         struct parse_events_state *parse_state = _parse_state;
393         struct list_head *list;                   539         struct list_head *list;
394         int err;                                  540         int err;
395                                                   541 
396         list = alloc_list();                      542         list = alloc_list();
397         if (!list)                             !! 543         ABORT_ON(!list);
398                 YYNOMEM;                       !! 544         err = parse_events_add_breakpoint(list, &parse_state->idx,
399                                                !! 545                                           $2, $6, $4);
400         err = parse_events_add_breakpoint(_par << 
401                                           $2,  << 
402         parse_events_terms__delete($7);        << 
403         free($6);                                 546         free($6);
404         if (err) {                                547         if (err) {
405                 free(list);                       548                 free(list);
406                 PE_ABORT(err);                 !! 549                 YYABORT;
407         }                                         550         }
408         $$ = list;                                551         $$ = list;
409 }                                                 552 }
410 |                                                 553 |
411 PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE op !! 554 PE_PREFIX_MEM PE_VALUE '/' PE_VALUE sep_dc
412 {                                                 555 {
                                                   >> 556         struct parse_events_state *parse_state = _parse_state;
413         struct list_head *list;                   557         struct list_head *list;
414         int err;                               << 
415                                                   558 
416         list = alloc_list();                      559         list = alloc_list();
417         if (!list)                             !! 560         ABORT_ON(!list);
418                 YYNOMEM;                       !! 561         if (parse_events_add_breakpoint(list, &parse_state->idx,
419                                                !! 562                                         $2, NULL, $4)) {
420         err = parse_events_add_breakpoint(_par << 
421                                           $2,  << 
422         parse_events_terms__delete($5);        << 
423         if (err) {                             << 
424                 free(list);                       563                 free(list);
425                 PE_ABORT(err);                 !! 564                 YYABORT;
426         }                                         565         }
427         $$ = list;                                566         $$ = list;
428 }                                                 567 }
429 |                                                 568 |
430 PE_PREFIX_MEM PE_VALUE PE_BP_COLON PE_MODIFIER !! 569 PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
431 {                                                 570 {
                                                   >> 571         struct parse_events_state *parse_state = _parse_state;
432         struct list_head *list;                   572         struct list_head *list;
433         int err;                                  573         int err;
434                                                   574 
435         list = alloc_list();                      575         list = alloc_list();
436         if (!list)                             !! 576         ABORT_ON(!list);
437                 YYNOMEM;                       !! 577         err = parse_events_add_breakpoint(list, &parse_state->idx,
438                                                !! 578                                           $2, $4, 0);
439         err = parse_events_add_breakpoint(_par << 
440                                           $2,  << 
441         parse_events_terms__delete($5);        << 
442         free($4);                                 579         free($4);
443         if (err) {                                580         if (err) {
444                 free(list);                       581                 free(list);
445                 PE_ABORT(err);                 !! 582                 YYABORT;
446         }                                         583         }
447         $$ = list;                                584         $$ = list;
448 }                                                 585 }
449 |                                                 586 |
450 PE_PREFIX_MEM PE_VALUE opt_event_config        !! 587 PE_PREFIX_MEM PE_VALUE sep_dc
451 {                                                 588 {
                                                   >> 589         struct parse_events_state *parse_state = _parse_state;
452         struct list_head *list;                   590         struct list_head *list;
453         int err;                               << 
454                                                   591 
455         list = alloc_list();                      592         list = alloc_list();
456         if (!list)                             !! 593         ABORT_ON(!list);
457                 YYNOMEM;                       !! 594         if (parse_events_add_breakpoint(list, &parse_state->idx,
458         err = parse_events_add_breakpoint(_par !! 595                                         $2, NULL, 0)) {
459                                           $2,  << 
460         parse_events_terms__delete($3);        << 
461         if (err) {                             << 
462                 free(list);                       596                 free(list);
463                 PE_ABORT(err);                 !! 597                 YYABORT;
464         }                                         598         }
465         $$ = list;                                599         $$ = list;
466 }                                                 600 }
467                                                   601 
468 event_legacy_tracepoint:                          602 event_legacy_tracepoint:
469 tracepoint_name opt_event_config                  603 tracepoint_name opt_event_config
470 {                                                 604 {
471         struct parse_events_state *parse_state    605         struct parse_events_state *parse_state = _parse_state;
472         struct parse_events_error *error = par    606         struct parse_events_error *error = parse_state->error;
473         struct list_head *list;                   607         struct list_head *list;
474         int err;                                  608         int err;
475                                                   609 
476         list = alloc_list();                      610         list = alloc_list();
477         if (!list)                             !! 611         ABORT_ON(!list);
478                 YYNOMEM;                       !! 612         if (error)
                                                   >> 613                 error->idx = @1.first_column;
479                                                   614 
480         err = parse_events_add_tracepoint(pars !! 615         err = parse_events_add_tracepoint(list, &parse_state->idx, $1.sys, $1.event,
481                                         error, !! 616                                         error, $2);
482                                                   617 
483         parse_events_terms__delete($2);           618         parse_events_terms__delete($2);
484         free($1.sys);                             619         free($1.sys);
485         free($1.event);                           620         free($1.event);
486         if (err) {                                621         if (err) {
487                 free(list);                       622                 free(list);
488                 PE_ABORT(err);                 !! 623                 YYABORT;
489         }                                         624         }
490         $$ = list;                                625         $$ = list;
491 }                                                 626 }
492                                                   627 
493 tracepoint_name:                                  628 tracepoint_name:
                                                   >> 629 PE_NAME '-' PE_NAME ':' PE_NAME
                                                   >> 630 {
                                                   >> 631         struct tracepoint_name tracepoint;
                                                   >> 632 
                                                   >> 633         ABORT_ON(asprintf(&tracepoint.sys, "%s-%s", $1, $3) < 0);
                                                   >> 634         tracepoint.event = $5;
                                                   >> 635         free($1);
                                                   >> 636         free($3);
                                                   >> 637         $$ = tracepoint;
                                                   >> 638 }
                                                   >> 639 |
494 PE_NAME ':' PE_NAME                               640 PE_NAME ':' PE_NAME
495 {                                                 641 {
496         struct tracepoint_name tracepoint = {$    642         struct tracepoint_name tracepoint = {$1, $3};
497                                                   643 
498         $$ = tracepoint;                          644         $$ = tracepoint;
499 }                                                 645 }
500                                                   646 
501 event_legacy_numeric:                             647 event_legacy_numeric:
502 PE_VALUE ':' PE_VALUE opt_event_config            648 PE_VALUE ':' PE_VALUE opt_event_config
503 {                                                 649 {
504         struct list_head *list;                   650         struct list_head *list;
505         int err;                                  651         int err;
506                                                   652 
507         list = alloc_list();                      653         list = alloc_list();
508         if (!list)                             !! 654         ABORT_ON(!list);
509                 YYNOMEM;                       !! 655         err = parse_events_add_numeric(_parse_state, list, (u32)$1, $3, $4);
510         err = parse_events_add_numeric(_parse_ << 
511                                        /*wildc << 
512         parse_events_terms__delete($4);           656         parse_events_terms__delete($4);
513         if (err) {                                657         if (err) {
514                 free(list);                       658                 free(list);
515                 PE_ABORT(err);                 !! 659                 YYABORT;
516         }                                         660         }
517         $$ = list;                                661         $$ = list;
518 }                                                 662 }
519                                                   663 
520 event_legacy_raw:                                 664 event_legacy_raw:
521 PE_RAW opt_event_config                           665 PE_RAW opt_event_config
522 {                                                 666 {
523         struct list_head *list;                   667         struct list_head *list;
524         int err;                                  668         int err;
525         u64 num;                               << 
526                                                   669 
527         list = alloc_list();                      670         list = alloc_list();
528         if (!list)                             !! 671         ABORT_ON(!list);
529                 YYNOMEM;                       !! 672         err = parse_events_add_numeric(_parse_state, list, PERF_TYPE_RAW, $1, $2);
530         errno = 0;                             !! 673         parse_events_terms__delete($2);
531         num = strtoull($1 + 1, NULL, 16);      !! 674         if (err) {
532         /* Given the lexer will only give [a-f !! 675                 free(list);
533         if (errno)                             << 
534                 YYABORT;                          676                 YYABORT;
                                                   >> 677         }
                                                   >> 678         $$ = list;
                                                   >> 679 }
                                                   >> 680 
                                                   >> 681 event_bpf_file:
                                                   >> 682 PE_BPF_OBJECT opt_event_config
                                                   >> 683 {
                                                   >> 684         struct parse_events_state *parse_state = _parse_state;
                                                   >> 685         struct list_head *list;
                                                   >> 686         int err;
                                                   >> 687 
                                                   >> 688         list = alloc_list();
                                                   >> 689         ABORT_ON(!list);
                                                   >> 690         err = parse_events_load_bpf(parse_state, list, $1, false, $2);
                                                   >> 691         parse_events_terms__delete($2);
535         free($1);                                 692         free($1);
536         err = parse_events_add_numeric(_parse_ !! 693         if (err) {
537                                        /*wildc !! 694                 free(list);
                                                   >> 695                 YYABORT;
                                                   >> 696         }
                                                   >> 697         $$ = list;
                                                   >> 698 }
                                                   >> 699 |
                                                   >> 700 PE_BPF_SOURCE opt_event_config
                                                   >> 701 {
                                                   >> 702         struct list_head *list;
                                                   >> 703         int err;
                                                   >> 704 
                                                   >> 705         list = alloc_list();
                                                   >> 706         ABORT_ON(!list);
                                                   >> 707         err = parse_events_load_bpf(_parse_state, list, $1, true, $2);
538         parse_events_terms__delete($2);           708         parse_events_terms__delete($2);
539         if (err) {                                709         if (err) {
540                 free(list);                       710                 free(list);
541                 PE_ABORT(err);                 !! 711                 YYABORT;
542         }                                         712         }
543         $$ = list;                                713         $$ = list;
544 }                                                 714 }
545                                                   715 
546 opt_event_config:                                 716 opt_event_config:
547 '/' event_config '/'                              717 '/' event_config '/'
548 {                                                 718 {
549         $$ = $2;                                  719         $$ = $2;
550 }                                                 720 }
551 |                                                 721 |
552 '/' '/'                                           722 '/' '/'
553 {                                                 723 {
554         $$ = NULL;                                724         $$ = NULL;
555 }                                                 725 }
556 |                                                 726 |
557 {                                                 727 {
558         $$ = NULL;                                728         $$ = NULL;
559 }                                                 729 }
560                                                   730 
561 opt_pmu_config:                                   731 opt_pmu_config:
562 '/' event_config '/'                              732 '/' event_config '/'
563 {                                                 733 {
564         $$ = $2;                                  734         $$ = $2;
565 }                                                 735 }
566 |                                                 736 |
567 '/' '/'                                           737 '/' '/'
568 {                                                 738 {
569         $$ = NULL;                                739         $$ = NULL;
570 }                                                 740 }
571                                                   741 
572 start_terms: event_config                         742 start_terms: event_config
573 {                                                 743 {
574         struct parse_events_state *parse_state    744         struct parse_events_state *parse_state = _parse_state;
575         if (parse_state->terms) {                 745         if (parse_state->terms) {
576                 parse_events_terms__delete ($1    746                 parse_events_terms__delete ($1);
577                 YYABORT;                          747                 YYABORT;
578         }                                         748         }
579         parse_state->terms = $1;                  749         parse_state->terms = $1;
580 }                                                 750 }
581                                                   751 
582 event_config:                                     752 event_config:
583 event_config ',' event_term                       753 event_config ',' event_term
584 {                                                 754 {
585         struct parse_events_terms *head = $1;  !! 755         struct list_head *head = $1;
586         struct parse_events_term *term = $3;      756         struct parse_events_term *term = $3;
587                                                   757 
588         if (!head) {                              758         if (!head) {
589                 parse_events_term__delete(term    759                 parse_events_term__delete(term);
590                 YYABORT;                          760                 YYABORT;
591         }                                         761         }
592         list_add_tail(&term->list, &head->term !! 762         list_add_tail(&term->list, head);
593         $$ = $1;                                  763         $$ = $1;
594 }                                                 764 }
595 |                                                 765 |
596 event_term                                        766 event_term
597 {                                                 767 {
598         struct parse_events_terms *head = mall !! 768         struct list_head *head = malloc(sizeof(*head));
599         struct parse_events_term *term = $1;      769         struct parse_events_term *term = $1;
600                                                   770 
601         if (!head)                             !! 771         ABORT_ON(!head);
602                 YYNOMEM;                       !! 772         INIT_LIST_HEAD(head);
603         parse_events_terms__init(head);        !! 773         list_add_tail(&term->list, head);
604         list_add_tail(&term->list, &head->term << 
605         $$ = head;                                774         $$ = head;
606 }                                                 775 }
607                                                   776 
608 name_or_raw: PE_RAW | PE_NAME | PE_LEGACY_CACH << 
609 |                                              << 
610 PE_TERM_HW                                     << 
611 {                                              << 
612         $$ = $1.str;                           << 
613 }                                              << 
614                                                << 
615 event_term:                                       777 event_term:
616 PE_RAW                                            778 PE_RAW
617 {                                                 779 {
618         struct parse_events_term *term;           780         struct parse_events_term *term;
619         int err = parse_events_term__str(&term << 
620                                          strdu << 
621                                                   781 
622         if (err) {                             !! 782         ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_CONFIG,
623                 free($1);                      !! 783                                         NULL, $1, false, &@1, NULL));
624                 PE_ABORT(err);                 << 
625         }                                      << 
626         $$ = term;                                784         $$ = term;
627 }                                                 785 }
628 |                                                 786 |
629 name_or_raw '=' name_or_raw                    !! 787 PE_NAME '=' PE_NAME
630 {                                                 788 {
631         struct parse_events_term *term;           789         struct parse_events_term *term;
632         int err = parse_events_term__str(&term << 
633                                                   790 
634         if (err) {                             !! 791         if (parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER,
                                                   >> 792                                         $1, $3, &@1, &@3)) {
635                 free($1);                         793                 free($1);
636                 free($3);                         794                 free($3);
637                 PE_ABORT(err);                 !! 795                 YYABORT;
638         }                                         796         }
639         $$ = term;                                797         $$ = term;
640 }                                                 798 }
641 |                                                 799 |
642 name_or_raw '=' PE_VALUE                       !! 800 PE_NAME '=' PE_VALUE
643 {                                                 801 {
644         struct parse_events_term *term;           802         struct parse_events_term *term;
645         int err = parse_events_term__num(&term << 
646                                          $1, $ << 
647                                                   803 
648         if (err) {                             !! 804         if (parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
                                                   >> 805                                         $1, $3, false, &@1, &@3)) {
649                 free($1);                         806                 free($1);
650                 PE_ABORT(err);                 !! 807                 YYABORT;
651         }                                         808         }
652         $$ = term;                                809         $$ = term;
653 }                                                 810 }
654 |                                                 811 |
655 PE_LEGACY_CACHE                                !! 812 PE_NAME '=' PE_VALUE_SYM_HW
656 {                                                 813 {
657         struct parse_events_term *term;           814         struct parse_events_term *term;
658         int err = parse_events_term__num(&term !! 815         int config = $3 & 255;
659                                          $1, / << 
660                                                   816 
661         if (err) {                             !! 817         if (parse_events_term__sym_hw(&term, $1, config)) {
662                 free($1);                         818                 free($1);
663                 PE_ABORT(err);                 !! 819                 YYABORT;
664         }                                         820         }
665         $$ = term;                                821         $$ = term;
666 }                                                 822 }
667 |                                                 823 |
668 PE_NAME                                           824 PE_NAME
669 {                                                 825 {
670         struct parse_events_term *term;           826         struct parse_events_term *term;
671         int err = parse_events_term__num(&term << 
672                                          $1, / << 
673                                                   827 
674         if (err) {                             !! 828         if (parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
                                                   >> 829                                         $1, 1, true, &@1, NULL)) {
675                 free($1);                         830                 free($1);
676                 PE_ABORT(err);                 !! 831                 YYABORT;
677         }                                         832         }
678         $$ = term;                                833         $$ = term;
679 }                                                 834 }
680 |                                                 835 |
681 PE_TERM_HW                                     !! 836 PE_VALUE_SYM_HW
682 {                                                 837 {
683         struct parse_events_term *term;           838         struct parse_events_term *term;
684         int err = parse_events_term__num(&term !! 839         int config = $1 & 255;
685                                          $1.st << 
686                                          &@1,  << 
687                                                   840 
688         if (err) {                             !! 841         ABORT_ON(parse_events_term__sym_hw(&term, NULL, config));
689                 free($1.str);                  << 
690                 PE_ABORT(err);                 << 
691         }                                      << 
692         $$ = term;                                842         $$ = term;
693 }                                                 843 }
694 |                                                 844 |
695 PE_TERM '=' name_or_raw                        !! 845 PE_TERM '=' PE_NAME
696 {                                                 846 {
697         struct parse_events_term *term;           847         struct parse_events_term *term;
698         int err = parse_events_term__str(&term << 
699                                                   848 
700         if (err) {                             !! 849         if (parse_events_term__str(&term, (int)$1, NULL, $3, &@1, &@3)) {
701                 free($3);                         850                 free($3);
702                 PE_ABORT(err);                 !! 851                 YYABORT;
703         }                                         852         }
704         $$ = term;                                853         $$ = term;
705 }                                                 854 }
706 |                                                 855 |
707 PE_TERM '=' PE_TERM                            !! 856 PE_TERM '=' PE_VALUE
708 {                                                 857 {
709         struct parse_events_term *term;           858         struct parse_events_term *term;
710         int err = parse_events_term__term(&ter << 
711                                                << 
712         if (err)                               << 
713                 PE_ABORT(err);                 << 
714                                                   859 
                                                   >> 860         ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3, false, &@1, &@3));
715         $$ = term;                                861         $$ = term;
716 }                                                 862 }
717 |                                                 863 |
718 PE_TERM '=' PE_VALUE                           !! 864 PE_TERM
719 {                                                 865 {
720         struct parse_events_term *term;           866         struct parse_events_term *term;
721         int err = parse_events_term__num(&term << 
722                                          /*con << 
723                                          &@1,  << 
724                                                << 
725         if (err)                               << 
726                 PE_ABORT(err);                 << 
727                                                   867 
                                                   >> 868         ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1, true, &@1, NULL));
728         $$ = term;                                869         $$ = term;
729 }                                                 870 }
730 |                                                 871 |
731 PE_TERM                                        !! 872 PE_NAME array '=' PE_NAME
732 {                                                 873 {
733         struct parse_events_term *term;           874         struct parse_events_term *term;
734         int err = parse_events_term__num(&term << 
735                                          /*con << 
736                                          &@1,  << 
737                                                   875 
738         if (err)                               !! 876         if (parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER,
739                 PE_ABORT(err);                 !! 877                                         $1, $4, &@1, &@4)) {
                                                   >> 878                 free($1);
                                                   >> 879                 free($4);
                                                   >> 880                 free($2.ranges);
                                                   >> 881                 YYABORT;
                                                   >> 882         }
                                                   >> 883         term->array = $2;
                                                   >> 884         $$ = term;
                                                   >> 885 }
                                                   >> 886 |
                                                   >> 887 PE_NAME array '=' PE_VALUE
                                                   >> 888 {
                                                   >> 889         struct parse_events_term *term;
740                                                   890 
                                                   >> 891         if (parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
                                                   >> 892                                         $1, $4, false, &@1, &@4)) {
                                                   >> 893                 free($1);
                                                   >> 894                 free($2.ranges);
                                                   >> 895                 YYABORT;
                                                   >> 896         }
                                                   >> 897         term->array = $2;
741         $$ = term;                                898         $$ = term;
742 }                                                 899 }
743 |                                                 900 |
744 PE_DRV_CFG_TERM                                   901 PE_DRV_CFG_TERM
745 {                                                 902 {
746         struct parse_events_term *term;           903         struct parse_events_term *term;
747         char *config = strdup($1);                904         char *config = strdup($1);
748         int err;                               << 
749                                                   905 
750         if (!config)                           !! 906         ABORT_ON(!config);
751                 YYNOMEM;                       !! 907         if (parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_DRV_CFG,
752         err = parse_events_term__str(&term, PA !! 908                                         config, $1, &@1, NULL)) {
753         if (err) {                             << 
754                 free($1);                         909                 free($1);
755                 free(config);                     910                 free(config);
756                 PE_ABORT(err);                 !! 911                 YYABORT;
757         }                                         912         }
758         $$ = term;                                913         $$ = term;
759 }                                                 914 }
760                                                   915 
                                                   >> 916 array:
                                                   >> 917 '[' array_terms ']'
                                                   >> 918 {
                                                   >> 919         $$ = $2;
                                                   >> 920 }
                                                   >> 921 |
                                                   >> 922 PE_ARRAY_ALL
                                                   >> 923 {
                                                   >> 924         $$.nr_ranges = 0;
                                                   >> 925         $$.ranges = NULL;
                                                   >> 926 }
                                                   >> 927 
                                                   >> 928 array_terms:
                                                   >> 929 array_terms ',' array_term
                                                   >> 930 {
                                                   >> 931         struct parse_events_array new_array;
                                                   >> 932 
                                                   >> 933         new_array.nr_ranges = $1.nr_ranges + $3.nr_ranges;
                                                   >> 934         new_array.ranges = realloc($1.ranges,
                                                   >> 935                                 sizeof(new_array.ranges[0]) *
                                                   >> 936                                 new_array.nr_ranges);
                                                   >> 937         ABORT_ON(!new_array.ranges);
                                                   >> 938         memcpy(&new_array.ranges[$1.nr_ranges], $3.ranges,
                                                   >> 939                $3.nr_ranges * sizeof(new_array.ranges[0]));
                                                   >> 940         free($3.ranges);
                                                   >> 941         $$ = new_array;
                                                   >> 942 }
                                                   >> 943 |
                                                   >> 944 array_term
                                                   >> 945 
                                                   >> 946 array_term:
                                                   >> 947 PE_VALUE
                                                   >> 948 {
                                                   >> 949         struct parse_events_array array;
                                                   >> 950 
                                                   >> 951         array.nr_ranges = 1;
                                                   >> 952         array.ranges = malloc(sizeof(array.ranges[0]));
                                                   >> 953         ABORT_ON(!array.ranges);
                                                   >> 954         array.ranges[0].start = $1;
                                                   >> 955         array.ranges[0].length = 1;
                                                   >> 956         $$ = array;
                                                   >> 957 }
                                                   >> 958 |
                                                   >> 959 PE_VALUE PE_ARRAY_RANGE PE_VALUE
                                                   >> 960 {
                                                   >> 961         struct parse_events_array array;
                                                   >> 962 
                                                   >> 963         ABORT_ON($3 < $1);
                                                   >> 964         array.nr_ranges = 1;
                                                   >> 965         array.ranges = malloc(sizeof(array.ranges[0]));
                                                   >> 966         ABORT_ON(!array.ranges);
                                                   >> 967         array.ranges[0].start = $1;
                                                   >> 968         array.ranges[0].length = $3 - $1 + 1;
                                                   >> 969         $$ = array;
                                                   >> 970 }
                                                   >> 971 
761 sep_dc: ':' |                                     972 sep_dc: ':' |
762                                                   973 
763 sep_slash_slash_dc: '/' '/' | ':' |               974 sep_slash_slash_dc: '/' '/' | ':' |
764                                                   975 
765 %%                                                976 %%
766                                                   977 
767 void parse_events_error(YYLTYPE *loc, void *_p !! 978 void parse_events_error(YYLTYPE *loc, void *parse_state,
768                         void *scanner __maybe_    979                         void *scanner __maybe_unused,
769                         char const *msg __mayb    980                         char const *msg __maybe_unused)
770 {                                                 981 {
771         struct parse_events_state *parse_state !! 982         parse_events_evlist_error(parse_state, loc->last_column, "parser error");
772                                                << 
773         if (!parse_state->error || !list_empty << 
774                 return;                        << 
775                                                << 
776         parse_events_error__handle(parse_state << 
777                                    strdup("Unr << 
778 }                                                 983 }
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php