~ [ 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.4.285)


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

~ [ 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