%{
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2015, Joyent, Inc. All rights reserved.
*/
#include <mdb/mdb_types.h>
#include <mdb/mdb_debug.h>
#include <mdb/mdb_shell.h>
#include <mdb/mdb_string.h>
#include <mdb/mdb_frame.h>
/*
* Utility routines to fetch values from the target's virtual address space
* and object file, respectively. These are called from the handlers for
* the * /.../ and % /.../ code below.
*/
static void
{
}
static void
{
}
/*
* Because we define YYMAXDEPTH as zero below, we have to provide a YYEXPAND()
* function to expand our yys and yyv variables. For simplicity, we currently
* define these structures statically; a more complex solution can be defined if
* it is ever needed. If we return 'val', yacc assumes resize has failed.
*/
static int
{
}
/*
* This will cause the rest of the yacc code to assume that yys and yyv are
* pointers, not static arrays.
*/
#define YYMAXDEPTH 0
%}
%union {
char *l_string;
char l_char;
}
%left '|'
%left '^'
%left '&'
%left '-' '+'
%left '*' '%' '#'
%%
| statement_list statement { return (0); }
;
| ';'
return (0);
}
return (0);
}
return (0);
}
return (0);
}
| expression terminator {
/*
* The handling of naked expressions is slightly tricky:
* in a string context, we want to just set dot to the
* expression value. In a pipe context, we also set
* dot but need to record the address in the right-
* hand command's addrv and update any vcbs that are
* active. Otherwise, on the command-line, we have to
* support this as an alias for executing the previous
* command with the new value of dot. Sigh.
*/
(uintptr_t)$1);
} else {
return (0);
}
}
return (0);
}
return (0);
}
yyerror("syntax error");
mdb_shell_exec($2);
}
| terminator {
/*
* If a bare terminator is encountered, execute
* the previous command if -o repeatlast is set
* and stdin is not an mdb_eval() string.
*/
return (0);
}
}
;
;
;
;
}
}
}
}
;
}
}
;
if ($3 == 0UL)
yyerror("attempted to divide by zero");
/*
* Annoyingly, x86 generates a #DE when dividing
* LONG_MIN by -1; check for this case explicitly.
*/
yyerror("divide overflow");
}
if ($3 == 0UL)
yyerror("attempted to divide by zero");
}
$$ = value;
}
$$ = value;
}
$$ = value;
}
$$ = value;
}
$$ = value;
}
$$ = value;
}
$$ = value;
}
$$ = value;
}
$$ = value;
}
$$ = value;
}
$$ = mdb_nv_get_value($1);
}
| MDB_TOK_SYMBOL {
strfree($1);
} else {
char *s = (char *)$1;
name = s;
obj = $1;
}
strfree($1);
yyperror("failed to dereference "
"symbol");
}
strfree($1);
}
}
;
%%