Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Add parser generator for events parsing

Changing event parsing to use flex/bison parse generator.
The event syntax stays as it was.

grammar description:

events: events ',' event | event

event: event_def PE_MODIFIER_EVENT | event_def

event_def: event_legacy_symbol sep_dc |
event_legacy_cache sep_dc |
event_legacy_breakpoint sep_dc |
event_legacy_tracepoint sep_dc |
event_legacy_numeric sep_dc |
event_legacy_raw sep_dc

event_legacy_symbol: PE_NAME_SYM

event_legacy_cache: PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT |
PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT |
PE_NAME_CACHE_TYPE

event_legacy_raw: PE_SEP_RAW PE_VALUE

event_legacy_numeric: PE_VALUE ':' PE_VALUE

event_legacy_breakpoint: PE_SEP_BP ':' PE_VALUE ':' PE_MODIFIER_BP

event_breakpoint_type: PE_MODIFIER_BPTYPE | empty

PE_NAME_SYM: cpu-cycles|cycles |
stalled-cycles-frontend|idle-cycles-frontend |
stalled-cycles-backend|idle-cycles-backend |
instructions |
cache-references |
cache-misses |
branch-instructions|branches |
branch-misses |
bus-cycles |
cpu-clock |
task-clock |
page-faults|faults |
minor-faults |
major-faults |
context-switches|cs |
cpu-migrations|migrations |
alignment-faults |
emulation-faults

PE_NAME_CACHE_TYPE: L1-dcache|l1-d|l1d|L1-data |
L1-icache|l1-i|l1i|L1-instruction |
LLC|L2 |
dTLB|d-tlb|Data-TLB |
iTLB|i-tlb|Instruction-TLB |
branch|branches|bpu|btb|bpc |
node

PE_NAME_CACHE_OP_RESULT: load|loads|read |
store|stores|write |
prefetch|prefetches |
speculative-read|speculative-load |
refs|Reference|ops|access |
misses|miss

PE_MODIFIER_EVENT: [ukhp]{0,5}

PE_MODIFIER_BP: [rwx]

PE_SEP_BP: 'mem'

PE_SEP_RAW: 'r'

sep_dc: ':' |

Added flex/bison files for event grammar parsing. The generated
parser is part of the patch. Added makefile rule 'event-parser'
to generate the parser code out of the bison/flex sources.

Acked-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-u4pfig5waq3ll2bfcdex8fgi@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
89812fc8 641cc938

