1 2 # line 2 "../../../common/mdb/mdb_grammar.y" 3 /* 4 * CDDL HEADER START 5 * 6 * The contents of this file are subject to the terms of the 7 * Common Development and Distribution License (the "License"). 8 * You may not use this file except in compliance with the License. 9 * 10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11 * or http://www.opensolaris.org/os/licensing. 12 * See the License for the specific language governing permissions 13 * and limitations under the License. 14 * 15 * When distributing Covered Code, include this CDDL HEADER in each 16 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17 * If applicable, add the following below this CDDL HEADER, with the 18 * fields enclosed by brackets "[]" replaced with your own identifying 19 * information: Portions Copyright [yyyy] [name of copyright owner] 20 * 21 * CDDL HEADER END 22 * 23 */ 24 /* 25 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 26 * Use is subject to license terms. 27 */ 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #include <mdb/mdb_types.h> 32 #include <mdb/mdb_debug.h> 33 #include <mdb/mdb_shell.h> 34 #include <mdb/mdb_string.h> 35 #include <mdb/mdb_frame.h> 36 #include <mdb/mdb_lex.h> 37 #include <mdb/mdb_io.h> 38 #include <mdb/mdb_nv.h> 39 #include <mdb/mdb.h> 40 41 /* 42 * Utility routines to fetch values from the target's virtual address space 43 * and object file, respectively. These are called from the handlers for 44 * the * /.../ and % /.../ code below. 45 */ 46 47 static void 48 vfetch(void *buf, size_t nbytes, uintptr_t addr) 49 { 50 if (mdb_tgt_vread(mdb.m_target, buf, nbytes, addr) != nbytes) 51 yyperror("failed to read from address %p", addr); 52 } 53 54 static void 55 ffetch(void *buf, size_t nbytes, uintptr_t addr) 56 { 57 if (mdb_tgt_fread(mdb.m_target, buf, nbytes, addr) != nbytes) 58 yyperror("failed to read from address %p", addr); 59 } 60 61 /* 62 * Because we define YYMAXDEPTH as zero below, we have to provide a YYEXPAND() 63 * function to expand our yys and yyv variables. For simplicity, we currently 64 * define these structures statically; a more complex solution can be defined if 65 * it is ever needed. If we return 'val', yacc assumes resize has failed. 66 */ 67 static int 68 yyexpand(int val) 69 { 70 return (val ? val : YYMAXDEPTH); 71 } 72 #define YYEXPAND yyexpand 73 74 /* 75 * This will cause the rest of the yacc code to assume that yys and yyv are 76 * pointers, not static arrays. 77 */ 78 #undef YYMAXDEPTH 79 #define YYMAXDEPTH 0 80 81 # line 81 "../../../common/mdb/mdb_grammar.y" 82 typedef union 83 #ifdef __cplusplus 84 YYSTYPE 85 #endif 86 { 87 char *l_string; 88 char l_char; 89 uintmax_t l_immediate; 90 mdb_var_t *l_var; 91 mdb_idcmd_t *l_dcmd; 92 } YYSTYPE; 93 # define MDB_TOK_SYMBOL 257 94 # define MDB_TOK_STRING 258 95 # define MDB_TOK_CHAR 259 96 # define MDB_TOK_IMMEDIATE 260 97 # define MDB_TOK_DCMD 261 98 # define MDB_TOK_VAR_REF 262 99 # define MDB_TOK_LEXPR 263 100 # define MDB_TOK_REXPR 264 101 # define MDB_TOK_COR1_DEREF 265 102 # define MDB_TOK_COR2_DEREF 266 103 # define MDB_TOK_COR4_DEREF 267 104 # define MDB_TOK_COR8_DEREF 268 105 # define MDB_TOK_OBJ1_DEREF 269 106 # define MDB_TOK_OBJ2_DEREF 270 107 # define MDB_TOK_OBJ4_DEREF 271 108 # define MDB_TOK_OBJ8_DEREF 272 109 # define MDB_TOK_EQUAL 273 110 # define MDB_TOK_NOTEQUAL 274 111 # define MDB_TOK_LSHIFT 275 112 # define MDB_TOK_RSHIFT 276 113 # define MDB_COR_VALUE 277 114 # define MDB_OBJ_VALUE 278 115 # define MDB_INT_NEGATE 279 116 # define MDB_BIT_COMPLEMENT 280 117 # define MDB_LOG_NEGATE 281 118 # define MDB_VAR_REFERENCE 282 119 120 #include <inttypes.h> 121 122 #ifdef __STDC__ 123 #include <stdlib.h> 124 #include <string.h> 125 #define YYCONST const 126 #else 127 #include <malloc.h> 128 #include <memory.h> 129 #define YYCONST 130 #endif 131 132 #include <values.h> 133 134 #if defined(__cplusplus) || defined(__STDC__) 135 136 #if defined(__cplusplus) && defined(__EXTERN_C__) 137 extern "C" { 138 #endif 139 #ifndef yyerror 140 #if defined(__cplusplus) 141 void yyerror(YYCONST char *); 142 #endif 143 #endif 144 #ifndef yylex 145 int yylex(void); 146 #endif 147 int yyparse(void); 148 #if defined(__cplusplus) && defined(__EXTERN_C__) 149 } 150 #endif 151 152 #endif 153 154 #define yyclearin yychar = -1 155 #define yyerrok yyerrflag = 0 156 extern int yychar; 157 extern int yyerrflag; 158 YYSTYPE yylval; 159 YYSTYPE yyval; 160 typedef int yytabelem; 161 #ifndef YYMAXDEPTH 162 #define YYMAXDEPTH 150 163 #endif 164 #if YYMAXDEPTH > 0 165 int yy_yys[YYMAXDEPTH], *yys = yy_yys; 166 YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv; 167 #else /* user does initial allocation */ 168 int *yys; 169 YYSTYPE *yyv; 170 #endif 171 static int yymaxdepth = YYMAXDEPTH; 172 # define YYERRCODE 256 173 174 # line 432 "../../../common/mdb/mdb_grammar.y" 175 176 static YYCONST yytabelem yyexca[] ={ 177 -1, 1, 178 0, -1, 179 -2, 0, 180 }; 181 # define YYNPROD 65 182 # define YYLAST 495 183 static YYCONST yytabelem yyact[]={ 184 185 29, 21, 104, 14, 27, 80, 22, 103, 9, 25, 186 57, 19, 40, 29, 101, 102, 100, 8, 77, 99, 187 29, 2, 55, 6, 47, 21, 37, 14, 27, 46, 188 22, 1, 9, 25, 5, 19, 0, 32, 55, 37, 189 47, 48, 0, 0, 0, 46, 44, 42, 45, 30, 190 32, 35, 0, 31, 34, 0, 0, 79, 0, 0, 191 26, 0, 30, 0, 35, 0, 31, 34, 0, 30, 192 0, 40, 0, 55, 37, 47, 48, 0, 0, 0, 193 46, 44, 33, 45, 26, 32, 55, 0, 47, 48, 194 0, 0, 20, 46, 44, 33, 45, 50, 0, 35, 195 0, 31, 34, 39, 55, 0, 47, 48, 0, 38, 196 0, 46, 44, 0, 45, 55, 20, 47, 48, 3, 197 0, 98, 46, 44, 41, 45, 55, 49, 47, 48, 198 33, 0, 50, 46, 44, 0, 45, 0, 0, 55, 199 0, 47, 48, 37, 0, 50, 46, 44, 55, 45, 200 47, 81, 0, 0, 32, 46, 44, 55, 45, 47, 201 0, 72, 49, 50, 46, 44, 96, 45, 35, 0, 202 31, 34, 7, 0, 50, 49, 95, 43, 0, 55, 203 0, 47, 0, 0, 0, 50, 46, 44, 0, 45, 204 0, 0, 107, 49, 73, 74, 75, 76, 0, 33, 205 0, 0, 106, 0, 49, 108, 0, 0, 0, 0, 206 0, 78, 0, 0, 0, 0, 112, 0, 0, 0, 207 0, 0, 0, 24, 0, 0, 28, 0, 23, 0, 208 97, 10, 11, 12, 13, 15, 16, 17, 18, 0, 209 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 210 28, 36, 23, 0, 105, 10, 11, 12, 13, 15, 211 16, 17, 18, 0, 36, 0, 0, 0, 0, 109, 212 0, 0, 0, 0, 0, 0, 51, 52, 53, 54, 213 113, 114, 0, 0, 0, 117, 0, 0, 0, 0, 214 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 215 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 216 0, 51, 52, 53, 54, 116, 0, 0, 0, 0, 217 0, 0, 0, 0, 51, 52, 53, 54, 0, 0, 218 0, 0, 0, 115, 0, 0, 0, 0, 0, 0, 219 0, 0, 51, 52, 53, 54, 0, 0, 0, 0, 220 0, 0, 0, 51, 52, 53, 54, 0, 0, 0, 221 0, 0, 0, 0, 51, 52, 53, 54, 36, 0, 222 0, 0, 0, 0, 0, 0, 0, 51, 52, 53, 223 54, 0, 0, 0, 0, 0, 51, 52, 53, 54, 224 4, 0, 0, 0, 0, 0, 56, 53, 54, 0, 225 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 226 68, 69, 70, 71, 0, 0, 0, 0, 0, 0, 227 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 228 0, 0, 0, 82, 0, 83, 84, 85, 86, 87, 229 88, 89, 90, 91, 92, 93, 94, 0, 0, 0, 230 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 231 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 233 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 234 110, 0, 0, 0, 111 }; 235 static YYCONST yytabelem yypact[]={ 236 237 -10000000, -10,-10000000, -21, 3, -34, -248,-10000000,-10000000, -34, 238 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 239 -34, -34, -34,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, 240 -10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, 10, 107, 241 -253, -21, -34,-10000000, -34, -34, -34, -34, -34, -34, 242 -34, -34, -34, -34, -34, -34, 38, 10,-10000000,-10000000, 243 -10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, 244 -10000000, 80, -244, -244, -244, -244, -244, -256,-10000000,-10000000, 245 -10000000, 10, 38, -13, -13,-10000000,-10000000, 113, 91, 104, 246 122, 122, 144, 144,-10000000, -21, 10,-10000000,-10000000, -34, 247 -10000000,-10000000,-10000000, -34,-10000000,-10000000, -21, 10, 10,-10000000, 248 69, 51, 10,-10000000,-10000000,-10000000,-10000000,-10000000 }; 249 static YYCONST yytabelem yypgo[]={ 250 251 0, 390, 17, 31, 21, 172, 119, 109, 161, 18 }; 252 static YYCONST yytabelem yyr1[]={ 253 254 0, 3, 3, 5, 5, 4, 4, 4, 4, 4, 255 4, 4, 4, 4, 6, 6, 2, 2, 2, 2, 256 2, 2, 2, 7, 7, 8, 8, 8, 8, 8, 257 9, 9, 9, 1, 1, 1, 1, 1, 1, 1, 258 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 259 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 260 1, 1, 1, 1, 1 }; 261 static YYCONST yytabelem yyr2[]={ 262 263 0, 0, 5, 2, 2, 7, 9, 13, 11, 5, 264 11, 9, 7, 3, 7, 3, 5, 5, 5, 5, 265 5, 5, 3, 0, 5, 0, 9, 5, 5, 5, 266 0, 9, 5, 7, 7, 7, 7, 7, 7, 7, 267 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 268 5, 5, 5, 5, 5, 5, 5, 5, 7, 3, 269 3, 3, 3, 3, 2 }; 270 static YYCONST yytabelem yychk[]={ 271 272 -10000000, -3, -4, -6, -1, 44, 33, -5, -2, 42, 273 265, 266, 267, 268, 37, 269, 270, 271, 272, 45, 274 126, 35, 40, 262, 257, 43, 94, 38, 260, 10, 275 59, 63, 47, 92, 64, 61, 261, 36, -7, 124, 276 33, -6, 44, -5, 43, 45, 42, 37, 38, 124, 277 94, 273, 274, 275, 276, 35, -1, 258, -1, -1, 278 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 279 -1, -1, -8, -8, -8, -8, -8, -9, -5, -2, 280 258, -7, -1, -1, -1, -1, -1, -1, -1, -1, 281 -1, -1, -1, -1, -1, -6, -7, -5, 41, 263, 282 260, 258, 259, 263, 258, -5, -6, -7, -7, -5, 283 -1, -1, -7, -5, -5, 264, 264, -5 }; 284 static YYCONST yytabelem yydef[]={ 285 286 1, -2, 2, 23, 0, 0, 0, 13, 15, 0, 287 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 288 0, 0, 0, 59, 60, 61, 62, 63, 64, 3, 289 4, 25, 25, 25, 25, 25, 30, 22, 0, 0, 290 0, 23, 0, 9, 0, 0, 0, 0, 0, 0, 291 0, 0, 0, 0, 0, 0, 23, 0, 45, 46, 292 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 293 57, 0, 16, 17, 18, 19, 20, 21, 5, 14, 294 24, 0, 23, 33, 34, 35, 36, 37, 38, 39, 295 40, 41, 42, 43, 44, 23, 0, 12, 58, 0, 296 27, 28, 29, 0, 32, 6, 23, 0, 0, 11, 297 0, 0, 0, 10, 8, 26, 31, 7 }; 298 typedef struct 299 #ifdef __cplusplus 300 yytoktype 301 #endif 302 { 303 #ifdef __cplusplus 304 const 305 #endif 306 char *t_name; int t_val; } yytoktype; 307 #ifndef YYDEBUG 308 # define YYDEBUG 0 /* don't allow debugging */ 309 #endif 310 311 #if YYDEBUG 312 313 yytoktype yytoks[] = 314 { 315 "MDB_TOK_SYMBOL", 257, 316 "MDB_TOK_STRING", 258, 317 "MDB_TOK_CHAR", 259, 318 "MDB_TOK_IMMEDIATE", 260, 319 "MDB_TOK_DCMD", 261, 320 "MDB_TOK_VAR_REF", 262, 321 "MDB_TOK_LEXPR", 263, 322 "MDB_TOK_REXPR", 264, 323 "MDB_TOK_COR1_DEREF", 265, 324 "MDB_TOK_COR2_DEREF", 266, 325 "MDB_TOK_COR4_DEREF", 267, 326 "MDB_TOK_COR8_DEREF", 268, 327 "MDB_TOK_OBJ1_DEREF", 269, 328 "MDB_TOK_OBJ2_DEREF", 270, 329 "MDB_TOK_OBJ4_DEREF", 271, 330 "MDB_TOK_OBJ8_DEREF", 272, 331 "|", 124, 332 "^", 94, 333 "&", 38, 334 "MDB_TOK_EQUAL", 273, 335 "MDB_TOK_NOTEQUAL", 274, 336 "MDB_TOK_LSHIFT", 275, 337 "MDB_TOK_RSHIFT", 276, 338 "-", 45, 339 "+", 43, 340 "*", 42, 341 "%", 37, 342 "#", 35, 343 "MDB_COR_VALUE", 277, 344 "MDB_OBJ_VALUE", 278, 345 "MDB_INT_NEGATE", 279, 346 "MDB_BIT_COMPLEMENT", 280, 347 "MDB_LOG_NEGATE", 281, 348 "MDB_VAR_REFERENCE", 282, 349 "-unknown-", -1 /* ends search */ 350 }; 351 352 #ifdef __cplusplus 353 const 354 #endif 355 char * yyreds[] = 356 { 357 "-no such reduction-", 358 "statement_list : /* empty */", 359 "statement_list : statement_list statement", 360 "terminator : '\n'", 361 "terminator : ';'", 362 "statement : pipeline shell_pipe terminator", 363 "statement : expression pipeline shell_pipe terminator", 364 "statement : expression ',' expression pipeline shell_pipe terminator", 365 "statement : ',' expression pipeline shell_pipe terminator", 366 "statement : expression terminator", 367 "statement : expression ',' expression shell_pipe terminator", 368 "statement : ',' expression shell_pipe terminator", 369 "statement : '!' MDB_TOK_STRING terminator", 370 "statement : terminator", 371 "pipeline : pipeline '|' command", 372 "pipeline : command", 373 "command : '?' format_list", 374 "command : '/' format_list", 375 "command : '\\' format_list", 376 "command : '@' format_list", 377 "command : '=' format_list", 378 "command : MDB_TOK_DCMD argument_list", 379 "command : '$'", 380 "shell_pipe : /* empty */", 381 "shell_pipe : '!' MDB_TOK_STRING", 382 "format_list : /* empty */", 383 "format_list : format_list MDB_TOK_LEXPR expression MDB_TOK_REXPR", 384 "format_list : format_list MDB_TOK_IMMEDIATE", 385 "format_list : format_list MDB_TOK_STRING", 386 "format_list : format_list MDB_TOK_CHAR", 387 "argument_list : /* empty */", 388 "argument_list : argument_list MDB_TOK_LEXPR expression MDB_TOK_REXPR", 389 "argument_list : argument_list MDB_TOK_STRING", 390 "expression : expression '+' expression", 391 "expression : expression '-' expression", 392 "expression : expression '*' expression", 393 "expression : expression '%' expression", 394 "expression : expression '&' expression", 395 "expression : expression '|' expression", 396 "expression : expression '^' expression", 397 "expression : expression MDB_TOK_EQUAL expression", 398 "expression : expression MDB_TOK_NOTEQUAL expression", 399 "expression : expression MDB_TOK_LSHIFT expression", 400 "expression : expression MDB_TOK_RSHIFT expression", 401 "expression : expression '#' expression", 402 "expression : '*' expression", 403 "expression : MDB_TOK_COR1_DEREF expression", 404 "expression : MDB_TOK_COR2_DEREF expression", 405 "expression : MDB_TOK_COR4_DEREF expression", 406 "expression : MDB_TOK_COR8_DEREF expression", 407 "expression : '%' expression", 408 "expression : MDB_TOK_OBJ1_DEREF expression", 409 "expression : MDB_TOK_OBJ2_DEREF expression", 410 "expression : MDB_TOK_OBJ4_DEREF expression", 411 "expression : MDB_TOK_OBJ8_DEREF expression", 412 "expression : '-' expression", 413 "expression : '~' expression", 414 "expression : '#' expression", 415 "expression : '(' expression ')'", 416 "expression : MDB_TOK_VAR_REF", 417 "expression : MDB_TOK_SYMBOL", 418 "expression : '+'", 419 "expression : '^'", 420 "expression : '&'", 421 "expression : MDB_TOK_IMMEDIATE", 422 }; 423 #endif /* YYDEBUG */ 424 # line 1 "/usr/share/lib/ccs/yaccpar" 425 /* 426 * CDDL HEADER START 427 * 428 * The contents of this file are subject to the terms of the 429 * Common Development and Distribution License, Version 1.0 only 430 * (the "License"). You may not use this file except in compliance 431 * with the License. 432 * 433 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 434 * or http://www.opensolaris.org/os/licensing. 435 * See the License for the specific language governing permissions 436 * and limitations under the License. 437 * 438 * When distributing Covered Code, include this CDDL HEADER in each 439 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 440 * If applicable, add the following below this CDDL HEADER, with the 441 * fields enclosed by brackets "[]" replaced with your own identifying 442 * information: Portions Copyright [yyyy] [name of copyright owner] 443 * 444 * CDDL HEADER END 445 */ 446 /* 447 * Copyright 1993 Sun Microsystems, Inc. All rights reserved. 448 * Use is subject to license terms. 449 */ 450 451 /* Copyright (c) 1988 AT&T */ 452 /* All Rights Reserved */ 453 454 #pragma ident "%Z%%M% %I% %E% SMI" 455 456 /* 457 ** Skeleton parser driver for yacc output 458 */ 459 460 /* 461 ** yacc user known macros and defines 462 */ 463 #define YYERROR goto yyerrlab 464 #define YYACCEPT return(0) 465 #define YYABORT return(1) 466 #define YYBACKUP( newtoken, newvalue )\ 467 {\ 468 if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ 469 {\ 470 yyerror( "syntax error - cannot backup" );\ 471 goto yyerrlab;\ 472 }\ 473 yychar = newtoken;\ 474 yystate = *yyps;\ 475 yylval = newvalue;\ 476 goto yynewstate;\ 477 } 478 #define YYRECOVERING() (!!yyerrflag) 479 #define YYNEW(type) malloc(sizeof(type) * yynewmax) 480 #define YYCOPY(to, from, type) \ 481 (type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type)) 482 #define YYENLARGE( from, type) \ 483 (type *) realloc((char *) from, yynewmax * sizeof(type)) 484 #ifndef YYDEBUG 485 # define YYDEBUG 1 /* make debugging available */ 486 #endif 487 488 /* 489 ** user known globals 490 */ 491 int yydebug; /* set to 1 to get debugging */ 492 493 /* 494 ** driver internal defines 495 */ 496 #define YYFLAG (-10000000) 497 498 /* 499 ** global variables used by the parser 500 */ 501 YYSTYPE *yypv; /* top of value stack */ 502 int *yyps; /* top of state stack */ 503 504 int yystate; /* current state */ 505 int yytmp; /* extra var (lasts between blocks) */ 506 507 int yynerrs; /* number of errors */ 508 int yyerrflag; /* error recovery flag */ 509 int yychar; /* current input token number */ 510 511 512 513 #ifdef YYNMBCHARS 514 #define YYLEX() yycvtok(yylex()) 515 /* 516 ** yycvtok - return a token if i is a wchar_t value that exceeds 255. 517 ** If i<255, i itself is the token. If i>255 but the neither 518 ** of the 30th or 31st bit is on, i is already a token. 519 */ 520 #if defined(__STDC__) || defined(__cplusplus) 521 int yycvtok(int i) 522 #else 523 int yycvtok(i) int i; 524 #endif 525 { 526 int first = 0; 527 int last = YYNMBCHARS - 1; 528 int mid; 529 wchar_t j; 530 531 if(i&0x60000000){/*Must convert to a token. */ 532 if( yymbchars[last].character < i ){ 533 return i;/*Giving up*/ 534 } 535 while ((last>=first)&&(first>=0)) {/*Binary search loop*/ 536 mid = (first+last)/2; 537 j = yymbchars[mid].character; 538 if( j==i ){/*Found*/ 539 return yymbchars[mid].tvalue; 540 }else if( j<i ){ 541 first = mid + 1; 542 }else{ 543 last = mid -1; 544 } 545 } 546 /*No entry in the table.*/ 547 return i;/* Giving up.*/ 548 }else{/* i is already a token. */ 549 return i; 550 } 551 } 552 #else/*!YYNMBCHARS*/ 553 #define YYLEX() yylex() 554 #endif/*!YYNMBCHARS*/ 555 556 /* 557 ** yyparse - return 0 if worked, 1 if syntax error not recovered from 558 */ 559 #if defined(__STDC__) || defined(__cplusplus) 560 int yyparse(void) 561 #else 562 int yyparse() 563 #endif 564 { 565 register YYSTYPE *yypvt = 0; /* top of value stack for $vars */ 566 567 #if defined(__cplusplus) || defined(lint) 568 /* 569 hacks to please C++ and lint - goto's inside 570 switch should never be executed 571 */ 572 static int __yaccpar_lint_hack__ = 0; 573 switch (__yaccpar_lint_hack__) 574 { 575 case 1: goto yyerrlab; 576 case 2: goto yynewstate; 577 } 578 #endif 579 580 /* 581 ** Initialize externals - yyparse may be called more than once 582 */ 583 yypv = &yyv[-1]; 584 yyps = &yys[-1]; 585 yystate = 0; 586 yytmp = 0; 587 yynerrs = 0; 588 yyerrflag = 0; 589 yychar = -1; 590 591 #if YYMAXDEPTH <= 0 592 if (yymaxdepth <= 0) 593 { 594 if ((yymaxdepth = YYEXPAND(0)) <= 0) 595 { 596 yyerror("yacc initialization error"); 597 YYABORT; 598 } 599 } 600 #endif 601 602 { 603 register YYSTYPE *yy_pv; /* top of value stack */ 604 register int *yy_ps; /* top of state stack */ 605 register int yy_state; /* current state */ 606 register int yy_n; /* internal state number info */ 607 goto yystack; /* moved from 6 lines above to here to please C++ */ 608 609 /* 610 ** get globals into registers. 611 ** branch to here only if YYBACKUP was called. 612 */ 613 yynewstate: 614 yy_pv = yypv; 615 yy_ps = yyps; 616 yy_state = yystate; 617 goto yy_newstate; 618 619 /* 620 ** get globals into registers. 621 ** either we just started, or we just finished a reduction 622 */ 623 yystack: 624 yy_pv = yypv; 625 yy_ps = yyps; 626 yy_state = yystate; 627 628 /* 629 ** top of for (;;) loop while no reductions done 630 */ 631 yy_stack: 632 /* 633 ** put a state and value onto the stacks 634 */ 635 #if YYDEBUG 636 /* 637 ** if debugging, look up token value in list of value vs. 638 ** name pairs. 0 and negative (-1) are special values. 639 ** Note: linear search is used since time is not a real 640 ** consideration while debugging. 641 */ 642 if ( yydebug ) 643 { 644 register int yy_i; 645 646 printf( "State %d, token ", yy_state ); 647 if ( yychar == 0 ) 648 printf( "end-of-file\n" ); 649 else if ( yychar < 0 ) 650 printf( "-none-\n" ); 651 else 652 { 653 for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 654 yy_i++ ) 655 { 656 if ( yytoks[yy_i].t_val == yychar ) 657 break; 658 } 659 printf( "%s\n", yytoks[yy_i].t_name ); 660 } 661 } 662 #endif /* YYDEBUG */ 663 if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ 664 { 665 /* 666 ** reallocate and recover. Note that pointers 667 ** have to be reset, or bad things will happen 668 */ 669 long yyps_index = (yy_ps - yys); 670 long yypv_index = (yy_pv - yyv); 671 long yypvt_index = (yypvt - yyv); 672 int yynewmax; 673 #ifdef YYEXPAND 674 yynewmax = YYEXPAND(yymaxdepth); 675 #else 676 yynewmax = 2 * yymaxdepth; /* double table size */ 677 if (yymaxdepth == YYMAXDEPTH) /* first time growth */ 678 { 679 char *newyys = (char *)YYNEW(int); 680 char *newyyv = (char *)YYNEW(YYSTYPE); 681 if (newyys != 0 && newyyv != 0) 682 { 683 yys = YYCOPY(newyys, yys, int); 684 yyv = YYCOPY(newyyv, yyv, YYSTYPE); 685 } 686 else 687 yynewmax = 0; /* failed */ 688 } 689 else /* not first time */ 690 { 691 yys = YYENLARGE(yys, int); 692 yyv = YYENLARGE(yyv, YYSTYPE); 693 if (yys == 0 || yyv == 0) 694 yynewmax = 0; /* failed */ 695 } 696 #endif 697 if (yynewmax <= yymaxdepth) /* tables not expanded */ 698 { 699 yyerror( "yacc stack overflow" ); 700 YYABORT; 701 } 702 yymaxdepth = yynewmax; 703 704 yy_ps = yys + yyps_index; 705 yy_pv = yyv + yypv_index; 706 yypvt = yyv + yypvt_index; 707 } 708 *yy_ps = yy_state; 709 *++yy_pv = yyval; 710 711 /* 712 ** we have a new state - find out what to do 713 */ 714 yy_newstate: 715 if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) 716 goto yydefault; /* simple state */ 717 #if YYDEBUG 718 /* 719 ** if debugging, need to mark whether new token grabbed 720 */ 721 yytmp = yychar < 0; 722 #endif 723 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 724 yychar = 0; /* reached EOF */ 725 #if YYDEBUG 726 if ( yydebug && yytmp ) 727 { 728 register int yy_i; 729 730 printf( "Received token " ); 731 if ( yychar == 0 ) 732 printf( "end-of-file\n" ); 733 else if ( yychar < 0 ) 734 printf( "-none-\n" ); 735 else 736 { 737 for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 738 yy_i++ ) 739 { 740 if ( yytoks[yy_i].t_val == yychar ) 741 break; 742 } 743 printf( "%s\n", yytoks[yy_i].t_name ); 744 } 745 } 746 #endif /* YYDEBUG */ 747 if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) 748 goto yydefault; 749 if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ 750 { 751 yychar = -1; 752 yyval = yylval; 753 yy_state = yy_n; 754 if ( yyerrflag > 0 ) 755 yyerrflag--; 756 goto yy_stack; 757 } 758 759 yydefault: 760 if ( ( yy_n = yydef[ yy_state ] ) == -2 ) 761 { 762 #if YYDEBUG 763 yytmp = yychar < 0; 764 #endif 765 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 766 yychar = 0; /* reached EOF */ 767 #if YYDEBUG 768 if ( yydebug && yytmp ) 769 { 770 register int yy_i; 771 772 printf( "Received token " ); 773 if ( yychar == 0 ) 774 printf( "end-of-file\n" ); 775 else if ( yychar < 0 ) 776 printf( "-none-\n" ); 777 else 778 { 779 for ( yy_i = 0; 780 yytoks[yy_i].t_val >= 0; 781 yy_i++ ) 782 { 783 if ( yytoks[yy_i].t_val 784 == yychar ) 785 { 786 break; 787 } 788 } 789 printf( "%s\n", yytoks[yy_i].t_name ); 790 } 791 } 792 #endif /* YYDEBUG */ 793 /* 794 ** look through exception table 795 */ 796 { 797 register YYCONST int *yyxi = yyexca; 798 799 while ( ( *yyxi != -1 ) || 800 ( yyxi[1] != yy_state ) ) 801 { 802 yyxi += 2; 803 } 804 while ( ( *(yyxi += 2) >= 0 ) && 805 ( *yyxi != yychar ) ) 806 ; 807 if ( ( yy_n = yyxi[1] ) < 0 ) 808 YYACCEPT; 809 } 810 } 811 812 /* 813 ** check for syntax error 814 */ 815 if ( yy_n == 0 ) /* have an error */ 816 { 817 /* no worry about speed here! */ 818 switch ( yyerrflag ) 819 { 820 case 0: /* new error */ 821 yyerror( "syntax error" ); 822 goto skip_init; 823 yyerrlab: 824 /* 825 ** get globals into registers. 826 ** we have a user generated syntax type error 827 */ 828 yy_pv = yypv; 829 yy_ps = yyps; 830 yy_state = yystate; 831 skip_init: 832 yynerrs++; 833 /* FALLTHRU */ 834 case 1: 835 case 2: /* incompletely recovered error */ 836 /* try again... */ 837 yyerrflag = 3; 838 /* 839 ** find state where "error" is a legal 840 ** shift action 841 */ 842 while ( yy_ps >= yys ) 843 { 844 yy_n = yypact[ *yy_ps ] + YYERRCODE; 845 if ( yy_n >= 0 && yy_n < YYLAST && 846 yychk[yyact[yy_n]] == YYERRCODE) { 847 /* 848 ** simulate shift of "error" 849 */ 850 yy_state = yyact[ yy_n ]; 851 goto yy_stack; 852 } 853 /* 854 ** current state has no shift on 855 ** "error", pop stack 856 */ 857 #if YYDEBUG 858 # define _POP_ "Error recovery pops state %d, uncovers state %d\n" 859 if ( yydebug ) 860 printf( _POP_, *yy_ps, 861 yy_ps[-1] ); 862 # undef _POP_ 863 #endif 864 yy_ps--; 865 yy_pv--; 866 } 867 /* 868 ** there is no state on stack with "error" as 869 ** a valid shift. give up. 870 */ 871 YYABORT; 872 case 3: /* no shift yet; eat a token */ 873 #if YYDEBUG 874 /* 875 ** if debugging, look up token in list of 876 ** pairs. 0 and negative shouldn't occur, 877 ** but since timing doesn't matter when 878 ** debugging, it doesn't hurt to leave the 879 ** tests here. 880 */ 881 if ( yydebug ) 882 { 883 register int yy_i; 884 885 printf( "Error recovery discards " ); 886 if ( yychar == 0 ) 887 printf( "token end-of-file\n" ); 888 else if ( yychar < 0 ) 889 printf( "token -none-\n" ); 890 else 891 { 892 for ( yy_i = 0; 893 yytoks[yy_i].t_val >= 0; 894 yy_i++ ) 895 { 896 if ( yytoks[yy_i].t_val 897 == yychar ) 898 { 899 break; 900 } 901 } 902 printf( "token %s\n", 903 yytoks[yy_i].t_name ); 904 } 905 } 906 #endif /* YYDEBUG */ 907 if ( yychar == 0 ) /* reached EOF. quit */ 908 YYABORT; 909 yychar = -1; 910 goto yy_newstate; 911 } 912 }/* end if ( yy_n == 0 ) */ 913 /* 914 ** reduction by production yy_n 915 ** put stack tops, etc. so things right after switch 916 */ 917 #if YYDEBUG 918 /* 919 ** if debugging, print the string that is the user's 920 ** specification of the reduction which is just about 921 ** to be done. 922 */ 923 if ( yydebug ) 924 printf( "Reduce by (%d) \"%s\"\n", 925 yy_n, yyreds[ yy_n ] ); 926 #endif 927 yytmp = yy_n; /* value to switch over */ 928 yypvt = yy_pv; /* $vars top of value stack */ 929 /* 930 ** Look in goto table for next state 931 ** Sorry about using yy_state here as temporary 932 ** register variable, but why not, if it works... 933 ** If yyr2[ yy_n ] doesn't have the low order bit 934 ** set, then there is no action to be done for 935 ** this reduction. So, no saving & unsaving of 936 ** registers done. The only difference between the 937 ** code just after the if and the body of the if is 938 ** the goto yy_stack in the body. This way the test 939 ** can be made before the choice of what to do is needed. 940 */ 941 { 942 /* length of production doubled with extra bit */ 943 register int yy_len = yyr2[ yy_n ]; 944 945 if ( !( yy_len & 01 ) ) 946 { 947 yy_len >>= 1; 948 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 949 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 950 *( yy_ps -= yy_len ) + 1; 951 if ( yy_state >= YYLAST || 952 yychk[ yy_state = 953 yyact[ yy_state ] ] != -yy_n ) 954 { 955 yy_state = yyact[ yypgo[ yy_n ] ]; 956 } 957 goto yy_stack; 958 } 959 yy_len >>= 1; 960 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 961 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 962 *( yy_ps -= yy_len ) + 1; 963 if ( yy_state >= YYLAST || 964 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) 965 { 966 yy_state = yyact[ yypgo[ yy_n ] ]; 967 } 968 } 969 /* save until reenter driver code */ 970 yystate = yy_state; 971 yyps = yy_ps; 972 yypv = yy_pv; 973 } 974 /* 975 ** code supplied by user is placed in this switch 976 */ 977 switch( yytmp ) 978 { 979 980 case 2: 981 # line 126 "../../../common/mdb/mdb_grammar.y" 982 { return (0); } break; 983 case 5: 984 # line 132 "../../../common/mdb/mdb_grammar.y" 985 { 986 if (!mdb_call(mdb_nv_get_value(mdb.m_dot), 1, 0)) 987 return (0); 988 } break; 989 case 6: 990 # line 137 "../../../common/mdb/mdb_grammar.y" 991 { 992 if (!mdb_call(yypvt[-3].l_immediate, 1, DCMD_ADDRSPEC)) 993 return (0); 994 } break; 995 case 7: 996 # line 142 "../../../common/mdb/mdb_grammar.y" 997 { 998 if (!mdb_call(yypvt[-5].l_immediate, yypvt[-3].l_immediate, DCMD_ADDRSPEC | DCMD_LOOP)) 999 return (0); 1000 } break; 1001 case 8: 1002 # line 147 "../../../common/mdb/mdb_grammar.y" 1003 { 1004 if (!mdb_call(mdb_nv_get_value(mdb.m_dot), yypvt[-3].l_immediate, 1005 DCMD_LOOP)) 1006 return (0); 1007 } break; 1008 case 9: 1009 # line 153 "../../../common/mdb/mdb_grammar.y" 1010 { 1011 mdb_frame_t *pfp = mdb_frame_pipe(); 1012 /* 1013 * The handling of naked expressions is slightly tricky: 1014 * in a string context, we want to just set dot to the 1015 * expression value. In a pipe context, we also set 1016 * dot but need to record the address in the right- 1017 * hand command's addrv and update any vcbs that are 1018 * active. Otherwise, on the command-line, we have to 1019 * support this as an alias for executing the previous 1020 * command with the new value of dot. Sigh. 1021 */ 1022 if (mdb_iob_isastr(mdb.m_in)) { 1023 mdb_nv_set_value(mdb.m_dot, yypvt[-1].l_immediate); 1024 mdb.m_incr = 0; 1025 } else if (pfp != NULL && pfp->f_pcmd != NULL) { 1026 mdb_addrvec_unshift(&pfp->f_pcmd->c_addrv, 1027 (uintptr_t)yypvt[-1].l_immediate); 1028 mdb_vcb_update(pfp, (uintptr_t)yypvt[-1].l_immediate); 1029 mdb_nv_set_value(mdb.m_dot, yypvt[-1].l_immediate); 1030 } else { 1031 mdb_list_move(&mdb.m_lastc, 1032 &mdb.m_frame->f_cmds); 1033 if (!mdb_call(yypvt[-1].l_immediate, 1, DCMD_ADDRSPEC)) 1034 return (0); 1035 } 1036 } break; 1037 case 10: 1038 # line 181 "../../../common/mdb/mdb_grammar.y" 1039 { 1040 mdb_list_move(&mdb.m_lastc, &mdb.m_frame->f_cmds); 1041 if (!mdb_call(yypvt[-4].l_immediate, yypvt[-2].l_immediate, DCMD_ADDRSPEC | DCMD_LOOP)) 1042 return (0); 1043 } break; 1044 case 11: 1045 # line 187 "../../../common/mdb/mdb_grammar.y" 1046 { 1047 uintmax_t dot = mdb_dot_incr(","); 1048 mdb_list_move(&mdb.m_lastc, &mdb.m_frame->f_cmds); 1049 if (!mdb_call(dot, yypvt[-2].l_immediate, DCMD_LOOP)) 1050 return (0); 1051 } break; 1052 case 12: 1053 # line 194 "../../../common/mdb/mdb_grammar.y" 1054 { 1055 if (mdb_iob_isapipe(mdb.m_in)) 1056 yyerror("syntax error"); 1057 mdb_shell_exec(yypvt[-1].l_string); 1058 } break; 1059 case 13: 1060 # line 200 "../../../common/mdb/mdb_grammar.y" 1061 { 1062 if ((mdb.m_flags & MDB_FL_REPLAST) && 1063 !mdb_iob_isastr(mdb.m_in)) { 1064 uintmax_t dot = mdb_dot_incr("\\n"); 1065 /* 1066 * If a bare terminator is encountered, execute 1067 * the previous command if -o repeatlast is set 1068 * and stdin is not an mdb_eval() string. 1069 */ 1070 mdb_list_move(&mdb.m_lastc, 1071 &mdb.m_frame->f_cmds); 1072 if (!mdb_call(dot, 1, 0)) 1073 return (0); 1074 } 1075 } break; 1076 case 14: 1077 # line 217 "../../../common/mdb/mdb_grammar.y" 1078 { mdb_cmd_create(yypvt[-0].l_dcmd, &mdb.m_frame->f_argvec); } break; 1079 case 15: 1080 # line 218 "../../../common/mdb/mdb_grammar.y" 1081 { mdb_cmd_create(yypvt[-0].l_dcmd, &mdb.m_frame->f_argvec); } break; 1082 case 16: 1083 # line 221 "../../../common/mdb/mdb_grammar.y" 1084 { yyval.l_dcmd = mdb_dcmd_lookup("?"); } break; 1085 case 17: 1086 # line 222 "../../../common/mdb/mdb_grammar.y" 1087 { yyval.l_dcmd = mdb_dcmd_lookup("/"); } break; 1088 case 18: 1089 # line 223 "../../../common/mdb/mdb_grammar.y" 1090 { yyval.l_dcmd = mdb_dcmd_lookup("\\"); } break; 1091 case 19: 1092 # line 224 "../../../common/mdb/mdb_grammar.y" 1093 { yyval.l_dcmd = mdb_dcmd_lookup("@"); } break; 1094 case 20: 1095 # line 225 "../../../common/mdb/mdb_grammar.y" 1096 { yyval.l_dcmd = mdb_dcmd_lookup("="); } break; 1097 case 21: 1098 # line 226 "../../../common/mdb/mdb_grammar.y" 1099 { yyval.l_dcmd = yypvt[-1].l_dcmd; } break; 1100 case 22: 1101 # line 227 "../../../common/mdb/mdb_grammar.y" 1102 { yyval.l_dcmd = mdb_dcmd_lookup("$?"); } break; 1103 case 24: 1104 # line 231 "../../../common/mdb/mdb_grammar.y" 1105 { mdb_shell_pipe(yypvt[-0].l_string); } break; 1106 case 26: 1107 # line 235 "../../../common/mdb/mdb_grammar.y" 1108 { 1109 mdb_arg_t arg; 1110 1111 arg.a_type = MDB_TYPE_IMMEDIATE; 1112 arg.a_un.a_val = yypvt[-1].l_immediate; 1113 1114 mdb_argvec_append(&mdb.m_frame->f_argvec, &arg); 1115 } break; 1116 case 27: 1117 # line 244 "../../../common/mdb/mdb_grammar.y" 1118 { 1119 mdb_arg_t arg; 1120 1121 arg.a_type = MDB_TYPE_IMMEDIATE; 1122 arg.a_un.a_val = yypvt[-0].l_immediate; 1123 1124 mdb_argvec_append(&mdb.m_frame->f_argvec, &arg); 1125 } break; 1126 case 28: 1127 # line 253 "../../../common/mdb/mdb_grammar.y" 1128 { 1129 mdb_arg_t arg; 1130 1131 arg.a_type = MDB_TYPE_STRING; 1132 arg.a_un.a_str = yypvt[-0].l_string; 1133 1134 mdb_argvec_append(&mdb.m_frame->f_argvec, &arg); 1135 } break; 1136 case 29: 1137 # line 262 "../../../common/mdb/mdb_grammar.y" 1138 { 1139 mdb_arg_t arg; 1140 1141 arg.a_type = MDB_TYPE_CHAR; 1142 arg.a_un.a_char = yypvt[-0].l_char; 1143 1144 mdb_argvec_append(&mdb.m_frame->f_argvec, &arg); 1145 } break; 1146 case 31: 1147 # line 273 "../../../common/mdb/mdb_grammar.y" 1148 { 1149 mdb_arg_t arg; 1150 1151 arg.a_type = MDB_TYPE_IMMEDIATE; 1152 arg.a_un.a_val = yypvt[-1].l_immediate; 1153 1154 mdb_argvec_append(&mdb.m_frame->f_argvec, &arg); 1155 } break; 1156 case 32: 1157 # line 282 "../../../common/mdb/mdb_grammar.y" 1158 { 1159 mdb_arg_t arg; 1160 1161 arg.a_type = MDB_TYPE_STRING; 1162 arg.a_un.a_str = yypvt[-0].l_string; 1163 1164 mdb_argvec_append(&mdb.m_frame->f_argvec, &arg); 1165 } break; 1166 case 33: 1167 # line 292 "../../../common/mdb/mdb_grammar.y" 1168 { yyval.l_immediate = yypvt[-2].l_immediate + yypvt[-0].l_immediate; } break; 1169 case 34: 1170 # line 293 "../../../common/mdb/mdb_grammar.y" 1171 { yyval.l_immediate = yypvt[-2].l_immediate - yypvt[-0].l_immediate; } break; 1172 case 35: 1173 # line 294 "../../../common/mdb/mdb_grammar.y" 1174 { yyval.l_immediate = yypvt[-2].l_immediate * yypvt[-0].l_immediate; } break; 1175 case 36: 1176 # line 296 "../../../common/mdb/mdb_grammar.y" 1177 { 1178 if (yypvt[-0].l_immediate == 0UL) 1179 yyerror("attempted to divide by zero"); 1180 1181 yyval.l_immediate = (intmax_t)yypvt[-2].l_immediate / (intmax_t)yypvt[-0].l_immediate; 1182 } break; 1183 case 37: 1184 # line 303 "../../../common/mdb/mdb_grammar.y" 1185 { yyval.l_immediate = yypvt[-2].l_immediate & yypvt[-0].l_immediate; } break; 1186 case 38: 1187 # line 304 "../../../common/mdb/mdb_grammar.y" 1188 { yyval.l_immediate = yypvt[-2].l_immediate | yypvt[-0].l_immediate; } break; 1189 case 39: 1190 # line 305 "../../../common/mdb/mdb_grammar.y" 1191 { yyval.l_immediate = yypvt[-2].l_immediate ^ yypvt[-0].l_immediate; } break; 1192 case 40: 1193 # line 307 "../../../common/mdb/mdb_grammar.y" 1194 { yyval.l_immediate = (yypvt[-2].l_immediate == yypvt[-0].l_immediate); } break; 1195 case 41: 1196 # line 308 "../../../common/mdb/mdb_grammar.y" 1197 { yyval.l_immediate = (yypvt[-2].l_immediate != yypvt[-0].l_immediate); } break; 1198 case 42: 1199 # line 310 "../../../common/mdb/mdb_grammar.y" 1200 { yyval.l_immediate = yypvt[-2].l_immediate << yypvt[-0].l_immediate; } break; 1201 case 43: 1202 # line 311 "../../../common/mdb/mdb_grammar.y" 1203 { yyval.l_immediate = yypvt[-2].l_immediate >> yypvt[-0].l_immediate; } break; 1204 case 44: 1205 # line 313 "../../../common/mdb/mdb_grammar.y" 1206 { 1207 if (yypvt[-0].l_immediate == 0UL) 1208 yyerror("attempted to divide by zero"); 1209 1210 yyval.l_immediate = ((intptr_t)(yypvt[-2].l_immediate + (yypvt[-0].l_immediate - 1)) / (intptr_t)yypvt[-0].l_immediate) * yypvt[-0].l_immediate; 1211 } break; 1212 case 45: 1213 # line 320 "../../../common/mdb/mdb_grammar.y" 1214 { 1215 uintptr_t value; 1216 1217 vfetch(&value, sizeof (value), yypvt[-0].l_immediate); 1218 yyval.l_immediate = value; 1219 } break; 1220 case 46: 1221 # line 327 "../../../common/mdb/mdb_grammar.y" 1222 { 1223 uint8_t value; 1224 1225 vfetch(&value, sizeof (value), yypvt[-0].l_immediate); 1226 yyval.l_immediate = value; 1227 } break; 1228 case 47: 1229 # line 334 "../../../common/mdb/mdb_grammar.y" 1230 { 1231 uint16_t value; 1232 1233 vfetch(&value, sizeof (value), yypvt[-0].l_immediate); 1234 yyval.l_immediate = value; 1235 } break; 1236 case 48: 1237 # line 341 "../../../common/mdb/mdb_grammar.y" 1238 { 1239 uint32_t value; 1240 1241 vfetch(&value, sizeof (value), yypvt[-0].l_immediate); 1242 yyval.l_immediate = value; 1243 } break; 1244 case 49: 1245 # line 348 "../../../common/mdb/mdb_grammar.y" 1246 { 1247 uint64_t value; 1248 1249 vfetch(&value, sizeof (value), yypvt[-0].l_immediate); 1250 yyval.l_immediate = value; 1251 } break; 1252 case 50: 1253 # line 355 "../../../common/mdb/mdb_grammar.y" 1254 { 1255 uintptr_t value; 1256 1257 ffetch(&value, sizeof (value), yypvt[-0].l_immediate); 1258 yyval.l_immediate = value; 1259 } break; 1260 case 51: 1261 # line 362 "../../../common/mdb/mdb_grammar.y" 1262 { 1263 uint8_t value; 1264 1265 ffetch(&value, sizeof (value), yypvt[-0].l_immediate); 1266 yyval.l_immediate = value; 1267 } break; 1268 case 52: 1269 # line 369 "../../../common/mdb/mdb_grammar.y" 1270 { 1271 uint16_t value; 1272 1273 ffetch(&value, sizeof (value), yypvt[-0].l_immediate); 1274 yyval.l_immediate = value; 1275 } break; 1276 case 53: 1277 # line 376 "../../../common/mdb/mdb_grammar.y" 1278 { 1279 uint32_t value; 1280 1281 ffetch(&value, sizeof (value), yypvt[-0].l_immediate); 1282 yyval.l_immediate = value; 1283 } break; 1284 case 54: 1285 # line 383 "../../../common/mdb/mdb_grammar.y" 1286 { 1287 uint64_t value; 1288 1289 ffetch(&value, sizeof (value), yypvt[-0].l_immediate); 1290 yyval.l_immediate = value; 1291 } break; 1292 case 55: 1293 # line 390 "../../../common/mdb/mdb_grammar.y" 1294 { yyval.l_immediate = -yypvt[-0].l_immediate; } break; 1295 case 56: 1296 # line 391 "../../../common/mdb/mdb_grammar.y" 1297 { yyval.l_immediate = ~yypvt[-0].l_immediate; } break; 1298 case 57: 1299 # line 392 "../../../common/mdb/mdb_grammar.y" 1300 { yyval.l_immediate = !yypvt[-0].l_immediate; } break; 1301 case 58: 1302 # line 393 "../../../common/mdb/mdb_grammar.y" 1303 { yyval.l_immediate = yypvt[-1].l_immediate; } break; 1304 case 59: 1305 # line 395 "../../../common/mdb/mdb_grammar.y" 1306 { 1307 yyval.l_immediate = mdb_nv_get_value(yypvt[-0].l_var); 1308 } break; 1309 case 60: 1310 # line 399 "../../../common/mdb/mdb_grammar.y" 1311 { 1312 if (strcmp(yypvt[-0].l_string, ".") == 0) { 1313 yyval.l_immediate = mdb_nv_get_value(mdb.m_dot); 1314 strfree(yypvt[-0].l_string); 1315 1316 } else { 1317 const char *obj = MDB_TGT_OBJ_EVERY, *name = yypvt[-0].l_string; 1318 char *s = (char *)yypvt[-0].l_string; 1319 GElf_Sym sym; 1320 1321 if ((s = strrsplit(s, '`')) != NULL) { 1322 name = s; 1323 obj = yypvt[-0].l_string; 1324 } 1325 1326 if (mdb_tgt_lookup_by_name(mdb.m_target, 1327 obj, name, &sym, NULL) == -1) { 1328 strfree(yypvt[-0].l_string); 1329 yyperror("failed to dereference " 1330 "symbol"); 1331 } 1332 1333 strfree(yypvt[-0].l_string); 1334 yyval.l_immediate = (uintmax_t)sym.st_value; 1335 } 1336 } break; 1337 case 61: 1338 # line 426 "../../../common/mdb/mdb_grammar.y" 1339 { yyval.l_immediate = mdb_dot_incr("+"); } break; 1340 case 62: 1341 # line 427 "../../../common/mdb/mdb_grammar.y" 1342 { yyval.l_immediate = mdb_dot_decr("^"); } break; 1343 case 63: 1344 # line 428 "../../../common/mdb/mdb_grammar.y" 1345 { yyval.l_immediate = mdb.m_raddr; } break; 1346 # line 556 "/usr/share/lib/ccs/yaccpar" 1347 } 1348 goto yystack; /* reset registers in driver code */ 1349 } 1350 1351