aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-03-20 14:15:40 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-03-22 14:11:38 -0400
commit5d7be90ed5cfb5dd3c9ab726d7daa91b86b81747 (patch)
tree9b40166a00566af8bef1c388d51b8863a92cc6fe /tools/perf
parent9fafd98f1bf14276f95b69f0186ad5675f1e1a18 (diff)
perf tools: Fix modifier to be applied on correct events
The event modifier needs to be applied only on the event definition it is attached to. The current state is that in case of multiple events definition (in single '-e' option, separated by ',') all will get modifier of the last one. Fixing this by adding separated list for each event definition, so the modifier is applied only to proper event(s). Added automated test to catch this, plus some other modifier tests. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1332267341-26338-3-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-test.c116
-rw-r--r--tools/perf/util/parse-events-bison.c675
-rw-r--r--tools/perf/util/parse-events-bison.h15
-rw-r--r--tools/perf/util/parse-events.c27
-rw-r--r--tools/perf/util/parse-events.h7
-rw-r--r--tools/perf/util/parse-events.y40
6 files changed, 543 insertions, 337 deletions
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 86874238a350..1c5b9801ac61 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -877,6 +877,58 @@ static int test__checkevent_genhw_modifier(struct perf_evlist *evlist)
877 return test__checkevent_genhw(evlist); 877 return test__checkevent_genhw(evlist);
878} 878}
879 879
880static int test__checkevent_breakpoint_modifier(struct perf_evlist *evlist)
881{
882 struct perf_evsel *evsel = list_entry(evlist->entries.next,
883 struct perf_evsel, node);
884
885 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
886 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
887 TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
888 TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
889
890 return test__checkevent_breakpoint(evlist);
891}
892
893static int test__checkevent_breakpoint_x_modifier(struct perf_evlist *evlist)
894{
895 struct perf_evsel *evsel = list_entry(evlist->entries.next,
896 struct perf_evsel, node);
897
898 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
899 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
900 TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
901 TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
902
903 return test__checkevent_breakpoint_x(evlist);
904}
905
906static int test__checkevent_breakpoint_r_modifier(struct perf_evlist *evlist)
907{
908 struct perf_evsel *evsel = list_entry(evlist->entries.next,
909 struct perf_evsel, node);
910
911 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
912 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
913 TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
914 TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
915
916 return test__checkevent_breakpoint_r(evlist);
917}
918
919static int test__checkevent_breakpoint_w_modifier(struct perf_evlist *evlist)
920{
921 struct perf_evsel *evsel = list_entry(evlist->entries.next,
922 struct perf_evsel, node);
923
924 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
925 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
926 TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
927 TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
928
929 return test__checkevent_breakpoint_w(evlist);
930}
931
880static int test__checkevent_pmu(struct perf_evlist *evlist) 932static int test__checkevent_pmu(struct perf_evlist *evlist)
881{ 933{
882 934
@@ -893,6 +945,47 @@ static int test__checkevent_pmu(struct perf_evlist *evlist)
893 return 0; 945 return 0;
894} 946}
895 947
948static int test__checkevent_list(struct perf_evlist *evlist)
949{
950 struct perf_evsel *evsel;
951
952 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries);
953
954 /* r1 */
955 evsel = list_entry(evlist->entries.next, struct perf_evsel, node);
956 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
957 TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config);
958 TEST_ASSERT_VAL("wrong config1", 0 == evsel->attr.config1);
959 TEST_ASSERT_VAL("wrong config2", 0 == evsel->attr.config2);
960 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
961 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
962 TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
963 TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
964
965 /* syscalls:sys_enter_open:k */
966 evsel = list_entry(evsel->node.next, struct perf_evsel, node);
967 TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type);
968 TEST_ASSERT_VAL("wrong sample_type",
969 (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | PERF_SAMPLE_CPU) ==
970 evsel->attr.sample_type);
971 TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period);
972 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
973 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
974 TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
975 TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
976
977 /* 1:1:hp */
978 evsel = list_entry(evsel->node.next, struct perf_evsel, node);
979 TEST_ASSERT_VAL("wrong type", 1 == evsel->attr.type);
980 TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config);
981 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
982 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
983 TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
984 TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
985
986 return 0;
987}
988
896static struct test__event_st { 989static struct test__event_st {
897 const char *name; 990 const char *name;
898 __u32 type; 991 __u32 type;
@@ -975,9 +1068,29 @@ static struct test__event_st {
975 .check = test__checkevent_genhw_modifier, 1068 .check = test__checkevent_genhw_modifier,
976 }, 1069 },
977 { 1070 {
1071 .name = "mem:0:u",
1072 .check = test__checkevent_breakpoint_modifier,
1073 },
1074 {
1075 .name = "mem:0:x:k",
1076 .check = test__checkevent_breakpoint_x_modifier,
1077 },
1078 {
1079 .name = "mem:0:r:hp",
1080 .check = test__checkevent_breakpoint_r_modifier,
1081 },
1082 {
1083 .name = "mem:0:w:up",
1084 .check = test__checkevent_breakpoint_w_modifier,
1085 },
1086 {
978 .name = "cpu/config=10,config1,config2=3,period=1000/u", 1087 .name = "cpu/config=10,config1,config2=3,period=1000/u",
979 .check = test__checkevent_pmu, 1088 .check = test__checkevent_pmu,
980 }, 1089 },
1090 {
1091 .name = "r1,syscalls:sys_enter_open:k,1:1:hp",
1092 .check = test__checkevent_list,
1093 },
981}; 1094};
982 1095
983#define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st)) 1096#define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st))
@@ -1003,10 +1116,9 @@ static int test__parse_events(void)
1003 } 1116 }
1004 1117
1005 ret = e->check(evlist); 1118 ret = e->check(evlist);
1119 perf_evlist__delete(evlist);
1006 if (ret) 1120 if (ret)
1007 break; 1121 break;
1008
1009 perf_evlist__delete(evlist);
1010 } 1122 }
1011 1123
1012 return ret; 1124 return ret;
diff --git a/tools/perf/util/parse-events-bison.c b/tools/perf/util/parse-events-bison.c
index 4a0fd6d5cebf..4a4e02aff34e 100644
--- a/tools/perf/util/parse-events-bison.c
+++ b/tools/perf/util/parse-events-bison.c
@@ -1,9 +1,8 @@
1/* A Bison parser, made by GNU Bison 2.4.3. */ 1/* A Bison parser, made by GNU Bison 2.5. */
2 2
3/* Skeleton implementation for Bison's Yacc-like parsers in C 3/* Bison implementation for Yacc-like parsers in C
4 4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6 2009, 2010 Free Software Foundation, Inc.
7 6
8 This program is free software: you can redistribute it and/or modify 7 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
@@ -45,7 +44,7 @@
45#define YYBISON 1 44#define YYBISON 1
46 45
47/* Bison version. */ 46/* Bison version. */
48#define YYBISON_VERSION "2.4.3" 47#define YYBISON_VERSION "2.5"
49 48
50/* Skeleton name. */ 49/* Skeleton name. */
51#define YYSKELETON_NAME "yacc.c" 50#define YYSKELETON_NAME "yacc.c"
@@ -74,8 +73,8 @@
74 73
75/* Copy the first part of user declarations. */ 74/* Copy the first part of user declarations. */
76 75
77/* Line 189 of yacc.c */ 76/* Line 268 of yacc.c */
78#line 6 "util/parse-events.y" 77#line 7 "util/parse-events.y"
79 78
80 79
81#define YYDEBUG 1 80#define YYDEBUG 1
@@ -96,8 +95,8 @@ do { \
96 95
97 96
98 97
99/* Line 189 of yacc.c */ 98/* Line 268 of yacc.c */
100#line 101 "util/parse-events-bison.c" 99#line 100 "util/parse-events-bison.c"
101 100
102/* Enabling traces. */ 101/* Enabling traces. */
103#ifndef YYDEBUG 102#ifndef YYDEBUG
@@ -145,8 +144,8 @@ do { \
145typedef union YYSTYPE 144typedef union YYSTYPE
146{ 145{
147 146
148/* Line 214 of yacc.c */ 147/* Line 293 of yacc.c */
149#line 45 "util/parse-events.y" 148#line 46 "util/parse-events.y"
150 149
151 char *str; 150 char *str;
152 unsigned long num; 151 unsigned long num;
@@ -155,8 +154,8 @@ typedef union YYSTYPE
155 154
156 155
157 156
158/* Line 214 of yacc.c */ 157/* Line 293 of yacc.c */
159#line 160 "util/parse-events-bison.c" 158#line 159 "util/parse-events-bison.c"
160} YYSTYPE; 159} YYSTYPE;
161# define YYSTYPE_IS_TRIVIAL 1 160# define YYSTYPE_IS_TRIVIAL 1
162# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 161# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -167,8 +166,8 @@ typedef union YYSTYPE
167/* Copy the second part of user declarations. */ 166/* Copy the second part of user declarations. */
168 167
169 168
170/* Line 264 of yacc.c */ 169/* Line 343 of yacc.c */
171#line 172 "util/parse-events-bison.c" 170#line 171 "util/parse-events-bison.c"
172 171
173#ifdef short 172#ifdef short
174# undef short 173# undef short
@@ -271,11 +270,11 @@ YYID (yyi)
271# define alloca _alloca 270# define alloca _alloca
272# else 271# else
273# define YYSTACK_ALLOC alloca 272# define YYSTACK_ALLOC alloca
274# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 273# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
275 || defined __cplusplus || defined _MSC_VER) 274 || defined __cplusplus || defined _MSC_VER)
276# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 275# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
277# ifndef _STDLIB_H 276# ifndef EXIT_SUCCESS
278# define _STDLIB_H 1 277# define EXIT_SUCCESS 0
279# endif 278# endif
280# endif 279# endif
281# endif 280# endif
@@ -298,24 +297,24 @@ YYID (yyi)
298# ifndef YYSTACK_ALLOC_MAXIMUM 297# ifndef YYSTACK_ALLOC_MAXIMUM
299# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 298# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
300# endif 299# endif
301# if (defined __cplusplus && ! defined _STDLIB_H \ 300# if (defined __cplusplus && ! defined EXIT_SUCCESS \
302 && ! ((defined YYMALLOC || defined malloc) \ 301 && ! ((defined YYMALLOC || defined malloc) \
303 && (defined YYFREE || defined free))) 302 && (defined YYFREE || defined free)))
304# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 303# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
305# ifndef _STDLIB_H 304# ifndef EXIT_SUCCESS
306# define _STDLIB_H 1 305# define EXIT_SUCCESS 0
307# endif 306# endif
308# endif 307# endif
309# ifndef YYMALLOC 308# ifndef YYMALLOC
310# define YYMALLOC malloc 309# define YYMALLOC malloc
311# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 310# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
312 || defined __cplusplus || defined _MSC_VER) 311 || defined __cplusplus || defined _MSC_VER)
313void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 312void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
314# endif 313# endif
315# endif 314# endif
316# ifndef YYFREE 315# ifndef YYFREE
317# define YYFREE free 316# define YYFREE free
318# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 317# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
319 || defined __cplusplus || defined _MSC_VER) 318 || defined __cplusplus || defined _MSC_VER)
320void free (void *); /* INFRINGES ON USER NAME SPACE */ 319void free (void *); /* INFRINGES ON USER NAME SPACE */
321# endif 320# endif
@@ -344,23 +343,7 @@ union yyalloc
344 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 343 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
345 + YYSTACK_GAP_MAXIMUM) 344 + YYSTACK_GAP_MAXIMUM)
346 345
347/* Copy COUNT objects from FROM to TO. The source and destination do 346# define YYCOPY_NEEDED 1
348 not overlap. */
349# ifndef YYCOPY
350# if defined __GNUC__ && 1 < __GNUC__
351# define YYCOPY(To, From, Count) \
352 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
353# else
354# define YYCOPY(To, From, Count) \
355 do \
356 { \
357 YYSIZE_T yyi; \
358 for (yyi = 0; yyi < (Count); yyi++) \
359 (To)[yyi] = (From)[yyi]; \
360 } \
361 while (YYID (0))
362# endif
363# endif
364 347
365/* Relocate STACK from its old location to the new one. The 348/* Relocate STACK from its old location to the new one. The
366 local variables YYSIZE and YYSTACKSIZE give the old and new number of 349 local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -380,6 +363,26 @@ union yyalloc
380 363
381#endif 364#endif
382 365
366#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
367/* Copy COUNT objects from FROM to TO. The source and destination do
368 not overlap. */
369# ifndef YYCOPY
370# if defined __GNUC__ && 1 < __GNUC__
371# define YYCOPY(To, From, Count) \
372 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
373# else
374# define YYCOPY(To, From, Count) \
375 do \
376 { \
377 YYSIZE_T yyi; \
378 for (yyi = 0; yyi < (Count); yyi++) \
379 (To)[yyi] = (From)[yyi]; \
380 } \
381 while (YYID (0))
382# endif
383# endif
384#endif /* !YYCOPY_NEEDED */
385
383/* YYFINAL -- State number of the termination state. */ 386/* YYFINAL -- State number of the termination state. */
384#define YYFINAL 25 387#define YYFINAL 25
385/* YYLAST -- Last index in YYTABLE. */ 388/* YYLAST -- Last index in YYTABLE. */
@@ -463,10 +466,10 @@ static const yytype_int8 yyrhs[] =
463/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 466/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
464static const yytype_uint8 yyrline[] = 467static const yytype_uint8 yyrline[] =
465{ 468{
466 0, 54, 54, 54, 57, 62, 64, 65, 66, 67, 469 0, 55, 55, 55, 58, 69, 74, 75, 76, 77,
467 68, 69, 70, 73, 80, 89, 98, 103, 108, 114, 470 78, 79, 80, 83, 90, 99, 108, 113, 118, 124,
468 119, 125, 131, 137, 143, 153, 165, 174, 183, 192, 471 129, 135, 141, 147, 153, 163, 175, 184, 193, 202,
469 200, 208, 208, 210, 210, 210 472 210, 218, 218, 220, 220, 220
470}; 473};
471#endif 474#endif
472 475
@@ -514,8 +517,8 @@ static const yytype_uint8 yyr2[] =
514 1, 1, 0, 1, 1, 0 517 1, 1, 0, 1, 1, 0
515}; 518};
516 519
517/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 520/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
518 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 521 Performed when YYTABLE doesn't specify something else to do. Zero
519 means the default is an error. */ 522 means the default is an error. */
520static const yytype_uint8 yydefact[] = 523static const yytype_uint8 yydefact[] =
521{ 524{
@@ -556,8 +559,7 @@ static const yytype_int8 yypgoto[] =
556 559
557/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 560/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
558 positive, shift that token. If negative, reduce the rule which 561 positive, shift that token. If negative, reduce the rule which
559 number is the opposite. If zero, do what YYDEFACT says. 562 number is the opposite. If YYTABLE_NINF, syntax error. */
560 If YYTABLE_NINF, syntax error. */
561#define YYTABLE_NINF -1 563#define YYTABLE_NINF -1
562static const yytype_uint8 yytable[] = 564static const yytype_uint8 yytable[] =
563{ 565{
@@ -568,6 +570,12 @@ static const yytype_uint8 yytable[] =
568 38, 54, 0, 43 570 38, 54, 0, 43
569}; 571};
570 572
573#define yypact_value_is_default(yystate) \
574 ((yystate) == (-15))
575
576#define yytable_value_is_error(yytable_value) \
577 YYID (0)
578
571static const yytype_int8 yycheck[] = 579static const yytype_int8 yycheck[] =
572{ 580{
573 14, 15, 16, 0, 3, 4, 5, 16, 7, 18, 581 14, 15, 16, 0, 3, 4, 5, 16, 7, 18,
@@ -622,13 +630,12 @@ do \
622 { \ 630 { \
623 yychar = (Token); \ 631 yychar = (Token); \
624 yylval = (Value); \ 632 yylval = (Value); \
625 yytoken = YYTRANSLATE (yychar); \
626 YYPOPSTACK (1); \ 633 YYPOPSTACK (1); \
627 goto yybackup; \ 634 goto yybackup; \
628 } \ 635 } \
629 else \ 636 else \
630 { \ 637 { \
631 yyerror (list, idx, YY_("syntax error: cannot back up")); \ 638 yyerror (list_all, list_event, idx, YY_("syntax error: cannot back up")); \
632 YYERROR; \ 639 YYERROR; \
633 } \ 640 } \
634while (YYID (0)) 641while (YYID (0))
@@ -664,19 +671,10 @@ while (YYID (0))
664#endif 671#endif
665 672
666 673
667/* YY_LOCATION_PRINT -- Print the location on the stream. 674/* This macro is provided for backward compatibility. */
668 This macro was not mandated originally: define only if we know
669 we won't break user code: when these are the locations we know. */
670 675
671#ifndef YY_LOCATION_PRINT 676#ifndef YY_LOCATION_PRINT
672# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL 677# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
673# define YY_LOCATION_PRINT(File, Loc) \
674 fprintf (File, "%d.%d-%d.%d", \
675 (Loc).first_line, (Loc).first_column, \
676 (Loc).last_line, (Loc).last_column)
677# else
678# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
679# endif
680#endif 678#endif
681 679
682 680
@@ -708,7 +706,7 @@ do { \
708 { \ 706 { \
709 YYFPRINTF (stderr, "%s ", Title); \ 707 YYFPRINTF (stderr, "%s ", Title); \
710 yy_symbol_print (stderr, \ 708 yy_symbol_print (stderr, \
711 Type, Value, list, idx); \ 709 Type, Value, list_all, list_event, idx); \
712 YYFPRINTF (stderr, "\n"); \ 710 YYFPRINTF (stderr, "\n"); \
713 } \ 711 } \
714} while (YYID (0)) 712} while (YYID (0))
@@ -722,20 +720,22 @@ do { \
722#if (defined __STDC__ || defined __C99__FUNC__ \ 720#if (defined __STDC__ || defined __C99__FUNC__ \
723 || defined __cplusplus || defined _MSC_VER) 721 || defined __cplusplus || defined _MSC_VER)
724static void 722static void
725yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list, int *idx) 723yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list_all, struct list_head *list_event, int *idx)
726#else 724#else
727static void 725static void
728yy_symbol_value_print (yyoutput, yytype, yyvaluep, list, idx) 726yy_symbol_value_print (yyoutput, yytype, yyvaluep, list_all, list_event, idx)
729 FILE *yyoutput; 727 FILE *yyoutput;
730 int yytype; 728 int yytype;
731 YYSTYPE const * const yyvaluep; 729 YYSTYPE const * const yyvaluep;
732 struct list_head *list; 730 struct list_head *list_all;
731 struct list_head *list_event;
733 int *idx; 732 int *idx;
734#endif 733#endif
735{ 734{
736 if (!yyvaluep) 735 if (!yyvaluep)
737 return; 736 return;
738 YYUSE (list); 737 YYUSE (list_all);
738 YYUSE (list_event);
739 YYUSE (idx); 739 YYUSE (idx);
740# ifdef YYPRINT 740# ifdef YYPRINT
741 if (yytype < YYNTOKENS) 741 if (yytype < YYNTOKENS)
@@ -758,14 +758,15 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, list, idx)
758#if (defined __STDC__ || defined __C99__FUNC__ \ 758#if (defined __STDC__ || defined __C99__FUNC__ \
759 || defined __cplusplus || defined _MSC_VER) 759 || defined __cplusplus || defined _MSC_VER)
760static void 760static void
761yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list, int *idx) 761yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list_all, struct list_head *list_event, int *idx)
762#else 762#else
763static void 763static void
764yy_symbol_print (yyoutput, yytype, yyvaluep, list, idx) 764yy_symbol_print (yyoutput, yytype, yyvaluep, list_all, list_event, idx)
765 FILE *yyoutput; 765 FILE *yyoutput;
766 int yytype; 766 int yytype;
767 YYSTYPE const * const yyvaluep; 767 YYSTYPE const * const yyvaluep;
768 struct list_head *list; 768 struct list_head *list_all;
769 struct list_head *list_event;
769 int *idx; 770 int *idx;
770#endif 771#endif
771{ 772{
@@ -774,7 +775,7 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, list, idx)
774 else 775 else
775 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 776 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
776 777
777 yy_symbol_value_print (yyoutput, yytype, yyvaluep, list, idx); 778 yy_symbol_value_print (yyoutput, yytype, yyvaluep, list_all, list_event, idx);
778 YYFPRINTF (yyoutput, ")"); 779 YYFPRINTF (yyoutput, ")");
779} 780}
780 781
@@ -817,13 +818,14 @@ do { \
817#if (defined __STDC__ || defined __C99__FUNC__ \ 818#if (defined __STDC__ || defined __C99__FUNC__ \
818 || defined __cplusplus || defined _MSC_VER) 819 || defined __cplusplus || defined _MSC_VER)
819static void 820static void
820yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct list_head *list, int *idx) 821yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct list_head *list_all, struct list_head *list_event, int *idx)
821#else 822#else
822static void 823static void
823yy_reduce_print (yyvsp, yyrule, list, idx) 824yy_reduce_print (yyvsp, yyrule, list_all, list_event, idx)
824 YYSTYPE *yyvsp; 825 YYSTYPE *yyvsp;
825 int yyrule; 826 int yyrule;
826 struct list_head *list; 827 struct list_head *list_all;
828 struct list_head *list_event;
827 int *idx; 829 int *idx;
828#endif 830#endif
829{ 831{
@@ -838,7 +840,7 @@ yy_reduce_print (yyvsp, yyrule, list, idx)
838 YYFPRINTF (stderr, " $%d = ", yyi + 1); 840 YYFPRINTF (stderr, " $%d = ", yyi + 1);
839 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 841 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
840 &(yyvsp[(yyi + 1) - (yynrhs)]) 842 &(yyvsp[(yyi + 1) - (yynrhs)])
841 , list, idx); 843 , list_all, list_event, idx);
842 YYFPRINTF (stderr, "\n"); 844 YYFPRINTF (stderr, "\n");
843 } 845 }
844} 846}
@@ -846,7 +848,7 @@ yy_reduce_print (yyvsp, yyrule, list, idx)
846# define YY_REDUCE_PRINT(Rule) \ 848# define YY_REDUCE_PRINT(Rule) \
847do { \ 849do { \
848 if (yydebug) \ 850 if (yydebug) \
849 yy_reduce_print (yyvsp, Rule, list, idx); \ 851 yy_reduce_print (yyvsp, Rule, list_all, list_event, idx); \
850} while (YYID (0)) 852} while (YYID (0))
851 853
852/* Nonzero means print parse trace. It is left uninitialized so that 854/* Nonzero means print parse trace. It is left uninitialized so that
@@ -876,7 +878,6 @@ int yydebug;
876# define YYMAXDEPTH 10000 878# define YYMAXDEPTH 10000
877#endif 879#endif
878 880
879
880 881
881#if YYERROR_VERBOSE 882#if YYERROR_VERBOSE
882 883
@@ -979,115 +980,142 @@ yytnamerr (char *yyres, const char *yystr)
979} 980}
980# endif 981# endif
981 982
982/* Copy into YYRESULT an error message about the unexpected token 983/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
983 YYCHAR while in state YYSTATE. Return the number of bytes copied, 984 about the unexpected token YYTOKEN for the state stack whose top is
984 including the terminating null byte. If YYRESULT is null, do not 985 YYSSP.
985 copy anything; just return the number of bytes that would be
986 copied. As a special case, return 0 if an ordinary "syntax error"
987 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
988 size calculation. */
989static YYSIZE_T
990yysyntax_error (char *yyresult, int yystate, int yychar)
991{
992 int yyn = yypact[yystate];
993 986
994 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 987 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
995 return 0; 988 not large enough to hold the message. In that case, also set
996 else 989 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
990 required number of bytes is too large to store. */
991static int
992yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
993 yytype_int16 *yyssp, int yytoken)
994{
995 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
996 YYSIZE_T yysize = yysize0;
997 YYSIZE_T yysize1;
998 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
999 /* Internationalized format string. */
1000 const char *yyformat = 0;
1001 /* Arguments of yyformat. */
1002 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1003 /* Number of reported tokens (one for the "unexpected", one per
1004 "expected"). */
1005 int yycount = 0;
1006
1007 /* There are many possibilities here to consider:
1008 - Assume YYFAIL is not used. It's too flawed to consider. See
1009 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1010 for details. YYERROR is fine as it does not invoke this
1011 function.
1012 - If this state is a consistent state with a default action, then
1013 the only way this function was invoked is if the default action
1014 is an error action. In that case, don't check for expected
1015 tokens because there are none.
1016 - The only way there can be no lookahead present (in yychar) is if
1017 this state is a consistent state with a default action. Thus,
1018 detecting the absence of a lookahead is sufficient to determine
1019 that there is no unexpected or expected token to report. In that
1020 case, just report a simple "syntax error".
1021 - Don't assume there isn't a lookahead just because this state is a
1022 consistent state with a default action. There might have been a
1023 previous inconsistent state, consistent state with a non-default
1024 action, or user semantic action that manipulated yychar.
1025 - Of course, the expected token list depends on states to have
1026 correct lookahead information, and it depends on the parser not
1027 to perform extra reductions after fetching a lookahead from the
1028 scanner and before detecting a syntax error. Thus, state merging
1029 (from LALR or IELR) and default reductions corrupt the expected
1030 token list. However, the list is correct for canonical LR with
1031 one exception: it will still contain any token that will not be
1032 accepted due to an error action in a later state.
1033 */
1034 if (yytoken != YYEMPTY)
997 { 1035 {
998 int yytype = YYTRANSLATE (yychar); 1036 int yyn = yypact[*yyssp];
999 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 1037 yyarg[yycount++] = yytname[yytoken];
1000 YYSIZE_T yysize = yysize0; 1038 if (!yypact_value_is_default (yyn))
1001 YYSIZE_T yysize1; 1039 {
1002 int yysize_overflow = 0; 1040 /* Start YYX at -YYN if negative to avoid negative indexes in
1003 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1041 YYCHECK. In other words, skip the first -YYN actions for
1004 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1042 this state because they are default actions. */
1005 int yyx; 1043 int yyxbegin = yyn < 0 ? -yyn : 0;
1006 1044 /* Stay within bounds of both yycheck and yytname. */
1007# if 0 1045 int yychecklim = YYLAST - yyn + 1;
1008 /* This is so xgettext sees the translatable formats that are 1046 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1009 constructed on the fly. */ 1047 int yyx;
1010 YY_("syntax error, unexpected %s"); 1048
1011 YY_("syntax error, unexpected %s, expecting %s"); 1049 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1012 YY_("syntax error, unexpected %s, expecting %s or %s"); 1050 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1013 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 1051 && !yytable_value_is_error (yytable[yyx + yyn]))
1014 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 1052 {
1015# endif 1053 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1016 char *yyfmt; 1054 {
1017 char const *yyf; 1055 yycount = 1;
1018 static char const yyunexpected[] = "syntax error, unexpected %s"; 1056 yysize = yysize0;
1019 static char const yyexpecting[] = ", expecting %s"; 1057 break;
1020 static char const yyor[] = " or %s"; 1058 }
1021 char yyformat[sizeof yyunexpected 1059 yyarg[yycount++] = yytname[yyx];
1022 + sizeof yyexpecting - 1 1060 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1023 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1061 if (! (yysize <= yysize1
1024 * (sizeof yyor - 1))]; 1062 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1025 char const *yyprefix = yyexpecting; 1063 return 2;
1026 1064 yysize = yysize1;
1027 /* Start YYX at -YYN if negative to avoid negative indexes in 1065 }
1028 YYCHECK. */ 1066 }
1029 int yyxbegin = yyn < 0 ? -yyn : 0; 1067 }
1030
1031 /* Stay within bounds of both yycheck and yytname. */
1032 int yychecklim = YYLAST - yyn + 1;
1033 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1034 int yycount = 1;
1035
1036 yyarg[0] = yytname[yytype];
1037 yyfmt = yystpcpy (yyformat, yyunexpected);
1038
1039 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1040 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1041 {
1042 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1043 {
1044 yycount = 1;
1045 yysize = yysize0;
1046 yyformat[sizeof yyunexpected - 1] = '\0';
1047 break;
1048 }
1049 yyarg[yycount++] = yytname[yyx];
1050 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1051 yysize_overflow |= (yysize1 < yysize);
1052 yysize = yysize1;
1053 yyfmt = yystpcpy (yyfmt, yyprefix);
1054 yyprefix = yyor;
1055 }
1056 1068
1057 yyf = YY_(yyformat); 1069 switch (yycount)
1058 yysize1 = yysize + yystrlen (yyf); 1070 {
1059 yysize_overflow |= (yysize1 < yysize); 1071# define YYCASE_(N, S) \
1060 yysize = yysize1; 1072 case N: \
1073 yyformat = S; \
1074 break
1075 YYCASE_(0, YY_("syntax error"));
1076 YYCASE_(1, YY_("syntax error, unexpected %s"));
1077 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1078 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1079 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1080 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1081# undef YYCASE_
1082 }
1061 1083
1062 if (yysize_overflow) 1084 yysize1 = yysize + yystrlen (yyformat);
1063 return YYSIZE_MAXIMUM; 1085 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1086 return 2;
1087 yysize = yysize1;
1064 1088
1065 if (yyresult) 1089 if (*yymsg_alloc < yysize)
1066 { 1090 {
1067 /* Avoid sprintf, as that infringes on the user's name space. 1091 *yymsg_alloc = 2 * yysize;
1068 Don't have undefined behavior even if the translation 1092 if (! (yysize <= *yymsg_alloc
1069 produced a string with the wrong number of "%s"s. */ 1093 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1070 char *yyp = yyresult; 1094 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1071 int yyi = 0; 1095 return 1;
1072 while ((*yyp = *yyf) != '\0')
1073 {
1074 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1075 {
1076 yyp += yytnamerr (yyp, yyarg[yyi++]);
1077 yyf += 2;
1078 }
1079 else
1080 {
1081 yyp++;
1082 yyf++;
1083 }
1084 }
1085 }
1086 return yysize;
1087 } 1096 }
1097
1098 /* Avoid sprintf, as that infringes on the user's name space.
1099 Don't have undefined behavior even if the translation
1100 produced a string with the wrong number of "%s"s. */
1101 {
1102 char *yyp = *yymsg;
1103 int yyi = 0;
1104 while ((*yyp = *yyformat) != '\0')
1105 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1106 {
1107 yyp += yytnamerr (yyp, yyarg[yyi++]);
1108 yyformat += 2;
1109 }
1110 else
1111 {
1112 yyp++;
1113 yyformat++;
1114 }
1115 }
1116 return 0;
1088} 1117}
1089#endif /* YYERROR_VERBOSE */ 1118#endif /* YYERROR_VERBOSE */
1090
1091 1119
1092/*-----------------------------------------------. 1120/*-----------------------------------------------.
1093| Release the memory associated to this symbol. | 1121| Release the memory associated to this symbol. |
@@ -1097,19 +1125,21 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
1097#if (defined __STDC__ || defined __C99__FUNC__ \ 1125#if (defined __STDC__ || defined __C99__FUNC__ \
1098 || defined __cplusplus || defined _MSC_VER) 1126 || defined __cplusplus || defined _MSC_VER)
1099static void 1127static void
1100yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct list_head *list, int *idx) 1128yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct list_head *list_all, struct list_head *list_event, int *idx)
1101#else 1129#else
1102static void 1130static void
1103yydestruct (yymsg, yytype, yyvaluep, list, idx) 1131yydestruct (yymsg, yytype, yyvaluep, list_all, list_event, idx)
1104 const char *yymsg; 1132 const char *yymsg;
1105 int yytype; 1133 int yytype;
1106 YYSTYPE *yyvaluep; 1134 YYSTYPE *yyvaluep;
1107 struct list_head *list; 1135 struct list_head *list_all;
1136 struct list_head *list_event;
1108 int *idx; 1137 int *idx;
1109#endif 1138#endif
1110{ 1139{
1111 YYUSE (yyvaluep); 1140 YYUSE (yyvaluep);
1112 YYUSE (list); 1141 YYUSE (list_all);
1142 YYUSE (list_event);
1113 YYUSE (idx); 1143 YYUSE (idx);
1114 1144
1115 if (!yymsg) 1145 if (!yymsg)
@@ -1124,6 +1154,7 @@ yydestruct (yymsg, yytype, yyvaluep, list, idx)
1124 } 1154 }
1125} 1155}
1126 1156
1157
1127/* Prevent warnings from -Wmissing-prototypes. */ 1158/* Prevent warnings from -Wmissing-prototypes. */
1128#ifdef YYPARSE_PARAM 1159#ifdef YYPARSE_PARAM
1129#if defined __STDC__ || defined __cplusplus 1160#if defined __STDC__ || defined __cplusplus
@@ -1133,7 +1164,7 @@ int yyparse ();
1133#endif 1164#endif
1134#else /* ! YYPARSE_PARAM */ 1165#else /* ! YYPARSE_PARAM */
1135#if defined __STDC__ || defined __cplusplus 1166#if defined __STDC__ || defined __cplusplus
1136int yyparse (struct list_head *list, int *idx); 1167int yyparse (struct list_head *list_all, struct list_head *list_event, int *idx);
1137#else 1168#else
1138int yyparse (); 1169int yyparse ();
1139#endif 1170#endif
@@ -1150,10 +1181,9 @@ YYSTYPE yylval;
1150int yynerrs; 1181int yynerrs;
1151 1182
1152 1183
1153 1184/*----------.
1154/*-------------------------. 1185| yyparse. |
1155| yyparse or yypush_parse. | 1186`----------*/
1156`-------------------------*/
1157 1187
1158#ifdef YYPARSE_PARAM 1188#ifdef YYPARSE_PARAM
1159#if (defined __STDC__ || defined __C99__FUNC__ \ 1189#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1169,17 +1199,16 @@ yyparse (YYPARSE_PARAM)
1169#if (defined __STDC__ || defined __C99__FUNC__ \ 1199#if (defined __STDC__ || defined __C99__FUNC__ \
1170 || defined __cplusplus || defined _MSC_VER) 1200 || defined __cplusplus || defined _MSC_VER)
1171int 1201int
1172yyparse (struct list_head *list, int *idx) 1202yyparse (struct list_head *list_all, struct list_head *list_event, int *idx)
1173#else 1203#else
1174int 1204int
1175yyparse (list, idx) 1205yyparse (list_all, list_event, idx)
1176 struct list_head *list; 1206 struct list_head *list_all;
1207 struct list_head *list_event;
1177 int *idx; 1208 int *idx;
1178#endif 1209#endif
1179#endif 1210#endif
1180{ 1211{
1181
1182
1183 int yystate; 1212 int yystate;
1184 /* Number of tokens to shift before error messages enabled. */ 1213 /* Number of tokens to shift before error messages enabled. */
1185 int yyerrstatus; 1214 int yyerrstatus;
@@ -1334,7 +1363,7 @@ yybackup:
1334 1363
1335 /* First try to decide what to do without reference to lookahead token. */ 1364 /* First try to decide what to do without reference to lookahead token. */
1336 yyn = yypact[yystate]; 1365 yyn = yypact[yystate];
1337 if (yyn == YYPACT_NINF) 1366 if (yypact_value_is_default (yyn))
1338 goto yydefault; 1367 goto yydefault;
1339 1368
1340 /* Not known => get a lookahead token if don't already have one. */ 1369 /* Not known => get a lookahead token if don't already have one. */
@@ -1365,8 +1394,8 @@ yybackup:
1365 yyn = yytable[yyn]; 1394 yyn = yytable[yyn];
1366 if (yyn <= 0) 1395 if (yyn <= 0)
1367 { 1396 {
1368 if (yyn == 0 || yyn == YYTABLE_NINF) 1397 if (yytable_value_is_error (yyn))
1369 goto yyerrlab; 1398 goto yyerrlab;
1370 yyn = -yyn; 1399 yyn = -yyn;
1371 goto yyreduce; 1400 goto yyreduce;
1372 } 1401 }
@@ -1421,124 +1450,139 @@ yyreduce:
1421 { 1450 {
1422 case 4: 1451 case 4:
1423 1452
1424/* Line 1464 of yacc.c */ 1453/* Line 1806 of yacc.c */
1425#line 58 "util/parse-events.y" 1454#line 59 "util/parse-events.y"
1426 { 1455 {
1427 ABORT_ON(parse_events_modifier(list, (yyvsp[(2) - (2)].str))); 1456 /*
1428;} 1457 * Apply modifier on all events added by single event definition
1458 * (there could be more events added for multiple tracepoint
1459 * definitions via '*?'.
1460 */
1461 ABORT_ON(parse_events_modifier(list_event, (yyvsp[(2) - (2)].str)));
1462 parse_events_update_lists(list_event, list_all);
1463}
1464 break;
1465
1466 case 5:
1467
1468/* Line 1806 of yacc.c */
1469#line 70 "util/parse-events.y"
1470 {
1471 parse_events_update_lists(list_event, list_all);
1472}
1429 break; 1473 break;
1430 1474
1431 case 13: 1475 case 13:
1432 1476
1433/* Line 1464 of yacc.c */ 1477/* Line 1806 of yacc.c */
1434#line 74 "util/parse-events.y" 1478#line 84 "util/parse-events.y"
1435 { 1479 {
1436 ABORT_ON(parse_events_add_pmu(list, idx, (yyvsp[(1) - (4)].str), (yyvsp[(3) - (4)].head))); 1480 ABORT_ON(parse_events_add_pmu(list_event, idx, (yyvsp[(1) - (4)].str), (yyvsp[(3) - (4)].head)));
1437 parse_events__free_terms((yyvsp[(3) - (4)].head)); 1481 parse_events__free_terms((yyvsp[(3) - (4)].head));
1438;} 1482}
1439 break; 1483 break;
1440 1484
1441 case 14: 1485 case 14:
1442 1486
1443/* Line 1464 of yacc.c */ 1487/* Line 1806 of yacc.c */
1444#line 81 "util/parse-events.y" 1488#line 91 "util/parse-events.y"
1445 { 1489 {
1446 int type = (yyvsp[(1) - (4)].num) >> 16; 1490 int type = (yyvsp[(1) - (4)].num) >> 16;
1447 int config = (yyvsp[(1) - (4)].num) & 255; 1491 int config = (yyvsp[(1) - (4)].num) & 255;
1448 1492
1449 ABORT_ON(parse_events_add_numeric(list, idx, type, config, (yyvsp[(3) - (4)].head))); 1493 ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, (yyvsp[(3) - (4)].head)));
1450 parse_events__free_terms((yyvsp[(3) - (4)].head)); 1494 parse_events__free_terms((yyvsp[(3) - (4)].head));
1451;} 1495}
1452 break; 1496 break;
1453 1497
1454 case 15: 1498 case 15:
1455 1499
1456/* Line 1464 of yacc.c */ 1500/* Line 1806 of yacc.c */
1457#line 90 "util/parse-events.y" 1501#line 100 "util/parse-events.y"
1458 { 1502 {
1459 int type = (yyvsp[(1) - (2)].num) >> 16; 1503 int type = (yyvsp[(1) - (2)].num) >> 16;
1460 int config = (yyvsp[(1) - (2)].num) & 255; 1504 int config = (yyvsp[(1) - (2)].num) & 255;
1461 1505
1462 ABORT_ON(parse_events_add_numeric(list, idx, type, config, NULL)); 1506 ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, NULL));
1463;} 1507}
1464 break; 1508 break;
1465 1509
1466 case 16: 1510 case 16:
1467 1511
1468/* Line 1464 of yacc.c */ 1512/* Line 1806 of yacc.c */
1469#line 99 "util/parse-events.y" 1513#line 109 "util/parse-events.y"
1470 { 1514 {
1471 ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), (yyvsp[(5) - (5)].str))); 1515 ABORT_ON(parse_events_add_cache(list_event, idx, (yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), (yyvsp[(5) - (5)].str)));
1472;} 1516}
1473 break; 1517 break;
1474 1518
1475 case 17: 1519 case 17:
1476 1520
1477/* Line 1464 of yacc.c */ 1521/* Line 1806 of yacc.c */
1478#line 104 "util/parse-events.y" 1522#line 114 "util/parse-events.y"
1479 { 1523 {
1480 ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), NULL)); 1524 ABORT_ON(parse_events_add_cache(list_event, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), NULL));
1481;} 1525}
1482 break; 1526 break;
1483 1527
1484 case 18: 1528 case 18:
1485 1529
1486/* Line 1464 of yacc.c */ 1530/* Line 1806 of yacc.c */
1487#line 109 "util/parse-events.y" 1531#line 119 "util/parse-events.y"
1488 { 1532 {
1489 ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (1)].str), NULL, NULL)); 1533 ABORT_ON(parse_events_add_cache(list_event, idx, (yyvsp[(1) - (1)].str), NULL, NULL));
1490;} 1534}
1491 break; 1535 break;
1492 1536
1493 case 19: 1537 case 19:
1494 1538
1495/* Line 1464 of yacc.c */ 1539/* Line 1806 of yacc.c */
1496#line 115 "util/parse-events.y" 1540#line 125 "util/parse-events.y"
1497 { 1541 {
1498 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) (yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].str))); 1542 ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) (yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].str)));
1499;} 1543}
1500 break; 1544 break;
1501 1545
1502 case 20: 1546 case 20:
1503 1547
1504/* Line 1464 of yacc.c */ 1548/* Line 1806 of yacc.c */
1505#line 120 "util/parse-events.y" 1549#line 130 "util/parse-events.y"
1506 { 1550 {
1507 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) (yyvsp[(2) - (3)].num), NULL)); 1551 ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) (yyvsp[(2) - (3)].num), NULL));
1508;} 1552}
1509 break; 1553 break;
1510 1554
1511 case 21: 1555 case 21:
1512 1556
1513/* Line 1464 of yacc.c */ 1557/* Line 1806 of yacc.c */
1514#line 126 "util/parse-events.y" 1558#line 136 "util/parse-events.y"
1515 { 1559 {
1516 ABORT_ON(parse_events_add_tracepoint(list, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str))); 1560 ABORT_ON(parse_events_add_tracepoint(list_event, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)));
1517;} 1561}
1518 break; 1562 break;
1519 1563
1520 case 22: 1564 case 22:
1521 1565
1522/* Line 1464 of yacc.c */ 1566/* Line 1806 of yacc.c */
1523#line 132 "util/parse-events.y" 1567#line 142 "util/parse-events.y"
1524 { 1568 {
1525 ABORT_ON(parse_events_add_numeric(list, idx, (yyvsp[(1) - (3)].num), (yyvsp[(3) - (3)].num), NULL)); 1569 ABORT_ON(parse_events_add_numeric(list_event, idx, (yyvsp[(1) - (3)].num), (yyvsp[(3) - (3)].num), NULL));
1526;} 1570}
1527 break; 1571 break;
1528 1572
1529 case 23: 1573 case 23:
1530 1574
1531/* Line 1464 of yacc.c */ 1575/* Line 1806 of yacc.c */
1532#line 138 "util/parse-events.y" 1576#line 148 "util/parse-events.y"
1533 { 1577 {
1534 ABORT_ON(parse_events_add_numeric(list, idx, PERF_TYPE_RAW, (yyvsp[(1) - (1)].num), NULL)); 1578 ABORT_ON(parse_events_add_numeric(list_event, idx, PERF_TYPE_RAW, (yyvsp[(1) - (1)].num), NULL));
1535;} 1579}
1536 break; 1580 break;
1537 1581
1538 case 24: 1582 case 24:
1539 1583
1540/* Line 1464 of yacc.c */ 1584/* Line 1806 of yacc.c */
1541#line 144 "util/parse-events.y" 1585#line 154 "util/parse-events.y"
1542 { 1586 {
1543 struct list_head *head = (yyvsp[(1) - (3)].head); 1587 struct list_head *head = (yyvsp[(1) - (3)].head);
1544 struct parse_events__term *term = (yyvsp[(3) - (3)].term); 1588 struct parse_events__term *term = (yyvsp[(3) - (3)].term);
@@ -1546,13 +1590,13 @@ yyreduce:
1546 ABORT_ON(!head); 1590 ABORT_ON(!head);
1547 list_add_tail(&term->list, head); 1591 list_add_tail(&term->list, head);
1548 (yyval.head) = (yyvsp[(1) - (3)].head); 1592 (yyval.head) = (yyvsp[(1) - (3)].head);
1549;} 1593}
1550 break; 1594 break;
1551 1595
1552 case 25: 1596 case 25:
1553 1597
1554/* Line 1464 of yacc.c */ 1598/* Line 1806 of yacc.c */
1555#line 154 "util/parse-events.y" 1599#line 164 "util/parse-events.y"
1556 { 1600 {
1557 struct list_head *head = malloc(sizeof(*head)); 1601 struct list_head *head = malloc(sizeof(*head));
1558 struct parse_events__term *term = (yyvsp[(1) - (1)].term); 1602 struct parse_events__term *term = (yyvsp[(1) - (1)].term);
@@ -1561,78 +1605,89 @@ yyreduce:
1561 INIT_LIST_HEAD(head); 1605 INIT_LIST_HEAD(head);
1562 list_add_tail(&term->list, head); 1606 list_add_tail(&term->list, head);
1563 (yyval.head) = head; 1607 (yyval.head) = head;
1564;} 1608}
1565 break; 1609 break;
1566 1610
1567 case 26: 1611 case 26:
1568 1612
1569/* Line 1464 of yacc.c */ 1613/* Line 1806 of yacc.c */
1570#line 166 "util/parse-events.y" 1614#line 176 "util/parse-events.y"
1571 { 1615 {
1572 struct parse_events__term *term; 1616 struct parse_events__term *term;
1573 1617
1574 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_STR, 1618 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_STR,
1575 (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), 0)); 1619 (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), 0));
1576 (yyval.term) = term; 1620 (yyval.term) = term;
1577;} 1621}
1578 break; 1622 break;
1579 1623
1580 case 27: 1624 case 27:
1581 1625
1582/* Line 1464 of yacc.c */ 1626/* Line 1806 of yacc.c */
1583#line 175 "util/parse-events.y" 1627#line 185 "util/parse-events.y"
1584 { 1628 {
1585 struct parse_events__term *term; 1629 struct parse_events__term *term;
1586 1630
1587 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM, 1631 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM,
1588 (yyvsp[(1) - (3)].str), NULL, (yyvsp[(3) - (3)].num))); 1632 (yyvsp[(1) - (3)].str), NULL, (yyvsp[(3) - (3)].num)));
1589 (yyval.term) = term; 1633 (yyval.term) = term;
1590;} 1634}
1591 break; 1635 break;
1592 1636
1593 case 28: 1637 case 28:
1594 1638
1595/* Line 1464 of yacc.c */ 1639/* Line 1806 of yacc.c */
1596#line 184 "util/parse-events.y" 1640#line 194 "util/parse-events.y"
1597 { 1641 {
1598 struct parse_events__term *term; 1642 struct parse_events__term *term;
1599 1643
1600 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM, 1644 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM,
1601 (yyvsp[(1) - (1)].str), NULL, 1)); 1645 (yyvsp[(1) - (1)].str), NULL, 1));
1602 (yyval.term) = term; 1646 (yyval.term) = term;
1603;} 1647}
1604 break; 1648 break;
1605 1649
1606 case 29: 1650 case 29:
1607 1651
1608/* Line 1464 of yacc.c */ 1652/* Line 1806 of yacc.c */
1609#line 193 "util/parse-events.y" 1653#line 203 "util/parse-events.y"
1610 { 1654 {
1611 struct parse_events__term *term; 1655 struct parse_events__term *term;
1612 1656
1613 ABORT_ON(parse_events__new_term(&term, (yyvsp[(1) - (3)].num), NULL, NULL, (yyvsp[(3) - (3)].num))); 1657 ABORT_ON(parse_events__new_term(&term, (yyvsp[(1) - (3)].num), NULL, NULL, (yyvsp[(3) - (3)].num)));
1614 (yyval.term) = term; 1658 (yyval.term) = term;
1615;} 1659}
1616 break; 1660 break;
1617 1661
1618 case 30: 1662 case 30:
1619 1663
1620/* Line 1464 of yacc.c */ 1664/* Line 1806 of yacc.c */
1621#line 201 "util/parse-events.y" 1665#line 211 "util/parse-events.y"
1622 { 1666 {
1623 struct parse_events__term *term; 1667 struct parse_events__term *term;
1624 1668
1625 ABORT_ON(parse_events__new_term(&term, (yyvsp[(1) - (1)].num), NULL, NULL, 1)); 1669 ABORT_ON(parse_events__new_term(&term, (yyvsp[(1) - (1)].num), NULL, NULL, 1));
1626 (yyval.term) = term; 1670 (yyval.term) = term;
1627;} 1671}
1628 break; 1672 break;
1629 1673
1630 1674
1631 1675
1632/* Line 1464 of yacc.c */ 1676/* Line 1806 of yacc.c */
1633#line 1634 "util/parse-events-bison.c" 1677#line 1678 "util/parse-events-bison.c"
1634 default: break; 1678 default: break;
1635 } 1679 }
1680 /* User semantic actions sometimes alter yychar, and that requires
1681 that yytoken be updated with the new translation. We take the
1682 approach of translating immediately before every use of yytoken.
1683 One alternative is translating here after every semantic action,
1684 but that translation would be missed if the semantic action invokes
1685 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1686 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1687 incorrect destructor might then be invoked immediately. In the
1688 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1689 to an incorrect destructor call or verbose syntax error message
1690 before the lookahead is translated. */
1636 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1691 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1637 1692
1638 YYPOPSTACK (yylen); 1693 YYPOPSTACK (yylen);
@@ -1660,44 +1715,47 @@ yyreduce:
1660| yyerrlab -- here on detecting error | 1715| yyerrlab -- here on detecting error |
1661`------------------------------------*/ 1716`------------------------------------*/
1662yyerrlab: 1717yyerrlab:
1718 /* Make sure we have latest lookahead translation. See comments at
1719 user semantic actions for why this is necessary. */
1720 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1721
1663 /* If not already recovering from an error, report this error. */ 1722 /* If not already recovering from an error, report this error. */
1664 if (!yyerrstatus) 1723 if (!yyerrstatus)
1665 { 1724 {
1666 ++yynerrs; 1725 ++yynerrs;
1667#if ! YYERROR_VERBOSE 1726#if ! YYERROR_VERBOSE
1668 yyerror (list, idx, YY_("syntax error")); 1727 yyerror (list_all, list_event, idx, YY_("syntax error"));
1669#else 1728#else
1729# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1730 yyssp, yytoken)
1670 { 1731 {
1671 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 1732 char const *yymsgp = YY_("syntax error");
1672 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 1733 int yysyntax_error_status;
1673 { 1734 yysyntax_error_status = YYSYNTAX_ERROR;
1674 YYSIZE_T yyalloc = 2 * yysize; 1735 if (yysyntax_error_status == 0)
1675 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 1736 yymsgp = yymsg;
1676 yyalloc = YYSTACK_ALLOC_MAXIMUM; 1737 else if (yysyntax_error_status == 1)
1677 if (yymsg != yymsgbuf) 1738 {
1678 YYSTACK_FREE (yymsg); 1739 if (yymsg != yymsgbuf)
1679 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 1740 YYSTACK_FREE (yymsg);
1680 if (yymsg) 1741 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1681 yymsg_alloc = yyalloc; 1742 if (!yymsg)
1682 else 1743 {
1683 { 1744 yymsg = yymsgbuf;
1684 yymsg = yymsgbuf; 1745 yymsg_alloc = sizeof yymsgbuf;
1685 yymsg_alloc = sizeof yymsgbuf; 1746 yysyntax_error_status = 2;
1686 } 1747 }
1687 } 1748 else
1688 1749 {
1689 if (0 < yysize && yysize <= yymsg_alloc) 1750 yysyntax_error_status = YYSYNTAX_ERROR;
1690 { 1751 yymsgp = yymsg;
1691 (void) yysyntax_error (yymsg, yystate, yychar); 1752 }
1692 yyerror (list, idx, yymsg); 1753 }
1693 } 1754 yyerror (list_all, list_event, idx, yymsgp);
1694 else 1755 if (yysyntax_error_status == 2)
1695 { 1756 goto yyexhaustedlab;
1696 yyerror (list, idx, YY_("syntax error"));
1697 if (yysize != 0)
1698 goto yyexhaustedlab;
1699 }
1700 } 1757 }
1758# undef YYSYNTAX_ERROR
1701#endif 1759#endif
1702 } 1760 }
1703 1761
@@ -1717,7 +1775,7 @@ yyerrlab:
1717 else 1775 else
1718 { 1776 {
1719 yydestruct ("Error: discarding", 1777 yydestruct ("Error: discarding",
1720 yytoken, &yylval, list, idx); 1778 yytoken, &yylval, list_all, list_event, idx);
1721 yychar = YYEMPTY; 1779 yychar = YYEMPTY;
1722 } 1780 }
1723 } 1781 }
@@ -1756,7 +1814,7 @@ yyerrlab1:
1756 for (;;) 1814 for (;;)
1757 { 1815 {
1758 yyn = yypact[yystate]; 1816 yyn = yypact[yystate];
1759 if (yyn != YYPACT_NINF) 1817 if (!yypact_value_is_default (yyn))
1760 { 1818 {
1761 yyn += YYTERROR; 1819 yyn += YYTERROR;
1762 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 1820 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -1773,7 +1831,7 @@ yyerrlab1:
1773 1831
1774 1832
1775 yydestruct ("Error: popping", 1833 yydestruct ("Error: popping",
1776 yystos[yystate], yyvsp, list, idx); 1834 yystos[yystate], yyvsp, list_all, list_event, idx);
1777 YYPOPSTACK (1); 1835 YYPOPSTACK (1);
1778 yystate = *yyssp; 1836 yystate = *yyssp;
1779 YY_STACK_PRINT (yyss, yyssp); 1837 YY_STACK_PRINT (yyss, yyssp);
@@ -1808,15 +1866,20 @@ yyabortlab:
1808| yyexhaustedlab -- memory exhaustion comes here. | 1866| yyexhaustedlab -- memory exhaustion comes here. |
1809`-------------------------------------------------*/ 1867`-------------------------------------------------*/
1810yyexhaustedlab: 1868yyexhaustedlab:
1811 yyerror (list, idx, YY_("memory exhausted")); 1869 yyerror (list_all, list_event, idx, YY_("memory exhausted"));
1812 yyresult = 2; 1870 yyresult = 2;
1813 /* Fall through. */ 1871 /* Fall through. */
1814#endif 1872#endif
1815 1873
1816yyreturn: 1874yyreturn:
1817 if (yychar != YYEMPTY) 1875 if (yychar != YYEMPTY)
1818 yydestruct ("Cleanup: discarding lookahead", 1876 {
1819 yytoken, &yylval, list, idx); 1877 /* Make sure we have latest lookahead translation. See comments at
1878 user semantic actions for why this is necessary. */
1879 yytoken = YYTRANSLATE (yychar);
1880 yydestruct ("Cleanup: discarding lookahead",
1881 yytoken, &yylval, list_all, list_event, idx);
1882 }
1820 /* Do not reclaim the symbols of the rule which action triggered 1883 /* Do not reclaim the symbols of the rule which action triggered
1821 this YYABORT or YYACCEPT. */ 1884 this YYABORT or YYACCEPT. */
1822 YYPOPSTACK (yylen); 1885 YYPOPSTACK (yylen);
@@ -1824,7 +1887,7 @@ yyreturn:
1824 while (yyssp != yyss) 1887 while (yyssp != yyss)
1825 { 1888 {
1826 yydestruct ("Cleanup: popping", 1889 yydestruct ("Cleanup: popping",
1827 yystos[*yyssp], yyvsp, list, idx); 1890 yystos[*yyssp], yyvsp, list_all, list_event, idx);
1828 YYPOPSTACK (1); 1891 YYPOPSTACK (1);
1829 } 1892 }
1830#ifndef yyoverflow 1893#ifndef yyoverflow
@@ -1841,11 +1904,13 @@ yyreturn:
1841 1904
1842 1905
1843 1906
1844/* Line 1684 of yacc.c */ 1907/* Line 2067 of yacc.c */
1845#line 212 "util/parse-events.y" 1908#line 222 "util/parse-events.y"
1846 1909
1847 1910
1848void parse_events_error(struct list_head *list __used, int *idx __used, 1911void parse_events_error(struct list_head *list_all __used,
1912 struct list_head *list_event __used,
1913 int *idx __used,
1849 char const *msg __used) 1914 char const *msg __used)
1850{ 1915{
1851} 1916}
diff --git a/tools/perf/util/parse-events-bison.h b/tools/perf/util/parse-events-bison.h
index c58b76584f92..0be3e5ae2fed 100644
--- a/tools/perf/util/parse-events-bison.h
+++ b/tools/perf/util/parse-events-bison.h
@@ -1,9 +1,8 @@
1/* A Bison parser, made by GNU Bison 2.4.3. */ 1/* A Bison parser, made by GNU Bison 2.5. */
2 2
3/* Skeleton interface for Bison's Yacc-like parsers in C 3/* Bison interface for Yacc-like parsers in C
4 4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6 2009, 2010 Free Software Foundation, Inc.
7 6
8 This program is free software: you can redistribute it and/or modify 7 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
@@ -59,8 +58,8 @@
59typedef union YYSTYPE 58typedef union YYSTYPE
60{ 59{
61 60
62/* Line 1685 of yacc.c */ 61/* Line 2068 of yacc.c */
63#line 45 "util/parse-events.y" 62#line 46 "util/parse-events.y"
64 63
65 char *str; 64 char *str;
66 unsigned long num; 65 unsigned long num;
@@ -69,8 +68,8 @@ typedef union YYSTYPE
69 68
70 69
71 70
72/* Line 1685 of yacc.c */ 71/* Line 2068 of yacc.c */
73#line 74 "util/parse-events-bison.h" 72#line 73 "util/parse-events-bison.h"
74} YYSTYPE; 73} YYSTYPE;
75# define YYSTYPE_IS_TRIVIAL 1 74# define YYSTYPE_IS_TRIVIAL 1
76# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 75# define yystype YYSTYPE /* obsolescent; will be withdrawn */
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index f542a631388b..5b3a0ef4e232 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -23,7 +23,8 @@ struct event_symbol {
23 const char *alias; 23 const char *alias;
24}; 24};
25 25
26int parse_events_parse(struct list_head *list, int *idx); 26int parse_events_parse(struct list_head *list, struct list_head *list_tmp,
27 int *idx);
27 28
28#define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x 29#define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x
29#define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x 30#define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x
@@ -671,6 +672,18 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
671 return add_event(list, idx, &attr, (char *) "pmu"); 672 return add_event(list, idx, &attr, (char *) "pmu");
672} 673}
673 674
675void parse_events_update_lists(struct list_head *list_event,
676 struct list_head *list_all)
677{
678 /*
679 * Called for single event definition. Update the
680 * 'all event' list, and reinit the 'signle event'
681 * list, for next event definition.
682 */
683 list_splice_tail(list_event, list_all);
684 INIT_LIST_HEAD(list_event);
685}
686
674int parse_events_modifier(struct list_head *list, char *str) 687int parse_events_modifier(struct list_head *list, char *str)
675{ 688{
676 struct perf_evsel *evsel; 689 struct perf_evsel *evsel;
@@ -736,14 +749,14 @@ int parse_events_modifier(struct list_head *list, char *str)
736 749
737int parse_events(struct perf_evlist *evlist, const char *str, int unset __used) 750int parse_events(struct perf_evlist *evlist, const char *str, int unset __used)
738{ 751{
739 struct perf_evsel *evsel, *h;
740 LIST_HEAD(list); 752 LIST_HEAD(list);
753 LIST_HEAD(list_tmp);
741 YY_BUFFER_STATE buffer; 754 YY_BUFFER_STATE buffer;
742 int ret, idx = evlist->nr_entries; 755 int ret, idx = evlist->nr_entries;
743 756
744 buffer = parse_events__scan_string(str); 757 buffer = parse_events__scan_string(str);
745 758
746 ret = parse_events_parse(&list, &idx); 759 ret = parse_events_parse(&list, &list_tmp, &idx);
747 760
748 parse_events__flush_buffer(buffer); 761 parse_events__flush_buffer(buffer);
749 parse_events__delete_buffer(buffer); 762 parse_events__delete_buffer(buffer);
@@ -754,9 +767,11 @@ int parse_events(struct perf_evlist *evlist, const char *str, int unset __used)
754 return 0; 767 return 0;
755 } 768 }
756 769
757 list_for_each_entry_safe(evsel, h, &list, node) 770 /*
758 perf_evsel__delete(evsel); 771 * There are 2 users - builtin-record and builtin-test objects.
759 772 * Both call perf_evlist__delete in case of error, so we dont
773 * need to bother.
774 */
760 fprintf(stderr, "invalid or unsupported event: '%s'\n", str); 775 fprintf(stderr, "invalid or unsupported event: '%s'\n", str);
761 fprintf(stderr, "Run 'perf list' for a list of valid events\n"); 776 fprintf(stderr, "Run 'perf list' for a list of valid events\n");
762 return ret; 777 return ret;
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 6d7c74b77c24..ca069f893381 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -76,8 +76,11 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx,
76 void *ptr, char *type); 76 void *ptr, char *type);
77int parse_events_add_pmu(struct list_head *list, int *idx, 77int parse_events_add_pmu(struct list_head *list, int *idx,
78 char *pmu , struct list_head *head_config); 78 char *pmu , struct list_head *head_config);
79void parse_events_error(struct list_head *list, int *idx, 79void parse_events_update_lists(struct list_head *list_event,
80 char const *msg); 80 struct list_head *list_all);
81void parse_events_error(struct list_head *list_all,
82 struct list_head *list_event,
83 int *idx, char const *msg);
81 84
82void print_events(const char *event_glob); 85void print_events(const char *event_glob);
83void print_events_type(u8 type); 86void print_events_type(u8 type);
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 3a530193f5a8..d9637da7333c 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -1,6 +1,7 @@
1 1
2%name-prefix "parse_events_" 2%name-prefix "parse_events_"
3%parse-param {struct list_head *list} 3%parse-param {struct list_head *list_all}
4%parse-param {struct list_head *list_event}
4%parse-param {int *idx} 5%parse-param {int *idx}
5 6
6%{ 7%{
@@ -56,10 +57,19 @@ events ',' event | event
56event: 57event:
57event_def PE_MODIFIER_EVENT 58event_def PE_MODIFIER_EVENT
58{ 59{
59 ABORT_ON(parse_events_modifier(list, $2)); 60 /*
61 * Apply modifier on all events added by single event definition
62 * (there could be more events added for multiple tracepoint
63 * definitions via '*?'.
64 */
65 ABORT_ON(parse_events_modifier(list_event, $2));
66 parse_events_update_lists(list_event, list_all);
60} 67}
61| 68|
62event_def 69event_def
70{
71 parse_events_update_lists(list_event, list_all);
72}
63 73
64event_def: event_pmu | 74event_def: event_pmu |
65 event_legacy_symbol | 75 event_legacy_symbol |
@@ -72,7 +82,7 @@ event_def: event_pmu |
72event_pmu: 82event_pmu:
73PE_NAME '/' event_config '/' 83PE_NAME '/' event_config '/'
74{ 84{
75 ABORT_ON(parse_events_add_pmu(list, idx, $1, $3)); 85 ABORT_ON(parse_events_add_pmu(list_event, idx, $1, $3));
76 parse_events__free_terms($3); 86 parse_events__free_terms($3);
77} 87}
78 88
@@ -82,7 +92,7 @@ PE_VALUE_SYM '/' event_config '/'
82 int type = $1 >> 16; 92 int type = $1 >> 16;
83 int config = $1 & 255; 93 int config = $1 & 255;
84 94
85 ABORT_ON(parse_events_add_numeric(list, idx, type, config, $3)); 95 ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, $3));
86 parse_events__free_terms($3); 96 parse_events__free_terms($3);
87} 97}
88| 98|
@@ -91,52 +101,52 @@ PE_VALUE_SYM sep_slash_dc
91 int type = $1 >> 16; 101 int type = $1 >> 16;
92 int config = $1 & 255; 102 int config = $1 & 255;
93 103
94 ABORT_ON(parse_events_add_numeric(list, idx, type, config, NULL)); 104 ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, NULL));
95} 105}
96 106
97event_legacy_cache: 107event_legacy_cache:
98PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT 108PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT
99{ 109{
100 ABORT_ON(parse_events_add_cache(list, idx, $1, $3, $5)); 110 ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, $5));
101} 111}
102| 112|
103PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT 113PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT
104{ 114{
105 ABORT_ON(parse_events_add_cache(list, idx, $1, $3, NULL)); 115 ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, NULL));
106} 116}
107| 117|
108PE_NAME_CACHE_TYPE 118PE_NAME_CACHE_TYPE
109{ 119{
110 ABORT_ON(parse_events_add_cache(list, idx, $1, NULL, NULL)); 120 ABORT_ON(parse_events_add_cache(list_event, idx, $1, NULL, NULL));
111} 121}
112 122
113event_legacy_mem: 123event_legacy_mem:
114PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc 124PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
115{ 125{
116 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, $4)); 126 ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, $4));
117} 127}
118| 128|
119PE_PREFIX_MEM PE_VALUE sep_dc 129PE_PREFIX_MEM PE_VALUE sep_dc
120{ 130{
121 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, NULL)); 131 ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, NULL));
122} 132}
123 133
124event_legacy_tracepoint: 134event_legacy_tracepoint:
125PE_NAME ':' PE_NAME 135PE_NAME ':' PE_NAME
126{ 136{
127 ABORT_ON(parse_events_add_tracepoint(list, idx, $1, $3)); 137 ABORT_ON(parse_events_add_tracepoint(list_event, idx, $1, $3));
128} 138}
129 139
130event_legacy_numeric: 140event_legacy_numeric:
131PE_VALUE ':' PE_VALUE 141PE_VALUE ':' PE_VALUE
132{ 142{
133 ABORT_ON(parse_events_add_numeric(list, idx, $1, $3, NULL)); 143 ABORT_ON(parse_events_add_numeric(list_event, idx, $1, $3, NULL));
134} 144}
135 145
136event_legacy_raw: 146event_legacy_raw:
137PE_RAW 147PE_RAW
138{ 148{
139 ABORT_ON(parse_events_add_numeric(list, idx, PERF_TYPE_RAW, $1, NULL)); 149 ABORT_ON(parse_events_add_numeric(list_event, idx, PERF_TYPE_RAW, $1, NULL));
140} 150}
141 151
142event_config: 152event_config:
@@ -211,7 +221,9 @@ sep_slash_dc: '/' | ':' |
211 221
212%% 222%%
213 223
214void parse_events_error(struct list_head *list __used, int *idx __used, 224void parse_events_error(struct list_head *list_all __used,
225 struct list_head *list_event __used,
226 int *idx __used,
215 char const *msg __used) 227 char const *msg __used)
216{ 228{
217} 229}