+4752 -341
+17
tools/perf/Makefile
··· 61 61 62 62 CC = $(CROSS_COMPILE)gcc 63 63 AR = $(CROSS_COMPILE)ar 64 + FLEX = $(CROSS_COMPILE)flex 65 + BISON= $(CROSS_COMPILE)bison 64 66 65 67 # Additional ARCH settings for x86 66 68 ifeq ($(ARCH),i386) ··· 359 357 LIB_OBJS += $(OUTPUT)util/thread.o 360 358 LIB_OBJS += $(OUTPUT)util/thread_map.o 361 359 LIB_OBJS += $(OUTPUT)util/trace-event-parse.o 360 + LIB_OBJS += $(OUTPUT)util/parse-events-flex.o 361 + LIB_OBJS += $(OUTPUT)util/parse-events-bison.o 362 362 LIB_OBJS += $(OUTPUT)util/trace-event-read.o 363 363 LIB_OBJS += $(OUTPUT)util/trace-event-info.o 364 364 LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o ··· 649 645 QUIET_LINK = @echo ' ' LINK $@; 650 646 QUIET_MKDIR = @echo ' ' MKDIR $@; 651 647 QUIET_GEN = @echo ' ' GEN $@; 648 + QUIET_FLEX = @echo ' ' FLEX $@; 649 + QUIET_BISON = @echo ' ' BISON $@; 652 650 endif 653 651 endif 654 652 ··· 731 725 $(SCRIPTS) \ 732 726 : $(OUTPUT)PERF-VERSION-FILE 733 727 728 + .SUFFIXES: 729 + .SUFFIXES: .o .c .S .s 730 + 734 731 $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS 735 732 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< 736 733 $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS ··· 769 760 770 761 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS 771 762 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< 763 + 764 + $(OUTPUT)util/parse-events-flex.o: util/parse-events-flex.c $(OUTPUT)PERF-CFLAGS 765 + $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< 772 766 773 767 $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS 774 768 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< ··· 809 797 @echo ' html - make html documentation' 810 798 @echo ' info - make GNU info documentation (access with info <foo>)' 811 799 @echo ' pdf - make pdf documentation' 800 + @echo ' event-parser - make event parser code' 812 801 @echo ' TAGS - use etags to make tag information for source browsing' 813 802 @echo ' tags - use ctags to make tag information for source browsing' 814 803 @echo ' cscope - use cscope to make interactive browsing database' ··· 858 845 cscope: 859 846 $(RM) cscope* 860 847 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b 848 + 849 + event-parser: 850 + $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o util/parse-events-bison.c 851 + $(QUIET_FLEX)$(FLEX) --header-file=util/parse-events-flex.h -t util/parse-events.l > util/parse-events-flex.c 861 852 862 853 ### Detect prefix changes 863 854 TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
+3 -3
tools/perf/builtin-test.c
··· 650 650 651 651 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 652 652 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); 653 - TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config); 653 + TEST_ASSERT_VAL("wrong config", 0x1a == evsel->attr.config); 654 654 return 0; 655 655 } 656 656 ··· 872 872 .check = test__checkevent_tracepoint_multi, 873 873 }, 874 874 { 875 - .name = "r1", 875 + .name = "r1a", 876 876 .check = test__checkevent_raw, 877 877 }, 878 878 { ··· 916 916 .check = test__checkevent_tracepoint_multi_modifier, 917 917 }, 918 918 { 919 - .name = "r1:kp", 919 + .name = "r1a:kp", 920 920 .check = test__checkevent_raw_modifier, 921 921 }, 922 922 {
+1715
tools/perf/util/parse-events-bison.c
··· 1 + /* A Bison parser, made by GNU Bison 2.4.3. */ 2 + 3 + /* Skeleton implementation for Bison's Yacc-like parsers in C 4 + 5 + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 6 + 2009, 2010 Free Software Foundation, Inc. 7 + 8 + 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 10 + the Free Software Foundation, either version 3 of the License, or 11 + (at your option) any later version. 12 + 13 + This program is distributed in the hope that it will be useful, 14 + but WITHOUT ANY WARRANTY; without even the implied warranty of 15 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 + GNU General Public License for more details. 17 + 18 + You should have received a copy of the GNU General Public License 19 + along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 + 21 + /* As a special exception, you may create a larger work that contains 22 + part or all of the Bison parser skeleton and distribute that work 23 + under terms of your choice, so long as that work isn't itself a 24 + parser generator using the skeleton or a modified version thereof 25 + as a parser skeleton. Alternatively, if you modify or redistribute 26 + the parser skeleton itself, you may (at your option) remove this 27 + special exception, which will cause the skeleton and the resulting 28 + Bison output files to be licensed under the GNU General Public 29 + License without this special exception. 30 + 31 + This special exception was added by the Free Software Foundation in 32 + version 2.2 of Bison. */ 33 + 34 + /* C LALR(1) parser skeleton written by Richard Stallman, by 35 + simplifying the original so-called "semantic" parser. */ 36 + 37 + /* All symbols defined below should begin with yy or YY, to avoid 38 + infringing on user name space. This should be done even for local 39 + variables, as they might otherwise be expanded by user macros. 40 + There are some unavoidable exceptions within include files to 41 + define necessary library symbols; they are noted "INFRINGES ON 42 + USER NAME SPACE" below. */ 43 + 44 + /* Identify Bison output. */ 45 + #define YYBISON 1 46 + 47 + /* Bison version. */ 48 + #define YYBISON_VERSION "2.4.3" 49 + 50 + /* Skeleton name. */ 51 + #define YYSKELETON_NAME "yacc.c" 52 + 53 + /* Pure parsers. */ 54 + #define YYPURE 0 55 + 56 + /* Push parsers. */ 57 + #define YYPUSH 0 58 + 59 + /* Pull parsers. */ 60 + #define YYPULL 1 61 + 62 + /* Using locations. */ 63 + #define YYLSP_NEEDED 0 64 + 65 + /* Substitute the variable and function names. */ 66 + #define yyparse parse_events_parse 67 + #define yylex parse_events_lex 68 + #define yyerror parse_events_error 69 + #define yylval parse_events_lval 70 + #define yychar parse_events_char 71 + #define yydebug parse_events_debug 72 + #define yynerrs parse_events_nerrs 73 + 74 + 75 + /* Copy the first part of user declarations. */ 76 + 77 + /* Line 189 of yacc.c */ 78 + #line 6 "util/parse-events.y" 79 + 80 + 81 + #define YYDEBUG 1 82 + 83 + #include <linux/compiler.h> 84 + #include <linux/list.h> 85 + #include "types.h" 86 + #include "util.h" 87 + #include "parse-events.h" 88 + 89 + extern int parse_events_lex (void); 90 + 91 + #define ABORT_ON(val) \ 92 + do { \ 93 + if (val) \ 94 + YYABORT; \ 95 + } while (0) 96 + 97 + 98 + 99 + /* Line 189 of yacc.c */ 100 + #line 101 "util/parse-events-bison.c" 101 + 102 + /* Enabling traces. */ 103 + #ifndef YYDEBUG 104 + # define YYDEBUG 0 105 + #endif 106 + 107 + /* Enabling verbose error messages. */ 108 + #ifdef YYERROR_VERBOSE 109 + # undef YYERROR_VERBOSE 110 + # define YYERROR_VERBOSE 1 111 + #else 112 + # define YYERROR_VERBOSE 0 113 + #endif 114 + 115 + /* Enabling the token table. */ 116 + #ifndef YYTOKEN_TABLE 117 + # define YYTOKEN_TABLE 0 118 + #endif 119 + 120 + 121 + /* Tokens. */ 122 + #ifndef YYTOKENTYPE 123 + # define YYTOKENTYPE 124 + /* Put the tokens into the symbol table, so that GDB and other debuggers 125 + know about them. */ 126 + enum yytokentype { 127 + PE_VALUE = 258, 128 + PE_VALUE_SYM = 259, 129 + PE_RAW = 260, 130 + PE_NAME = 261, 131 + PE_MODIFIER_EVENT = 262, 132 + PE_MODIFIER_BP = 263, 133 + PE_NAME_CACHE_TYPE = 264, 134 + PE_NAME_CACHE_OP_RESULT = 265, 135 + PE_PREFIX_MEM = 266, 136 + PE_PREFIX_RAW = 267, 137 + PE_ERROR = 268 138 + }; 139 + #endif 140 + 141 + 142 + 143 + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 144 + typedef union YYSTYPE 145 + { 146 + 147 + /* Line 214 of yacc.c */ 148 + #line 42 "util/parse-events.y" 149 + 150 + char *str; 151 + unsigned long num; 152 + 153 + 154 + 155 + /* Line 214 of yacc.c */ 156 + #line 157 "util/parse-events-bison.c" 157 + } YYSTYPE; 158 + # define YYSTYPE_IS_TRIVIAL 1 159 + # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 160 + # define YYSTYPE_IS_DECLARED 1 161 + #endif 162 + 163 + 164 + /* Copy the second part of user declarations. */ 165 + 166 + 167 + /* Line 264 of yacc.c */ 168 + #line 169 "util/parse-events-bison.c" 169 + 170 + #ifdef short 171 + # undef short 172 + #endif 173 + 174 + #ifdef YYTYPE_UINT8 175 + typedef YYTYPE_UINT8 yytype_uint8; 176 + #else 177 + typedef unsigned char yytype_uint8; 178 + #endif 179 + 180 + #ifdef YYTYPE_INT8 181 + typedef YYTYPE_INT8 yytype_int8; 182 + #elif (defined __STDC__ || defined __C99__FUNC__ \ 183 + || defined __cplusplus || defined _MSC_VER) 184 + typedef signed char yytype_int8; 185 + #else 186 + typedef short int yytype_int8; 187 + #endif 188 + 189 + #ifdef YYTYPE_UINT16 190 + typedef YYTYPE_UINT16 yytype_uint16; 191 + #else 192 + typedef unsigned short int yytype_uint16; 193 + #endif 194 + 195 + #ifdef YYTYPE_INT16 196 + typedef YYTYPE_INT16 yytype_int16; 197 + #else 198 + typedef short int yytype_int16; 199 + #endif 200 + 201 + #ifndef YYSIZE_T 202 + # ifdef __SIZE_TYPE__ 203 + # define YYSIZE_T __SIZE_TYPE__ 204 + # elif defined size_t 205 + # define YYSIZE_T size_t 206 + # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 207 + || defined __cplusplus || defined _MSC_VER) 208 + # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 209 + # define YYSIZE_T size_t 210 + # else 211 + # define YYSIZE_T unsigned int 212 + # endif 213 + #endif 214 + 215 + #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 216 + 217 + #ifndef YY_ 218 + # if defined YYENABLE_NLS && YYENABLE_NLS 219 + # if ENABLE_NLS 220 + # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 221 + # define YY_(msgid) dgettext ("bison-runtime", msgid) 222 + # endif 223 + # endif 224 + # ifndef YY_ 225 + # define YY_(msgid) msgid 226 + # endif 227 + #endif 228 + 229 + /* Suppress unused-variable warnings by "using" E. */ 230 + #if ! defined lint || defined __GNUC__ 231 + # define YYUSE(e) ((void) (e)) 232 + #else 233 + # define YYUSE(e) /* empty */ 234 + #endif 235 + 236 + /* Identity function, used to suppress warnings about constant conditions. */ 237 + #ifndef lint 238 + # define YYID(n) (n) 239 + #else 240 + #if (defined __STDC__ || defined __C99__FUNC__ \ 241 + || defined __cplusplus || defined _MSC_VER) 242 + static int 243 + YYID (int yyi) 244 + #else 245 + static int 246 + YYID (yyi) 247 + int yyi; 248 + #endif 249 + { 250 + return yyi; 251 + } 252 + #endif 253 + 254 + #if ! defined yyoverflow || YYERROR_VERBOSE 255 + 256 + /* The parser invokes alloca or malloc; define the necessary symbols. */ 257 + 258 + # ifdef YYSTACK_USE_ALLOCA 259 + # if YYSTACK_USE_ALLOCA 260 + # ifdef __GNUC__ 261 + # define YYSTACK_ALLOC __builtin_alloca 262 + # elif defined __BUILTIN_VA_ARG_INCR 263 + # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 264 + # elif defined _AIX 265 + # define YYSTACK_ALLOC __alloca 266 + # elif defined _MSC_VER 267 + # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 268 + # define alloca _alloca 269 + # else 270 + # define YYSTACK_ALLOC alloca 271 + # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 272 + || defined __cplusplus || defined _MSC_VER) 273 + # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 274 + # ifndef _STDLIB_H 275 + # define _STDLIB_H 1 276 + # endif 277 + # endif 278 + # endif 279 + # endif 280 + # endif 281 + 282 + # ifdef YYSTACK_ALLOC 283 + /* Pacify GCC's `empty if-body' warning. */ 284 + # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 285 + # ifndef YYSTACK_ALLOC_MAXIMUM 286 + /* The OS might guarantee only one guard page at the bottom of the stack, 287 + and a page size can be as small as 4096 bytes. So we cannot safely 288 + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 289 + to allow for a few compiler-allocated temporary stack slots. */ 290 + # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 291 + # endif 292 + # else 293 + # define YYSTACK_ALLOC YYMALLOC 294 + # define YYSTACK_FREE YYFREE 295 + # ifndef YYSTACK_ALLOC_MAXIMUM 296 + # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 297 + # endif 298 + # if (defined __cplusplus && ! defined _STDLIB_H \ 299 + && ! ((defined YYMALLOC || defined malloc) \ 300 + && (defined YYFREE || defined free))) 301 + # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 302 + # ifndef _STDLIB_H 303 + # define _STDLIB_H 1 304 + # endif 305 + # endif 306 + # ifndef YYMALLOC 307 + # define YYMALLOC malloc 308 + # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 309 + || defined __cplusplus || defined _MSC_VER) 310 + void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 311 + # endif 312 + # endif 313 + # ifndef YYFREE 314 + # define YYFREE free 315 + # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 316 + || defined __cplusplus || defined _MSC_VER) 317 + void free (void *); /* INFRINGES ON USER NAME SPACE */ 318 + # endif 319 + # endif 320 + # endif 321 + #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 322 + 323 + 324 + #if (! defined yyoverflow \ 325 + && (! defined __cplusplus \ 326 + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 327 + 328 + /* A type that is properly aligned for any stack member. */ 329 + union yyalloc 330 + { 331 + yytype_int16 yyss_alloc; 332 + YYSTYPE yyvs_alloc; 333 + }; 334 + 335 + /* The size of the maximum gap between one aligned stack and the next. */ 336 + # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 337 + 338 + /* The size of an array large to enough to hold all stacks, each with 339 + N elements. */ 340 + # define YYSTACK_BYTES(N) \ 341 + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 342 + + YYSTACK_GAP_MAXIMUM) 343 + 344 + /* Copy COUNT objects from FROM to TO. The source and destination do 345 + not overlap. */ 346 + # ifndef YYCOPY 347 + # if defined __GNUC__ && 1 < __GNUC__ 348 + # define YYCOPY(To, From, Count) \ 349 + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 350 + # else 351 + # define YYCOPY(To, From, Count) \ 352 + do \ 353 + { \ 354 + YYSIZE_T yyi; \ 355 + for (yyi = 0; yyi < (Count); yyi++) \ 356 + (To)[yyi] = (From)[yyi]; \ 357 + } \ 358 + while (YYID (0)) 359 + # endif 360 + # endif 361 + 362 + /* Relocate STACK from its old location to the new one. The 363 + local variables YYSIZE and YYSTACKSIZE give the old and new number of 364 + elements in the stack, and YYPTR gives the new location of the 365 + stack. Advance YYPTR to a properly aligned location for the next 366 + stack. */ 367 + # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 368 + do \ 369 + { \ 370 + YYSIZE_T yynewbytes; \ 371 + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 372 + Stack = &yyptr->Stack_alloc; \ 373 + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 374 + yyptr += yynewbytes / sizeof (*yyptr); \ 375 + } \ 376 + while (YYID (0)) 377 + 378 + #endif 379 + 380 + /* YYFINAL -- State number of the termination state. */ 381 + #define YYFINAL 20 382 + /* YYLAST -- Last index in YYTABLE. */ 383 + #define YYLAST 27 384 + 385 + /* YYNTOKENS -- Number of terminals. */ 386 + #define YYNTOKENS 17 387 + /* YYNNTS -- Number of nonterminals. */ 388 + #define YYNNTS 11 389 + /* YYNRULES -- Number of rules. */ 390 + #define YYNRULES 22 391 + /* YYNRULES -- Number of states. */ 392 + #define YYNSTATES 39 393 + 394 + /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 395 + #define YYUNDEFTOK 2 396 + #define YYMAXUTOK 268 397 + 398 + #define YYTRANSLATE(YYX) \ 399 + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 400 + 401 + /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 402 + static const yytype_uint8 yytranslate[] = 403 + { 404 + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 405 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 406 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 407 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 408 + 2, 2, 2, 2, 14, 15, 2, 2, 2, 2, 409 + 2, 2, 2, 2, 2, 2, 2, 2, 16, 2, 410 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 411 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 412 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 413 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 414 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 415 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 416 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 417 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 418 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 419 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 420 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 421 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 422 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 423 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 424 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 425 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 426 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 427 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 428 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 429 + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 430 + 5, 6, 7, 8, 9, 10, 11, 12, 13 431 + }; 432 + 433 + #if YYDEBUG 434 + /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 435 + YYRHS. */ 436 + static const yytype_uint8 yyprhs[] = 437 + { 438 + 0, 0, 3, 7, 9, 12, 14, 17, 20, 22, 439 + 25, 28, 31, 33, 39, 43, 45, 51, 55, 59, 440 + 63, 65, 67 441 + }; 442 + 443 + /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 444 + static const yytype_int8 yyrhs[] = 445 + { 446 + 18, 0, -1, 18, 14, 19, -1, 19, -1, 20, 447 + 7, -1, 20, -1, 21, 27, -1, 22, 27, -1, 448 + 23, -1, 24, 27, -1, 25, 27, -1, 26, 27, 449 + -1, 4, -1, 9, 15, 10, 15, 10, -1, 9, 450 + 15, 10, -1, 9, -1, 11, 3, 16, 8, 27, 451 + -1, 11, 3, 27, -1, 6, 16, 6, -1, 3, 452 + 16, 3, -1, 5, -1, 16, -1, -1 453 + }; 454 + 455 + /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 456 + static const yytype_uint8 yyrline[] = 457 + { 458 + 0, 49, 49, 49, 52, 57, 59, 60, 61, 62, 459 + 63, 64, 67, 76, 81, 86, 92, 97, 103, 109, 460 + 115, 120, 120 461 + }; 462 + #endif 463 + 464 + #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 465 + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 466 + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 467 + static const char *const yytname[] = 468 + { 469 + "$end", "error", "$undefined", "PE_VALUE", "PE_VALUE_SYM", "PE_RAW", 470 + "PE_NAME", "PE_MODIFIER_EVENT", "PE_MODIFIER_BP", "PE_NAME_CACHE_TYPE", 471 + "PE_NAME_CACHE_OP_RESULT", "PE_PREFIX_MEM", "PE_PREFIX_RAW", "PE_ERROR", 472 + "','", "'-'", "':'", "$accept", "events", "event", "event_def", 473 + "event_legacy_symbol", "event_legacy_cache", "event_legacy_mem", 474 + "event_legacy_tracepoint", "event_legacy_numeric", "event_legacy_raw", 475 + "sep_dc", 0 476 + }; 477 + #endif 478 + 479 + # ifdef YYPRINT 480 + /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 481 + token YYLEX-NUM. */ 482 + static const yytype_uint16 yytoknum[] = 483 + { 484 + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 485 + 265, 266, 267, 268, 44, 45, 58 486 + }; 487 + # endif 488 + 489 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 490 + static const yytype_uint8 yyr1[] = 491 + { 492 + 0, 17, 18, 18, 19, 19, 20, 20, 20, 20, 493 + 20, 20, 21, 22, 22, 22, 23, 23, 24, 25, 494 + 26, 27, 27 495 + }; 496 + 497 + /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 498 + static const yytype_uint8 yyr2[] = 499 + { 500 + 0, 2, 3, 1, 2, 1, 2, 2, 1, 2, 501 + 2, 2, 1, 5, 3, 1, 5, 3, 3, 3, 502 + 1, 1, 0 503 + }; 504 + 505 + /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 506 + STATE-NUM when YYTABLE doesn't specify something else to do. Zero 507 + means the default is an error. */ 508 + static const yytype_uint8 yydefact[] = 509 + { 510 + 0, 0, 12, 20, 0, 15, 0, 0, 3, 5, 511 + 22, 22, 8, 22, 22, 22, 0, 0, 0, 22, 512 + 1, 0, 4, 21, 6, 7, 9, 10, 11, 19, 513 + 18, 14, 21, 17, 2, 0, 22, 13, 16 514 + }; 515 + 516 + /* YYDEFGOTO[NTERM-NUM]. */ 517 + static const yytype_int8 yydefgoto[] = 518 + { 519 + -1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 520 + 24 521 + }; 522 + 523 + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 524 + STATE-NUM. */ 525 + #define YYPACT_NINF -12 526 + static const yytype_int8 yypact[] = 527 + { 528 + 7, -10, -12, -12, -9, -6, 2, 1, -12, 10, 529 + -2, -2, -12, -2, -2, -2, 16, 14, 11, 6, 530 + -12, 7, -12, -12, -12, -12, -12, -12, -12, -12, 531 + -12, 8, 18, -12, -12, 17, -2, -12, -12 532 + }; 533 + 534 + /* YYPGOTO[NTERM-NUM]. */ 535 + static const yytype_int8 yypgoto[] = 536 + { 537 + -12, -12, 3, -12, -12, -12, -12, -12, -12, -12, 538 + -11 539 + }; 540 + 541 + /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 542 + positive, shift that token. If negative, reduce the rule which 543 + number is the opposite. If zero, do what YYDEFACT says. 544 + If YYTABLE_NINF, syntax error. */ 545 + #define YYTABLE_NINF -1 546 + static const yytype_uint8 yytable[] = 547 + { 548 + 25, 20, 26, 27, 28, 19, 16, 17, 33, 18, 549 + 1, 2, 3, 4, 23, 21, 5, 22, 6, 29, 550 + 30, 31, 32, 35, 34, 38, 36, 37 551 + }; 552 + 553 + static const yytype_uint8 yycheck[] = 554 + { 555 + 11, 0, 13, 14, 15, 3, 16, 16, 19, 15, 556 + 3, 4, 5, 6, 16, 14, 9, 7, 11, 3, 557 + 6, 10, 16, 15, 21, 36, 8, 10 558 + }; 559 + 560 + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 561 + symbol of state STATE-NUM. */ 562 + static const yytype_uint8 yystos[] = 563 + { 564 + 0, 3, 4, 5, 6, 9, 11, 18, 19, 20, 565 + 21, 22, 23, 24, 25, 26, 16, 16, 15, 3, 566 + 0, 14, 7, 16, 27, 27, 27, 27, 27, 3, 567 + 6, 10, 16, 27, 19, 15, 8, 10, 27 568 + }; 569 + 570 + #define yyerrok (yyerrstatus = 0) 571 + #define yyclearin (yychar = YYEMPTY) 572 + #define YYEMPTY (-2) 573 + #define YYEOF 0 574 + 575 + #define YYACCEPT goto yyacceptlab 576 + #define YYABORT goto yyabortlab 577 + #define YYERROR goto yyerrorlab 578 + 579 + 580 + /* Like YYERROR except do call yyerror. This remains here temporarily 581 + to ease the transition to the new meaning of YYERROR, for GCC. 582 + Once GCC version 2 has supplanted version 1, this can go. However, 583 + YYFAIL appears to be in use. Nevertheless, it is formally deprecated 584 + in Bison 2.4.2's NEWS entry, where a plan to phase it out is 585 + discussed. */ 586 + 587 + #define YYFAIL goto yyerrlab 588 + #if defined YYFAIL 589 + /* This is here to suppress warnings from the GCC cpp's 590 + -Wunused-macros. Normally we don't worry about that warning, but 591 + some users do, and we want to make it easy for users to remove 592 + YYFAIL uses, which will produce warnings from Bison 2.5. */ 593 + #endif 594 + 595 + #define YYRECOVERING() (!!yyerrstatus) 596 + 597 + #define YYBACKUP(Token, Value) \ 598 + do \ 599 + if (yychar == YYEMPTY && yylen == 1) \ 600 + { \ 601 + yychar = (Token); \ 602 + yylval = (Value); \ 603 + yytoken = YYTRANSLATE (yychar); \ 604 + YYPOPSTACK (1); \ 605 + goto yybackup; \ 606 + } \ 607 + else \ 608 + { \ 609 + yyerror (list, idx, YY_("syntax error: cannot back up")); \ 610 + YYERROR; \ 611 + } \ 612 + while (YYID (0)) 613 + 614 + 615 + #define YYTERROR 1 616 + #define YYERRCODE 256 617 + 618 + 619 + /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 620 + If N is 0, then set CURRENT to the empty location which ends 621 + the previous symbol: RHS[0] (always defined). */ 622 + 623 + #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 624 + #ifndef YYLLOC_DEFAULT 625 + # define YYLLOC_DEFAULT(Current, Rhs, N) \ 626 + do \ 627 + if (YYID (N)) \ 628 + { \ 629 + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 630 + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 631 + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 632 + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 633 + } \ 634 + else \ 635 + { \ 636 + (Current).first_line = (Current).last_line = \ 637 + YYRHSLOC (Rhs, 0).last_line; \ 638 + (Current).first_column = (Current).last_column = \ 639 + YYRHSLOC (Rhs, 0).last_column; \ 640 + } \ 641 + while (YYID (0)) 642 + #endif 643 + 644 + 645 + /* YY_LOCATION_PRINT -- Print the location on the stream. 646 + This macro was not mandated originally: define only if we know 647 + we won't break user code: when these are the locations we know. */ 648 + 649 + #ifndef YY_LOCATION_PRINT 650 + # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL 651 + # define YY_LOCATION_PRINT(File, Loc) \ 652 + fprintf (File, "%d.%d-%d.%d", \ 653 + (Loc).first_line, (Loc).first_column, \ 654 + (Loc).last_line, (Loc).last_column) 655 + # else 656 + # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 657 + # endif 658 + #endif 659 + 660 + 661 + /* YYLEX -- calling `yylex' with the right arguments. */ 662 + 663 + #ifdef YYLEX_PARAM 664 + # define YYLEX yylex (YYLEX_PARAM) 665 + #else 666 + # define YYLEX yylex () 667 + #endif 668 + 669 + /* Enable debugging if requested. */ 670 + #if YYDEBUG 671 + 672 + # ifndef YYFPRINTF 673 + # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 674 + # define YYFPRINTF fprintf 675 + # endif 676 + 677 + # define YYDPRINTF(Args) \ 678 + do { \ 679 + if (yydebug) \ 680 + YYFPRINTF Args; \ 681 + } while (YYID (0)) 682 + 683 + # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 684 + do { \ 685 + if (yydebug) \ 686 + { \ 687 + YYFPRINTF (stderr, "%s ", Title); \ 688 + yy_symbol_print (stderr, \ 689 + Type, Value, list, idx); \ 690 + YYFPRINTF (stderr, "\n"); \ 691 + } \ 692 + } while (YYID (0)) 693 + 694 + 695 + /*--------------------------------. 696 + | Print this symbol on YYOUTPUT. | 697 + `--------------------------------*/ 698 + 699 + /*ARGSUSED*/ 700 + #if (defined __STDC__ || defined __C99__FUNC__ \ 701 + || defined __cplusplus || defined _MSC_VER) 702 + static void 703 + yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list, int *idx) 704 + #else 705 + static void 706 + yy_symbol_value_print (yyoutput, yytype, yyvaluep, list, idx) 707 + FILE *yyoutput; 708 + int yytype; 709 + YYSTYPE const * const yyvaluep; 710 + struct list_head *list; 711 + int *idx; 712 + #endif 713 + { 714 + if (!yyvaluep) 715 + return; 716 + YYUSE (list); 717 + YYUSE (idx); 718 + # ifdef YYPRINT 719 + if (yytype < YYNTOKENS) 720 + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 721 + # else 722 + YYUSE (yyoutput); 723 + # endif 724 + switch (yytype) 725 + { 726 + default: 727 + break; 728 + } 729 + } 730 + 731 + 732 + /*--------------------------------. 733 + | Print this symbol on YYOUTPUT. | 734 + `--------------------------------*/ 735 + 736 + #if (defined __STDC__ || defined __C99__FUNC__ \ 737 + || defined __cplusplus || defined _MSC_VER) 738 + static void 739 + yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list, int *idx) 740 + #else 741 + static void 742 + yy_symbol_print (yyoutput, yytype, yyvaluep, list, idx) 743 + FILE *yyoutput; 744 + int yytype; 745 + YYSTYPE const * const yyvaluep; 746 + struct list_head *list; 747 + int *idx; 748 + #endif 749 + { 750 + if (yytype < YYNTOKENS) 751 + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 752 + else 753 + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 754 + 755 + yy_symbol_value_print (yyoutput, yytype, yyvaluep, list, idx); 756 + YYFPRINTF (yyoutput, ")"); 757 + } 758 + 759 + /*------------------------------------------------------------------. 760 + | yy_stack_print -- Print the state stack from its BOTTOM up to its | 761 + | TOP (included). | 762 + `------------------------------------------------------------------*/ 763 + 764 + #if (defined __STDC__ || defined __C99__FUNC__ \ 765 + || defined __cplusplus || defined _MSC_VER) 766 + static void 767 + yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 768 + #else 769 + static void 770 + yy_stack_print (yybottom, yytop) 771 + yytype_int16 *yybottom; 772 + yytype_int16 *yytop; 773 + #endif 774 + { 775 + YYFPRINTF (stderr, "Stack now"); 776 + for (; yybottom <= yytop; yybottom++) 777 + { 778 + int yybot = *yybottom; 779 + YYFPRINTF (stderr, " %d", yybot); 780 + } 781 + YYFPRINTF (stderr, "\n"); 782 + } 783 + 784 + # define YY_STACK_PRINT(Bottom, Top) \ 785 + do { \ 786 + if (yydebug) \ 787 + yy_stack_print ((Bottom), (Top)); \ 788 + } while (YYID (0)) 789 + 790 + 791 + /*------------------------------------------------. 792 + | Report that the YYRULE is going to be reduced. | 793 + `------------------------------------------------*/ 794 + 795 + #if (defined __STDC__ || defined __C99__FUNC__ \ 796 + || defined __cplusplus || defined _MSC_VER) 797 + static void 798 + yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct list_head *list, int *idx) 799 + #else 800 + static void 801 + yy_reduce_print (yyvsp, yyrule, list, idx) 802 + YYSTYPE *yyvsp; 803 + int yyrule; 804 + struct list_head *list; 805 + int *idx; 806 + #endif 807 + { 808 + int yynrhs = yyr2[yyrule]; 809 + int yyi; 810 + unsigned long int yylno = yyrline[yyrule]; 811 + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 812 + yyrule - 1, yylno); 813 + /* The symbols being reduced. */ 814 + for (yyi = 0; yyi < yynrhs; yyi++) 815 + { 816 + YYFPRINTF (stderr, " $%d = ", yyi + 1); 817 + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 818 + &(yyvsp[(yyi + 1) - (yynrhs)]) 819 + , list, idx); 820 + YYFPRINTF (stderr, "\n"); 821 + } 822 + } 823 + 824 + # define YY_REDUCE_PRINT(Rule) \ 825 + do { \ 826 + if (yydebug) \ 827 + yy_reduce_print (yyvsp, Rule, list, idx); \ 828 + } while (YYID (0)) 829 + 830 + /* Nonzero means print parse trace. It is left uninitialized so that 831 + multiple parsers can coexist. */ 832 + int yydebug; 833 + #else /* !YYDEBUG */ 834 + # define YYDPRINTF(Args) 835 + # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 836 + # define YY_STACK_PRINT(Bottom, Top) 837 + # define YY_REDUCE_PRINT(Rule) 838 + #endif /* !YYDEBUG */ 839 + 840 + 841 + /* YYINITDEPTH -- initial size of the parser's stacks. */ 842 + #ifndef YYINITDEPTH 843 + # define YYINITDEPTH 200 844 + #endif 845 + 846 + /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 847 + if the built-in stack extension method is used). 848 + 849 + Do not make this value too large; the results are undefined if 850 + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 851 + evaluated with infinite-precision integer arithmetic. */ 852 + 853 + #ifndef YYMAXDEPTH 854 + # define YYMAXDEPTH 10000 855 + #endif 856 + 857 + 858 + 859 + #if YYERROR_VERBOSE 860 + 861 + # ifndef yystrlen 862 + # if defined __GLIBC__ && defined _STRING_H 863 + # define yystrlen strlen 864 + # else 865 + /* Return the length of YYSTR. */ 866 + #if (defined __STDC__ || defined __C99__FUNC__ \ 867 + || defined __cplusplus || defined _MSC_VER) 868 + static YYSIZE_T 869 + yystrlen (const char *yystr) 870 + #else 871 + static YYSIZE_T 872 + yystrlen (yystr) 873 + const char *yystr; 874 + #endif 875 + { 876 + YYSIZE_T yylen; 877 + for (yylen = 0; yystr[yylen]; yylen++) 878 + continue; 879 + return yylen; 880 + } 881 + # endif 882 + # endif 883 + 884 + # ifndef yystpcpy 885 + # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 886 + # define yystpcpy stpcpy 887 + # else 888 + /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 889 + YYDEST. */ 890 + #if (defined __STDC__ || defined __C99__FUNC__ \ 891 + || defined __cplusplus || defined _MSC_VER) 892 + static char * 893 + yystpcpy (char *yydest, const char *yysrc) 894 + #else 895 + static char * 896 + yystpcpy (yydest, yysrc) 897 + char *yydest; 898 + const char *yysrc; 899 + #endif 900 + { 901 + char *yyd = yydest; 902 + const char *yys = yysrc; 903 + 904 + while ((*yyd++ = *yys++) != '\0') 905 + continue; 906 + 907 + return yyd - 1; 908 + } 909 + # endif 910 + # endif 911 + 912 + # ifndef yytnamerr 913 + /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 914 + quotes and backslashes, so that it's suitable for yyerror. The 915 + heuristic is that double-quoting is unnecessary unless the string 916 + contains an apostrophe, a comma, or backslash (other than 917 + backslash-backslash). YYSTR is taken from yytname. If YYRES is 918 + null, do not copy; instead, return the length of what the result 919 + would have been. */ 920 + static YYSIZE_T 921 + yytnamerr (char *yyres, const char *yystr) 922 + { 923 + if (*yystr == '"') 924 + { 925 + YYSIZE_T yyn = 0; 926 + char const *yyp = yystr; 927 + 928 + for (;;) 929 + switch (*++yyp) 930 + { 931 + case '\'': 932 + case ',': 933 + goto do_not_strip_quotes; 934 + 935 + case '\\': 936 + if (*++yyp != '\\') 937 + goto do_not_strip_quotes; 938 + /* Fall through. */ 939 + default: 940 + if (yyres) 941 + yyres[yyn] = *yyp; 942 + yyn++; 943 + break; 944 + 945 + case '"': 946 + if (yyres) 947 + yyres[yyn] = '\0'; 948 + return yyn; 949 + } 950 + do_not_strip_quotes: ; 951 + } 952 + 953 + if (! yyres) 954 + return yystrlen (yystr); 955 + 956 + return yystpcpy (yyres, yystr) - yyres; 957 + } 958 + # endif 959 + 960 + /* Copy into YYRESULT an error message about the unexpected token 961 + YYCHAR while in state YYSTATE. Return the number of bytes copied, 962 + including the terminating null byte. If YYRESULT is null, do not 963 + copy anything; just return the number of bytes that would be 964 + copied. As a special case, return 0 if an ordinary "syntax error" 965 + message will do. Return YYSIZE_MAXIMUM if overflow occurs during 966 + size calculation. */ 967 + static YYSIZE_T 968 + yysyntax_error (char *yyresult, int yystate, int yychar) 969 + { 970 + int yyn = yypact[yystate]; 971 + 972 + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 973 + return 0; 974 + else 975 + { 976 + int yytype = YYTRANSLATE (yychar); 977 + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 978 + YYSIZE_T yysize = yysize0; 979 + YYSIZE_T yysize1; 980 + int yysize_overflow = 0; 981 + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 982 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 983 + int yyx; 984 + 985 + # if 0 986 + /* This is so xgettext sees the translatable formats that are 987 + constructed on the fly. */ 988 + YY_("syntax error, unexpected %s"); 989 + YY_("syntax error, unexpected %s, expecting %s"); 990 + YY_("syntax error, unexpected %s, expecting %s or %s"); 991 + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 992 + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 993 + # endif 994 + char *yyfmt; 995 + char const *yyf; 996 + static char const yyunexpected[] = "syntax error, unexpected %s"; 997 + static char const yyexpecting[] = ", expecting %s"; 998 + static char const yyor[] = " or %s"; 999 + char yyformat[sizeof yyunexpected 1000 + + sizeof yyexpecting - 1 1001 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1002 + * (sizeof yyor - 1))]; 1003 + char const *yyprefix = yyexpecting; 1004 + 1005 + /* Start YYX at -YYN if negative to avoid negative indexes in 1006 + YYCHECK. */ 1007 + int yyxbegin = yyn < 0 ? -yyn : 0; 1008 + 1009 + /* Stay within bounds of both yycheck and yytname. */ 1010 + int yychecklim = YYLAST - yyn + 1; 1011 + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1012 + int yycount = 1; 1013 + 1014 + yyarg[0] = yytname[yytype]; 1015 + yyfmt = yystpcpy (yyformat, yyunexpected); 1016 + 1017 + for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1018 + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 1019 + { 1020 + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1021 + { 1022 + yycount = 1; 1023 + yysize = yysize0; 1024 + yyformat[sizeof yyunexpected - 1] = '\0'; 1025 + break; 1026 + } 1027 + yyarg[yycount++] = yytname[yyx]; 1028 + yysize1 = yysize + yytnamerr (0, yytname[yyx]); 1029 + yysize_overflow |= (yysize1 < yysize); 1030 + yysize = yysize1; 1031 + yyfmt = yystpcpy (yyfmt, yyprefix); 1032 + yyprefix = yyor; 1033 + } 1034 + 1035 + yyf = YY_(yyformat); 1036 + yysize1 = yysize + yystrlen (yyf); 1037 + yysize_overflow |= (yysize1 < yysize); 1038 + yysize = yysize1; 1039 + 1040 + if (yysize_overflow) 1041 + return YYSIZE_MAXIMUM; 1042 + 1043 + if (yyresult) 1044 + { 1045 + /* Avoid sprintf, as that infringes on the user's name space. 1046 + Don't have undefined behavior even if the translation 1047 + produced a string with the wrong number of "%s"s. */ 1048 + char *yyp = yyresult; 1049 + int yyi = 0; 1050 + while ((*yyp = *yyf) != '\0') 1051 + { 1052 + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 1053 + { 1054 + yyp += yytnamerr (yyp, yyarg[yyi++]); 1055 + yyf += 2; 1056 + } 1057 + else 1058 + { 1059 + yyp++; 1060 + yyf++; 1061 + } 1062 + } 1063 + } 1064 + return yysize; 1065 + } 1066 + } 1067 + #endif /* YYERROR_VERBOSE */ 1068 + 1069 + 1070 + /*-----------------------------------------------. 1071 + | Release the memory associated to this symbol. | 1072 + `-----------------------------------------------*/ 1073 + 1074 + /*ARGSUSED*/ 1075 + #if (defined __STDC__ || defined __C99__FUNC__ \ 1076 + || defined __cplusplus || defined _MSC_VER) 1077 + static void 1078 + yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct list_head *list, int *idx) 1079 + #else 1080 + static void 1081 + yydestruct (yymsg, yytype, yyvaluep, list, idx) 1082 + const char *yymsg; 1083 + int yytype; 1084 + YYSTYPE *yyvaluep; 1085 + struct list_head *list; 1086 + int *idx; 1087 + #endif 1088 + { 1089 + YYUSE (yyvaluep); 1090 + YYUSE (list); 1091 + YYUSE (idx); 1092 + 1093 + if (!yymsg) 1094 + yymsg = "Deleting"; 1095 + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1096 + 1097 + switch (yytype) 1098 + { 1099 + 1100 + default: 1101 + break; 1102 + } 1103 + } 1104 + 1105 + /* Prevent warnings from -Wmissing-prototypes. */ 1106 + #ifdef YYPARSE_PARAM 1107 + #if defined __STDC__ || defined __cplusplus 1108 + int yyparse (void *YYPARSE_PARAM); 1109 + #else 1110 + int yyparse (); 1111 + #endif 1112 + #else /* ! YYPARSE_PARAM */ 1113 + #if defined __STDC__ || defined __cplusplus 1114 + int yyparse (struct list_head *list, int *idx); 1115 + #else 1116 + int yyparse (); 1117 + #endif 1118 + #endif /* ! YYPARSE_PARAM */ 1119 + 1120 + 1121 + /* The lookahead symbol. */ 1122 + int yychar; 1123 + 1124 + /* The semantic value of the lookahead symbol. */ 1125 + YYSTYPE yylval; 1126 + 1127 + /* Number of syntax errors so far. */ 1128 + int yynerrs; 1129 + 1130 + 1131 + 1132 + /*-------------------------. 1133 + | yyparse or yypush_parse. | 1134 + `-------------------------*/ 1135 + 1136 + #ifdef YYPARSE_PARAM 1137 + #if (defined __STDC__ || defined __C99__FUNC__ \ 1138 + || defined __cplusplus || defined _MSC_VER) 1139 + int 1140 + yyparse (void *YYPARSE_PARAM) 1141 + #else 1142 + int 1143 + yyparse (YYPARSE_PARAM) 1144 + void *YYPARSE_PARAM; 1145 + #endif 1146 + #else /* ! YYPARSE_PARAM */ 1147 + #if (defined __STDC__ || defined __C99__FUNC__ \ 1148 + || defined __cplusplus || defined _MSC_VER) 1149 + int 1150 + yyparse (struct list_head *list, int *idx) 1151 + #else 1152 + int 1153 + yyparse (list, idx) 1154 + struct list_head *list; 1155 + int *idx; 1156 + #endif 1157 + #endif 1158 + { 1159 + 1160 + 1161 + int yystate; 1162 + /* Number of tokens to shift before error messages enabled. */ 1163 + int yyerrstatus; 1164 + 1165 + /* The stacks and their tools: 1166 + `yyss': related to states. 1167 + `yyvs': related to semantic values. 1168 + 1169 + Refer to the stacks thru separate pointers, to allow yyoverflow 1170 + to reallocate them elsewhere. */ 1171 + 1172 + /* The state stack. */ 1173 + yytype_int16 yyssa[YYINITDEPTH]; 1174 + yytype_int16 *yyss; 1175 + yytype_int16 *yyssp; 1176 + 1177 + /* The semantic value stack. */ 1178 + YYSTYPE yyvsa[YYINITDEPTH]; 1179 + YYSTYPE *yyvs; 1180 + YYSTYPE *yyvsp; 1181 + 1182 + YYSIZE_T yystacksize; 1183 + 1184 + int yyn; 1185 + int yyresult; 1186 + /* Lookahead token as an internal (translated) token number. */ 1187 + int yytoken; 1188 + /* The variables used to return semantic value and location from the 1189 + action routines. */ 1190 + YYSTYPE yyval; 1191 + 1192 + #if YYERROR_VERBOSE 1193 + /* Buffer for error messages, and its allocated size. */ 1194 + char yymsgbuf[128]; 1195 + char *yymsg = yymsgbuf; 1196 + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1197 + #endif 1198 + 1199 + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1200 + 1201 + /* The number of symbols on the RHS of the reduced rule. 1202 + Keep to zero when no symbol should be popped. */ 1203 + int yylen = 0; 1204 + 1205 + yytoken = 0; 1206 + yyss = yyssa; 1207 + yyvs = yyvsa; 1208 + yystacksize = YYINITDEPTH; 1209 + 1210 + YYDPRINTF ((stderr, "Starting parse\n")); 1211 + 1212 + yystate = 0; 1213 + yyerrstatus = 0; 1214 + yynerrs = 0; 1215 + yychar = YYEMPTY; /* Cause a token to be read. */ 1216 + 1217 + /* Initialize stack pointers. 1218 + Waste one element of value and location stack 1219 + so that they stay on the same level as the state stack. 1220 + The wasted elements are never initialized. */ 1221 + yyssp = yyss; 1222 + yyvsp = yyvs; 1223 + 1224 + goto yysetstate; 1225 + 1226 + /*------------------------------------------------------------. 1227 + | yynewstate -- Push a new state, which is found in yystate. | 1228 + `------------------------------------------------------------*/ 1229 + yynewstate: 1230 + /* In all cases, when you get here, the value and location stacks 1231 + have just been pushed. So pushing a state here evens the stacks. */ 1232 + yyssp++; 1233 + 1234 + yysetstate: 1235 + *yyssp = yystate; 1236 + 1237 + if (yyss + yystacksize - 1 <= yyssp) 1238 + { 1239 + /* Get the current used size of the three stacks, in elements. */ 1240 + YYSIZE_T yysize = yyssp - yyss + 1; 1241 + 1242 + #ifdef yyoverflow 1243 + { 1244 + /* Give user a chance to reallocate the stack. Use copies of 1245 + these so that the &'s don't force the real ones into 1246 + memory. */ 1247 + YYSTYPE *yyvs1 = yyvs; 1248 + yytype_int16 *yyss1 = yyss; 1249 + 1250 + /* Each stack pointer address is followed by the size of the 1251 + data in use in that stack, in bytes. This used to be a 1252 + conditional around just the two extra args, but that might 1253 + be undefined if yyoverflow is a macro. */ 1254 + yyoverflow (YY_("memory exhausted"), 1255 + &yyss1, yysize * sizeof (*yyssp), 1256 + &yyvs1, yysize * sizeof (*yyvsp), 1257 + &yystacksize); 1258 + 1259 + yyss = yyss1; 1260 + yyvs = yyvs1; 1261 + } 1262 + #else /* no yyoverflow */ 1263 + # ifndef YYSTACK_RELOCATE 1264 + goto yyexhaustedlab; 1265 + # else 1266 + /* Extend the stack our own way. */ 1267 + if (YYMAXDEPTH <= yystacksize) 1268 + goto yyexhaustedlab; 1269 + yystacksize *= 2; 1270 + if (YYMAXDEPTH < yystacksize) 1271 + yystacksize = YYMAXDEPTH; 1272 + 1273 + { 1274 + yytype_int16 *yyss1 = yyss; 1275 + union yyalloc *yyptr = 1276 + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1277 + if (! yyptr) 1278 + goto yyexhaustedlab; 1279 + YYSTACK_RELOCATE (yyss_alloc, yyss); 1280 + YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1281 + # undef YYSTACK_RELOCATE 1282 + if (yyss1 != yyssa) 1283 + YYSTACK_FREE (yyss1); 1284 + } 1285 + # endif 1286 + #endif /* no yyoverflow */ 1287 + 1288 + yyssp = yyss + yysize - 1; 1289 + yyvsp = yyvs + yysize - 1; 1290 + 1291 + YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1292 + (unsigned long int) yystacksize)); 1293 + 1294 + if (yyss + yystacksize - 1 <= yyssp) 1295 + YYABORT; 1296 + } 1297 + 1298 + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1299 + 1300 + if (yystate == YYFINAL) 1301 + YYACCEPT; 1302 + 1303 + goto yybackup; 1304 + 1305 + /*-----------. 1306 + | yybackup. | 1307 + `-----------*/ 1308 + yybackup: 1309 + 1310 + /* Do appropriate processing given the current state. Read a 1311 + lookahead token if we need one and don't already have one. */ 1312 + 1313 + /* First try to decide what to do without reference to lookahead token. */ 1314 + yyn = yypact[yystate]; 1315 + if (yyn == YYPACT_NINF) 1316 + goto yydefault; 1317 + 1318 + /* Not known => get a lookahead token if don't already have one. */ 1319 + 1320 + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1321 + if (yychar == YYEMPTY) 1322 + { 1323 + YYDPRINTF ((stderr, "Reading a token: ")); 1324 + yychar = YYLEX; 1325 + } 1326 + 1327 + if (yychar <= YYEOF) 1328 + { 1329 + yychar = yytoken = YYEOF; 1330 + YYDPRINTF ((stderr, "Now at end of input.\n")); 1331 + } 1332 + else 1333 + { 1334 + yytoken = YYTRANSLATE (yychar); 1335 + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1336 + } 1337 + 1338 + /* If the proper action on seeing token YYTOKEN is to reduce or to 1339 + detect an error, take that action. */ 1340 + yyn += yytoken; 1341 + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1342 + goto yydefault; 1343 + yyn = yytable[yyn]; 1344 + if (yyn <= 0) 1345 + { 1346 + if (yyn == 0 || yyn == YYTABLE_NINF) 1347 + goto yyerrlab; 1348 + yyn = -yyn; 1349 + goto yyreduce; 1350 + } 1351 + 1352 + /* Count tokens shifted since error; after three, turn off error 1353 + status. */ 1354 + if (yyerrstatus) 1355 + yyerrstatus--; 1356 + 1357 + /* Shift the lookahead token. */ 1358 + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1359 + 1360 + /* Discard the shifted token. */ 1361 + yychar = YYEMPTY; 1362 + 1363 + yystate = yyn; 1364 + *++yyvsp = yylval; 1365 + 1366 + goto yynewstate; 1367 + 1368 + 1369 + /*-----------------------------------------------------------. 1370 + | yydefault -- do the default action for the current state. | 1371 + `-----------------------------------------------------------*/ 1372 + yydefault: 1373 + yyn = yydefact[yystate]; 1374 + if (yyn == 0) 1375 + goto yyerrlab; 1376 + goto yyreduce; 1377 + 1378 + 1379 + /*-----------------------------. 1380 + | yyreduce -- Do a reduction. | 1381 + `-----------------------------*/ 1382 + yyreduce: 1383 + /* yyn is the number of a rule to reduce with. */ 1384 + yylen = yyr2[yyn]; 1385 + 1386 + /* If YYLEN is nonzero, implement the default value of the action: 1387 + `$$ = $1'. 1388 + 1389 + Otherwise, the following line sets YYVAL to garbage. 1390 + This behavior is undocumented and Bison 1391 + users should not rely upon it. Assigning to YYVAL 1392 + unconditionally makes the parser a bit smaller, and it avoids a 1393 + GCC warning that YYVAL may be used uninitialized. */ 1394 + yyval = yyvsp[1-yylen]; 1395 + 1396 + 1397 + YY_REDUCE_PRINT (yyn); 1398 + switch (yyn) 1399 + { 1400 + case 4: 1401 + 1402 + /* Line 1464 of yacc.c */ 1403 + #line 53 "util/parse-events.y" 1404 + { 1405 + ABORT_ON(parse_events_modifier(list, (yyvsp[(2) - (2)].str))); 1406 + ;} 1407 + break; 1408 + 1409 + case 12: 1410 + 1411 + /* Line 1464 of yacc.c */ 1412 + #line 68 "util/parse-events.y" 1413 + { 1414 + int type = (yyvsp[(1) - (1)].num) >> 16; 1415 + int config = (yyvsp[(1) - (1)].num) & 255; 1416 + 1417 + ABORT_ON(parse_events_add_numeric(list, idx, type, config)); 1418 + ;} 1419 + break; 1420 + 1421 + case 13: 1422 + 1423 + /* Line 1464 of yacc.c */ 1424 + #line 77 "util/parse-events.y" 1425 + { 1426 + ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), (yyvsp[(5) - (5)].str))); 1427 + ;} 1428 + break; 1429 + 1430 + case 14: 1431 + 1432 + /* Line 1464 of yacc.c */ 1433 + #line 82 "util/parse-events.y" 1434 + { 1435 + ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), NULL)); 1436 + ;} 1437 + break; 1438 + 1439 + case 15: 1440 + 1441 + /* Line 1464 of yacc.c */ 1442 + #line 87 "util/parse-events.y" 1443 + { 1444 + ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (1)].str), NULL, NULL)); 1445 + ;} 1446 + break; 1447 + 1448 + case 16: 1449 + 1450 + /* Line 1464 of yacc.c */ 1451 + #line 93 "util/parse-events.y" 1452 + { 1453 + ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) (yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].str))); 1454 + ;} 1455 + break; 1456 + 1457 + case 17: 1458 + 1459 + /* Line 1464 of yacc.c */ 1460 + #line 98 "util/parse-events.y" 1461 + { 1462 + ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) (yyvsp[(2) - (3)].num), NULL)); 1463 + ;} 1464 + break; 1465 + 1466 + case 18: 1467 + 1468 + /* Line 1464 of yacc.c */ 1469 + #line 104 "util/parse-events.y" 1470 + { 1471 + ABORT_ON(parse_events_add_tracepoint(list, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str))); 1472 + ;} 1473 + break; 1474 + 1475 + case 19: 1476 + 1477 + /* Line 1464 of yacc.c */ 1478 + #line 110 "util/parse-events.y" 1479 + { 1480 + ABORT_ON(parse_events_add_numeric(list, idx, (yyvsp[(1) - (3)].num), (yyvsp[(3) - (3)].num))); 1481 + ;} 1482 + break; 1483 + 1484 + case 20: 1485 + 1486 + /* Line 1464 of yacc.c */ 1487 + #line 116 "util/parse-events.y" 1488 + { 1489 + ABORT_ON(parse_events_add_numeric(list, idx, PERF_TYPE_RAW, (yyvsp[(1) - (1)].num))); 1490 + ;} 1491 + break; 1492 + 1493 + 1494 + 1495 + /* Line 1464 of yacc.c */ 1496 + #line 1497 "util/parse-events-bison.c" 1497 + default: break; 1498 + } 1499 + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1500 + 1501 + YYPOPSTACK (yylen); 1502 + yylen = 0; 1503 + YY_STACK_PRINT (yyss, yyssp); 1504 + 1505 + *++yyvsp = yyval; 1506 + 1507 + /* Now `shift' the result of the reduction. Determine what state 1508 + that goes to, based on the state we popped back to and the rule 1509 + number reduced by. */ 1510 + 1511 + yyn = yyr1[yyn]; 1512 + 1513 + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 1514 + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1515 + yystate = yytable[yystate]; 1516 + else 1517 + yystate = yydefgoto[yyn - YYNTOKENS]; 1518 + 1519 + goto yynewstate; 1520 + 1521 + 1522 + /*------------------------------------. 1523 + | yyerrlab -- here on detecting error | 1524 + `------------------------------------*/ 1525 + yyerrlab: 1526 + /* If not already recovering from an error, report this error. */ 1527 + if (!yyerrstatus) 1528 + { 1529 + ++yynerrs; 1530 + #if ! YYERROR_VERBOSE 1531 + yyerror (list, idx, YY_("syntax error")); 1532 + #else 1533 + { 1534 + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 1535 + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 1536 + { 1537 + YYSIZE_T yyalloc = 2 * yysize; 1538 + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 1539 + yyalloc = YYSTACK_ALLOC_MAXIMUM; 1540 + if (yymsg != yymsgbuf) 1541 + YYSTACK_FREE (yymsg); 1542 + yymsg = (char *) YYSTACK_ALLOC (yyalloc); 1543 + if (yymsg) 1544 + yymsg_alloc = yyalloc; 1545 + else 1546 + { 1547 + yymsg = yymsgbuf; 1548 + yymsg_alloc = sizeof yymsgbuf; 1549 + } 1550 + } 1551 + 1552 + if (0 < yysize && yysize <= yymsg_alloc) 1553 + { 1554 + (void) yysyntax_error (yymsg, yystate, yychar); 1555 + yyerror (list, idx, yymsg); 1556 + } 1557 + else 1558 + { 1559 + yyerror (list, idx, YY_("syntax error")); 1560 + if (yysize != 0) 1561 + goto yyexhaustedlab; 1562 + } 1563 + } 1564 + #endif 1565 + } 1566 + 1567 + 1568 + 1569 + if (yyerrstatus == 3) 1570 + { 1571 + /* If just tried and failed to reuse lookahead token after an 1572 + error, discard it. */ 1573 + 1574 + if (yychar <= YYEOF) 1575 + { 1576 + /* Return failure if at end of input. */ 1577 + if (yychar == YYEOF) 1578 + YYABORT; 1579 + } 1580 + else 1581 + { 1582 + yydestruct ("Error: discarding", 1583 + yytoken, &yylval, list, idx); 1584 + yychar = YYEMPTY; 1585 + } 1586 + } 1587 + 1588 + /* Else will try to reuse lookahead token after shifting the error 1589 + token. */ 1590 + goto yyerrlab1; 1591 + 1592 + 1593 + /*---------------------------------------------------. 1594 + | yyerrorlab -- error raised explicitly by YYERROR. | 1595 + `---------------------------------------------------*/ 1596 + yyerrorlab: 1597 + 1598 + /* Pacify compilers like GCC when the user code never invokes 1599 + YYERROR and the label yyerrorlab therefore never appears in user 1600 + code. */ 1601 + if (/*CONSTCOND*/ 0) 1602 + goto yyerrorlab; 1603 + 1604 + /* Do not reclaim the symbols of the rule which action triggered 1605 + this YYERROR. */ 1606 + YYPOPSTACK (yylen); 1607 + yylen = 0; 1608 + YY_STACK_PRINT (yyss, yyssp); 1609 + yystate = *yyssp; 1610 + goto yyerrlab1; 1611 + 1612 + 1613 + /*-------------------------------------------------------------. 1614 + | yyerrlab1 -- common code for both syntax error and YYERROR. | 1615 + `-------------------------------------------------------------*/ 1616 + yyerrlab1: 1617 + yyerrstatus = 3; /* Each real token shifted decrements this. */ 1618 + 1619 + for (;;) 1620 + { 1621 + yyn = yypact[yystate]; 1622 + if (yyn != YYPACT_NINF) 1623 + { 1624 + yyn += YYTERROR; 1625 + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 1626 + { 1627 + yyn = yytable[yyn]; 1628 + if (0 < yyn) 1629 + break; 1630 + } 1631 + } 1632 + 1633 + /* Pop the current state because it cannot handle the error token. */ 1634 + if (yyssp == yyss) 1635 + YYABORT; 1636 + 1637 + 1638 + yydestruct ("Error: popping", 1639 + yystos[yystate], yyvsp, list, idx); 1640 + YYPOPSTACK (1); 1641 + yystate = *yyssp; 1642 + YY_STACK_PRINT (yyss, yyssp); 1643 + } 1644 + 1645 + *++yyvsp = yylval; 1646 + 1647 + 1648 + /* Shift the error token. */ 1649 + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 1650 + 1651 + yystate = yyn; 1652 + goto yynewstate; 1653 + 1654 + 1655 + /*-------------------------------------. 1656 + | yyacceptlab -- YYACCEPT comes here. | 1657 + `-------------------------------------*/ 1658 + yyacceptlab: 1659 + yyresult = 0; 1660 + goto yyreturn; 1661 + 1662 + /*-----------------------------------. 1663 + | yyabortlab -- YYABORT comes here. | 1664 + `-----------------------------------*/ 1665 + yyabortlab: 1666 + yyresult = 1; 1667 + goto yyreturn; 1668 + 1669 + #if !defined(yyoverflow) || YYERROR_VERBOSE 1670 + /*-------------------------------------------------. 1671 + | yyexhaustedlab -- memory exhaustion comes here. | 1672 + `-------------------------------------------------*/ 1673 + yyexhaustedlab: 1674 + yyerror (list, idx, YY_("memory exhausted")); 1675 + yyresult = 2; 1676 + /* Fall through. */ 1677 + #endif 1678 + 1679 + yyreturn: 1680 + if (yychar != YYEMPTY) 1681 + yydestruct ("Cleanup: discarding lookahead", 1682 + yytoken, &yylval, list, idx); 1683 + /* Do not reclaim the symbols of the rule which action triggered 1684 + this YYABORT or YYACCEPT. */ 1685 + YYPOPSTACK (yylen); 1686 + YY_STACK_PRINT (yyss, yyssp); 1687 + while (yyssp != yyss) 1688 + { 1689 + yydestruct ("Cleanup: popping", 1690 + yystos[*yyssp], yyvsp, list, idx); 1691 + YYPOPSTACK (1); 1692 + } 1693 + #ifndef yyoverflow 1694 + if (yyss != yyssa) 1695 + YYSTACK_FREE (yyss); 1696 + #endif 1697 + #if YYERROR_VERBOSE 1698 + if (yymsg != yymsgbuf) 1699 + YYSTACK_FREE (yymsg); 1700 + #endif 1701 + /* Make sure YYID is used. */ 1702 + return YYID (yyresult); 1703 + } 1704 + 1705 + 1706 + 1707 + /* Line 1684 of yacc.c */ 1708 + #line 122 "util/parse-events.y" 1709 + 1710 + 1711 + void parse_events_error(struct list_head *list __used, int *idx __used, 1712 + char const *msg __used) 1713 + { 1714 + } 1715 +
+79
tools/perf/util/parse-events-bison.h
··· 1 + /* A Bison parser, made by GNU Bison 2.4.3. */ 2 + 3 + /* Skeleton interface for Bison's Yacc-like parsers in C 4 + 5 + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 6 + 2009, 2010 Free Software Foundation, Inc. 7 + 8 + 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 10 + the Free Software Foundation, either version 3 of the License, or 11 + (at your option) any later version. 12 + 13 + This program is distributed in the hope that it will be useful, 14 + but WITHOUT ANY WARRANTY; without even the implied warranty of 15 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 + GNU General Public License for more details. 17 + 18 + You should have received a copy of the GNU General Public License 19 + along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 + 21 + /* As a special exception, you may create a larger work that contains 22 + part or all of the Bison parser skeleton and distribute that work 23 + under terms of your choice, so long as that work isn't itself a 24 + parser generator using the skeleton or a modified version thereof 25 + as a parser skeleton. Alternatively, if you modify or redistribute 26 + the parser skeleton itself, you may (at your option) remove this 27 + special exception, which will cause the skeleton and the resulting 28 + Bison output files to be licensed under the GNU General Public 29 + License without this special exception. 30 + 31 + This special exception was added by the Free Software Foundation in 32 + version 2.2 of Bison. */ 33 + 34 + 35 + /* Tokens. */ 36 + #ifndef YYTOKENTYPE 37 + # define YYTOKENTYPE 38 + /* Put the tokens into the symbol table, so that GDB and other debuggers 39 + know about them. */ 40 + enum yytokentype { 41 + PE_VALUE = 258, 42 + PE_VALUE_SYM = 259, 43 + PE_RAW = 260, 44 + PE_NAME = 261, 45 + PE_MODIFIER_EVENT = 262, 46 + PE_MODIFIER_BP = 263, 47 + PE_NAME_CACHE_TYPE = 264, 48 + PE_NAME_CACHE_OP_RESULT = 265, 49 + PE_PREFIX_MEM = 266, 50 + PE_PREFIX_RAW = 267, 51 + PE_ERROR = 268 52 + }; 53 + #endif 54 + 55 + 56 + 57 + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 58 + typedef union YYSTYPE 59 + { 60 + 61 + /* Line 1685 of yacc.c */ 62 + #line 42 "util/parse-events.y" 63 + 64 + char *str; 65 + unsigned long num; 66 + 67 + 68 + 69 + /* Line 1685 of yacc.c */ 70 + #line 71 "util/parse-events-bison.h" 71 + } YYSTYPE; 72 + # define YYSTYPE_IS_TRIVIAL 1 73 + # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 74 + # define YYSTYPE_IS_DECLARED 1 75 + #endif 76 + 77 + extern YYSTYPE parse_events_lval; 78 + 79 +
+2225
tools/perf/util/parse-events-flex.c
··· 1 + 2 + #line 3 "<stdout>" 3 + 4 + #define YY_INT_ALIGNED short int 5 + 6 + /* A lexical scanner generated by flex */ 7 + 8 + #define yy_create_buffer parse_events__create_buffer 9 + #define yy_delete_buffer parse_events__delete_buffer 10 + #define yy_flex_debug parse_events__flex_debug 11 + #define yy_init_buffer parse_events__init_buffer 12 + #define yy_flush_buffer parse_events__flush_buffer 13 + #define yy_load_buffer_state parse_events__load_buffer_state 14 + #define yy_switch_to_buffer parse_events__switch_to_buffer 15 + #define yyin parse_events_in 16 + #define yyleng parse_events_leng 17 + #define yylex parse_events_lex 18 + #define yylineno parse_events_lineno 19 + #define yyout parse_events_out 20 + #define yyrestart parse_events_restart 21 + #define yytext parse_events_text 22 + #define yywrap parse_events_wrap 23 + #define yyalloc parse_events_alloc 24 + #define yyrealloc parse_events_realloc 25 + #define yyfree parse_events_free 26 + 27 + #define FLEX_SCANNER 28 + #define YY_FLEX_MAJOR_VERSION 2 29 + #define YY_FLEX_MINOR_VERSION 5 30 + #define YY_FLEX_SUBMINOR_VERSION 35 31 + #if YY_FLEX_SUBMINOR_VERSION > 0 32 + #define FLEX_BETA 33 + #endif 34 + 35 + /* First, we deal with platform-specific or compiler-specific issues. */ 36 + 37 + /* begin standard C headers. */ 38 + #include <stdio.h> 39 + #include <string.h> 40 + #include <errno.h> 41 + #include <stdlib.h> 42 + 43 + /* end standard C headers. */ 44 + 45 + /* flex integer type definitions */ 46 + 47 + #ifndef FLEXINT_H 48 + #define FLEXINT_H 49 + 50 + /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 51 + 52 + #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 53 + 54 + /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 55 + * if you want the limit (max/min) macros for int types. 56 + */ 57 + #ifndef __STDC_LIMIT_MACROS 58 + #define __STDC_LIMIT_MACROS 1 59 + #endif 60 + 61 + #include <inttypes.h> 62 + typedef int8_t flex_int8_t; 63 + typedef uint8_t flex_uint8_t; 64 + typedef int16_t flex_int16_t; 65 + typedef uint16_t flex_uint16_t; 66 + typedef int32_t flex_int32_t; 67 + typedef uint32_t flex_uint32_t; 68 + #else 69 + typedef signed char flex_int8_t; 70 + typedef short int flex_int16_t; 71 + typedef int flex_int32_t; 72 + typedef unsigned char flex_uint8_t; 73 + typedef unsigned short int flex_uint16_t; 74 + typedef unsigned int flex_uint32_t; 75 + #endif /* ! C99 */ 76 + 77 + /* Limits of integral types. */ 78 + #ifndef INT8_MIN 79 + #define INT8_MIN (-128) 80 + #endif 81 + #ifndef INT16_MIN 82 + #define INT16_MIN (-32767-1) 83 + #endif 84 + #ifndef INT32_MIN 85 + #define INT32_MIN (-2147483647-1) 86 + #endif 87 + #ifndef INT8_MAX 88 + #define INT8_MAX (127) 89 + #endif 90 + #ifndef INT16_MAX 91 + #define INT16_MAX (32767) 92 + #endif 93 + #ifndef INT32_MAX 94 + #define INT32_MAX (2147483647) 95 + #endif 96 + #ifndef UINT8_MAX 97 + #define UINT8_MAX (255U) 98 + #endif 99 + #ifndef UINT16_MAX 100 + #define UINT16_MAX (65535U) 101 + #endif 102 + #ifndef UINT32_MAX 103 + #define UINT32_MAX (4294967295U) 104 + #endif 105 + 106 + #endif /* ! FLEXINT_H */ 107 + 108 + #ifdef __cplusplus 109 + 110 + /* The "const" storage-class-modifier is valid. */ 111 + #define YY_USE_CONST 112 + 113 + #else /* ! __cplusplus */ 114 + 115 + /* C99 requires __STDC__ to be defined as 1. */ 116 + #if defined (__STDC__) 117 + 118 + #define YY_USE_CONST 119 + 120 + #endif /* defined (__STDC__) */ 121 + #endif /* ! __cplusplus */ 122 + 123 + #ifdef YY_USE_CONST 124 + #define yyconst const 125 + #else 126 + #define yyconst 127 + #endif 128 + 129 + /* Returned upon end-of-file. */ 130 + #define YY_NULL 0 131 + 132 + /* Promotes a possibly negative, possibly signed char to an unsigned 133 + * integer for use as an array index. If the signed char is negative, 134 + * we want to instead treat it as an 8-bit unsigned char, hence the 135 + * double cast. 136 + */ 137 + #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 138 + 139 + /* Enter a start condition. This macro really ought to take a parameter, 140 + * but we do it the disgusting crufty way forced on us by the ()-less 141 + * definition of BEGIN. 142 + */ 143 + #define BEGIN (yy_start) = 1 + 2 * 144 + 145 + /* Translate the current start state into a value that can be later handed 146 + * to BEGIN to return to the state. The YYSTATE alias is for lex 147 + * compatibility. 148 + */ 149 + #define YY_START (((yy_start) - 1) / 2) 150 + #define YYSTATE YY_START 151 + 152 + /* Action number for EOF rule of a given start state. */ 153 + #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 154 + 155 + /* Special action meaning "start processing a new file". */ 156 + #define YY_NEW_FILE parse_events_restart(parse_events_in ) 157 + 158 + #define YY_END_OF_BUFFER_CHAR 0 159 + 160 + /* Size of default input buffer. */ 161 + #ifndef YY_BUF_SIZE 162 + #define YY_BUF_SIZE 16384 163 + #endif 164 + 165 + /* The state buf must be large enough to hold one state per character in the main buffer. 166 + */ 167 + #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 168 + 169 + #ifndef YY_TYPEDEF_YY_BUFFER_STATE 170 + #define YY_TYPEDEF_YY_BUFFER_STATE 171 + typedef struct yy_buffer_state *YY_BUFFER_STATE; 172 + #endif 173 + 174 + extern int parse_events_leng; 175 + 176 + extern FILE *parse_events_in, *parse_events_out; 177 + 178 + #define EOB_ACT_CONTINUE_SCAN 0 179 + #define EOB_ACT_END_OF_FILE 1 180 + #define EOB_ACT_LAST_MATCH 2 181 + 182 + #define YY_LESS_LINENO(n) 183 + 184 + /* Return all but the first "n" matched characters back to the input stream. */ 185 + #define yyless(n) \ 186 + do \ 187 + { \ 188 + /* Undo effects of setting up parse_events_text. */ \ 189 + int yyless_macro_arg = (n); \ 190 + YY_LESS_LINENO(yyless_macro_arg);\ 191 + *yy_cp = (yy_hold_char); \ 192 + YY_RESTORE_YY_MORE_OFFSET \ 193 + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 194 + YY_DO_BEFORE_ACTION; /* set up parse_events_text again */ \ 195 + } \ 196 + while ( 0 ) 197 + 198 + #define unput(c) yyunput( c, (yytext_ptr) ) 199 + 200 + #ifndef YY_TYPEDEF_YY_SIZE_T 201 + #define YY_TYPEDEF_YY_SIZE_T 202 + typedef size_t yy_size_t; 203 + #endif 204 + 205 + #ifndef YY_STRUCT_YY_BUFFER_STATE 206 + #define YY_STRUCT_YY_BUFFER_STATE 207 + struct yy_buffer_state 208 + { 209 + FILE *yy_input_file; 210 + 211 + char *yy_ch_buf; /* input buffer */ 212 + char *yy_buf_pos; /* current position in input buffer */ 213 + 214 + /* Size of input buffer in bytes, not including room for EOB 215 + * characters. 216 + */ 217 + yy_size_t yy_buf_size; 218 + 219 + /* Number of characters read into yy_ch_buf, not including EOB 220 + * characters. 221 + */ 222 + int yy_n_chars; 223 + 224 + /* Whether we "own" the buffer - i.e., we know we created it, 225 + * and can realloc() it to grow it, and should free() it to 226 + * delete it. 227 + */ 228 + int yy_is_our_buffer; 229 + 230 + /* Whether this is an "interactive" input source; if so, and 231 + * if we're using stdio for input, then we want to use getc() 232 + * instead of fread(), to make sure we stop fetching input after 233 + * each newline. 234 + */ 235 + int yy_is_interactive; 236 + 237 + /* Whether we're considered to be at the beginning of a line. 238 + * If so, '^' rules will be active on the next match, otherwise 239 + * not. 240 + */ 241 + int yy_at_bol; 242 + 243 + int yy_bs_lineno; /**< The line count. */ 244 + int yy_bs_column; /**< The column count. */ 245 + 246 + /* Whether to try to fill the input buffer when we reach the 247 + * end of it. 248 + */ 249 + int yy_fill_buffer; 250 + 251 + int yy_buffer_status; 252 + 253 + #define YY_BUFFER_NEW 0 254 + #define YY_BUFFER_NORMAL 1 255 + /* When an EOF's been seen but there's still some text to process 256 + * then we mark the buffer as YY_EOF_PENDING, to indicate that we 257 + * shouldn't try reading from the input source any more. We might 258 + * still have a bunch of tokens to match, though, because of 259 + * possible backing-up. 260 + * 261 + * When we actually see the EOF, we change the status to "new" 262 + * (via parse_events_restart()), so that the user can continue scanning by 263 + * just pointing parse_events_in at a new input file. 264 + */ 265 + #define YY_BUFFER_EOF_PENDING 2 266 + 267 + }; 268 + #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 269 + 270 + /* Stack of input buffers. */ 271 + static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ 272 + static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 273 + static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ 274 + 275 + /* We provide macros for accessing buffer states in case in the 276 + * future we want to put the buffer states in a more general 277 + * "scanner state". 278 + * 279 + * Returns the top of the stack, or NULL. 280 + */ 281 + #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 282 + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 283 + : NULL) 284 + 285 + /* Same as previous macro, but useful when we know that the buffer stack is not 286 + * NULL or when we need an lvalue. For internal use only. 287 + */ 288 + #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 289 + 290 + /* yy_hold_char holds the character lost when parse_events_text is formed. */ 291 + static char yy_hold_char; 292 + static int yy_n_chars; /* number of characters read into yy_ch_buf */ 293 + int parse_events_leng; 294 + 295 + /* Points to current character in buffer. */ 296 + static char *yy_c_buf_p = (char *) 0; 297 + static int yy_init = 0; /* whether we need to initialize */ 298 + static int yy_start = 0; /* start state number */ 299 + 300 + /* Flag which is used to allow parse_events_wrap()'s to do buffer switches 301 + * instead of setting up a fresh parse_events_in. A bit of a hack ... 302 + */ 303 + static int yy_did_buffer_switch_on_eof; 304 + 305 + void parse_events_restart (FILE *input_file ); 306 + void parse_events__switch_to_buffer (YY_BUFFER_STATE new_buffer ); 307 + YY_BUFFER_STATE parse_events__create_buffer (FILE *file,int size ); 308 + void parse_events__delete_buffer (YY_BUFFER_STATE b ); 309 + void parse_events__flush_buffer (YY_BUFFER_STATE b ); 310 + void parse_events_push_buffer_state (YY_BUFFER_STATE new_buffer ); 311 + void parse_events_pop_buffer_state (void ); 312 + 313 + static void parse_events_ensure_buffer_stack (void ); 314 + static void parse_events__load_buffer_state (void ); 315 + static void parse_events__init_buffer (YY_BUFFER_STATE b,FILE *file ); 316 + 317 + #define YY_FLUSH_BUFFER parse_events__flush_buffer(YY_CURRENT_BUFFER ) 318 + 319 + YY_BUFFER_STATE parse_events__scan_buffer (char *base,yy_size_t size ); 320 + YY_BUFFER_STATE parse_events__scan_string (yyconst char *yy_str ); 321 + YY_BUFFER_STATE parse_events__scan_bytes (yyconst char *bytes,int len ); 322 + 323 + void *parse_events_alloc (yy_size_t ); 324 + void *parse_events_realloc (void *,yy_size_t ); 325 + void parse_events_free (void * ); 326 + 327 + #define yy_new_buffer parse_events__create_buffer 328 + 329 + #define yy_set_interactive(is_interactive) \ 330 + { \ 331 + if ( ! YY_CURRENT_BUFFER ){ \ 332 + parse_events_ensure_buffer_stack (); \ 333 + YY_CURRENT_BUFFER_LVALUE = \ 334 + parse_events__create_buffer(parse_events_in,YY_BUF_SIZE ); \ 335 + } \ 336 + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 337 + } 338 + 339 + #define yy_set_bol(at_bol) \ 340 + { \ 341 + if ( ! YY_CURRENT_BUFFER ){\ 342 + parse_events_ensure_buffer_stack (); \ 343 + YY_CURRENT_BUFFER_LVALUE = \ 344 + parse_events__create_buffer(parse_events_in,YY_BUF_SIZE ); \ 345 + } \ 346 + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 347 + } 348 + 349 + #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 350 + 351 + /* Begin user sect3 */ 352 + 353 + typedef unsigned char YY_CHAR; 354 + 355 + FILE *parse_events_in = (FILE *) 0, *parse_events_out = (FILE *) 0; 356 + 357 + typedef int yy_state_type; 358 + 359 + extern int parse_events_lineno; 360 + 361 + int parse_events_lineno = 1; 362 + 363 + extern char *parse_events_text; 364 + #define yytext_ptr parse_events_text 365 + 366 + static yy_state_type yy_get_previous_state (void ); 367 + static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); 368 + static int yy_get_next_buffer (void ); 369 + static void yy_fatal_error (yyconst char msg[] ); 370 + 371 + /* Done after the current pattern has been matched and before the 372 + * corresponding action - sets up parse_events_text. 373 + */ 374 + #define YY_DO_BEFORE_ACTION \ 375 + (yytext_ptr) = yy_bp; \ 376 + parse_events_leng = (size_t) (yy_cp - yy_bp); \ 377 + (yy_hold_char) = *yy_cp; \ 378 + *yy_cp = '\0'; \ 379 + (yy_c_buf_p) = yy_cp; 380 + 381 + #define YY_NUM_RULES 44 382 + #define YY_END_OF_BUFFER 45 383 + /* This struct is not used in this scanner, 384 + but its presence is necessary. */ 385 + struct yy_trans_info 386 + { 387 + flex_int32_t yy_verify; 388 + flex_int32_t yy_nxt; 389 + }; 390 + static yyconst flex_int16_t yy_accept[425] = 391 + { 0, 392 + 0, 0, 45, 44, 38, 41, 40, 39, 34, 34, 393 + 42, 43, 38, 38, 38, 38, 38, 38, 38, 38, 394 + 38, 38, 36, 38, 38, 38, 38, 38, 36, 37, 395 + 38, 38, 37, 37, 38, 34, 0, 38, 38, 38, 396 + 21, 38, 38, 38, 38, 38, 38, 38, 38, 38, 397 + 38, 38, 15, 38, 0, 38, 38, 38, 36, 0, 398 + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 399 + 38, 38, 33, 33, 38, 38, 38, 38, 35, 38, 400 + 38, 0, 38, 38, 38, 24, 38, 38, 38, 38, 401 + 38, 38, 0, 38, 38, 38, 36, 0, 38, 38, 402 + 403 + 38, 0, 19, 20, 38, 38, 38, 38, 38, 38, 404 + 38, 30, 38, 38, 33, 33, 38, 38, 38, 38, 405 + 38, 38, 38, 0, 0, 38, 38, 38, 38, 0, 406 + 38, 38, 0, 38, 0, 22, 38, 38, 36, 0, 407 + 23, 38, 38, 19, 20, 26, 38, 32, 38, 38, 408 + 31, 25, 38, 38, 26, 38, 38, 38, 38, 38, 409 + 0, 38, 0, 0, 0, 0, 38, 38, 38, 38, 410 + 0, 38, 38, 0, 0, 38, 22, 38, 38, 36, 411 + 23, 0, 38, 26, 38, 38, 38, 38, 0, 38, 412 + 38, 38, 27, 0, 27, 0, 38, 0, 0, 0, 413 + 414 + 0, 38, 38, 24, 0, 0, 38, 0, 0, 0, 415 + 1, 38, 12, 0, 38, 0, 38, 0, 31, 0, 416 + 38, 38, 38, 0, 0, 38, 0, 0, 0, 38, 417 + 38, 0, 38, 0, 0, 0, 38, 0, 0, 0, 418 + 38, 0, 38, 0, 38, 0, 0, 38, 38, 38, 419 + 0, 38, 0, 0, 0, 38, 38, 0, 0, 7, 420 + 0, 0, 0, 0, 0, 0, 0, 38, 0, 38, 421 + 0, 38, 0, 0, 28, 38, 0, 0, 38, 0, 422 + 38, 0, 0, 0, 0, 0, 0, 10, 0, 0, 423 + 38, 0, 38, 0, 38, 0, 0, 38, 38, 0, 424 + 425 + 0, 38, 0, 0, 0, 0, 9, 0, 0, 0, 426 + 1, 0, 0, 0, 38, 0, 16, 0, 0, 28, 427 + 38, 0, 11, 38, 0, 0, 0, 0, 0, 0, 428 + 0, 0, 0, 0, 38, 0, 0, 12, 38, 0, 429 + 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 430 + 0, 4, 14, 13, 0, 0, 0, 0, 0, 0, 431 + 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 432 + 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 433 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 434 + 0, 0, 17, 0, 5, 15, 18, 0, 0, 29, 435 + 436 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 437 + 0, 0, 7, 3, 0, 0, 0, 2, 0, 0, 438 + 0, 0, 0, 0 439 + } ; 440 + 441 + static yyconst flex_int32_t yy_ec[256] = 442 + { 0, 443 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 444 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 445 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 446 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 447 + 1, 2, 1, 3, 4, 1, 5, 6, 7, 8, 448 + 9, 9, 9, 9, 9, 9, 9, 10, 1, 1, 449 + 11, 1, 2, 1, 12, 13, 14, 15, 12, 12, 450 + 2, 2, 16, 2, 2, 17, 2, 2, 2, 2, 451 + 2, 18, 2, 19, 2, 2, 2, 2, 2, 2, 452 + 1, 1, 1, 1, 2, 1, 20, 21, 22, 23, 453 + 454 + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 455 + 34, 35, 2, 36, 37, 38, 39, 40, 41, 42, 456 + 43, 2, 1, 1, 1, 1, 1, 1, 1, 1, 457 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 458 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 459 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 460 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 461 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 462 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 463 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 464 + 465 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 466 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 467 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 468 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 469 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 470 + 1, 1, 1, 1, 1 471 + } ; 472 + 473 + static yyconst flex_int32_t yy_meta[44] = 474 + { 0, 475 + 1, 2, 1, 1, 1, 3, 3, 3, 3, 1, 476 + 1, 3, 3, 3, 3, 2, 2, 2, 2, 3, 477 + 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 478 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 479 + 2, 2, 2 480 + } ; 481 + 482 + static yyconst flex_int16_t yy_base[427] = 483 + { 0, 484 + 0, 0, 494, 495, 0, 495, 495, 495, 38, 42, 485 + 495, 495, 473, 459, 45, 467, 32, 20, 40, 53, 486 + 458, 469, 34, 62, 58, 58, 454, 452, 64, 98, 487 + 32, 466, 449, 0, 0, 81, 0, 446, 446, 478, 488 + 0, 467, 455, 457, 450, 54, 457, 455, 438, 452, 489 + 440, 433, 0, 449, 432, 452, 429, 428, 97, 428, 490 + 448, 433, 426, 105, 442, 432, 428, 104, 436, 421, 491 + 431, 432, 431, 77, 430, 95, 416, 424, 0, 431, 492 + 412, 103, 425, 424, 421, 0, 413, 441, 417, 405, 493 + 438, 410, 409, 426, 407, 406, 108, 405, 422, 410, 494 + 495 + 395, 111, 0, 0, 409, 397, 420, 393, 394, 390, 496 + 402, 0, 401, 399, 93, 116, 401, 391, 385, 390, 497 + 381, 414, 381, 76, 46, 380, 378, 381, 391, 390, 498 + 387, 386, 120, 385, 387, 0, 387, 368, 119, 384, 499 + 0, 400, 367, 495, 495, 365, 365, 495, 380, 363, 500 + 374, 0, 393, 372, 371, 355, 362, 368, 387, 366, 501 + 370, 349, 349, 366, 365, 347, 359, 345, 349, 353, 502 + 336, 374, 335, 113, 348, 338, 495, 336, 336, 0, 503 + 495, 350, 332, 0, 366, 331, 364, 330, 341, 327, 504 + 333, 339, 325, 339, 0, 343, 337, 338, 335, 334, 505 + 506 + 317, 321, 329, 121, 330, 119, 313, 316, 327, 322, 507 + 0, 319, 0, 303, 323, 319, 315, 317, 0, 321, 508 + 318, 319, 315, 306, 323, 297, 307, 306, 296, 309, 509 + 297, 129, 292, 297, 299, 302, 321, 302, 292, 286, 510 + 287, 298, 281, 298, 283, 296, 276, 287, 275, 308, 511 + 277, 282, 285, 284, 268, 282, 267, 271, 275, 0, 512 + 278, 264, 275, 262, 268, 273, 276, 262, 263, 265, 513 + 253, 258, 251, 258, 264, 259, 264, 263, 250, 261, 514 + 278, 244, 243, 242, 241, 253, 235, 495, 238, 236, 515 + 269, 248, 237, 239, 232, 237, 229, 229, 225, 221, 516 + 517 + 233, 229, 223, 235, 221, 221, 495, 233, 220, 227, 518 + 495, 226, 228, 215, 218, 212, 0, 211, 211, 0, 519 + 223, 224, 495, 241, 216, 223, 206, 217, 203, 215, 520 + 200, 203, 216, 231, 197, 196, 195, 495, 227, 199, 521 + 210, 194, 188, 187, 188, 495, 191, 201, 189, 182, 522 + 138, 0, 495, 495, 129, 196, 202, 185, 186, 194, 523 + 495, 193, 187, 176, 181, 191, 174, 175, 184, 170, 524 + 193, 167, 166, 179, 178, 495, 163, 178, 165, 178, 525 + 177, 192, 158, 166, 156, 155, 154, 160, 156, 165, 526 + 164, 141, 495, 152, 495, 495, 495, 161, 146, 495, 527 + 528 + 163, 146, 148, 147, 155, 156, 143, 139, 152, 141, 529 + 143, 139, 495, 495, 148, 146, 131, 495, 131, 126, 530 + 125, 81, 85, 495, 165, 68 531 + } ; 532 + 533 + static yyconst flex_int16_t yy_def[427] = 534 + { 0, 535 + 424, 1, 424, 424, 425, 424, 424, 424, 424, 424, 536 + 424, 424, 425, 425, 425, 425, 425, 425, 425, 425, 537 + 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 538 + 425, 425, 425, 425, 425, 424, 426, 425, 425, 425, 539 + 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 540 + 425, 425, 425, 425, 424, 425, 425, 425, 425, 424, 541 + 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 542 + 425, 425, 30, 30, 425, 425, 425, 425, 426, 425, 543 + 425, 424, 425, 425, 425, 425, 425, 425, 425, 425, 544 + 425, 425, 424, 425, 425, 425, 425, 424, 425, 425, 545 + 546 + 425, 424, 425, 425, 425, 425, 425, 425, 425, 425, 547 + 425, 425, 425, 425, 30, 30, 425, 425, 425, 425, 548 + 425, 425, 425, 424, 424, 425, 425, 425, 425, 424, 549 + 425, 425, 424, 425, 424, 425, 425, 425, 425, 424, 550 + 425, 425, 425, 424, 424, 425, 425, 424, 425, 425, 551 + 425, 425, 425, 425, 30, 425, 425, 425, 425, 425, 552 + 424, 425, 424, 424, 424, 424, 425, 425, 425, 425, 553 + 424, 425, 425, 424, 424, 425, 424, 425, 425, 425, 554 + 424, 424, 425, 425, 425, 425, 425, 425, 424, 425, 555 + 425, 425, 425, 424, 425, 424, 425, 424, 424, 424, 556 + 557 + 424, 425, 425, 425, 424, 424, 425, 424, 424, 424, 558 + 425, 425, 425, 424, 425, 424, 425, 424, 425, 424, 559 + 425, 425, 425, 424, 424, 425, 424, 424, 424, 425, 560 + 425, 424, 425, 424, 424, 424, 425, 424, 424, 424, 561 + 425, 424, 425, 424, 425, 424, 424, 425, 425, 425, 562 + 424, 425, 424, 424, 424, 425, 425, 424, 424, 425, 563 + 424, 424, 424, 424, 424, 424, 424, 425, 424, 425, 564 + 424, 425, 424, 424, 425, 425, 424, 424, 425, 424, 565 + 425, 424, 424, 424, 424, 424, 424, 424, 424, 424, 566 + 425, 424, 425, 424, 425, 424, 424, 425, 425, 424, 567 + 568 + 424, 425, 424, 424, 424, 424, 424, 424, 424, 424, 569 + 424, 424, 424, 424, 425, 424, 425, 424, 424, 425, 570 + 425, 424, 424, 425, 424, 424, 424, 424, 424, 424, 571 + 424, 424, 424, 424, 425, 424, 424, 424, 425, 424, 572 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 573 + 424, 425, 424, 424, 424, 424, 424, 424, 424, 424, 574 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 575 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 576 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 577 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 578 + 579 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 580 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 581 + 424, 424, 424, 0, 424, 424 582 + } ; 583 + 584 + static yyconst flex_int16_t yy_nxt[539] = 585 + { 0, 586 + 4, 5, 6, 7, 8, 9, 10, 10, 10, 11, 587 + 12, 5, 5, 5, 13, 14, 15, 16, 5, 17, 588 + 18, 19, 20, 21, 22, 5, 23, 24, 5, 23, 589 + 25, 26, 27, 28, 29, 30, 31, 32, 23, 5, 590 + 33, 34, 5, 36, 36, 36, 36, 36, 36, 36, 591 + 36, 40, 41, 44, 46, 47, 55, 48, 49, 50, 592 + 59, 42, 45, 59, 64, 60, 75, 165, 59, 76, 593 + 79, 56, 59, 51, 52, 86, 53, 66, 166, 37, 594 + 61, 67, 54, 71, 62, 68, 36, 36, 36, 36, 595 + 59, 65, 86, 59, 63, 163, 115, 164, 59, 72, 596 + 597 + 73, 116, 59, 73, 73, 73, 73, 418, 102, 73, 598 + 73, 73, 73, 423, 118, 155, 73, 73, 73, 73, 599 + 73, 74, 73, 97, 232, 124, 97, 103, 119, 108, 600 + 125, 97, 104, 144, 139, 97, 109, 139, 145, 73, 601 + 110, 174, 139, 208, 233, 180, 139, 414, 180, 422, 602 + 235, 175, 112, 180, 236, 209, 258, 180, 366, 368, 603 + 259, 401, 367, 421, 369, 402, 35, 35, 420, 419, 604 + 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 605 + 408, 407, 406, 405, 404, 403, 400, 400, 399, 398, 606 + 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 607 + 608 + 387, 386, 385, 384, 383, 181, 382, 381, 380, 379, 609 + 378, 377, 376, 375, 374, 373, 372, 145, 371, 370, 610 + 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 611 + 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 612 + 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 613 + 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 614 + 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 615 + 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 616 + 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 617 + 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 618 + 619 + 285, 284, 283, 282, 281, 112, 280, 145, 144, 279, 620 + 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 621 + 268, 267, 266, 265, 264, 263, 262, 261, 260, 257, 622 + 256, 255, 254, 253, 252, 177, 251, 250, 249, 248, 623 + 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 624 + 237, 234, 231, 230, 229, 228, 227, 144, 226, 225, 625 + 224, 195, 223, 222, 221, 220, 219, 218, 217, 216, 626 + 215, 214, 213, 212, 211, 210, 207, 206, 205, 204, 627 + 203, 112, 202, 201, 200, 199, 198, 197, 196, 195, 628 + 194, 193, 192, 191, 73, 190, 189, 188, 187, 186, 629 + 630 + 185, 184, 183, 182, 181, 179, 178, 177, 176, 173, 631 + 172, 171, 170, 169, 168, 167, 162, 161, 160, 159, 632 + 158, 157, 156, 154, 153, 152, 151, 150, 149, 148, 633 + 147, 146, 143, 142, 141, 140, 138, 137, 136, 135, 634 + 134, 133, 132, 131, 130, 129, 128, 127, 126, 123, 635 + 122, 121, 120, 117, 73, 114, 113, 112, 111, 107, 636 + 106, 105, 101, 100, 99, 98, 96, 95, 94, 93, 637 + 92, 91, 90, 89, 88, 86, 87, 85, 84, 83, 638 + 41, 82, 81, 80, 78, 77, 70, 69, 58, 57, 639 + 43, 39, 38, 424, 3, 424, 424, 424, 424, 424, 640 + 641 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 642 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 643 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 644 + 424, 424, 424, 424, 424, 424, 424, 424 645 + } ; 646 + 647 + static yyconst flex_int16_t yy_chk[539] = 648 + { 0, 649 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 650 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 651 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 652 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 653 + 1, 1, 1, 9, 9, 9, 9, 10, 10, 10, 654 + 10, 15, 15, 17, 18, 18, 20, 18, 18, 19, 655 + 23, 15, 17, 23, 25, 24, 31, 125, 23, 31, 656 + 426, 20, 23, 19, 19, 46, 19, 26, 125, 9, 657 + 24, 26, 19, 29, 24, 26, 36, 36, 36, 36, 658 + 29, 25, 46, 29, 24, 124, 74, 124, 29, 29, 659 + 660 + 74, 74, 29, 30, 30, 30, 30, 423, 64, 30, 661 + 30, 30, 30, 422, 76, 115, 115, 30, 30, 30, 662 + 30, 30, 30, 59, 204, 82, 59, 64, 76, 68, 663 + 82, 59, 64, 102, 97, 59, 68, 97, 102, 116, 664 + 68, 133, 97, 174, 204, 139, 97, 421, 139, 420, 665 + 206, 133, 116, 139, 206, 174, 232, 139, 351, 355, 666 + 232, 392, 351, 419, 355, 392, 425, 425, 417, 416, 667 + 415, 412, 411, 410, 409, 408, 407, 406, 405, 404, 668 + 403, 402, 401, 399, 398, 394, 391, 390, 389, 388, 669 + 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 670 + 671 + 377, 375, 374, 373, 372, 371, 370, 369, 368, 367, 672 + 366, 365, 364, 363, 362, 360, 359, 358, 357, 356, 673 + 350, 349, 348, 347, 345, 344, 343, 342, 341, 340, 674 + 339, 337, 336, 335, 334, 333, 332, 331, 330, 329, 675 + 328, 327, 326, 325, 324, 322, 321, 319, 318, 316, 676 + 315, 314, 313, 312, 310, 309, 308, 306, 305, 304, 677 + 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 678 + 293, 292, 291, 290, 289, 287, 286, 285, 284, 283, 679 + 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 680 + 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 681 + 682 + 262, 261, 259, 258, 257, 256, 255, 254, 253, 252, 683 + 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 684 + 241, 240, 239, 238, 237, 236, 235, 234, 233, 231, 685 + 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 686 + 220, 218, 217, 216, 215, 214, 212, 210, 209, 208, 687 + 207, 205, 203, 202, 201, 200, 199, 198, 197, 196, 688 + 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 689 + 183, 182, 179, 178, 176, 175, 173, 172, 171, 170, 690 + 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 691 + 159, 158, 157, 156, 155, 154, 153, 151, 150, 149, 692 + 693 + 147, 146, 143, 142, 140, 138, 137, 135, 134, 132, 694 + 131, 130, 129, 128, 127, 126, 123, 122, 121, 120, 695 + 119, 118, 117, 114, 113, 111, 110, 109, 108, 107, 696 + 106, 105, 101, 100, 99, 98, 96, 95, 94, 93, 697 + 92, 91, 90, 89, 88, 87, 85, 84, 83, 81, 698 + 80, 78, 77, 75, 73, 72, 71, 70, 69, 67, 699 + 66, 65, 63, 62, 61, 60, 58, 57, 56, 55, 700 + 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 701 + 42, 40, 39, 38, 33, 32, 28, 27, 22, 21, 702 + 16, 14, 13, 3, 424, 424, 424, 424, 424, 424, 703 + 704 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 705 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 706 + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 707 + 424, 424, 424, 424, 424, 424, 424, 424 708 + } ; 709 + 710 + static yy_state_type yy_last_accepting_state; 711 + static char *yy_last_accepting_cpos; 712 + 713 + extern int parse_events__flex_debug; 714 + int parse_events__flex_debug = 0; 715 + 716 + /* The intent behind this definition is that it'll catch 717 + * any uses of REJECT which flex missed. 718 + */ 719 + #define REJECT reject_used_but_not_detected 720 + #define yymore() yymore_used_but_not_detected 721 + #define YY_MORE_ADJ 0 722 + #define YY_RESTORE_YY_MORE_OFFSET 723 + char *parse_events_text; 724 + #line 1 "util/parse-events.l" 725 + #line 5 "util/parse-events.l" 726 + #include <errno.h> 727 + #include "../perf.h" 728 + #include "parse-events-bison.h" 729 + 730 + static int __value(char *str, int base, int token) 731 + { 732 + long num; 733 + 734 + errno = 0; 735 + num = strtoul(str, NULL, base); 736 + if (errno) 737 + return PE_ERROR; 738 + 739 + parse_events_lval.num = num; 740 + return token; 741 + } 742 + 743 + static int value(int base) 744 + { 745 + return __value(parse_events_text, base, PE_VALUE); 746 + } 747 + 748 + static int raw(void) 749 + { 750 + return __value(parse_events_text + 1, 16, PE_RAW); 751 + } 752 + 753 + static int str(int token) 754 + { 755 + parse_events_lval.str = strdup(parse_events_text); 756 + return token; 757 + } 758 + 759 + static int sym(int type, int config) 760 + { 761 + parse_events_lval.num = (type << 16) + config; 762 + return PE_VALUE_SYM; 763 + } 764 + 765 + #line 766 "<stdout>" 766 + 767 + #define INITIAL 0 768 + 769 + #ifndef YY_NO_UNISTD_H 770 + /* Special case for "unistd.h", since it is non-ANSI. We include it way 771 + * down here because we want the user's section 1 to have been scanned first. 772 + * The user has a chance to override it with an option. 773 + */ 774 + #include <unistd.h> 775 + #endif 776 + 777 + #ifndef YY_EXTRA_TYPE 778 + #define YY_EXTRA_TYPE void * 779 + #endif 780 + 781 + static int yy_init_globals (void ); 782 + 783 + /* Accessor methods to globals. 784 + These are made visible to non-reentrant scanners for convenience. */ 785 + 786 + int parse_events_lex_destroy (void ); 787 + 788 + int parse_events_get_debug (void ); 789 + 790 + void parse_events_set_debug (int debug_flag ); 791 + 792 + YY_EXTRA_TYPE parse_events_get_extra (void ); 793 + 794 + void parse_events_set_extra (YY_EXTRA_TYPE user_defined ); 795 + 796 + FILE *parse_events_get_in (void ); 797 + 798 + void parse_events_set_in (FILE * in_str ); 799 + 800 + FILE *parse_events_get_out (void ); 801 + 802 + void parse_events_set_out (FILE * out_str ); 803 + 804 + int parse_events_get_leng (void ); 805 + 806 + char *parse_events_get_text (void ); 807 + 808 + int parse_events_get_lineno (void ); 809 + 810 + void parse_events_set_lineno (int line_number ); 811 + 812 + /* Macros after this point can all be overridden by user definitions in 813 + * section 1. 814 + */ 815 + 816 + #ifndef YY_SKIP_YYWRAP 817 + #ifdef __cplusplus 818 + extern "C" int parse_events_wrap (void ); 819 + #else 820 + extern int parse_events_wrap (void ); 821 + #endif 822 + #endif 823 + 824 + static void yyunput (int c,char *buf_ptr ); 825 + 826 + #ifndef yytext_ptr 827 + static void yy_flex_strncpy (char *,yyconst char *,int ); 828 + #endif 829 + 830 + #ifdef YY_NEED_STRLEN 831 + static int yy_flex_strlen (yyconst char * ); 832 + #endif 833 + 834 + #ifndef YY_NO_INPUT 835 + 836 + #ifdef __cplusplus 837 + static int yyinput (void ); 838 + #else 839 + static int input (void ); 840 + #endif 841 + 842 + #endif 843 + 844 + /* Amount of stuff to slurp up with each read. */ 845 + #ifndef YY_READ_BUF_SIZE 846 + #define YY_READ_BUF_SIZE 8192 847 + #endif 848 + 849 + /* Copy whatever the last rule matched to the standard output. */ 850 + #ifndef ECHO 851 + /* This used to be an fputs(), but since the string might contain NUL's, 852 + * we now use fwrite(). 853 + */ 854 + #define ECHO do { if (fwrite( parse_events_text, parse_events_leng, 1, parse_events_out )) {} } while (0) 855 + #endif 856 + 857 + /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 858 + * is returned in "result". 859 + */ 860 + #ifndef YY_INPUT 861 + #define YY_INPUT(buf,result,max_size) \ 862 + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 863 + { \ 864 + int c = '*'; \ 865 + unsigned n; \ 866 + for ( n = 0; n < max_size && \ 867 + (c = getc( parse_events_in )) != EOF && c != '\n'; ++n ) \ 868 + buf[n] = (char) c; \ 869 + if ( c == '\n' ) \ 870 + buf[n++] = (char) c; \ 871 + if ( c == EOF && ferror( parse_events_in ) ) \ 872 + YY_FATAL_ERROR( "input in flex scanner failed" ); \ 873 + result = n; \ 874 + } \ 875 + else \ 876 + { \ 877 + errno=0; \ 878 + while ( (result = fread(buf, 1, max_size, parse_events_in))==0 && ferror(parse_events_in)) \ 879 + { \ 880 + if( errno != EINTR) \ 881 + { \ 882 + YY_FATAL_ERROR( "input in flex scanner failed" ); \ 883 + break; \ 884 + } \ 885 + errno=0; \ 886 + clearerr(parse_events_in); \ 887 + } \ 888 + }\ 889 + \ 890 + 891 + #endif 892 + 893 + /* No semi-colon after return; correct usage is to write "yyterminate();" - 894 + * we don't want an extra ';' after the "return" because that will cause 895 + * some compilers to complain about unreachable statements. 896 + */ 897 + #ifndef yyterminate 898 + #define yyterminate() return YY_NULL 899 + #endif 900 + 901 + /* Number of entries by which start-condition stack grows. */ 902 + #ifndef YY_START_STACK_INCR 903 + #define YY_START_STACK_INCR 25 904 + #endif 905 + 906 + /* Report a fatal error. */ 907 + #ifndef YY_FATAL_ERROR 908 + #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 909 + #endif 910 + 911 + /* end tables serialization structures and prototypes */ 912 + 913 + /* Default declaration of generated scanner - a define so the user can 914 + * easily add parameters. 915 + */ 916 + #ifndef YY_DECL 917 + #define YY_DECL_IS_OURS 1 918 + 919 + extern int parse_events_lex (void); 920 + 921 + #define YY_DECL int parse_events_lex (void) 922 + #endif /* !YY_DECL */ 923 + 924 + /* Code executed at the beginning of each rule, after parse_events_text and parse_events_leng 925 + * have been set up. 926 + */ 927 + #ifndef YY_USER_ACTION 928 + #define YY_USER_ACTION 929 + #endif 930 + 931 + /* Code executed at the end of each rule. */ 932 + #ifndef YY_BREAK 933 + #define YY_BREAK break; 934 + #endif 935 + 936 + #define YY_RULE_SETUP \ 937 + YY_USER_ACTION 938 + 939 + /** The main scanner function which does all the work. 940 + */ 941 + YY_DECL 942 + { 943 + register yy_state_type yy_current_state; 944 + register char *yy_cp, *yy_bp; 945 + register int yy_act; 946 + 947 + #line 53 "util/parse-events.l" 948 + 949 + #line 950 "<stdout>" 950 + 951 + if ( !(yy_init) ) 952 + { 953 + (yy_init) = 1; 954 + 955 + #ifdef YY_USER_INIT 956 + YY_USER_INIT; 957 + #endif 958 + 959 + if ( ! (yy_start) ) 960 + (yy_start) = 1; /* first start state */ 961 + 962 + if ( ! parse_events_in ) 963 + parse_events_in = stdin; 964 + 965 + if ( ! parse_events_out ) 966 + parse_events_out = stdout; 967 + 968 + if ( ! YY_CURRENT_BUFFER ) { 969 + parse_events_ensure_buffer_stack (); 970 + YY_CURRENT_BUFFER_LVALUE = 971 + parse_events__create_buffer(parse_events_in,YY_BUF_SIZE ); 972 + } 973 + 974 + parse_events__load_buffer_state( ); 975 + } 976 + 977 + while ( 1 ) /* loops until end-of-file is reached */ 978 + { 979 + yy_cp = (yy_c_buf_p); 980 + 981 + /* Support of parse_events_text. */ 982 + *yy_cp = (yy_hold_char); 983 + 984 + /* yy_bp points to the position in yy_ch_buf of the start of 985 + * the current run. 986 + */ 987 + yy_bp = yy_cp; 988 + 989 + yy_current_state = (yy_start); 990 + yy_match: 991 + do 992 + { 993 + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 994 + if ( yy_accept[yy_current_state] ) 995 + { 996 + (yy_last_accepting_state) = yy_current_state; 997 + (yy_last_accepting_cpos) = yy_cp; 998 + } 999 + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1000 + { 1001 + yy_current_state = (int) yy_def[yy_current_state]; 1002 + if ( yy_current_state >= 425 ) 1003 + yy_c = yy_meta[(unsigned int) yy_c]; 1004 + } 1005 + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1006 + ++yy_cp; 1007 + } 1008 + while ( yy_base[yy_current_state] != 495 ); 1009 + 1010 + yy_find_action: 1011 + yy_act = yy_accept[yy_current_state]; 1012 + if ( yy_act == 0 ) 1013 + { /* have to back up */ 1014 + yy_cp = (yy_last_accepting_cpos); 1015 + yy_current_state = (yy_last_accepting_state); 1016 + yy_act = yy_accept[yy_current_state]; 1017 + } 1018 + 1019 + YY_DO_BEFORE_ACTION; 1020 + 1021 + do_action: /* This label is used only to access EOF actions. */ 1022 + 1023 + switch ( yy_act ) 1024 + { /* beginning of action switch */ 1025 + case 0: /* must back up */ 1026 + /* undo the effects of YY_DO_BEFORE_ACTION */ 1027 + *yy_cp = (yy_hold_char); 1028 + yy_cp = (yy_last_accepting_cpos); 1029 + yy_current_state = (yy_last_accepting_state); 1030 + goto yy_find_action; 1031 + 1032 + case 1: 1033 + YY_RULE_SETUP 1034 + #line 54 "util/parse-events.l" 1035 + { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); } 1036 + YY_BREAK 1037 + case 2: 1038 + YY_RULE_SETUP 1039 + #line 55 "util/parse-events.l" 1040 + { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); } 1041 + YY_BREAK 1042 + case 3: 1043 + YY_RULE_SETUP 1044 + #line 56 "util/parse-events.l" 1045 + { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); } 1046 + YY_BREAK 1047 + case 4: 1048 + YY_RULE_SETUP 1049 + #line 57 "util/parse-events.l" 1050 + { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); } 1051 + YY_BREAK 1052 + case 5: 1053 + YY_RULE_SETUP 1054 + #line 58 "util/parse-events.l" 1055 + { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES); } 1056 + YY_BREAK 1057 + case 6: 1058 + YY_RULE_SETUP 1059 + #line 59 "util/parse-events.l" 1060 + { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); } 1061 + YY_BREAK 1062 + case 7: 1063 + YY_RULE_SETUP 1064 + #line 60 "util/parse-events.l" 1065 + { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); } 1066 + YY_BREAK 1067 + case 8: 1068 + YY_RULE_SETUP 1069 + #line 61 "util/parse-events.l" 1070 + { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); } 1071 + YY_BREAK 1072 + case 9: 1073 + YY_RULE_SETUP 1074 + #line 62 "util/parse-events.l" 1075 + { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); } 1076 + YY_BREAK 1077 + case 10: 1078 + YY_RULE_SETUP 1079 + #line 63 "util/parse-events.l" 1080 + { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); } 1081 + YY_BREAK 1082 + case 11: 1083 + YY_RULE_SETUP 1084 + #line 64 "util/parse-events.l" 1085 + { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); } 1086 + YY_BREAK 1087 + case 12: 1088 + YY_RULE_SETUP 1089 + #line 65 "util/parse-events.l" 1090 + { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); } 1091 + YY_BREAK 1092 + case 13: 1093 + YY_RULE_SETUP 1094 + #line 66 "util/parse-events.l" 1095 + { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN); } 1096 + YY_BREAK 1097 + case 14: 1098 + YY_RULE_SETUP 1099 + #line 67 "util/parse-events.l" 1100 + { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MAJ); } 1101 + YY_BREAK 1102 + case 15: 1103 + YY_RULE_SETUP 1104 + #line 68 "util/parse-events.l" 1105 + { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CONTEXT_SWITCHES); } 1106 + YY_BREAK 1107 + case 16: 1108 + YY_RULE_SETUP 1109 + #line 69 "util/parse-events.l" 1110 + { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS); } 1111 + YY_BREAK 1112 + case 17: 1113 + YY_RULE_SETUP 1114 + #line 70 "util/parse-events.l" 1115 + { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS); } 1116 + YY_BREAK 1117 + case 18: 1118 + YY_RULE_SETUP 1119 + #line 71 "util/parse-events.l" 1120 + { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); } 1121 + YY_BREAK 1122 + case 19: 1123 + #line 74 "util/parse-events.l" 1124 + case 20: 1125 + #line 75 "util/parse-events.l" 1126 + case 21: 1127 + #line 76 "util/parse-events.l" 1128 + case 22: 1129 + #line 77 "util/parse-events.l" 1130 + case 23: 1131 + #line 78 "util/parse-events.l" 1132 + case 24: 1133 + #line 79 "util/parse-events.l" 1134 + case 25: 1135 + YY_RULE_SETUP 1136 + #line 79 "util/parse-events.l" 1137 + { return str(PE_NAME_CACHE_TYPE); } 1138 + YY_BREAK 1139 + case 26: 1140 + #line 82 "util/parse-events.l" 1141 + case 27: 1142 + #line 83 "util/parse-events.l" 1143 + case 28: 1144 + #line 84 "util/parse-events.l" 1145 + case 29: 1146 + #line 85 "util/parse-events.l" 1147 + case 30: 1148 + #line 86 "util/parse-events.l" 1149 + case 31: 1150 + YY_RULE_SETUP 1151 + #line 86 "util/parse-events.l" 1152 + { return str(PE_NAME_CACHE_OP_RESULT); } 1153 + YY_BREAK 1154 + case 32: 1155 + YY_RULE_SETUP 1156 + #line 88 "util/parse-events.l" 1157 + { return PE_PREFIX_MEM; } 1158 + YY_BREAK 1159 + case 33: 1160 + YY_RULE_SETUP 1161 + #line 89 "util/parse-events.l" 1162 + { return raw(); } 1163 + YY_BREAK 1164 + case 34: 1165 + YY_RULE_SETUP 1166 + #line 90 "util/parse-events.l" 1167 + { return value(10); } 1168 + YY_BREAK 1169 + case 35: 1170 + YY_RULE_SETUP 1171 + #line 91 "util/parse-events.l" 1172 + { return value(16); } 1173 + YY_BREAK 1174 + case 36: 1175 + YY_RULE_SETUP 1176 + #line 93 "util/parse-events.l" 1177 + { return str(PE_MODIFIER_EVENT); } 1178 + YY_BREAK 1179 + case 37: 1180 + YY_RULE_SETUP 1181 + #line 94 "util/parse-events.l" 1182 + { return str(PE_MODIFIER_BP); } 1183 + YY_BREAK 1184 + case 38: 1185 + YY_RULE_SETUP 1186 + #line 95 "util/parse-events.l" 1187 + { return str(PE_NAME); } 1188 + YY_BREAK 1189 + case 39: 1190 + YY_RULE_SETUP 1191 + #line 96 "util/parse-events.l" 1192 + { return '/'; } 1193 + YY_BREAK 1194 + case 40: 1195 + YY_RULE_SETUP 1196 + #line 97 "util/parse-events.l" 1197 + { return '-'; } 1198 + YY_BREAK 1199 + case 41: 1200 + YY_RULE_SETUP 1201 + #line 98 "util/parse-events.l" 1202 + { return ','; } 1203 + YY_BREAK 1204 + case 42: 1205 + YY_RULE_SETUP 1206 + #line 99 "util/parse-events.l" 1207 + { return ':'; } 1208 + YY_BREAK 1209 + case 43: 1210 + YY_RULE_SETUP 1211 + #line 100 "util/parse-events.l" 1212 + { return '='; } 1213 + YY_BREAK 1214 + case 44: 1215 + YY_RULE_SETUP 1216 + #line 102 "util/parse-events.l" 1217 + ECHO; 1218 + YY_BREAK 1219 + #line 1220 "<stdout>" 1220 + case YY_STATE_EOF(INITIAL): 1221 + yyterminate(); 1222 + 1223 + case YY_END_OF_BUFFER: 1224 + { 1225 + /* Amount of text matched not including the EOB char. */ 1226 + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 1227 + 1228 + /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1229 + *yy_cp = (yy_hold_char); 1230 + YY_RESTORE_YY_MORE_OFFSET 1231 + 1232 + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1233 + { 1234 + /* We're scanning a new file or input source. It's 1235 + * possible that this happened because the user 1236 + * just pointed parse_events_in at a new source and called 1237 + * parse_events_lex(). If so, then we have to assure 1238 + * consistency between YY_CURRENT_BUFFER and our 1239 + * globals. Here is the right place to do so, because 1240 + * this is the first action (other than possibly a 1241 + * back-up) that will match for the new input source. 1242 + */ 1243 + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1244 + YY_CURRENT_BUFFER_LVALUE->yy_input_file = parse_events_in; 1245 + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1246 + } 1247 + 1248 + /* Note that here we test for yy_c_buf_p "<=" to the position 1249 + * of the first EOB in the buffer, since yy_c_buf_p will 1250 + * already have been incremented past the NUL character 1251 + * (since all states make transitions on EOB to the 1252 + * end-of-buffer state). Contrast this with the test 1253 + * in input(). 1254 + */ 1255 + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1256 + { /* This was really a NUL. */ 1257 + yy_state_type yy_next_state; 1258 + 1259 + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 1260 + 1261 + yy_current_state = yy_get_previous_state( ); 1262 + 1263 + /* Okay, we're now positioned to make the NUL 1264 + * transition. We couldn't have 1265 + * yy_get_previous_state() go ahead and do it 1266 + * for us because it doesn't know how to deal 1267 + * with the possibility of jamming (and we don't 1268 + * want to build jamming into it because then it 1269 + * will run more slowly). 1270 + */ 1271 + 1272 + yy_next_state = yy_try_NUL_trans( yy_current_state ); 1273 + 1274 + yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1275 + 1276 + if ( yy_next_state ) 1277 + { 1278 + /* Consume the NUL. */ 1279 + yy_cp = ++(yy_c_buf_p); 1280 + yy_current_state = yy_next_state; 1281 + goto yy_match; 1282 + } 1283 + 1284 + else 1285 + { 1286 + yy_cp = (yy_c_buf_p); 1287 + goto yy_find_action; 1288 + } 1289 + } 1290 + 1291 + else switch ( yy_get_next_buffer( ) ) 1292 + { 1293 + case EOB_ACT_END_OF_FILE: 1294 + { 1295 + (yy_did_buffer_switch_on_eof) = 0; 1296 + 1297 + if ( parse_events_wrap( ) ) 1298 + { 1299 + /* Note: because we've taken care in 1300 + * yy_get_next_buffer() to have set up 1301 + * parse_events_text, we can now set up 1302 + * yy_c_buf_p so that if some total 1303 + * hoser (like flex itself) wants to 1304 + * call the scanner after we return the 1305 + * YY_NULL, it'll still work - another 1306 + * YY_NULL will get returned. 1307 + */ 1308 + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 1309 + 1310 + yy_act = YY_STATE_EOF(YY_START); 1311 + goto do_action; 1312 + } 1313 + 1314 + else 1315 + { 1316 + if ( ! (yy_did_buffer_switch_on_eof) ) 1317 + YY_NEW_FILE; 1318 + } 1319 + break; 1320 + } 1321 + 1322 + case EOB_ACT_CONTINUE_SCAN: 1323 + (yy_c_buf_p) = 1324 + (yytext_ptr) + yy_amount_of_matched_text; 1325 + 1326 + yy_current_state = yy_get_previous_state( ); 1327 + 1328 + yy_cp = (yy_c_buf_p); 1329 + yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1330 + goto yy_match; 1331 + 1332 + case EOB_ACT_LAST_MATCH: 1333 + (yy_c_buf_p) = 1334 + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 1335 + 1336 + yy_current_state = yy_get_previous_state( ); 1337 + 1338 + yy_cp = (yy_c_buf_p); 1339 + yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1340 + goto yy_find_action; 1341 + } 1342 + break; 1343 + } 1344 + 1345 + default: 1346 + YY_FATAL_ERROR( 1347 + "fatal flex scanner internal error--no action found" ); 1348 + } /* end of action switch */ 1349 + } /* end of scanning one token */ 1350 + } /* end of parse_events_lex */ 1351 + 1352 + /* yy_get_next_buffer - try to read in a new buffer 1353 + * 1354 + * Returns a code representing an action: 1355 + * EOB_ACT_LAST_MATCH - 1356 + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1357 + * EOB_ACT_END_OF_FILE - end of file 1358 + */ 1359 + static int yy_get_next_buffer (void) 1360 + { 1361 + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1362 + register char *source = (yytext_ptr); 1363 + register int number_to_move, i; 1364 + int ret_val; 1365 + 1366 + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 1367 + YY_FATAL_ERROR( 1368 + "fatal flex scanner internal error--end of buffer missed" ); 1369 + 1370 + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1371 + { /* Don't try to fill the buffer, so this is an EOF. */ 1372 + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 1373 + { 1374 + /* We matched a single character, the EOB, so 1375 + * treat this as a final EOF. 1376 + */ 1377 + return EOB_ACT_END_OF_FILE; 1378 + } 1379 + 1380 + else 1381 + { 1382 + /* We matched some text prior to the EOB, first 1383 + * process it. 1384 + */ 1385 + return EOB_ACT_LAST_MATCH; 1386 + } 1387 + } 1388 + 1389 + /* Try to read more data. */ 1390 + 1391 + /* First move last chars to start of buffer. */ 1392 + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; 1393 + 1394 + for ( i = 0; i < number_to_move; ++i ) 1395 + *(dest++) = *(source++); 1396 + 1397 + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1398 + /* don't do the read, it's not guaranteed to return an EOF, 1399 + * just force an EOF 1400 + */ 1401 + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 1402 + 1403 + else 1404 + { 1405 + int num_to_read = 1406 + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1407 + 1408 + while ( num_to_read <= 0 ) 1409 + { /* Not enough room in the buffer - grow it. */ 1410 + 1411 + /* just a shorter name for the current buffer */ 1412 + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1413 + 1414 + int yy_c_buf_p_offset = 1415 + (int) ((yy_c_buf_p) - b->yy_ch_buf); 1416 + 1417 + if ( b->yy_is_our_buffer ) 1418 + { 1419 + int new_size = b->yy_buf_size * 2; 1420 + 1421 + if ( new_size <= 0 ) 1422 + b->yy_buf_size += b->yy_buf_size / 8; 1423 + else 1424 + b->yy_buf_size *= 2; 1425 + 1426 + b->yy_ch_buf = (char *) 1427 + /* Include room in for 2 EOB chars. */ 1428 + parse_events_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); 1429 + } 1430 + else 1431 + /* Can't grow it, we don't own it. */ 1432 + b->yy_ch_buf = 0; 1433 + 1434 + if ( ! b->yy_ch_buf ) 1435 + YY_FATAL_ERROR( 1436 + "fatal error - scanner input buffer overflow" ); 1437 + 1438 + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 1439 + 1440 + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1441 + number_to_move - 1; 1442 + 1443 + } 1444 + 1445 + if ( num_to_read > YY_READ_BUF_SIZE ) 1446 + num_to_read = YY_READ_BUF_SIZE; 1447 + 1448 + /* Read in more data. */ 1449 + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1450 + (yy_n_chars), (size_t) num_to_read ); 1451 + 1452 + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1453 + } 1454 + 1455 + if ( (yy_n_chars) == 0 ) 1456 + { 1457 + if ( number_to_move == YY_MORE_ADJ ) 1458 + { 1459 + ret_val = EOB_ACT_END_OF_FILE; 1460 + parse_events_restart(parse_events_in ); 1461 + } 1462 + 1463 + else 1464 + { 1465 + ret_val = EOB_ACT_LAST_MATCH; 1466 + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1467 + YY_BUFFER_EOF_PENDING; 1468 + } 1469 + } 1470 + 1471 + else 1472 + ret_val = EOB_ACT_CONTINUE_SCAN; 1473 + 1474 + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1475 + /* Extend the array by 50%, plus the number we really need. */ 1476 + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 1477 + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) parse_events_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); 1478 + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1479 + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1480 + } 1481 + 1482 + (yy_n_chars) += number_to_move; 1483 + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1484 + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1485 + 1486 + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1487 + 1488 + return ret_val; 1489 + } 1490 + 1491 + /* yy_get_previous_state - get the state just before the EOB char was reached */ 1492 + 1493 + static yy_state_type yy_get_previous_state (void) 1494 + { 1495 + register yy_state_type yy_current_state; 1496 + register char *yy_cp; 1497 + 1498 + yy_current_state = (yy_start); 1499 + 1500 + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 1501 + { 1502 + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1503 + if ( yy_accept[yy_current_state] ) 1504 + { 1505 + (yy_last_accepting_state) = yy_current_state; 1506 + (yy_last_accepting_cpos) = yy_cp; 1507 + } 1508 + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1509 + { 1510 + yy_current_state = (int) yy_def[yy_current_state]; 1511 + if ( yy_current_state >= 425 ) 1512 + yy_c = yy_meta[(unsigned int) yy_c]; 1513 + } 1514 + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1515 + } 1516 + 1517 + return yy_current_state; 1518 + } 1519 + 1520 + /* yy_try_NUL_trans - try to make a transition on the NUL character 1521 + * 1522 + * synopsis 1523 + * next_state = yy_try_NUL_trans( current_state ); 1524 + */ 1525 + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 1526 + { 1527 + register int yy_is_jam; 1528 + register char *yy_cp = (yy_c_buf_p); 1529 + 1530 + register YY_CHAR yy_c = 1; 1531 + if ( yy_accept[yy_current_state] ) 1532 + { 1533 + (yy_last_accepting_state) = yy_current_state; 1534 + (yy_last_accepting_cpos) = yy_cp; 1535 + } 1536 + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1537 + { 1538 + yy_current_state = (int) yy_def[yy_current_state]; 1539 + if ( yy_current_state >= 425 ) 1540 + yy_c = yy_meta[(unsigned int) yy_c]; 1541 + } 1542 + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1543 + yy_is_jam = (yy_current_state == 424); 1544 + 1545 + return yy_is_jam ? 0 : yy_current_state; 1546 + } 1547 + 1548 + static void yyunput (int c, register char * yy_bp ) 1549 + { 1550 + register char *yy_cp; 1551 + 1552 + yy_cp = (yy_c_buf_p); 1553 + 1554 + /* undo effects of setting up parse_events_text */ 1555 + *yy_cp = (yy_hold_char); 1556 + 1557 + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1558 + { /* need to shift things up to make room */ 1559 + /* +2 for EOB chars. */ 1560 + register int number_to_move = (yy_n_chars) + 2; 1561 + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ 1562 + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; 1563 + register char *source = 1564 + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; 1565 + 1566 + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1567 + *--dest = *--source; 1568 + 1569 + yy_cp += (int) (dest - source); 1570 + yy_bp += (int) (dest - source); 1571 + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = 1572 + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; 1573 + 1574 + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1575 + YY_FATAL_ERROR( "flex scanner push-back overflow" ); 1576 + } 1577 + 1578 + *--yy_cp = (char) c; 1579 + 1580 + (yytext_ptr) = yy_bp; 1581 + (yy_hold_char) = *yy_cp; 1582 + (yy_c_buf_p) = yy_cp; 1583 + } 1584 + 1585 + #ifndef YY_NO_INPUT 1586 + #ifdef __cplusplus 1587 + static int yyinput (void) 1588 + #else 1589 + static int input (void) 1590 + #endif 1591 + 1592 + { 1593 + int c; 1594 + 1595 + *(yy_c_buf_p) = (yy_hold_char); 1596 + 1597 + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 1598 + { 1599 + /* yy_c_buf_p now points to the character we want to return. 1600 + * If this occurs *before* the EOB characters, then it's a 1601 + * valid NUL; if not, then we've hit the end of the buffer. 1602 + */ 1603 + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1604 + /* This was really a NUL. */ 1605 + *(yy_c_buf_p) = '\0'; 1606 + 1607 + else 1608 + { /* need more input */ 1609 + int offset = (yy_c_buf_p) - (yytext_ptr); 1610 + ++(yy_c_buf_p); 1611 + 1612 + switch ( yy_get_next_buffer( ) ) 1613 + { 1614 + case EOB_ACT_LAST_MATCH: 1615 + /* This happens because yy_g_n_b() 1616 + * sees that we've accumulated a 1617 + * token and flags that we need to 1618 + * try matching the token before 1619 + * proceeding. But for input(), 1620 + * there's no matching to consider. 1621 + * So convert the EOB_ACT_LAST_MATCH 1622 + * to EOB_ACT_END_OF_FILE. 1623 + */ 1624 + 1625 + /* Reset buffer status. */ 1626 + parse_events_restart(parse_events_in ); 1627 + 1628 + /*FALLTHROUGH*/ 1629 + 1630 + case EOB_ACT_END_OF_FILE: 1631 + { 1632 + if ( parse_events_wrap( ) ) 1633 + return EOF; 1634 + 1635 + if ( ! (yy_did_buffer_switch_on_eof) ) 1636 + YY_NEW_FILE; 1637 + #ifdef __cplusplus 1638 + return yyinput(); 1639 + #else 1640 + return input(); 1641 + #endif 1642 + } 1643 + 1644 + case EOB_ACT_CONTINUE_SCAN: 1645 + (yy_c_buf_p) = (yytext_ptr) + offset; 1646 + break; 1647 + } 1648 + } 1649 + } 1650 + 1651 + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 1652 + *(yy_c_buf_p) = '\0'; /* preserve parse_events_text */ 1653 + (yy_hold_char) = *++(yy_c_buf_p); 1654 + 1655 + return c; 1656 + } 1657 + #endif /* ifndef YY_NO_INPUT */ 1658 + 1659 + /** Immediately switch to a different input stream. 1660 + * @param input_file A readable stream. 1661 + * 1662 + * @note This function does not reset the start condition to @c INITIAL . 1663 + */ 1664 + void parse_events_restart (FILE * input_file ) 1665 + { 1666 + 1667 + if ( ! YY_CURRENT_BUFFER ){ 1668 + parse_events_ensure_buffer_stack (); 1669 + YY_CURRENT_BUFFER_LVALUE = 1670 + parse_events__create_buffer(parse_events_in,YY_BUF_SIZE ); 1671 + } 1672 + 1673 + parse_events__init_buffer(YY_CURRENT_BUFFER,input_file ); 1674 + parse_events__load_buffer_state( ); 1675 + } 1676 + 1677 + /** Switch to a different input buffer. 1678 + * @param new_buffer The new input buffer. 1679 + * 1680 + */ 1681 + void parse_events__switch_to_buffer (YY_BUFFER_STATE new_buffer ) 1682 + { 1683 + 1684 + /* TODO. We should be able to replace this entire function body 1685 + * with 1686 + * parse_events_pop_buffer_state(); 1687 + * parse_events_push_buffer_state(new_buffer); 1688 + */ 1689 + parse_events_ensure_buffer_stack (); 1690 + if ( YY_CURRENT_BUFFER == new_buffer ) 1691 + return; 1692 + 1693 + if ( YY_CURRENT_BUFFER ) 1694 + { 1695 + /* Flush out information for old buffer. */ 1696 + *(yy_c_buf_p) = (yy_hold_char); 1697 + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1698 + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1699 + } 1700 + 1701 + YY_CURRENT_BUFFER_LVALUE = new_buffer; 1702 + parse_events__load_buffer_state( ); 1703 + 1704 + /* We don't actually know whether we did this switch during 1705 + * EOF (parse_events_wrap()) processing, but the only time this flag 1706 + * is looked at is after parse_events_wrap() is called, so it's safe 1707 + * to go ahead and always set it. 1708 + */ 1709 + (yy_did_buffer_switch_on_eof) = 1; 1710 + } 1711 + 1712 + static void parse_events__load_buffer_state (void) 1713 + { 1714 + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1715 + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1716 + parse_events_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1717 + (yy_hold_char) = *(yy_c_buf_p); 1718 + } 1719 + 1720 + /** Allocate and initialize an input buffer state. 1721 + * @param file A readable stream. 1722 + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1723 + * 1724 + * @return the allocated buffer state. 1725 + */ 1726 + YY_BUFFER_STATE parse_events__create_buffer (FILE * file, int size ) 1727 + { 1728 + YY_BUFFER_STATE b; 1729 + 1730 + b = (YY_BUFFER_STATE) parse_events_alloc(sizeof( struct yy_buffer_state ) ); 1731 + if ( ! b ) 1732 + YY_FATAL_ERROR( "out of dynamic memory in parse_events__create_buffer()" ); 1733 + 1734 + b->yy_buf_size = size; 1735 + 1736 + /* yy_ch_buf has to be 2 characters longer than the size given because 1737 + * we need to put in 2 end-of-buffer characters. 1738 + */ 1739 + b->yy_ch_buf = (char *) parse_events_alloc(b->yy_buf_size + 2 ); 1740 + if ( ! b->yy_ch_buf ) 1741 + YY_FATAL_ERROR( "out of dynamic memory in parse_events__create_buffer()" ); 1742 + 1743 + b->yy_is_our_buffer = 1; 1744 + 1745 + parse_events__init_buffer(b,file ); 1746 + 1747 + return b; 1748 + } 1749 + 1750 + /** Destroy the buffer. 1751 + * @param b a buffer created with parse_events__create_buffer() 1752 + * 1753 + */ 1754 + void parse_events__delete_buffer (YY_BUFFER_STATE b ) 1755 + { 1756 + 1757 + if ( ! b ) 1758 + return; 1759 + 1760 + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1761 + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1762 + 1763 + if ( b->yy_is_our_buffer ) 1764 + parse_events_free((void *) b->yy_ch_buf ); 1765 + 1766 + parse_events_free((void *) b ); 1767 + } 1768 + 1769 + #ifndef __cplusplus 1770 + extern int isatty (int ); 1771 + #endif /* __cplusplus */ 1772 + 1773 + /* Initializes or reinitializes a buffer. 1774 + * This function is sometimes called more than once on the same buffer, 1775 + * such as during a parse_events_restart() or at EOF. 1776 + */ 1777 + static void parse_events__init_buffer (YY_BUFFER_STATE b, FILE * file ) 1778 + 1779 + { 1780 + int oerrno = errno; 1781 + 1782 + parse_events__flush_buffer(b ); 1783 + 1784 + b->yy_input_file = file; 1785 + b->yy_fill_buffer = 1; 1786 + 1787 + /* If b is the current buffer, then parse_events__init_buffer was _probably_ 1788 + * called from parse_events_restart() or through yy_get_next_buffer. 1789 + * In that case, we don't want to reset the lineno or column. 1790 + */ 1791 + if (b != YY_CURRENT_BUFFER){ 1792 + b->yy_bs_lineno = 1; 1793 + b->yy_bs_column = 0; 1794 + } 1795 + 1796 + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 1797 + 1798 + errno = oerrno; 1799 + } 1800 + 1801 + /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1802 + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1803 + * 1804 + */ 1805 + void parse_events__flush_buffer (YY_BUFFER_STATE b ) 1806 + { 1807 + if ( ! b ) 1808 + return; 1809 + 1810 + b->yy_n_chars = 0; 1811 + 1812 + /* We always need two end-of-buffer characters. The first causes 1813 + * a transition to the end-of-buffer state. The second causes 1814 + * a jam in that state. 1815 + */ 1816 + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1817 + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1818 + 1819 + b->yy_buf_pos = &b->yy_ch_buf[0]; 1820 + 1821 + b->yy_at_bol = 1; 1822 + b->yy_buffer_status = YY_BUFFER_NEW; 1823 + 1824 + if ( b == YY_CURRENT_BUFFER ) 1825 + parse_events__load_buffer_state( ); 1826 + } 1827 + 1828 + /** Pushes the new state onto the stack. The new state becomes 1829 + * the current state. This function will allocate the stack 1830 + * if necessary. 1831 + * @param new_buffer The new state. 1832 + * 1833 + */ 1834 + void parse_events_push_buffer_state (YY_BUFFER_STATE new_buffer ) 1835 + { 1836 + if (new_buffer == NULL) 1837 + return; 1838 + 1839 + parse_events_ensure_buffer_stack(); 1840 + 1841 + /* This block is copied from parse_events__switch_to_buffer. */ 1842 + if ( YY_CURRENT_BUFFER ) 1843 + { 1844 + /* Flush out information for old buffer. */ 1845 + *(yy_c_buf_p) = (yy_hold_char); 1846 + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1847 + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1848 + } 1849 + 1850 + /* Only push if top exists. Otherwise, replace top. */ 1851 + if (YY_CURRENT_BUFFER) 1852 + (yy_buffer_stack_top)++; 1853 + YY_CURRENT_BUFFER_LVALUE = new_buffer; 1854 + 1855 + /* copied from parse_events__switch_to_buffer. */ 1856 + parse_events__load_buffer_state( ); 1857 + (yy_did_buffer_switch_on_eof) = 1; 1858 + } 1859 + 1860 + /** Removes and deletes the top of the stack, if present. 1861 + * The next element becomes the new top. 1862 + * 1863 + */ 1864 + void parse_events_pop_buffer_state (void) 1865 + { 1866 + if (!YY_CURRENT_BUFFER) 1867 + return; 1868 + 1869 + parse_events__delete_buffer(YY_CURRENT_BUFFER ); 1870 + YY_CURRENT_BUFFER_LVALUE = NULL; 1871 + if ((yy_buffer_stack_top) > 0) 1872 + --(yy_buffer_stack_top); 1873 + 1874 + if (YY_CURRENT_BUFFER) { 1875 + parse_events__load_buffer_state( ); 1876 + (yy_did_buffer_switch_on_eof) = 1; 1877 + } 1878 + } 1879 + 1880 + /* Allocates the stack if it does not exist. 1881 + * Guarantees space for at least one push. 1882 + */ 1883 + static void parse_events_ensure_buffer_stack (void) 1884 + { 1885 + int num_to_alloc; 1886 + 1887 + if (!(yy_buffer_stack)) { 1888 + 1889 + /* First allocation is just for 2 elements, since we don't know if this 1890 + * scanner will even need a stack. We use 2 instead of 1 to avoid an 1891 + * immediate realloc on the next call. 1892 + */ 1893 + num_to_alloc = 1; 1894 + (yy_buffer_stack) = (struct yy_buffer_state**)parse_events_alloc 1895 + (num_to_alloc * sizeof(struct yy_buffer_state*) 1896 + ); 1897 + if ( ! (yy_buffer_stack) ) 1898 + YY_FATAL_ERROR( "out of dynamic memory in parse_events_ensure_buffer_stack()" ); 1899 + 1900 + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1901 + 1902 + (yy_buffer_stack_max) = num_to_alloc; 1903 + (yy_buffer_stack_top) = 0; 1904 + return; 1905 + } 1906 + 1907 + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 1908 + 1909 + /* Increase the buffer to prepare for a possible push. */ 1910 + int grow_size = 8 /* arbitrary grow size */; 1911 + 1912 + num_to_alloc = (yy_buffer_stack_max) + grow_size; 1913 + (yy_buffer_stack) = (struct yy_buffer_state**)parse_events_realloc 1914 + ((yy_buffer_stack), 1915 + num_to_alloc * sizeof(struct yy_buffer_state*) 1916 + ); 1917 + if ( ! (yy_buffer_stack) ) 1918 + YY_FATAL_ERROR( "out of dynamic memory in parse_events_ensure_buffer_stack()" ); 1919 + 1920 + /* zero only the new slots.*/ 1921 + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1922 + (yy_buffer_stack_max) = num_to_alloc; 1923 + } 1924 + } 1925 + 1926 + /** Setup the input buffer state to scan directly from a user-specified character buffer. 1927 + * @param base the character buffer 1928 + * @param size the size in bytes of the character buffer 1929 + * 1930 + * @return the newly allocated buffer state object. 1931 + */ 1932 + YY_BUFFER_STATE parse_events__scan_buffer (char * base, yy_size_t size ) 1933 + { 1934 + YY_BUFFER_STATE b; 1935 + 1936 + if ( size < 2 || 1937 + base[size-2] != YY_END_OF_BUFFER_CHAR || 1938 + base[size-1] != YY_END_OF_BUFFER_CHAR ) 1939 + /* They forgot to leave room for the EOB's. */ 1940 + return 0; 1941 + 1942 + b = (YY_BUFFER_STATE) parse_events_alloc(sizeof( struct yy_buffer_state ) ); 1943 + if ( ! b ) 1944 + YY_FATAL_ERROR( "out of dynamic memory in parse_events__scan_buffer()" ); 1945 + 1946 + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 1947 + b->yy_buf_pos = b->yy_ch_buf = base; 1948 + b->yy_is_our_buffer = 0; 1949 + b->yy_input_file = 0; 1950 + b->yy_n_chars = b->yy_buf_size; 1951 + b->yy_is_interactive = 0; 1952 + b->yy_at_bol = 1; 1953 + b->yy_fill_buffer = 0; 1954 + b->yy_buffer_status = YY_BUFFER_NEW; 1955 + 1956 + parse_events__switch_to_buffer(b ); 1957 + 1958 + return b; 1959 + } 1960 + 1961 + /** Setup the input buffer state to scan a string. The next call to parse_events_lex() will 1962 + * scan from a @e copy of @a str. 1963 + * @param yystr a NUL-terminated string to scan 1964 + * 1965 + * @return the newly allocated buffer state object. 1966 + * @note If you want to scan bytes that may contain NUL values, then use 1967 + * parse_events__scan_bytes() instead. 1968 + */ 1969 + YY_BUFFER_STATE parse_events__scan_string (yyconst char * yystr ) 1970 + { 1971 + 1972 + return parse_events__scan_bytes(yystr,strlen(yystr) ); 1973 + } 1974 + 1975 + /** Setup the input buffer state to scan the given bytes. The next call to parse_events_lex() will 1976 + * scan from a @e copy of @a bytes. 1977 + * @param bytes the byte buffer to scan 1978 + * @param len the number of bytes in the buffer pointed to by @a bytes. 1979 + * 1980 + * @return the newly allocated buffer state object. 1981 + */ 1982 + YY_BUFFER_STATE parse_events__scan_bytes (yyconst char * yybytes, int _yybytes_len ) 1983 + { 1984 + YY_BUFFER_STATE b; 1985 + char *buf; 1986 + yy_size_t n; 1987 + int i; 1988 + 1989 + /* Get memory for full buffer, including space for trailing EOB's. */ 1990 + n = _yybytes_len + 2; 1991 + buf = (char *) parse_events_alloc(n ); 1992 + if ( ! buf ) 1993 + YY_FATAL_ERROR( "out of dynamic memory in parse_events__scan_bytes()" ); 1994 + 1995 + for ( i = 0; i < _yybytes_len; ++i ) 1996 + buf[i] = yybytes[i]; 1997 + 1998 + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 1999 + 2000 + b = parse_events__scan_buffer(buf,n ); 2001 + if ( ! b ) 2002 + YY_FATAL_ERROR( "bad buffer in parse_events__scan_bytes()" ); 2003 + 2004 + /* It's okay to grow etc. this buffer, and we should throw it 2005 + * away when we're done. 2006 + */ 2007 + b->yy_is_our_buffer = 1; 2008 + 2009 + return b; 2010 + } 2011 + 2012 + #ifndef YY_EXIT_FAILURE 2013 + #define YY_EXIT_FAILURE 2 2014 + #endif 2015 + 2016 + static void yy_fatal_error (yyconst char* msg ) 2017 + { 2018 + (void) fprintf( stderr, "%s\n", msg ); 2019 + exit( YY_EXIT_FAILURE ); 2020 + } 2021 + 2022 + /* Redefine yyless() so it works in section 3 code. */ 2023 + 2024 + #undef yyless 2025 + #define yyless(n) \ 2026 + do \ 2027 + { \ 2028 + /* Undo effects of setting up parse_events_text. */ \ 2029 + int yyless_macro_arg = (n); \ 2030 + YY_LESS_LINENO(yyless_macro_arg);\ 2031 + parse_events_text[parse_events_leng] = (yy_hold_char); \ 2032 + (yy_c_buf_p) = parse_events_text + yyless_macro_arg; \ 2033 + (yy_hold_char) = *(yy_c_buf_p); \ 2034 + *(yy_c_buf_p) = '\0'; \ 2035 + parse_events_leng = yyless_macro_arg; \ 2036 + } \ 2037 + while ( 0 ) 2038 + 2039 + /* Accessor methods (get/set functions) to struct members. */ 2040 + 2041 + /** Get the current line number. 2042 + * 2043 + */ 2044 + int parse_events_get_lineno (void) 2045 + { 2046 + 2047 + return parse_events_lineno; 2048 + } 2049 + 2050 + /** Get the input stream. 2051 + * 2052 + */ 2053 + FILE *parse_events_get_in (void) 2054 + { 2055 + return parse_events_in; 2056 + } 2057 + 2058 + /** Get the output stream. 2059 + * 2060 + */ 2061 + FILE *parse_events_get_out (void) 2062 + { 2063 + return parse_events_out; 2064 + } 2065 + 2066 + /** Get the length of the current token. 2067 + * 2068 + */ 2069 + int parse_events_get_leng (void) 2070 + { 2071 + return parse_events_leng; 2072 + } 2073 + 2074 + /** Get the current token. 2075 + * 2076 + */ 2077 + 2078 + char *parse_events_get_text (void) 2079 + { 2080 + return parse_events_text; 2081 + } 2082 + 2083 + /** Set the current line number. 2084 + * @param line_number 2085 + * 2086 + */ 2087 + void parse_events_set_lineno (int line_number ) 2088 + { 2089 + 2090 + parse_events_lineno = line_number; 2091 + } 2092 + 2093 + /** Set the input stream. This does not discard the current 2094 + * input buffer. 2095 + * @param in_str A readable stream. 2096 + * 2097 + * @see parse_events__switch_to_buffer 2098 + */ 2099 + void parse_events_set_in (FILE * in_str ) 2100 + { 2101 + parse_events_in = in_str ; 2102 + } 2103 + 2104 + void parse_events_set_out (FILE * out_str ) 2105 + { 2106 + parse_events_out = out_str ; 2107 + } 2108 + 2109 + int parse_events_get_debug (void) 2110 + { 2111 + return parse_events__flex_debug; 2112 + } 2113 + 2114 + void parse_events_set_debug (int bdebug ) 2115 + { 2116 + parse_events__flex_debug = bdebug ; 2117 + } 2118 + 2119 + static int yy_init_globals (void) 2120 + { 2121 + /* Initialization is the same as for the non-reentrant scanner. 2122 + * This function is called from parse_events_lex_destroy(), so don't allocate here. 2123 + */ 2124 + 2125 + (yy_buffer_stack) = 0; 2126 + (yy_buffer_stack_top) = 0; 2127 + (yy_buffer_stack_max) = 0; 2128 + (yy_c_buf_p) = (char *) 0; 2129 + (yy_init) = 0; 2130 + (yy_start) = 0; 2131 + 2132 + /* Defined in main.c */ 2133 + #ifdef YY_STDINIT 2134 + parse_events_in = stdin; 2135 + parse_events_out = stdout; 2136 + #else 2137 + parse_events_in = (FILE *) 0; 2138 + parse_events_out = (FILE *) 0; 2139 + #endif 2140 + 2141 + /* For future reference: Set errno on error, since we are called by 2142 + * parse_events_lex_init() 2143 + */ 2144 + return 0; 2145 + } 2146 + 2147 + /* parse_events_lex_destroy is for both reentrant and non-reentrant scanners. */ 2148 + int parse_events_lex_destroy (void) 2149 + { 2150 + 2151 + /* Pop the buffer stack, destroying each element. */ 2152 + while(YY_CURRENT_BUFFER){ 2153 + parse_events__delete_buffer(YY_CURRENT_BUFFER ); 2154 + YY_CURRENT_BUFFER_LVALUE = NULL; 2155 + parse_events_pop_buffer_state(); 2156 + } 2157 + 2158 + /* Destroy the stack itself. */ 2159 + parse_events_free((yy_buffer_stack) ); 2160 + (yy_buffer_stack) = NULL; 2161 + 2162 + /* Reset the globals. This is important in a non-reentrant scanner so the next time 2163 + * parse_events_lex() is called, initialization will occur. */ 2164 + yy_init_globals( ); 2165 + 2166 + return 0; 2167 + } 2168 + 2169 + /* 2170 + * Internal utility routines. 2171 + */ 2172 + 2173 + #ifndef yytext_ptr 2174 + static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) 2175 + { 2176 + register int i; 2177 + for ( i = 0; i < n; ++i ) 2178 + s1[i] = s2[i]; 2179 + } 2180 + #endif 2181 + 2182 + #ifdef YY_NEED_STRLEN 2183 + static int yy_flex_strlen (yyconst char * s ) 2184 + { 2185 + register int n; 2186 + for ( n = 0; s[n]; ++n ) 2187 + ; 2188 + 2189 + return n; 2190 + } 2191 + #endif 2192 + 2193 + void *parse_events_alloc (yy_size_t size ) 2194 + { 2195 + return (void *) malloc( size ); 2196 + } 2197 + 2198 + void *parse_events_realloc (void * ptr, yy_size_t size ) 2199 + { 2200 + /* The cast to (char *) in the following accommodates both 2201 + * implementations that use char* generic pointers, and those 2202 + * that use void* generic pointers. It works with the latter 2203 + * because both ANSI C and C++ allow castless assignment from 2204 + * any pointer type to void*, and deal with argument conversions 2205 + * as though doing an assignment. 2206 + */ 2207 + return (void *) realloc( (char *) ptr, size ); 2208 + } 2209 + 2210 + void parse_events_free (void * ptr ) 2211 + { 2212 + free( (char *) ptr ); /* see parse_events_realloc() for (char *) cast */ 2213 + } 2214 + 2215 + #define YYTABLES_NAME "yytables" 2216 + 2217 + #line 102 "util/parse-events.l" 2218 + 2219 + 2220 + 2221 + int parse_events_wrap(void) 2222 + { 2223 + return 1; 2224 + } 2225 +
+316
tools/perf/util/parse-events-flex.h
··· 1 + #ifndef parse_events_HEADER_H 2 + #define parse_events_HEADER_H 1 3 + #define parse_events_IN_HEADER 1 4 + 5 + #line 6 "util/parse-events-flex.h" 6 + 7 + #define YY_INT_ALIGNED short int 8 + 9 + /* A lexical scanner generated by flex */ 10 + 11 + #define FLEX_SCANNER 12 + #define YY_FLEX_MAJOR_VERSION 2 13 + #define YY_FLEX_MINOR_VERSION 5 14 + #define YY_FLEX_SUBMINOR_VERSION 35 15 + #if YY_FLEX_SUBMINOR_VERSION > 0 16 + #define FLEX_BETA 17 + #endif 18 + 19 + /* First, we deal with platform-specific or compiler-specific issues. */ 20 + 21 + /* begin standard C headers. */ 22 + #include <stdio.h> 23 + #include <string.h> 24 + #include <errno.h> 25 + #include <stdlib.h> 26 + 27 + /* end standard C headers. */ 28 + 29 + /* flex integer type definitions */ 30 + 31 + #ifndef FLEXINT_H 32 + #define FLEXINT_H 33 + 34 + /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 35 + 36 + #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 37 + 38 + /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 39 + * if you want the limit (max/min) macros for int types. 40 + */ 41 + #ifndef __STDC_LIMIT_MACROS 42 + #define __STDC_LIMIT_MACROS 1 43 + #endif 44 + 45 + #include <inttypes.h> 46 + typedef int8_t flex_int8_t; 47 + typedef uint8_t flex_uint8_t; 48 + typedef int16_t flex_int16_t; 49 + typedef uint16_t flex_uint16_t; 50 + typedef int32_t flex_int32_t; 51 + typedef uint32_t flex_uint32_t; 52 + #else 53 + typedef signed char flex_int8_t; 54 + typedef short int flex_int16_t; 55 + typedef int flex_int32_t; 56 + typedef unsigned char flex_uint8_t; 57 + typedef unsigned short int flex_uint16_t; 58 + typedef unsigned int flex_uint32_t; 59 + #endif /* ! C99 */ 60 + 61 + /* Limits of integral types. */ 62 + #ifndef INT8_MIN 63 + #define INT8_MIN (-128) 64 + #endif 65 + #ifndef INT16_MIN 66 + #define INT16_MIN (-32767-1) 67 + #endif 68 + #ifndef INT32_MIN 69 + #define INT32_MIN (-2147483647-1) 70 + #endif 71 + #ifndef INT8_MAX 72 + #define INT8_MAX (127) 73 + #endif 74 + #ifndef INT16_MAX 75 + #define INT16_MAX (32767) 76 + #endif 77 + #ifndef INT32_MAX 78 + #define INT32_MAX (2147483647) 79 + #endif 80 + #ifndef UINT8_MAX 81 + #define UINT8_MAX (255U) 82 + #endif 83 + #ifndef UINT16_MAX 84 + #define UINT16_MAX (65535U) 85 + #endif 86 + #ifndef UINT32_MAX 87 + #define UINT32_MAX (4294967295U) 88 + #endif 89 + 90 + #endif /* ! FLEXINT_H */ 91 + 92 + #ifdef __cplusplus 93 + 94 + /* The "const" storage-class-modifier is valid. */ 95 + #define YY_USE_CONST 96 + 97 + #else /* ! __cplusplus */ 98 + 99 + /* C99 requires __STDC__ to be defined as 1. */ 100 + #if defined (__STDC__) 101 + 102 + #define YY_USE_CONST 103 + 104 + #endif /* defined (__STDC__) */ 105 + #endif /* ! __cplusplus */ 106 + 107 + #ifdef YY_USE_CONST 108 + #define yyconst const 109 + #else 110 + #define yyconst 111 + #endif 112 + 113 + /* Size of default input buffer. */ 114 + #ifndef YY_BUF_SIZE 115 + #define YY_BUF_SIZE 16384 116 + #endif 117 + 118 + #ifndef YY_TYPEDEF_YY_BUFFER_STATE 119 + #define YY_TYPEDEF_YY_BUFFER_STATE 120 + typedef struct yy_buffer_state *YY_BUFFER_STATE; 121 + #endif 122 + 123 + extern int parse_events_leng; 124 + 125 + extern FILE *parse_events_in, *parse_events_out; 126 + 127 + #ifndef YY_TYPEDEF_YY_SIZE_T 128 + #define YY_TYPEDEF_YY_SIZE_T 129 + typedef size_t yy_size_t; 130 + #endif 131 + 132 + #ifndef YY_STRUCT_YY_BUFFER_STATE 133 + #define YY_STRUCT_YY_BUFFER_STATE 134 + struct yy_buffer_state 135 + { 136 + FILE *yy_input_file; 137 + 138 + char *yy_ch_buf; /* input buffer */ 139 + char *yy_buf_pos; /* current position in input buffer */ 140 + 141 + /* Size of input buffer in bytes, not including room for EOB 142 + * characters. 143 + */ 144 + yy_size_t yy_buf_size; 145 + 146 + /* Number of characters read into yy_ch_buf, not including EOB 147 + * characters. 148 + */ 149 + int yy_n_chars; 150 + 151 + /* Whether we "own" the buffer - i.e., we know we created it, 152 + * and can realloc() it to grow it, and should free() it to 153 + * delete it. 154 + */ 155 + int yy_is_our_buffer; 156 + 157 + /* Whether this is an "interactive" input source; if so, and 158 + * if we're using stdio for input, then we want to use getc() 159 + * instead of fread(), to make sure we stop fetching input after 160 + * each newline. 161 + */ 162 + int yy_is_interactive; 163 + 164 + /* Whether we're considered to be at the beginning of a line. 165 + * If so, '^' rules will be active on the next match, otherwise 166 + * not. 167 + */ 168 + int yy_at_bol; 169 + 170 + int yy_bs_lineno; /**< The line count. */ 171 + int yy_bs_column; /**< The column count. */ 172 + 173 + /* Whether to try to fill the input buffer when we reach the 174 + * end of it. 175 + */ 176 + int yy_fill_buffer; 177 + 178 + int yy_buffer_status; 179 + 180 + }; 181 + #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 182 + 183 + void parse_events_restart (FILE *input_file ); 184 + void parse_events__switch_to_buffer (YY_BUFFER_STATE new_buffer ); 185 + YY_BUFFER_STATE parse_events__create_buffer (FILE *file,int size ); 186 + void parse_events__delete_buffer (YY_BUFFER_STATE b ); 187 + void parse_events__flush_buffer (YY_BUFFER_STATE b ); 188 + void parse_events_push_buffer_state (YY_BUFFER_STATE new_buffer ); 189 + void parse_events_pop_buffer_state (void ); 190 + 191 + YY_BUFFER_STATE parse_events__scan_buffer (char *base,yy_size_t size ); 192 + YY_BUFFER_STATE parse_events__scan_string (yyconst char *yy_str ); 193 + YY_BUFFER_STATE parse_events__scan_bytes (yyconst char *bytes,int len ); 194 + 195 + void *parse_events_alloc (yy_size_t ); 196 + void *parse_events_realloc (void *,yy_size_t ); 197 + void parse_events_free (void * ); 198 + 199 + /* Begin user sect3 */ 200 + 201 + extern int parse_events_lineno; 202 + 203 + extern char *parse_events_text; 204 + #define yytext_ptr parse_events_text 205 + 206 + #ifdef YY_HEADER_EXPORT_START_CONDITIONS 207 + #define INITIAL 0 208 + 209 + #endif 210 + 211 + #ifndef YY_NO_UNISTD_H 212 + /* Special case for "unistd.h", since it is non-ANSI. We include it way 213 + * down here because we want the user's section 1 to have been scanned first. 214 + * The user has a chance to override it with an option. 215 + */ 216 + #include <unistd.h> 217 + #endif 218 + 219 + #ifndef YY_EXTRA_TYPE 220 + #define YY_EXTRA_TYPE void * 221 + #endif 222 + 223 + /* Accessor methods to globals. 224 + These are made visible to non-reentrant scanners for convenience. */ 225 + 226 + int parse_events_lex_destroy (void ); 227 + 228 + int parse_events_get_debug (void ); 229 + 230 + void parse_events_set_debug (int debug_flag ); 231 + 232 + YY_EXTRA_TYPE parse_events_get_extra (void ); 233 + 234 + void parse_events_set_extra (YY_EXTRA_TYPE user_defined ); 235 + 236 + FILE *parse_events_get_in (void ); 237 + 238 + void parse_events_set_in (FILE * in_str ); 239 + 240 + FILE *parse_events_get_out (void ); 241 + 242 + void parse_events_set_out (FILE * out_str ); 243 + 244 + int parse_events_get_leng (void ); 245 + 246 + char *parse_events_get_text (void ); 247 + 248 + int parse_events_get_lineno (void ); 249 + 250 + void parse_events_set_lineno (int line_number ); 251 + 252 + /* Macros after this point can all be overridden by user definitions in 253 + * section 1. 254 + */ 255 + 256 + #ifndef YY_SKIP_YYWRAP 257 + #ifdef __cplusplus 258 + extern "C" int parse_events_wrap (void ); 259 + #else 260 + extern int parse_events_wrap (void ); 261 + #endif 262 + #endif 263 + 264 + #ifndef yytext_ptr 265 + static void yy_flex_strncpy (char *,yyconst char *,int ); 266 + #endif 267 + 268 + #ifdef YY_NEED_STRLEN 269 + static int yy_flex_strlen (yyconst char * ); 270 + #endif 271 + 272 + #ifndef YY_NO_INPUT 273 + 274 + #endif 275 + 276 + /* Amount of stuff to slurp up with each read. */ 277 + #ifndef YY_READ_BUF_SIZE 278 + #define YY_READ_BUF_SIZE 8192 279 + #endif 280 + 281 + /* Number of entries by which start-condition stack grows. */ 282 + #ifndef YY_START_STACK_INCR 283 + #define YY_START_STACK_INCR 25 284 + #endif 285 + 286 + /* Default declaration of generated scanner - a define so the user can 287 + * easily add parameters. 288 + */ 289 + #ifndef YY_DECL 290 + #define YY_DECL_IS_OURS 1 291 + 292 + extern int parse_events_lex (void); 293 + 294 + #define YY_DECL int parse_events_lex (void) 295 + #endif /* !YY_DECL */ 296 + 297 + /* yy_get_previous_state - get the state just before the EOB char was reached */ 298 + 299 + #undef YY_NEW_FILE 300 + #undef YY_FLUSH_BUFFER 301 + #undef yy_set_bol 302 + #undef yy_new_buffer 303 + #undef yy_set_interactive 304 + #undef YY_DO_BEFORE_ACTION 305 + 306 + #ifdef YY_DECL_IS_OURS 307 + #undef YY_DECL_IS_OURS 308 + #undef YY_DECL 309 + #endif 310 + 311 + #line 102 "util/parse-events.l" 312 + 313 + 314 + #line 315 "util/parse-events-flex.h" 315 + #undef parse_events_IN_HEADER 316 + #endif /* parse_events_HEADER_H */
+148 -338
tools/perf/util/parse-events.c
··· 11 11 #include "cache.h" 12 12 #include "header.h" 13 13 #include "debugfs.h" 14 + #include "parse-events-flex.h" 15 + 16 + #define MAX_NAME_LEN 100 14 17 15 18 struct event_symbol { 16 19 u8 type; ··· 22 19 const char *alias; 23 20 }; 24 21 25 - enum event_result { 26 - EVT_FAILED, 27 - EVT_HANDLED, 28 - EVT_HANDLED_ALL 29 - }; 22 + int parse_events_parse(struct list_head *list, int *idx); 30 23 31 24 #define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x 32 25 #define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x ··· 353 354 return "unknown"; 354 355 } 355 356 356 - static int parse_aliases(const char **str, const char *names[][MAX_ALIASES], int size) 357 + static int add_event(struct list_head *list, int *idx, 358 + struct perf_event_attr *attr, char *name) 359 + { 360 + struct perf_evsel *evsel; 361 + 362 + event_attr_init(attr); 363 + 364 + evsel = perf_evsel__new(attr, (*idx)++); 365 + if (!evsel) 366 + return -ENOMEM; 367 + 368 + list_add_tail(&evsel->node, list); 369 + 370 + evsel->name = strdup(name); 371 + return 0; 372 + } 373 + 374 + static int parse_aliases(char *str, const char *names[][MAX_ALIASES], int size) 357 375 { 358 376 int i, j; 359 377 int n, longest = -1; ··· 378 362 for (i = 0; i < size; i++) { 379 363 for (j = 0; j < MAX_ALIASES && names[i][j]; j++) { 380 364 n = strlen(names[i][j]); 381 - if (n > longest && !strncasecmp(*str, names[i][j], n)) 365 + if (n > longest && !strncasecmp(str, names[i][j], n)) 382 366 longest = n; 383 367 } 384 - if (longest > 0) { 385 - *str += longest; 368 + if (longest > 0) 386 369 return i; 387 - } 388 370 } 389 371 390 372 return -1; 391 373 } 392 374 393 - static enum event_result 394 - parse_generic_hw_event(const char **str, struct perf_event_attr *attr) 375 + int parse_events_add_cache(struct list_head *list, int *idx, 376 + char *type, char *op_result1, char *op_result2) 395 377 { 396 - const char *s = *str; 378 + struct perf_event_attr attr; 379 + char name[MAX_NAME_LEN]; 397 380 int cache_type = -1, cache_op = -1, cache_result = -1; 381 + char *op_result[2] = { op_result1, op_result2 }; 382 + int i, n; 398 383 399 - cache_type = parse_aliases(&s, hw_cache, PERF_COUNT_HW_CACHE_MAX); 400 384 /* 401 385 * No fallback - if we cannot get a clear cache type 402 386 * then bail out: 403 387 */ 388 + cache_type = parse_aliases(type, hw_cache, 389 + PERF_COUNT_HW_CACHE_MAX); 404 390 if (cache_type == -1) 405 - return EVT_FAILED; 391 + return -EINVAL; 406 392 407 - while ((cache_op == -1 || cache_result == -1) && *s == '-') { 408 - ++s; 393 + n = snprintf(name, MAX_NAME_LEN, "%s", type); 394 + 395 + for (i = 0; (i < 2) && (op_result[i]); i++) { 396 + char *str = op_result[i]; 397 + 398 + snprintf(name + n, MAX_NAME_LEN - n, "-%s\n", str); 409 399 410 400 if (cache_op == -1) { 411 - cache_op = parse_aliases(&s, hw_cache_op, 412 - PERF_COUNT_HW_CACHE_OP_MAX); 401 + cache_op = parse_aliases(str, hw_cache_op, 402 + PERF_COUNT_HW_CACHE_OP_MAX); 413 403 if (cache_op >= 0) { 414 404 if (!is_cache_op_valid(cache_type, cache_op)) 415 - return EVT_FAILED; 405 + return -EINVAL; 416 406 continue; 417 407 } 418 408 } 419 409 420 410 if (cache_result == -1) { 421 - cache_result = parse_aliases(&s, hw_cache_result, 411 + cache_result = parse_aliases(str, hw_cache_result, 422 412 PERF_COUNT_HW_CACHE_RESULT_MAX); 423 413 if (cache_result >= 0) 424 414 continue; 425 415 } 426 - 427 - /* 428 - * Can't parse this as a cache op or result, so back up 429 - * to the '-'. 430 - */ 431 - --s; 432 - break; 433 416 } 434 417 435 418 /* ··· 443 428 if (cache_result == -1) 444 429 cache_result = PERF_COUNT_HW_CACHE_RESULT_ACCESS; 445 430 446 - attr->config = cache_type | (cache_op << 8) | (cache_result << 16); 447 - attr->type = PERF_TYPE_HW_CACHE; 448 - 449 - *str = s; 450 - return EVT_HANDLED; 431 + memset(&attr, 0, sizeof(attr)); 432 + attr.config = cache_type | (cache_op << 8) | (cache_result << 16); 433 + attr.type = PERF_TYPE_HW_CACHE; 434 + return add_event(list, idx, &attr, name); 451 435 } 452 436 453 - static enum event_result 454 - parse_single_tracepoint_event(char *sys_name, 455 - const char *evt_name, 456 - unsigned int evt_length, 457 - struct perf_event_attr *attr, 458 - const char **strp) 437 + static int add_tracepoint(struct list_head *list, int *idx, 438 + char *sys_name, char *evt_name) 459 439 { 440 + struct perf_event_attr attr; 441 + char name[MAX_NAME_LEN]; 460 442 char evt_path[MAXPATHLEN]; 461 443 char id_buf[4]; 462 444 u64 id; ··· 464 452 465 453 fd = open(evt_path, O_RDONLY); 466 454 if (fd < 0) 467 - return EVT_FAILED; 455 + return -1; 468 456 469 457 if (read(fd, id_buf, sizeof(id_buf)) < 0) { 470 458 close(fd); 471 - return EVT_FAILED; 459 + return -1; 472 460 } 473 461 474 462 close(fd); 475 463 id = atoll(id_buf); 476 - attr->config = id; 477 - attr->type = PERF_TYPE_TRACEPOINT; 478 - *strp += strlen(sys_name) + evt_length + 1; /* + 1 for the ':' */ 479 464 480 - attr->sample_type |= PERF_SAMPLE_RAW; 481 - attr->sample_type |= PERF_SAMPLE_TIME; 482 - attr->sample_type |= PERF_SAMPLE_CPU; 465 + memset(&attr, 0, sizeof(attr)); 466 + attr.config = id; 467 + attr.type = PERF_TYPE_TRACEPOINT; 468 + attr.sample_type |= PERF_SAMPLE_RAW; 469 + attr.sample_type |= PERF_SAMPLE_TIME; 470 + attr.sample_type |= PERF_SAMPLE_CPU; 471 + attr.sample_period = 1; 483 472 484 - attr->sample_period = 1; 485 - 486 - 487 - return EVT_HANDLED; 473 + snprintf(name, MAX_NAME_LEN, "%s:%s", sys_name, evt_name); 474 + return add_event(list, idx, &attr, name); 488 475 } 489 476 490 - /* sys + ':' + event + ':' + flags*/ 491 - #define MAX_EVOPT_LEN (MAX_EVENT_LENGTH * 2 + 2 + 128) 492 - static enum event_result 493 - parse_multiple_tracepoint_event(struct perf_evlist *evlist, char *sys_name, 494 - const char *evt_exp, char *flags) 477 + static int add_tracepoint_multi(struct list_head *list, int *idx, 478 + char *sys_name, char *evt_name) 495 479 { 496 480 char evt_path[MAXPATHLEN]; 497 481 struct dirent *evt_ent; 498 482 DIR *evt_dir; 483 + int ret = 0; 499 484 500 485 snprintf(evt_path, MAXPATHLEN, "%s/%s", tracing_events_path, sys_name); 501 486 evt_dir = opendir(evt_path); 502 - 503 487 if (!evt_dir) { 504 488 perror("Can't open event dir"); 505 - return EVT_FAILED; 489 + return -1; 506 490 } 507 491 508 - while ((evt_ent = readdir(evt_dir))) { 509 - char event_opt[MAX_EVOPT_LEN + 1]; 510 - int len; 511 - 492 + while (!ret && (evt_ent = readdir(evt_dir))) { 512 493 if (!strcmp(evt_ent->d_name, ".") 513 494 || !strcmp(evt_ent->d_name, "..") 514 495 || !strcmp(evt_ent->d_name, "enable") 515 496 || !strcmp(evt_ent->d_name, "filter")) 516 497 continue; 517 498 518 - if (!strglobmatch(evt_ent->d_name, evt_exp)) 499 + if (!strglobmatch(evt_ent->d_name, evt_name)) 519 500 continue; 520 501 521 - len = snprintf(event_opt, MAX_EVOPT_LEN, "%s:%s%s%s", sys_name, 522 - evt_ent->d_name, flags ? ":" : "", 523 - flags ?: ""); 524 - if (len < 0) 525 - return EVT_FAILED; 526 - 527 - if (parse_events(evlist, event_opt, 0)) 528 - return EVT_FAILED; 502 + ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name); 529 503 } 530 504 531 - return EVT_HANDLED_ALL; 505 + return ret; 532 506 } 533 507 534 - static enum event_result 535 - parse_tracepoint_event(struct perf_evlist *evlist, const char **strp, 536 - struct perf_event_attr *attr) 508 + int parse_events_add_tracepoint(struct list_head *list, int *idx, 509 + char *sys, char *event) 537 510 { 538 - const char *evt_name; 539 - char *flags = NULL, *comma_loc; 540 - char sys_name[MAX_EVENT_LENGTH]; 541 - unsigned int sys_length, evt_length; 511 + int ret; 542 512 543 - if (debugfs_valid_mountpoint(tracing_events_path)) 544 - return 0; 513 + ret = debugfs_valid_mountpoint(tracing_events_path); 514 + if (ret) 515 + return ret; 545 516 546 - evt_name = strchr(*strp, ':'); 547 - if (!evt_name) 548 - return EVT_FAILED; 549 - 550 - sys_length = evt_name - *strp; 551 - if (sys_length >= MAX_EVENT_LENGTH) 552 - return 0; 553 - 554 - strncpy(sys_name, *strp, sys_length); 555 - sys_name[sys_length] = '\0'; 556 - evt_name = evt_name + 1; 557 - 558 - comma_loc = strchr(evt_name, ','); 559 - if (comma_loc) { 560 - /* take the event name up to the comma */ 561 - evt_name = strndup(evt_name, comma_loc - evt_name); 562 - } 563 - flags = strchr(evt_name, ':'); 564 - if (flags) { 565 - /* split it out: */ 566 - evt_name = strndup(evt_name, flags - evt_name); 567 - flags++; 568 - } 569 - 570 - evt_length = strlen(evt_name); 571 - if (evt_length >= MAX_EVENT_LENGTH) 572 - return EVT_FAILED; 573 - if (strpbrk(evt_name, "*?")) { 574 - *strp += strlen(sys_name) + evt_length + 1; /* 1 == the ':' */ 575 - return parse_multiple_tracepoint_event(evlist, sys_name, 576 - evt_name, flags); 577 - } else { 578 - return parse_single_tracepoint_event(sys_name, evt_name, 579 - evt_length, attr, strp); 580 - } 517 + return strpbrk(event, "*?") ? 518 + add_tracepoint_multi(list, idx, sys, event) : 519 + add_tracepoint(list, idx, sys, event); 581 520 } 582 521 583 - static enum event_result 584 - parse_breakpoint_type(const char *type, const char **strp, 585 - struct perf_event_attr *attr) 522 + static int 523 + parse_breakpoint_type(const char *type, struct perf_event_attr *attr) 586 524 { 587 525 int i; 588 526 589 527 for (i = 0; i < 3; i++) { 590 - if (!type[i]) 528 + if (!type || !type[i]) 591 529 break; 592 530 593 531 switch (type[i]) { ··· 551 589 attr->bp_type |= HW_BREAKPOINT_X; 552 590 break; 553 591 default: 554 - return EVT_FAILED; 592 + return -EINVAL; 555 593 } 556 594 } 595 + 557 596 if (!attr->bp_type) /* Default */ 558 597 attr->bp_type = HW_BREAKPOINT_R | HW_BREAKPOINT_W; 559 598 560 - *strp = type + i; 561 - 562 - return EVT_HANDLED; 599 + return 0; 563 600 } 564 601 565 - static enum event_result 566 - parse_breakpoint_event(const char **strp, struct perf_event_attr *attr) 602 + int parse_events_add_breakpoint(struct list_head *list, int *idx, 603 + void *ptr, char *type) 567 604 { 568 - const char *target; 569 - const char *type; 570 - char *endaddr; 571 - u64 addr; 572 - enum event_result err; 605 + struct perf_event_attr attr; 606 + char name[MAX_NAME_LEN]; 573 607 574 - target = strchr(*strp, ':'); 575 - if (!target) 576 - return EVT_FAILED; 608 + memset(&attr, 0, sizeof(attr)); 609 + attr.bp_addr = (u64) ptr; 577 610 578 - if (strncmp(*strp, "mem", target - *strp) != 0) 579 - return EVT_FAILED; 580 - 581 - target++; 582 - 583 - addr = strtoull(target, &endaddr, 0); 584 - if (target == endaddr) 585 - return EVT_FAILED; 586 - 587 - attr->bp_addr = addr; 588 - *strp = endaddr; 589 - 590 - type = strchr(target, ':'); 591 - 592 - /* If no type is defined, just rw as default */ 593 - if (!type) { 594 - attr->bp_type = HW_BREAKPOINT_R | HW_BREAKPOINT_W; 595 - } else { 596 - err = parse_breakpoint_type(++type, strp, attr); 597 - if (err == EVT_FAILED) 598 - return EVT_FAILED; 599 - } 611 + if (parse_breakpoint_type(type, &attr)) 612 + return -EINVAL; 600 613 601 614 /* 602 615 * We should find a nice way to override the access length 603 616 * Provide some defaults for now 604 617 */ 605 - if (attr->bp_type == HW_BREAKPOINT_X) 606 - attr->bp_len = sizeof(long); 618 + if (attr.bp_type == HW_BREAKPOINT_X) 619 + attr.bp_len = sizeof(long); 607 620 else 608 - attr->bp_len = HW_BREAKPOINT_LEN_4; 621 + attr.bp_len = HW_BREAKPOINT_LEN_4; 609 622 610 - attr->type = PERF_TYPE_BREAKPOINT; 623 + attr.type = PERF_TYPE_BREAKPOINT; 611 624 612 - return EVT_HANDLED; 625 + snprintf(name, MAX_NAME_LEN, "mem:%p:%s", ptr, type ? type : "rw"); 626 + return add_event(list, idx, &attr, name); 613 627 } 614 628 615 - static int check_events(const char *str, unsigned int i) 629 + int 630 + parse_events_add_numeric(struct list_head *list, int *idx, 631 + unsigned long type, unsigned long config) 616 632 { 617 - int n; 633 + struct perf_event_attr attr; 618 634 619 - n = strlen(event_symbols[i].symbol); 620 - if (!strncasecmp(str, event_symbols[i].symbol, n)) 621 - return n; 622 - 623 - n = strlen(event_symbols[i].alias); 624 - if (n) { 625 - if (!strncasecmp(str, event_symbols[i].alias, n)) 626 - return n; 627 - } 628 - 629 - return 0; 635 + memset(&attr, 0, sizeof(attr)); 636 + attr.type = type; 637 + attr.config = config; 638 + return add_event(list, idx, &attr, 639 + (char *) __event_name(type, config)); 630 640 } 631 641 632 - static enum event_result 633 - parse_symbolic_event(const char **strp, struct perf_event_attr *attr) 642 + int parse_events_modifier(struct list_head *list, char *str) 634 643 { 635 - const char *str = *strp; 636 - unsigned int i; 637 - int n; 638 - 639 - for (i = 0; i < ARRAY_SIZE(event_symbols); i++) { 640 - n = check_events(str, i); 641 - if (n > 0) { 642 - attr->type = event_symbols[i].type; 643 - attr->config = event_symbols[i].config; 644 - *strp = str + n; 645 - return EVT_HANDLED; 646 - } 647 - } 648 - return EVT_FAILED; 649 - } 650 - 651 - static enum event_result 652 - parse_raw_event(const char **strp, struct perf_event_attr *attr) 653 - { 654 - const char *str = *strp; 655 - u64 config; 656 - int n; 657 - 658 - if (*str != 'r') 659 - return EVT_FAILED; 660 - n = hex2u64(str + 1, &config); 661 - if (n > 0) { 662 - const char *end = str + n + 1; 663 - if (*end != '\0' && *end != ',' && *end != ':') 664 - return EVT_FAILED; 665 - 666 - *strp = end; 667 - attr->type = PERF_TYPE_RAW; 668 - attr->config = config; 669 - return EVT_HANDLED; 670 - } 671 - return EVT_FAILED; 672 - } 673 - 674 - static enum event_result 675 - parse_numeric_event(const char **strp, struct perf_event_attr *attr) 676 - { 677 - const char *str = *strp; 678 - char *endp; 679 - unsigned long type; 680 - u64 config; 681 - 682 - type = strtoul(str, &endp, 0); 683 - if (endp > str && type < PERF_TYPE_MAX && *endp == ':') { 684 - str = endp + 1; 685 - config = strtoul(str, &endp, 0); 686 - if (endp > str) { 687 - attr->type = type; 688 - attr->config = config; 689 - *strp = endp; 690 - return EVT_HANDLED; 691 - } 692 - } 693 - return EVT_FAILED; 694 - } 695 - 696 - static int 697 - parse_event_modifier(const char **strp, struct perf_event_attr *attr) 698 - { 699 - const char *str = *strp; 644 + struct perf_evsel *evsel; 700 645 int exclude = 0, exclude_GH = 0; 701 646 int eu = 0, ek = 0, eh = 0, eH = 0, eG = 0, precise = 0; 702 647 703 - if (!*str) 648 + if (str == NULL) 704 649 return 0; 705 - 706 - if (*str == ',') 707 - return 0; 708 - 709 - if (*str++ != ':') 710 - return -1; 711 650 712 651 while (*str) { 713 652 if (*str == 'u') { ··· 638 775 639 776 ++str; 640 777 } 641 - if (str < *strp + 2) 642 - return -1; 643 778 644 - *strp = str; 779 + /* 780 + * precise ip: 781 + * 782 + * 0 - SAMPLE_IP can have arbitrary skid 783 + * 1 - SAMPLE_IP must have constant skid 784 + * 2 - SAMPLE_IP requested to have 0 skid 785 + * 3 - SAMPLE_IP must have 0 skid 786 + * 787 + * See also PERF_RECORD_MISC_EXACT_IP 788 + */ 789 + if (precise > 3) 790 + return -EINVAL; 645 791 646 - attr->exclude_user = eu; 647 - attr->exclude_kernel = ek; 648 - attr->exclude_hv = eh; 649 - attr->precise_ip = precise; 650 - attr->exclude_host = eH; 651 - attr->exclude_guest = eG; 792 + list_for_each_entry(evsel, list, node) { 793 + evsel->attr.exclude_user = eu; 794 + evsel->attr.exclude_kernel = ek; 795 + evsel->attr.exclude_hv = eh; 796 + evsel->attr.precise_ip = precise; 797 + evsel->attr.exclude_host = eH; 798 + evsel->attr.exclude_guest = eG; 799 + } 652 800 653 801 return 0; 654 802 } 655 803 656 - /* 657 - * Each event can have multiple symbolic names. 658 - * Symbolic names are (almost) exactly matched. 659 - */ 660 - static enum event_result 661 - parse_event_symbols(struct perf_evlist *evlist, const char **str, 662 - struct perf_event_attr *attr) 804 + int parse_events(struct perf_evlist *evlist, const char *str, int unset __used) 663 805 { 664 - enum event_result ret; 806 + struct perf_evsel *evsel, *h; 807 + LIST_HEAD(list); 808 + YY_BUFFER_STATE buffer; 809 + int ret, idx = evlist->nr_entries; 665 810 666 - ret = parse_tracepoint_event(evlist, str, attr); 667 - if (ret != EVT_FAILED) 668 - goto modifier; 811 + buffer = parse_events__scan_string(str); 669 812 670 - ret = parse_raw_event(str, attr); 671 - if (ret != EVT_FAILED) 672 - goto modifier; 813 + ret = parse_events_parse(&list, &idx); 673 814 674 - ret = parse_numeric_event(str, attr); 675 - if (ret != EVT_FAILED) 676 - goto modifier; 815 + parse_events__flush_buffer(buffer); 816 + parse_events__delete_buffer(buffer); 677 817 678 - ret = parse_symbolic_event(str, attr); 679 - if (ret != EVT_FAILED) 680 - goto modifier; 818 + if (!ret) { 819 + int entries = idx - evlist->nr_entries; 820 + perf_evlist__splice_list_tail(evlist, &list, entries); 821 + return 0; 822 + } 681 823 682 - ret = parse_generic_hw_event(str, attr); 683 - if (ret != EVT_FAILED) 684 - goto modifier; 824 + list_for_each_entry_safe(evsel, h, &list, node) 825 + perf_evsel__delete(evsel); 685 826 686 - ret = parse_breakpoint_event(str, attr); 687 - if (ret != EVT_FAILED) 688 - goto modifier; 689 - 690 - fprintf(stderr, "invalid or unsupported event: '%s'\n", *str); 827 + fprintf(stderr, "invalid or unsupported event: '%s'\n", str); 691 828 fprintf(stderr, "Run 'perf list' for a list of valid events\n"); 692 - return EVT_FAILED; 693 - 694 - modifier: 695 - if (parse_event_modifier(str, attr) < 0) { 696 - fprintf(stderr, "invalid event modifier: '%s'\n", *str); 697 - fprintf(stderr, "Run 'perf list' for a list of valid events and modifiers\n"); 698 - 699 - return EVT_FAILED; 700 - } 701 - 702 829 return ret; 703 - } 704 - 705 - int parse_events(struct perf_evlist *evlist , const char *str, int unset __used) 706 - { 707 - struct perf_event_attr attr; 708 - enum event_result ret; 709 - const char *ostr; 710 - 711 - for (;;) { 712 - ostr = str; 713 - memset(&attr, 0, sizeof(attr)); 714 - event_attr_init(&attr); 715 - ret = parse_event_symbols(evlist, &str, &attr); 716 - if (ret == EVT_FAILED) 717 - return -1; 718 - 719 - if (!(*str == 0 || *str == ',' || isspace(*str))) 720 - return -1; 721 - 722 - if (ret != EVT_HANDLED_ALL) { 723 - struct perf_evsel *evsel; 724 - evsel = perf_evsel__new(&attr, evlist->nr_entries); 725 - if (evsel == NULL) 726 - return -1; 727 - perf_evlist__add(evlist, evsel); 728 - 729 - evsel->name = calloc(str - ostr + 1, 1); 730 - if (!evsel->name) 731 - return -1; 732 - strncpy(evsel->name, ostr, str - ostr); 733 - } 734 - 735 - if (*str == 0) 736 - break; 737 - if (*str == ',') 738 - ++str; 739 - while (isspace(*str)) 740 - ++str; 741 - } 742 - 743 - return 0; 744 830 } 745 831 746 832 int parse_events_option(const struct option *opt, const char *str, ··· 863 1051 864 1052 return printed; 865 1053 } 866 - 867 - #define MAX_NAME_LEN 100 868 1054 869 1055 /* 870 1056 * Print the help text for the event symbols:
+15
tools/perf/util/parse-events.h
··· 33 33 34 34 #define EVENTS_HELP_MAX (128*1024) 35 35 36 + int parse_events_modifier(struct list_head *list __used, char *str __used); 37 + int parse_events_add_tracepoint(struct list_head *list, int *idx, 38 + char *sys, char *event); 39 + int parse_events_add_raw(struct perf_evlist *evlist, unsigned long config, 40 + unsigned long config1, unsigned long config2, 41 + char *mod); 42 + int parse_events_add_numeric(struct list_head *list, int *idx, 43 + unsigned long type, unsigned long config); 44 + int parse_events_add_cache(struct list_head *list, int *idx, 45 + char *type, char *op_result1, char *op_result2); 46 + int parse_events_add_breakpoint(struct list_head *list, int *idx, 47 + void *ptr, char *type); 48 + void parse_events_error(struct list_head *list, int *idx, 49 + char const *msg); 50 + 36 51 void print_events(const char *event_glob); 37 52 void print_events_type(u8 type); 38 53 void print_tracepoint_events(const char *subsys_glob, const char *event_glob);
+107
tools/perf/util/parse-events.l
··· 1 + 2 + %option prefix="parse_events_" 3 + 4 + %{ 5 + #include <errno.h> 6 + #include "../perf.h" 7 + #include "parse-events-bison.h" 8 + 9 + static int __value(char *str, int base, int token) 10 + { 11 + long num; 12 + 13 + errno = 0; 14 + num = strtoul(str, NULL, base); 15 + if (errno) 16 + return PE_ERROR; 17 + 18 + parse_events_lval.num = num; 19 + return token; 20 + } 21 + 22 + static int value(int base) 23 + { 24 + return __value(parse_events_text, base, PE_VALUE); 25 + } 26 + 27 + static int raw(void) 28 + { 29 + return __value(parse_events_text + 1, 16, PE_RAW); 30 + } 31 + 32 + static int str(int token) 33 + { 34 + parse_events_lval.str = strdup(parse_events_text); 35 + return token; 36 + } 37 + 38 + static int sym(int type, int config) 39 + { 40 + parse_events_lval.num = (type << 16) + config; 41 + return PE_VALUE_SYM; 42 + } 43 + 44 + %} 45 + 46 + num_dec [0-9]+ 47 + num_hex 0x[a-fA-F0-9]+ 48 + num_raw_hex [a-fA-F0-9]+ 49 + name [a-zA-Z_*?][a-zA-Z0-9_*?]* 50 + modifier_event [ukhp]{1,5} 51 + modifier_bp [rwx] 52 + 53 + %% 54 + cpu-cycles|cycles { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); } 55 + stalled-cycles-frontend|idle-cycles-frontend { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); } 56 + stalled-cycles-backend|idle-cycles-backend { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); } 57 + instructions { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); } 58 + cache-references { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES); } 59 + cache-misses { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); } 60 + branch-instructions|branches { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); } 61 + branch-misses { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); } 62 + bus-cycles { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); } 63 + cpu-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); } 64 + task-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); } 65 + page-faults|faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); } 66 + minor-faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN); } 67 + major-faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MAJ); } 68 + context-switches|cs { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CONTEXT_SWITCHES); } 69 + cpu-migrations|migrations { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS); } 70 + alignment-faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS); } 71 + emulation-faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); } 72 + 73 + L1-dcache|l1-d|l1d|L1-data | 74 + L1-icache|l1-i|l1i|L1-instruction | 75 + LLC|L2 | 76 + dTLB|d-tlb|Data-TLB | 77 + iTLB|i-tlb|Instruction-TLB | 78 + branch|branches|bpu|btb|bpc | 79 + node { return str(PE_NAME_CACHE_TYPE); } 80 + 81 + load|loads|read | 82 + store|stores|write | 83 + prefetch|prefetches | 84 + speculative-read|speculative-load | 85 + refs|Reference|ops|access | 86 + misses|miss { return str(PE_NAME_CACHE_OP_RESULT); } 87 + 88 + mem: { return PE_PREFIX_MEM; } 89 + r{num_raw_hex} { return raw(); } 90 + {num_dec} { return value(10); } 91 + {num_hex} { return value(16); } 92 + 93 + {modifier_event} { return str(PE_MODIFIER_EVENT); } 94 + {modifier_bp} { return str(PE_MODIFIER_BP); } 95 + {name} { return str(PE_NAME); } 96 + "/" { return '/'; } 97 + - { return '-'; } 98 + , { return ','; } 99 + : { return ':'; } 100 + = { return '='; } 101 + 102 + %% 103 + 104 + int parse_events_wrap(void) 105 + { 106 + return 1; 107 + }
+127
tools/perf/util/parse-events.y
··· 1 + 2 + %name-prefix "parse_events_" 3 + %parse-param {struct list_head *list} 4 + %parse-param {int *idx} 5 + 6 + %{ 7 + 8 + #define YYDEBUG 1 9 + 10 + #include <linux/compiler.h> 11 + #include <linux/list.h> 12 + #include "types.h" 13 + #include "util.h" 14 + #include "parse-events.h" 15 + 16 + extern int parse_events_lex (void); 17 + 18 + #define ABORT_ON(val) \ 19 + do { \ 20 + if (val) \ 21 + YYABORT; \ 22 + } while (0) 23 + 24 + %} 25 + 26 + %token PE_VALUE PE_VALUE_SYM PE_RAW 27 + %token PE_NAME 28 + %token PE_MODIFIER_EVENT PE_MODIFIER_BP 29 + %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT 30 + %token PE_PREFIX_MEM PE_PREFIX_RAW 31 + %token PE_ERROR 32 + %type <num> PE_VALUE 33 + %type <num> PE_VALUE_SYM 34 + %type <num> PE_RAW 35 + %type <str> PE_NAME 36 + %type <str> PE_NAME_CACHE_TYPE 37 + %type <str> PE_NAME_CACHE_OP_RESULT 38 + %type <str> PE_MODIFIER_EVENT 39 + %type <str> PE_MODIFIER_BP 40 + 41 + %union 42 + { 43 + char *str; 44 + unsigned long num; 45 + } 46 + %% 47 + 48 + events: 49 + events ',' event | event 50 + 51 + event: 52 + event_def PE_MODIFIER_EVENT 53 + { 54 + ABORT_ON(parse_events_modifier(list, $2)); 55 + } 56 + | 57 + event_def 58 + 59 + event_def: event_legacy_symbol sep_dc | 60 + event_legacy_cache sep_dc | 61 + event_legacy_mem | 62 + event_legacy_tracepoint sep_dc | 63 + event_legacy_numeric sep_dc | 64 + event_legacy_raw sep_dc 65 + 66 + event_legacy_symbol: 67 + PE_VALUE_SYM 68 + { 69 + int type = $1 >> 16; 70 + int config = $1 & 255; 71 + 72 + ABORT_ON(parse_events_add_numeric(list, idx, type, config)); 73 + } 74 + 75 + event_legacy_cache: 76 + PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT 77 + { 78 + ABORT_ON(parse_events_add_cache(list, idx, $1, $3, $5)); 79 + } 80 + | 81 + PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT 82 + { 83 + ABORT_ON(parse_events_add_cache(list, idx, $1, $3, NULL)); 84 + } 85 + | 86 + PE_NAME_CACHE_TYPE 87 + { 88 + ABORT_ON(parse_events_add_cache(list, idx, $1, NULL, NULL)); 89 + } 90 + 91 + event_legacy_mem: 92 + PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc 93 + { 94 + ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, $4)); 95 + } 96 + | 97 + PE_PREFIX_MEM PE_VALUE sep_dc 98 + { 99 + ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, NULL)); 100 + } 101 + 102 + event_legacy_tracepoint: 103 + PE_NAME ':' PE_NAME 104 + { 105 + ABORT_ON(parse_events_add_tracepoint(list, idx, $1, $3)); 106 + } 107 + 108 + event_legacy_numeric: 109 + PE_VALUE ':' PE_VALUE 110 + { 111 + ABORT_ON(parse_events_add_numeric(list, idx, $1, $3)); 112 + } 113 + 114 + event_legacy_raw: 115 + PE_RAW 116 + { 117 + ABORT_ON(parse_events_add_numeric(list, idx, PERF_TYPE_RAW, $1)); 118 + } 119 + 120 + sep_dc: ':' | 121 + 122 + %% 123 + 124 + void parse_events_error(struct list_head *list __used, int *idx __used, 125 + char const *msg __used) 126 + { 127 + }