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


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

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