1999-04-16 03:35:26 +02:00
|
|
|
|
/* YACC parser for Java expressions, for GDB.
|
2013-01-01 07:33:28 +01:00
|
|
|
|
Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2009-03-18 09:51:11 +01:00
|
|
|
|
This file is part of GDB.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2009-03-18 09:51:11 +01:00
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2009-03-18 09:51:11 +01:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2009-03-18 09:51:11 +01:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
/* Parse a Java expression from text in a string,
|
|
|
|
|
and return the result as a struct expression pointer.
|
|
|
|
|
That structure contains arithmetic operations in reverse polish,
|
|
|
|
|
with constants represented by operations that are followed by special data.
|
|
|
|
|
See expression.h for the details of the format.
|
|
|
|
|
What is important here is that it can be built up sequentially
|
|
|
|
|
during the process of parsing; the lower levels of the tree always
|
|
|
|
|
come first in the result. Well, almost always; see ArrayAccess.
|
|
|
|
|
|
|
|
|
|
Note that malloc's and realloc's in this file are transformed to
|
|
|
|
|
xmalloc and xrealloc respectively by the same sed command in the
|
|
|
|
|
makefile that remaps any other malloc/realloc inserted by the parser
|
|
|
|
|
generator. Doing this with #defines and trying to control the interaction
|
|
|
|
|
with include files (<malloc.h> and <stdlib.h> for example) just became
|
|
|
|
|
too messy, particularly when such includes can be inserted at random
|
|
|
|
|
times by the parser generator. */
|
|
|
|
|
|
|
|
|
|
%{
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "gdb_string.h"
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include "expression.h"
|
|
|
|
|
#include "value.h"
|
|
|
|
|
#include "parser-defs.h"
|
|
|
|
|
#include "language.h"
|
|
|
|
|
#include "jv-lang.h"
|
|
|
|
|
#include "bfd.h" /* Required by objfiles.h. */
|
|
|
|
|
#include "symfile.h" /* Required by objfiles.h. */
|
|
|
|
|
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
|
2003-02-19 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add block.c.
(block_h): New.
(COMMON_OBS): Add block.o.
(block.o): New.
(x86-64-tdep.o): Add $(block_h).
(values.o, valops.o, tracepoint.o, symtab.o, symmisc.o, symfile.o)
(stack.o, printcmd.o, p-exp.tab.o, parse.o, objfiles.o)
(objc-exp.tab.o, objc-lang.o, nlmread.o, mips-tdep.o, mdebugread.o)
(m2-exp.tab.o, linespec.o, jv-lang.o, jv-exp.tab.o, infcmd.o)
(f-valprint.o, findvar.o, f-exp.tab.o, expprint.o, coffread.o)
(c-exp.tab.o, buildsym.o, breakpoint.o, blockframe.o, ax-gdb.o)
(alpha-tdep.o, ada-lang.o, ada-exp.tab.o, mi-cmd-stack.o): Ditto.
* value.h: Add opaque declaration for struct block.
* parser-defs.h, objc-lang.h, buildsym.h, breakpoint.h: Ditto.
* ada-lang.h: Ditto.
* x86-64-tdep.c: #include "block.h"
* values.c, valops.c, tracepoint.c, symtab.c, symmisc.c: Ditto.
* symfile.c, stack.c, printcmd.c, p-exp.y, parse.c: Ditto.
* objfiles.c, objc-exp.y, objc-lang.c, nlmread.c: Ditto.
* mips-tdep.c, mdebugread.c, m2-exp.y, linespec.c: Ditto.
* jv-lang.c, jv-exp.y, infcmd.c, f-valprint.c: Ditto.
* findvar.c, f-exp.y, expprint.c, coffread.c, c-exp.y: Ditto.
* buildsym.c, breakpoint.c, blockframe.c, ax-gdb.c: Ditto.
* alpha-tdep.c, ada-lang.c, ada-exp.y: Ditto.
* blockframe.c (blockvector_for_pc_sect): Move to "block.c".
(blockvector_for_pc, block_for_pc_sect, block_for_pc): Ditto.
* symtab.c (block_function): Ditto.
(contained_in): Ditto.
* frame.h: Move block_for_pc and block_for_pc_sect declarations to
block.h. Add opaque declaration for struct block.
* symtab.h: Move block_function and contained_in declarations to
block.h. Add opaque declarations for struct block, struct
blockvector.
(struct block): Move to block.h.
(struct blockvector): Ditto.
(BLOCK_START, BLOCK_END, BLOCK_FUNCTION, BLOCK_SUPERBLOCK)
(BLOCK_GCC_COMPILED, BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM)
(BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE)
(ALL_BLOCK_SYMBOLS, BLOCK_SHOULD_SORT, BLOCKVECTOR_NBLOCKS)
(BLOCKVECTOR_BLOCK, GLOBAL_BLOCK, STATIC_BLOCK, FIRST_LOCAL_BLOCK):
Ditto.
* block.c: New file.
* block.h: New file.
2003-02-19 David Carlton <carlton@math.stanford.edu>
* mi-cmd-stack.c: #include "block.h"
2003-02-20 01:01:07 +01:00
|
|
|
|
#include "block.h"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2008-09-11 16:09:37 +02:00
|
|
|
|
#define parse_type builtin_type (parse_gdbarch)
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
#define parse_java_type builtin_java_type (parse_gdbarch)
|
2008-09-11 16:09:37 +02:00
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
|
|
|
|
as well as gratuitiously global symbol names, so we can have multiple
|
|
|
|
|
yacc generated parsers in gdb. Note that these are only the variables
|
|
|
|
|
produced by yacc. If other parser generators (bison, byacc, etc) produce
|
|
|
|
|
additional global names that conflict at link time, then those parser
|
2011-01-09 04:08:57 +01:00
|
|
|
|
generators need to be fixed instead of adding those names to this list. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
#define yymaxdepth java_maxdepth
|
|
|
|
|
#define yyparse java_parse
|
|
|
|
|
#define yylex java_lex
|
|
|
|
|
#define yyerror java_error
|
|
|
|
|
#define yylval java_lval
|
|
|
|
|
#define yychar java_char
|
|
|
|
|
#define yydebug java_debug
|
|
|
|
|
#define yypact java_pact
|
|
|
|
|
#define yyr1 java_r1
|
|
|
|
|
#define yyr2 java_r2
|
|
|
|
|
#define yydef java_def
|
|
|
|
|
#define yychk java_chk
|
|
|
|
|
#define yypgo java_pgo
|
|
|
|
|
#define yyact java_act
|
|
|
|
|
#define yyexca java_exca
|
|
|
|
|
#define yyerrflag java_errflag
|
|
|
|
|
#define yynerrs java_nerrs
|
|
|
|
|
#define yyps java_ps
|
|
|
|
|
#define yypv java_pv
|
|
|
|
|
#define yys java_s
|
|
|
|
|
#define yy_yys java_yys
|
|
|
|
|
#define yystate java_state
|
|
|
|
|
#define yytmp java_tmp
|
|
|
|
|
#define yyv java_v
|
|
|
|
|
#define yy_yyv java_yyv
|
|
|
|
|
#define yyval java_val
|
|
|
|
|
#define yylloc java_lloc
|
|
|
|
|
#define yyreds java_reds /* With YYDEBUG defined */
|
|
|
|
|
#define yytoks java_toks /* With YYDEBUG defined */
|
2002-09-03 04:45:56 +02:00
|
|
|
|
#define yyname java_name /* With YYDEBUG defined */
|
|
|
|
|
#define yyrule java_rule /* With YYDEBUG defined */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
#define yylhs java_yylhs
|
|
|
|
|
#define yylen java_yylen
|
|
|
|
|
#define yydefred java_yydefred
|
|
|
|
|
#define yydgoto java_yydgoto
|
|
|
|
|
#define yysindex java_yysindex
|
|
|
|
|
#define yyrindex java_yyrindex
|
|
|
|
|
#define yygindex java_yygindex
|
|
|
|
|
#define yytable java_yytable
|
|
|
|
|
#define yycheck java_yycheck
|
* ada-exp.y (yyss, yysslim, yyssp, yystacksize, yyvs, yyvsp): New
defines.
* c-exp.y (yyss, yysslim, yyssp, yystacksize, yyvs, yyvsp): New
defines.
* cp-name-parser.y (yyss, yysslim, yyssp, yystacksize, yyvs)
(yyvsp): New defines.
* f-exp.y (yyss, yysslim, yyssp, yystacksize, yyvs, yyvsp): New
defines.
* jv-exp.y (yyss, yysslim, yyssp, yystacksize, yyvs, yyvsp): New
defines.
* m2-exp.y (yyss, yysslim, yyssp, yystacksize, yyvs, yyvsp): New
defines.
* objc-exp.y (yyss, yysslim, yyssp, yystacksize, yyvs, yyvsp): New
defines.
* p-exp.y (yyss, yysslim, yyssp, yystacksize, yyvs, yyvsp): New
defines.
2012-04-09 19:07:43 +02:00
|
|
|
|
#define yyss java_yyss
|
|
|
|
|
#define yysslim java_yysslim
|
|
|
|
|
#define yyssp java_yyssp
|
|
|
|
|
#define yystacksize java_yystacksize
|
|
|
|
|
#define yyvs java_yyvs
|
|
|
|
|
#define yyvsp java_yyvsp
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
#ifndef YYDEBUG
|
2002-06-21 16:32:10 +02:00
|
|
|
|
#define YYDEBUG 1 /* Default to yydebug support */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
2002-06-21 16:32:10 +02:00
|
|
|
|
#define YYFPRINTF parser_fprintf
|
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
|
int yyparse (void);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
|
static int yylex (void);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
|
void yyerror (char *);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
|
static struct type *java_type_from_name (struct stoken);
|
|
|
|
|
static void push_expression_name (struct stoken);
|
|
|
|
|
static void push_fieldnames (struct stoken);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
|
static struct expression *copy_exp (struct expression *, int);
|
|
|
|
|
static void insert_exp (int, struct expression *);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
/* Although the yacc "value" of an expression is not used,
|
|
|
|
|
since the result is stored in the structure being created,
|
|
|
|
|
other node types do have values. */
|
|
|
|
|
|
|
|
|
|
%union
|
|
|
|
|
{
|
|
|
|
|
LONGEST lval;
|
|
|
|
|
struct {
|
|
|
|
|
LONGEST val;
|
|
|
|
|
struct type *type;
|
|
|
|
|
} typed_val_int;
|
|
|
|
|
struct {
|
|
|
|
|
DOUBLEST dval;
|
|
|
|
|
struct type *type;
|
|
|
|
|
} typed_val_float;
|
|
|
|
|
struct symbol *sym;
|
|
|
|
|
struct type *tval;
|
|
|
|
|
struct stoken sval;
|
|
|
|
|
struct ttype tsym;
|
|
|
|
|
struct symtoken ssym;
|
|
|
|
|
struct block *bval;
|
|
|
|
|
enum exp_opcode opcode;
|
|
|
|
|
struct internalvar *ivar;
|
|
|
|
|
int *ivec;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
%{
|
|
|
|
|
/* YYSTYPE gets defined by %union */
|
2000-05-28 03:12:42 +02:00
|
|
|
|
static int parse_number (char *, int, int, YYSTYPE *);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
%type <lval> rcurly Dims Dims_opt
|
|
|
|
|
%type <tval> ClassOrInterfaceType ClassType /* ReferenceType Type ArrayType */
|
|
|
|
|
%type <tval> IntegralType FloatingPointType NumericType PrimitiveType ArrayType PrimitiveOrArrayType
|
|
|
|
|
|
|
|
|
|
%token <typed_val_int> INTEGER_LITERAL
|
|
|
|
|
%token <typed_val_float> FLOATING_POINT_LITERAL
|
|
|
|
|
|
|
|
|
|
%token <sval> IDENTIFIER
|
|
|
|
|
%token <sval> STRING_LITERAL
|
|
|
|
|
%token <lval> BOOLEAN_LITERAL
|
|
|
|
|
%token <tsym> TYPENAME
|
|
|
|
|
%type <sval> Name SimpleName QualifiedName ForcedName
|
|
|
|
|
|
|
|
|
|
/* A NAME_OR_INT is a symbol which is not known in the symbol table,
|
|
|
|
|
but which would parse as a valid number in the current input radix.
|
|
|
|
|
E.g. "c" when input_radix==16. Depending on the parse, it will be
|
|
|
|
|
turned into a name or into a number. */
|
|
|
|
|
|
|
|
|
|
%token <sval> NAME_OR_INT
|
|
|
|
|
|
|
|
|
|
%token ERROR
|
|
|
|
|
|
|
|
|
|
/* Special type cases, put in to allow the parser to distinguish different
|
|
|
|
|
legal basetypes. */
|
|
|
|
|
%token LONG SHORT BYTE INT CHAR BOOLEAN DOUBLE FLOAT
|
|
|
|
|
|
|
|
|
|
%token VARIABLE
|
|
|
|
|
|
|
|
|
|
%token <opcode> ASSIGN_MODIFY
|
|
|
|
|
|
2002-10-11 16:02:39 +02:00
|
|
|
|
%token SUPER NEW
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
%left ','
|
|
|
|
|
%right '=' ASSIGN_MODIFY
|
|
|
|
|
%right '?'
|
|
|
|
|
%left OROR
|
|
|
|
|
%left ANDAND
|
|
|
|
|
%left '|'
|
|
|
|
|
%left '^'
|
|
|
|
|
%left '&'
|
|
|
|
|
%left EQUAL NOTEQUAL
|
|
|
|
|
%left '<' '>' LEQ GEQ
|
|
|
|
|
%left LSH RSH
|
|
|
|
|
%left '+' '-'
|
|
|
|
|
%left '*' '/' '%'
|
|
|
|
|
%right INCREMENT DECREMENT
|
|
|
|
|
%right '.' '[' '('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
|
|
start : exp1
|
|
|
|
|
| type_exp
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
type_exp: PrimitiveOrArrayType
|
|
|
|
|
{
|
|
|
|
|
write_exp_elt_opcode(OP_TYPE);
|
|
|
|
|
write_exp_elt_type($1);
|
|
|
|
|
write_exp_elt_opcode(OP_TYPE);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
PrimitiveOrArrayType:
|
|
|
|
|
PrimitiveType
|
|
|
|
|
| ArrayType
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
StringLiteral:
|
|
|
|
|
STRING_LITERAL
|
|
|
|
|
{
|
|
|
|
|
write_exp_elt_opcode (OP_STRING);
|
|
|
|
|
write_exp_string ($1);
|
|
|
|
|
write_exp_elt_opcode (OP_STRING);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
Literal:
|
|
|
|
|
INTEGER_LITERAL
|
|
|
|
|
{ write_exp_elt_opcode (OP_LONG);
|
|
|
|
|
write_exp_elt_type ($1.type);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST)($1.val));
|
|
|
|
|
write_exp_elt_opcode (OP_LONG); }
|
|
|
|
|
| NAME_OR_INT
|
|
|
|
|
{ YYSTYPE val;
|
|
|
|
|
parse_number ($1.ptr, $1.length, 0, &val);
|
|
|
|
|
write_exp_elt_opcode (OP_LONG);
|
|
|
|
|
write_exp_elt_type (val.typed_val_int.type);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
|
|
|
|
|
write_exp_elt_opcode (OP_LONG);
|
|
|
|
|
}
|
|
|
|
|
| FLOATING_POINT_LITERAL
|
|
|
|
|
{ write_exp_elt_opcode (OP_DOUBLE);
|
|
|
|
|
write_exp_elt_type ($1.type);
|
|
|
|
|
write_exp_elt_dblcst ($1.dval);
|
|
|
|
|
write_exp_elt_opcode (OP_DOUBLE); }
|
|
|
|
|
| BOOLEAN_LITERAL
|
|
|
|
|
{ write_exp_elt_opcode (OP_LONG);
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
write_exp_elt_type (parse_java_type->builtin_boolean);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
write_exp_elt_longcst ((LONGEST)$1);
|
|
|
|
|
write_exp_elt_opcode (OP_LONG); }
|
|
|
|
|
| StringLiteral
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* UNUSED:
|
|
|
|
|
Type:
|
|
|
|
|
PrimitiveType
|
|
|
|
|
| ReferenceType
|
|
|
|
|
;
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
PrimitiveType:
|
|
|
|
|
NumericType
|
|
|
|
|
| BOOLEAN
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
{ $$ = parse_java_type->builtin_boolean; }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
NumericType:
|
|
|
|
|
IntegralType
|
|
|
|
|
| FloatingPointType
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
IntegralType:
|
|
|
|
|
BYTE
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
{ $$ = parse_java_type->builtin_byte; }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
| SHORT
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
{ $$ = parse_java_type->builtin_short; }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
| INT
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
{ $$ = parse_java_type->builtin_int; }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
| LONG
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
{ $$ = parse_java_type->builtin_long; }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
| CHAR
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
{ $$ = parse_java_type->builtin_char; }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
FloatingPointType:
|
|
|
|
|
FLOAT
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
{ $$ = parse_java_type->builtin_float; }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
| DOUBLE
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
{ $$ = parse_java_type->builtin_double; }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* UNUSED:
|
|
|
|
|
ReferenceType:
|
|
|
|
|
ClassOrInterfaceType
|
|
|
|
|
| ArrayType
|
|
|
|
|
;
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
ClassOrInterfaceType:
|
|
|
|
|
Name
|
|
|
|
|
{ $$ = java_type_from_name ($1); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ClassType:
|
|
|
|
|
ClassOrInterfaceType
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ArrayType:
|
|
|
|
|
PrimitiveType Dims
|
|
|
|
|
{ $$ = java_array_type ($1, $2); }
|
|
|
|
|
| Name Dims
|
|
|
|
|
{ $$ = java_array_type (java_type_from_name ($1), $2); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
Name:
|
|
|
|
|
IDENTIFIER
|
|
|
|
|
| QualifiedName
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ForcedName:
|
|
|
|
|
SimpleName
|
|
|
|
|
| QualifiedName
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
SimpleName:
|
|
|
|
|
IDENTIFIER
|
|
|
|
|
| NAME_OR_INT
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
QualifiedName:
|
|
|
|
|
Name '.' SimpleName
|
|
|
|
|
{ $$.length = $1.length + $3.length + 1;
|
|
|
|
|
if ($1.ptr + $1.length + 1 == $3.ptr
|
|
|
|
|
&& $1.ptr[$1.length] == '.')
|
2011-01-09 04:08:57 +01:00
|
|
|
|
$$.ptr = $1.ptr; /* Optimization. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$$.ptr = (char *) malloc ($$.length + 1);
|
|
|
|
|
make_cleanup (free, $$.ptr);
|
|
|
|
|
sprintf ($$.ptr, "%.*s.%.*s",
|
|
|
|
|
$1.length, $1.ptr, $3.length, $3.ptr);
|
|
|
|
|
} }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
type_exp: type
|
|
|
|
|
{ write_exp_elt_opcode(OP_TYPE);
|
|
|
|
|
write_exp_elt_type($1);
|
|
|
|
|
write_exp_elt_opcode(OP_TYPE);}
|
|
|
|
|
;
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Expressions, including the comma operator. */
|
|
|
|
|
exp1 : Expression
|
|
|
|
|
| exp1 ',' Expression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_COMMA); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
Primary:
|
|
|
|
|
PrimaryNoNewArray
|
|
|
|
|
| ArrayCreationExpression
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
PrimaryNoNewArray:
|
|
|
|
|
Literal
|
|
|
|
|
| '(' Expression ')'
|
|
|
|
|
| ClassInstanceCreationExpression
|
|
|
|
|
| FieldAccess
|
|
|
|
|
| MethodInvocation
|
|
|
|
|
| ArrayAccess
|
|
|
|
|
| lcurly ArgumentList rcurly
|
|
|
|
|
{ write_exp_elt_opcode (OP_ARRAY);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST) 0);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST) $3);
|
|
|
|
|
write_exp_elt_opcode (OP_ARRAY); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
lcurly:
|
|
|
|
|
'{'
|
|
|
|
|
{ start_arglist (); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
rcurly:
|
|
|
|
|
'}'
|
|
|
|
|
{ $$ = end_arglist () - 1; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ClassInstanceCreationExpression:
|
|
|
|
|
NEW ClassType '(' ArgumentList_opt ')'
|
2002-07-25 06:33:24 +02:00
|
|
|
|
{ internal_error (__FILE__, __LINE__,
|
|
|
|
|
_("FIXME - ClassInstanceCreationExpression")); }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ArgumentList:
|
|
|
|
|
Expression
|
|
|
|
|
{ arglist_len = 1; }
|
|
|
|
|
| ArgumentList ',' Expression
|
|
|
|
|
{ arglist_len++; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ArgumentList_opt:
|
|
|
|
|
/* EMPTY */
|
|
|
|
|
{ arglist_len = 0; }
|
|
|
|
|
| ArgumentList
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ArrayCreationExpression:
|
|
|
|
|
NEW PrimitiveType DimExprs Dims_opt
|
2002-07-25 06:33:24 +02:00
|
|
|
|
{ internal_error (__FILE__, __LINE__,
|
|
|
|
|
_("FIXME - ArrayCreationExpression")); }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
| NEW ClassOrInterfaceType DimExprs Dims_opt
|
2002-07-25 06:33:24 +02:00
|
|
|
|
{ internal_error (__FILE__, __LINE__,
|
|
|
|
|
_("FIXME - ArrayCreationExpression")); }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
DimExprs:
|
|
|
|
|
DimExpr
|
|
|
|
|
| DimExprs DimExpr
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
DimExpr:
|
|
|
|
|
'[' Expression ']'
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
Dims:
|
|
|
|
|
'[' ']'
|
|
|
|
|
{ $$ = 1; }
|
|
|
|
|
| Dims '[' ']'
|
|
|
|
|
{ $$ = $1 + 1; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
Dims_opt:
|
|
|
|
|
Dims
|
|
|
|
|
| /* EMPTY */
|
|
|
|
|
{ $$ = 0; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
FieldAccess:
|
|
|
|
|
Primary '.' SimpleName
|
|
|
|
|
{ push_fieldnames ($3); }
|
|
|
|
|
| VARIABLE '.' SimpleName
|
|
|
|
|
{ push_fieldnames ($3); }
|
|
|
|
|
/*| SUPER '.' SimpleName { FIXME } */
|
|
|
|
|
;
|
|
|
|
|
|
2004-09-20 22:18:39 +02:00
|
|
|
|
FuncStart:
|
|
|
|
|
Name '('
|
|
|
|
|
{ push_expression_name ($1); }
|
|
|
|
|
;
|
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
MethodInvocation:
|
2004-09-20 22:18:39 +02:00
|
|
|
|
FuncStart
|
|
|
|
|
{ start_arglist(); }
|
|
|
|
|
ArgumentList_opt ')'
|
|
|
|
|
{ write_exp_elt_opcode (OP_FUNCALL);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST) end_arglist ());
|
|
|
|
|
write_exp_elt_opcode (OP_FUNCALL); }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
| Primary '.' SimpleName '(' ArgumentList_opt ')'
|
2004-09-20 22:18:39 +02:00
|
|
|
|
{ error (_("Form of method invocation not implemented")); }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
| SUPER '.' SimpleName '(' ArgumentList_opt ')'
|
2004-09-20 22:18:39 +02:00
|
|
|
|
{ error (_("Form of method invocation not implemented")); }
|
1999-04-16 03:35:26 +02:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ArrayAccess:
|
|
|
|
|
Name '[' Expression ']'
|
|
|
|
|
{
|
|
|
|
|
/* Emit code for the Name now, then exchange it in the
|
|
|
|
|
expout array with the Expression's code. We could
|
|
|
|
|
introduce a OP_SWAP code or a reversed version of
|
|
|
|
|
BINOP_SUBSCRIPT, but that makes the rest of GDB pay
|
|
|
|
|
for our parsing kludges. */
|
|
|
|
|
struct expression *name_expr;
|
|
|
|
|
|
|
|
|
|
push_expression_name ($1);
|
|
|
|
|
name_expr = copy_exp (expout, expout_ptr);
|
|
|
|
|
expout_ptr -= name_expr->nelts;
|
|
|
|
|
insert_exp (expout_ptr-length_of_subexp (expout, expout_ptr),
|
|
|
|
|
name_expr);
|
|
|
|
|
free (name_expr);
|
|
|
|
|
write_exp_elt_opcode (BINOP_SUBSCRIPT);
|
|
|
|
|
}
|
|
|
|
|
| VARIABLE '[' Expression ']'
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_SUBSCRIPT); }
|
|
|
|
|
| PrimaryNoNewArray '[' Expression ']'
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_SUBSCRIPT); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
PostfixExpression:
|
|
|
|
|
Primary
|
|
|
|
|
| Name
|
|
|
|
|
{ push_expression_name ($1); }
|
|
|
|
|
| VARIABLE
|
2011-01-09 04:08:57 +01:00
|
|
|
|
/* Already written by write_dollar_variable. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
| PostIncrementExpression
|
|
|
|
|
| PostDecrementExpression
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
PostIncrementExpression:
|
|
|
|
|
PostfixExpression INCREMENT
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_POSTINCREMENT); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
PostDecrementExpression:
|
|
|
|
|
PostfixExpression DECREMENT
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_POSTDECREMENT); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
UnaryExpression:
|
|
|
|
|
PreIncrementExpression
|
|
|
|
|
| PreDecrementExpression
|
|
|
|
|
| '+' UnaryExpression
|
|
|
|
|
| '-' UnaryExpression
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_NEG); }
|
|
|
|
|
| '*' UnaryExpression
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_IND); } /*FIXME not in Java */
|
|
|
|
|
| UnaryExpressionNotPlusMinus
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
PreIncrementExpression:
|
|
|
|
|
INCREMENT UnaryExpression
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_PREINCREMENT); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
PreDecrementExpression:
|
|
|
|
|
DECREMENT UnaryExpression
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_PREDECREMENT); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
UnaryExpressionNotPlusMinus:
|
|
|
|
|
PostfixExpression
|
|
|
|
|
| '~' UnaryExpression
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_COMPLEMENT); }
|
|
|
|
|
| '!' UnaryExpression
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
|
|
|
|
|
| CastExpression
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
CastExpression:
|
|
|
|
|
'(' PrimitiveType Dims_opt ')' UnaryExpression
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_CAST);
|
|
|
|
|
write_exp_elt_type (java_array_type ($2, $3));
|
|
|
|
|
write_exp_elt_opcode (UNOP_CAST); }
|
|
|
|
|
| '(' Expression ')' UnaryExpressionNotPlusMinus
|
|
|
|
|
{
|
|
|
|
|
int last_exp_size = length_of_subexp(expout, expout_ptr);
|
|
|
|
|
struct type *type;
|
|
|
|
|
int i;
|
|
|
|
|
int base = expout_ptr - last_exp_size - 3;
|
|
|
|
|
if (base < 0 || expout->elts[base+2].opcode != OP_TYPE)
|
2002-07-25 06:33:24 +02:00
|
|
|
|
error (_("Invalid cast expression"));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
type = expout->elts[base+1].type;
|
|
|
|
|
/* Remove the 'Expression' and slide the
|
2011-01-09 04:08:57 +01:00
|
|
|
|
UnaryExpressionNotPlusMinus down to replace it. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
for (i = 0; i < last_exp_size; i++)
|
|
|
|
|
expout->elts[base + i] = expout->elts[base + i + 3];
|
|
|
|
|
expout_ptr -= 3;
|
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
|
|
|
|
|
type = lookup_pointer_type (type);
|
|
|
|
|
write_exp_elt_opcode (UNOP_CAST);
|
|
|
|
|
write_exp_elt_type (type);
|
|
|
|
|
write_exp_elt_opcode (UNOP_CAST);
|
|
|
|
|
}
|
|
|
|
|
| '(' Name Dims ')' UnaryExpressionNotPlusMinus
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_CAST);
|
|
|
|
|
write_exp_elt_type (java_array_type (java_type_from_name ($2), $3));
|
|
|
|
|
write_exp_elt_opcode (UNOP_CAST); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MultiplicativeExpression:
|
|
|
|
|
UnaryExpression
|
|
|
|
|
| MultiplicativeExpression '*' UnaryExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_MUL); }
|
|
|
|
|
| MultiplicativeExpression '/' UnaryExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_DIV); }
|
|
|
|
|
| MultiplicativeExpression '%' UnaryExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_REM); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
AdditiveExpression:
|
|
|
|
|
MultiplicativeExpression
|
|
|
|
|
| AdditiveExpression '+' MultiplicativeExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_ADD); }
|
|
|
|
|
| AdditiveExpression '-' MultiplicativeExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_SUB); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ShiftExpression:
|
|
|
|
|
AdditiveExpression
|
|
|
|
|
| ShiftExpression LSH AdditiveExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_LSH); }
|
|
|
|
|
| ShiftExpression RSH AdditiveExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_RSH); }
|
|
|
|
|
/* | ShiftExpression >>> AdditiveExpression { FIXME } */
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
RelationalExpression:
|
|
|
|
|
ShiftExpression
|
|
|
|
|
| RelationalExpression '<' ShiftExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_LESS); }
|
|
|
|
|
| RelationalExpression '>' ShiftExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_GTR); }
|
|
|
|
|
| RelationalExpression LEQ ShiftExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_LEQ); }
|
|
|
|
|
| RelationalExpression GEQ ShiftExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_GEQ); }
|
|
|
|
|
/* | RelationalExpresion INSTANCEOF ReferenceType { FIXME } */
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
EqualityExpression:
|
|
|
|
|
RelationalExpression
|
|
|
|
|
| EqualityExpression EQUAL RelationalExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_EQUAL); }
|
|
|
|
|
| EqualityExpression NOTEQUAL RelationalExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
AndExpression:
|
|
|
|
|
EqualityExpression
|
|
|
|
|
| AndExpression '&' EqualityExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_BITWISE_AND); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ExclusiveOrExpression:
|
|
|
|
|
AndExpression
|
|
|
|
|
| ExclusiveOrExpression '^' AndExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_BITWISE_XOR); }
|
|
|
|
|
;
|
|
|
|
|
InclusiveOrExpression:
|
|
|
|
|
ExclusiveOrExpression
|
|
|
|
|
| InclusiveOrExpression '|' ExclusiveOrExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_BITWISE_IOR); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ConditionalAndExpression:
|
|
|
|
|
InclusiveOrExpression
|
|
|
|
|
| ConditionalAndExpression ANDAND InclusiveOrExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_LOGICAL_AND); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ConditionalOrExpression:
|
|
|
|
|
ConditionalAndExpression
|
|
|
|
|
| ConditionalOrExpression OROR ConditionalAndExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_LOGICAL_OR); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ConditionalExpression:
|
|
|
|
|
ConditionalOrExpression
|
|
|
|
|
| ConditionalOrExpression '?' Expression ':' ConditionalExpression
|
|
|
|
|
{ write_exp_elt_opcode (TERNOP_COND); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
AssignmentExpression:
|
|
|
|
|
ConditionalExpression
|
|
|
|
|
| Assignment
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
Assignment:
|
|
|
|
|
LeftHandSide '=' ConditionalExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_ASSIGN); }
|
|
|
|
|
| LeftHandSide ASSIGN_MODIFY ConditionalExpression
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
|
|
|
|
|
write_exp_elt_opcode ($2);
|
|
|
|
|
write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
LeftHandSide:
|
|
|
|
|
ForcedName
|
|
|
|
|
{ push_expression_name ($1); }
|
|
|
|
|
| VARIABLE
|
2011-01-09 04:08:57 +01:00
|
|
|
|
/* Already written by write_dollar_variable. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
| FieldAccess
|
|
|
|
|
| ArrayAccess
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Expression:
|
|
|
|
|
AssignmentExpression
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
/* Take care of parsing a number (anything that starts with a digit).
|
|
|
|
|
Set yylval and return the token type; update lexptr.
|
|
|
|
|
LEN is the number of characters in it. */
|
|
|
|
|
|
|
|
|
|
/*** Needs some error checking for the float case ***/
|
|
|
|
|
|
|
|
|
|
static int
|
2008-09-27 19:03:16 +02:00
|
|
|
|
parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
2003-09-25 18:50:38 +02:00
|
|
|
|
ULONGEST n = 0;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
ULONGEST limit, limit_div_base;
|
|
|
|
|
|
2003-09-25 18:50:38 +02:00
|
|
|
|
int c;
|
|
|
|
|
int base = input_radix;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
struct type *type;
|
|
|
|
|
|
|
|
|
|
if (parsed_float)
|
|
|
|
|
{
|
2010-08-19 15:33:15 +02:00
|
|
|
|
const char *suffix;
|
|
|
|
|
int suffix_len;
|
|
|
|
|
|
|
|
|
|
if (! parse_float (p, len, &putithere->typed_val_float.dval, &suffix))
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return ERROR;
|
|
|
|
|
|
2010-08-19 15:33:15 +02:00
|
|
|
|
suffix_len = p + len - suffix;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2010-08-19 15:33:15 +02:00
|
|
|
|
if (suffix_len == 0)
|
2008-09-11 16:09:37 +02:00
|
|
|
|
putithere->typed_val_float.type = parse_type->builtin_double;
|
2010-08-19 15:33:15 +02:00
|
|
|
|
else if (suffix_len == 1)
|
|
|
|
|
{
|
|
|
|
|
/* See if it has `f' or `d' suffix (float or double). */
|
|
|
|
|
if (tolower (*suffix) == 'f')
|
|
|
|
|
putithere->typed_val_float.type =
|
|
|
|
|
parse_type->builtin_float;
|
|
|
|
|
else if (tolower (*suffix) == 'd')
|
|
|
|
|
putithere->typed_val_float.type =
|
|
|
|
|
parse_type->builtin_double;
|
|
|
|
|
else
|
|
|
|
|
return ERROR;
|
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
else
|
|
|
|
|
return ERROR;
|
|
|
|
|
|
|
|
|
|
return FLOATING_POINT_LITERAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Handle base-switching prefixes 0x, 0t, 0d, 0 */
|
|
|
|
|
if (p[0] == '0')
|
|
|
|
|
switch (p[1])
|
|
|
|
|
{
|
|
|
|
|
case 'x':
|
|
|
|
|
case 'X':
|
|
|
|
|
if (len >= 3)
|
|
|
|
|
{
|
|
|
|
|
p += 2;
|
|
|
|
|
base = 16;
|
|
|
|
|
len -= 2;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 't':
|
|
|
|
|
case 'T':
|
|
|
|
|
case 'd':
|
|
|
|
|
case 'D':
|
|
|
|
|
if (len >= 3)
|
|
|
|
|
{
|
|
|
|
|
p += 2;
|
|
|
|
|
base = 10;
|
|
|
|
|
len -= 2;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
base = 8;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
c = p[len-1];
|
2011-01-09 04:08:57 +01:00
|
|
|
|
/* A paranoid calculation of (1<<64)-1. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
limit = (ULONGEST)0xffffffff;
|
2002-02-20 23:41:52 +01:00
|
|
|
|
limit = ((limit << 16) << 16) | limit;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
if (c == 'l' || c == 'L')
|
|
|
|
|
{
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
type = parse_java_type->builtin_long;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
len--;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
type = parse_java_type->builtin_int;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
limit_div_base = limit / (ULONGEST) base;
|
|
|
|
|
|
|
|
|
|
while (--len >= 0)
|
|
|
|
|
{
|
|
|
|
|
c = *p++;
|
|
|
|
|
if (c >= '0' && c <= '9')
|
|
|
|
|
c -= '0';
|
|
|
|
|
else if (c >= 'A' && c <= 'Z')
|
|
|
|
|
c -= 'A' - 10;
|
|
|
|
|
else if (c >= 'a' && c <= 'z')
|
|
|
|
|
c -= 'a' - 10;
|
|
|
|
|
else
|
|
|
|
|
return ERROR; /* Char not a digit */
|
|
|
|
|
if (c >= base)
|
|
|
|
|
return ERROR;
|
|
|
|
|
if (n > limit_div_base
|
|
|
|
|
|| (n *= base) > limit - c)
|
2002-07-25 06:33:24 +02:00
|
|
|
|
error (_("Numeric constant too large"));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
n += c;
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-21 03:54:46 +01:00
|
|
|
|
/* If the type is bigger than a 32-bit signed integer can be, implicitly
|
* gdbtypes.h (builtin_type_int0, builtin_type_int8, builtin_type_uint8,
builtin_type_int16, builtin_type_uint16, builtin_type_int32,
builtin_type_uint32, builtin_type_int64, builtin_type_uint64,
builtin_type_int128, builtin_type_uint128): Remove.
(struct builtin_type): New members builtin_int0, builtin_int8,
builtin_uint8, builtin_int16, builtin_uint16, builtin_int32,
builtin_uint32, builtin_int64, builtin_uint64, builtin_int128,
and builtin_uint128.
* gdbtypes.c (builtin_type_int0, builtin_type_int8, builtin_type_uint8,
builtin_type_int16, builtin_type_uint16, builtin_type_int32,
builtin_type_uint32, builtin_type_int64, builtin_type_uint64,
builtin_type_int128, builtin_type_uint128): Remove.
(_initialize_gdbtypes): Do not initialize them.
(gdbtypes_post_init): Initialize fixed-size integer types.
* dwarf2expr.c (unsigned_address_type, signed_address_type): Add
GDBARCH argument. Return platform-specific type.
(dwarf2_read_address, execute_stack_op): Update calls.
* target-descriptions.c (tdesc_gdb_type): Use platform-specific types
instead of global builtin_int_... variables.
* mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
* printcmd.c (do_examine): Likewise.
* jv-exp.y (parse_number): Likewise.
* alpha-tdep.c (alpha_register_type, alpha_push_dummy_call,
alpha_store_return_value): Likewise.
* amd64-linux-tdep.c (amd64_linux_register_type): Likewise.
* amd64-tdep.c (amd64_register_type): Likewise.
* arm-tdep.c (arm_register_type): Likewise.
* avr-tdep.c (avr_register_type): Likewise.
* cris-tdep.c (cris_register_type, crisv32_register_type): Likewise.
* frv-tdep.c (frv_register_type): Likewise.
* h8300-tdep.c h8300_register_type): Likewise.
* hppa-tdep.c (hppa64_push_dummy_call, hppa32_register_type,
hppa64_register_type): Likewise.
* i386-tdep.c (i386_mmx_type, i386_sse_type): Likewise.
* iq2000-tdep.c (iq2000_register_type): Likewise.
* lm32-tdep.c (lm32_register_type, lm32_push_dummy_call): Likewise.
* m32r-tdep.c (m32r_register_type): Likewise.
* m68hc11-tdep.c (m68hc11_register_type, m68hc11_pseudo_register_read,
m68hc11_pseudo_register_write): Likewise.
* m68k-tdep.c (m68k_register_type): Likewise.
* m88k-tdep.c (m88k_register_type, m88k_store_arguments): Likewise.
* mep-tdep.c (mep_register_type): Likewise.
* mips-tdep.c (mips_register_type, mips_pseudo_register_type,
mips_print_fp_register): Likewise.
* moxie-tdep.c (moxie_register_type): Likewise.
* mt-tdep.c (mt_copro_register_type, mt_register_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* score-tdep.c (score_register_type): Likewise.
* sparc-tdep.c (sparc32_register_type, sparc32_store_arguments):
Likewise.
* sparc64-tdep.c (sparc64_register_type, sparc64_store_arguments):
Likewise.
* spu-tdep.c (spu_builtin_type_vec128, spu_register_type): Likewise.
* v850-tdep.c (v850_register_type): Likewise.
* xstormy16-tdep.c (xstormy16_register_type): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* mt-tdep.c (struct gdbarch_tdep): New data structure.
(mt_gdbarch_init): Alloc TDEP structures.
(mt_register_type): Cache coprocessor type in TDEP instead of
static global variable.
* xtensa-tdep.h (struct gdbarch_tdep): Add type_entries member.
* xtensa-tdep.c (type_entries): Remove.
(xtensa_register_type): Cache fixed-size types in TDEP instead
of in global variable.
2009-07-02 14:46:19 +02:00
|
|
|
|
promote to long. Java does not do this, so mark it as
|
|
|
|
|
parse_type->builtin_uint64 rather than parse_java_type->builtin_long.
|
|
|
|
|
0x80000000 will become -0x80000000 instead of 0x80000000L, because we
|
|
|
|
|
don't know the sign at this point. */
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
if (type == parse_java_type->builtin_int && n > (ULONGEST)0x80000000)
|
* gdbtypes.h (builtin_type_int0, builtin_type_int8, builtin_type_uint8,
builtin_type_int16, builtin_type_uint16, builtin_type_int32,
builtin_type_uint32, builtin_type_int64, builtin_type_uint64,
builtin_type_int128, builtin_type_uint128): Remove.
(struct builtin_type): New members builtin_int0, builtin_int8,
builtin_uint8, builtin_int16, builtin_uint16, builtin_int32,
builtin_uint32, builtin_int64, builtin_uint64, builtin_int128,
and builtin_uint128.
* gdbtypes.c (builtin_type_int0, builtin_type_int8, builtin_type_uint8,
builtin_type_int16, builtin_type_uint16, builtin_type_int32,
builtin_type_uint32, builtin_type_int64, builtin_type_uint64,
builtin_type_int128, builtin_type_uint128): Remove.
(_initialize_gdbtypes): Do not initialize them.
(gdbtypes_post_init): Initialize fixed-size integer types.
* dwarf2expr.c (unsigned_address_type, signed_address_type): Add
GDBARCH argument. Return platform-specific type.
(dwarf2_read_address, execute_stack_op): Update calls.
* target-descriptions.c (tdesc_gdb_type): Use platform-specific types
instead of global builtin_int_... variables.
* mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
* printcmd.c (do_examine): Likewise.
* jv-exp.y (parse_number): Likewise.
* alpha-tdep.c (alpha_register_type, alpha_push_dummy_call,
alpha_store_return_value): Likewise.
* amd64-linux-tdep.c (amd64_linux_register_type): Likewise.
* amd64-tdep.c (amd64_register_type): Likewise.
* arm-tdep.c (arm_register_type): Likewise.
* avr-tdep.c (avr_register_type): Likewise.
* cris-tdep.c (cris_register_type, crisv32_register_type): Likewise.
* frv-tdep.c (frv_register_type): Likewise.
* h8300-tdep.c h8300_register_type): Likewise.
* hppa-tdep.c (hppa64_push_dummy_call, hppa32_register_type,
hppa64_register_type): Likewise.
* i386-tdep.c (i386_mmx_type, i386_sse_type): Likewise.
* iq2000-tdep.c (iq2000_register_type): Likewise.
* lm32-tdep.c (lm32_register_type, lm32_push_dummy_call): Likewise.
* m32r-tdep.c (m32r_register_type): Likewise.
* m68hc11-tdep.c (m68hc11_register_type, m68hc11_pseudo_register_read,
m68hc11_pseudo_register_write): Likewise.
* m68k-tdep.c (m68k_register_type): Likewise.
* m88k-tdep.c (m88k_register_type, m88k_store_arguments): Likewise.
* mep-tdep.c (mep_register_type): Likewise.
* mips-tdep.c (mips_register_type, mips_pseudo_register_type,
mips_print_fp_register): Likewise.
* moxie-tdep.c (moxie_register_type): Likewise.
* mt-tdep.c (mt_copro_register_type, mt_register_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* score-tdep.c (score_register_type): Likewise.
* sparc-tdep.c (sparc32_register_type, sparc32_store_arguments):
Likewise.
* sparc64-tdep.c (sparc64_register_type, sparc64_store_arguments):
Likewise.
* spu-tdep.c (spu_builtin_type_vec128, spu_register_type): Likewise.
* v850-tdep.c (v850_register_type): Likewise.
* xstormy16-tdep.c (xstormy16_register_type): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* mt-tdep.c (struct gdbarch_tdep): New data structure.
(mt_gdbarch_init): Alloc TDEP structures.
(mt_register_type): Cache coprocessor type in TDEP instead of
static global variable.
* xtensa-tdep.h (struct gdbarch_tdep): Add type_entries member.
* xtensa-tdep.c (type_entries): Remove.
(xtensa_register_type): Cache fixed-size types in TDEP instead
of in global variable.
2009-07-02 14:46:19 +02:00
|
|
|
|
type = parse_type->builtin_uint64;
|
2002-02-20 23:41:52 +01:00
|
|
|
|
|
|
|
|
|
putithere->typed_val_int.val = n;
|
|
|
|
|
putithere->typed_val_int.type = type;
|
|
|
|
|
|
|
|
|
|
return INTEGER_LITERAL;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct token
|
|
|
|
|
{
|
|
|
|
|
char *operator;
|
|
|
|
|
int token;
|
|
|
|
|
enum exp_opcode opcode;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const struct token tokentab3[] =
|
|
|
|
|
{
|
|
|
|
|
{">>=", ASSIGN_MODIFY, BINOP_RSH},
|
|
|
|
|
{"<<=", ASSIGN_MODIFY, BINOP_LSH}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const struct token tokentab2[] =
|
|
|
|
|
{
|
|
|
|
|
{"+=", ASSIGN_MODIFY, BINOP_ADD},
|
|
|
|
|
{"-=", ASSIGN_MODIFY, BINOP_SUB},
|
|
|
|
|
{"*=", ASSIGN_MODIFY, BINOP_MUL},
|
|
|
|
|
{"/=", ASSIGN_MODIFY, BINOP_DIV},
|
|
|
|
|
{"%=", ASSIGN_MODIFY, BINOP_REM},
|
|
|
|
|
{"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
|
|
|
|
|
{"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
|
|
|
|
|
{"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
|
|
|
|
|
{"++", INCREMENT, BINOP_END},
|
|
|
|
|
{"--", DECREMENT, BINOP_END},
|
|
|
|
|
{"&&", ANDAND, BINOP_END},
|
|
|
|
|
{"||", OROR, BINOP_END},
|
|
|
|
|
{"<<", LSH, BINOP_END},
|
|
|
|
|
{">>", RSH, BINOP_END},
|
|
|
|
|
{"==", EQUAL, BINOP_END},
|
|
|
|
|
{"!=", NOTEQUAL, BINOP_END},
|
|
|
|
|
{"<=", LEQ, BINOP_END},
|
|
|
|
|
{">=", GEQ, BINOP_END}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Read one token, getting characters through lexptr. */
|
|
|
|
|
|
|
|
|
|
static int
|
2008-09-27 19:03:16 +02:00
|
|
|
|
yylex (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
int c;
|
|
|
|
|
int namelen;
|
|
|
|
|
unsigned int i;
|
|
|
|
|
char *tokstart;
|
|
|
|
|
char *tokptr;
|
|
|
|
|
int tempbufindex;
|
|
|
|
|
static char *tempbuf;
|
|
|
|
|
static int tempbufsize;
|
|
|
|
|
|
|
|
|
|
retry:
|
|
|
|
|
|
2002-05-03 10:23:12 +02:00
|
|
|
|
prev_lexptr = lexptr;
|
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
tokstart = lexptr;
|
|
|
|
|
/* See if it is a special token of length 3. */
|
|
|
|
|
for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
|
2003-11-06 23:54:02 +01:00
|
|
|
|
if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
lexptr += 3;
|
|
|
|
|
yylval.opcode = tokentab3[i].opcode;
|
|
|
|
|
return tokentab3[i].token;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* See if it is a special token of length 2. */
|
|
|
|
|
for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
|
2003-11-06 23:54:02 +01:00
|
|
|
|
if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
lexptr += 2;
|
|
|
|
|
yylval.opcode = tokentab2[i].opcode;
|
|
|
|
|
return tokentab2[i].token;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (c = *tokstart)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case ' ':
|
|
|
|
|
case '\t':
|
|
|
|
|
case '\n':
|
|
|
|
|
lexptr++;
|
|
|
|
|
goto retry;
|
|
|
|
|
|
|
|
|
|
case '\'':
|
|
|
|
|
/* We either have a character constant ('0' or '\177' for example)
|
|
|
|
|
or we have a quoted symbol reference ('foo(int,int)' in C++
|
2011-01-09 04:08:57 +01:00
|
|
|
|
for example). */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
lexptr++;
|
|
|
|
|
c = *lexptr++;
|
|
|
|
|
if (c == '\\')
|
2010-03-05 21:18:19 +01:00
|
|
|
|
c = parse_escape (parse_gdbarch, &lexptr);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
else if (c == '\'')
|
2002-07-25 06:33:24 +02:00
|
|
|
|
error (_("Empty character constant"));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
yylval.typed_val_int.val = c;
|
* jv-lang.h (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(struct builtin_java_type): New data type.
(builtin_java_type): Add prototype.
(java_primitive_type): Add GDBARCH argument.
(java_primitive_type_from_name): Likewise.
(type_from_class): Likewise.
* jv-lang.c (java_int_type, java_byte_type, java_short_type,
java_long_type, java_boolean_type, java_char_type, java_float_type,
java_double_type, java_void_type): Remove.
(build_java_types, builtin_java_type): New functions.
(java_type_data): New static variable.
(_initialize_java_language): Initialize it. No longer initialize
global types.
(java_language_arch_info): Use per-architecture types.
(java_primitive_type): Add GDBARCH argument. Return per-architecture
type instead of refering to global variable.
(java_primitive_type_from_name): Add GDBARCH argument.
(java_primitive_type_name): New function.
(java_demangled_signature_length): Use it instead of
java_primitive_type_from_name.
(java_demangled_signature_copy): Likewise.
(type_from_class): Add GDBARCH argument. Pass to java_link_class_type,
java_primitive_type, and recursive type_from_class call.
(java_link_class_type): Add GDBARCH argument. Pass to type_from_class
calls. Use per-architecture types instead of global types.
* jv-exp.y (parse_java_type): New define.
Use per-architecture types instead of global types througout.
* jv-valprint.c (java_value_print): Pass architecture to
type_from_class and java_primitive_type_from_name. Use per-
architecture types instead of global types.
2009-07-02 14:09:27 +02:00
|
|
|
|
yylval.typed_val_int.type = parse_java_type->builtin_char;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
c = *lexptr++;
|
|
|
|
|
if (c != '\'')
|
|
|
|
|
{
|
|
|
|
|
namelen = skip_quoted (tokstart) - tokstart;
|
|
|
|
|
if (namelen > 2)
|
|
|
|
|
{
|
|
|
|
|
lexptr = tokstart + namelen;
|
|
|
|
|
if (lexptr[-1] != '\'')
|
2002-07-25 06:33:24 +02:00
|
|
|
|
error (_("Unmatched single quote"));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
namelen -= 2;
|
|
|
|
|
tokstart++;
|
|
|
|
|
goto tryname;
|
|
|
|
|
}
|
2002-07-25 06:33:24 +02:00
|
|
|
|
error (_("Invalid character constant"));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
return INTEGER_LITERAL;
|
|
|
|
|
|
|
|
|
|
case '(':
|
|
|
|
|
paren_depth++;
|
|
|
|
|
lexptr++;
|
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case ')':
|
|
|
|
|
if (paren_depth == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
paren_depth--;
|
|
|
|
|
lexptr++;
|
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case ',':
|
|
|
|
|
if (comma_terminates && paren_depth == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
lexptr++;
|
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case '.':
|
|
|
|
|
/* Might be a floating point number. */
|
|
|
|
|
if (lexptr[1] < '0' || lexptr[1] > '9')
|
2011-01-09 04:08:57 +01:00
|
|
|
|
goto symbol; /* Nope, must be a symbol. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
/* FALL THRU into number case. */
|
|
|
|
|
|
|
|
|
|
case '0':
|
|
|
|
|
case '1':
|
|
|
|
|
case '2':
|
|
|
|
|
case '3':
|
|
|
|
|
case '4':
|
|
|
|
|
case '5':
|
|
|
|
|
case '6':
|
|
|
|
|
case '7':
|
|
|
|
|
case '8':
|
|
|
|
|
case '9':
|
|
|
|
|
{
|
|
|
|
|
/* It's a number. */
|
|
|
|
|
int got_dot = 0, got_e = 0, toktype;
|
2003-09-25 18:50:38 +02:00
|
|
|
|
char *p = tokstart;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
int hex = input_radix > 10;
|
|
|
|
|
|
|
|
|
|
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
|
|
|
|
|
{
|
|
|
|
|
p += 2;
|
|
|
|
|
hex = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
|
|
|
|
|
{
|
|
|
|
|
p += 2;
|
|
|
|
|
hex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (;; ++p)
|
|
|
|
|
{
|
|
|
|
|
/* This test includes !hex because 'e' is a valid hex digit
|
|
|
|
|
and thus does not indicate a floating point number when
|
|
|
|
|
the radix is hex. */
|
|
|
|
|
if (!hex && !got_e && (*p == 'e' || *p == 'E'))
|
|
|
|
|
got_dot = got_e = 1;
|
|
|
|
|
/* This test does not include !hex, because a '.' always indicates
|
|
|
|
|
a decimal floating point number regardless of the radix. */
|
|
|
|
|
else if (!got_dot && *p == '.')
|
|
|
|
|
got_dot = 1;
|
|
|
|
|
else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
|
|
|
|
|
&& (*p == '-' || *p == '+'))
|
|
|
|
|
/* This is the sign of the exponent, not the end of the
|
|
|
|
|
number. */
|
|
|
|
|
continue;
|
|
|
|
|
/* We will take any letters or digits. parse_number will
|
|
|
|
|
complain if past the radix, or if L or U are not final. */
|
|
|
|
|
else if ((*p < '0' || *p > '9')
|
|
|
|
|
&& ((*p < 'a' || *p > 'z')
|
|
|
|
|
&& (*p < 'A' || *p > 'Z')))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
|
|
|
|
|
if (toktype == ERROR)
|
|
|
|
|
{
|
|
|
|
|
char *err_copy = (char *) alloca (p - tokstart + 1);
|
|
|
|
|
|
|
|
|
|
memcpy (err_copy, tokstart, p - tokstart);
|
|
|
|
|
err_copy[p - tokstart] = 0;
|
2002-07-25 06:33:24 +02:00
|
|
|
|
error (_("Invalid number \"%s\""), err_copy);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
lexptr = p;
|
|
|
|
|
return toktype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case '+':
|
|
|
|
|
case '-':
|
|
|
|
|
case '*':
|
|
|
|
|
case '/':
|
|
|
|
|
case '%':
|
|
|
|
|
case '|':
|
|
|
|
|
case '&':
|
|
|
|
|
case '^':
|
|
|
|
|
case '~':
|
|
|
|
|
case '!':
|
|
|
|
|
case '<':
|
|
|
|
|
case '>':
|
|
|
|
|
case '[':
|
|
|
|
|
case ']':
|
|
|
|
|
case '?':
|
|
|
|
|
case ':':
|
|
|
|
|
case '=':
|
|
|
|
|
case '{':
|
|
|
|
|
case '}':
|
|
|
|
|
symbol:
|
|
|
|
|
lexptr++;
|
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case '"':
|
|
|
|
|
|
|
|
|
|
/* Build the gdb internal form of the input string in tempbuf,
|
|
|
|
|
translating any standard C escape forms seen. Note that the
|
|
|
|
|
buffer is null byte terminated *only* for the convenience of
|
|
|
|
|
debugging gdb itself and printing the buffer contents when
|
|
|
|
|
the buffer contains no embedded nulls. Gdb does not depend
|
|
|
|
|
upon the buffer being null byte terminated, it uses the length
|
|
|
|
|
string instead. This allows gdb to handle C strings (as well
|
|
|
|
|
as strings in other languages) with embedded null bytes */
|
|
|
|
|
|
|
|
|
|
tokptr = ++tokstart;
|
|
|
|
|
tempbufindex = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
/* Grow the static temp buffer if necessary, including allocating
|
2011-01-09 04:08:57 +01:00
|
|
|
|
the first one on demand. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
if (tempbufindex + 1 >= tempbufsize)
|
|
|
|
|
{
|
|
|
|
|
tempbuf = (char *) realloc (tempbuf, tempbufsize += 64);
|
|
|
|
|
}
|
|
|
|
|
switch (*tokptr)
|
|
|
|
|
{
|
|
|
|
|
case '\0':
|
|
|
|
|
case '"':
|
2011-01-09 04:08:57 +01:00
|
|
|
|
/* Do nothing, loop will terminate. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
break;
|
|
|
|
|
case '\\':
|
|
|
|
|
tokptr++;
|
2010-03-05 21:18:19 +01:00
|
|
|
|
c = parse_escape (parse_gdbarch, &tokptr);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
if (c == -1)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
tempbuf[tempbufindex++] = c;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
tempbuf[tempbufindex++] = *tokptr++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} while ((*tokptr != '"') && (*tokptr != '\0'));
|
|
|
|
|
if (*tokptr++ != '"')
|
|
|
|
|
{
|
2002-07-25 06:33:24 +02:00
|
|
|
|
error (_("Unterminated string in expression"));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
tempbuf[tempbufindex] = '\0'; /* See note above */
|
|
|
|
|
yylval.sval.ptr = tempbuf;
|
|
|
|
|
yylval.sval.length = tempbufindex;
|
|
|
|
|
lexptr = tokptr;
|
|
|
|
|
return (STRING_LITERAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(c == '_' || c == '$'
|
|
|
|
|
|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
|
|
|
|
|
/* We must have come across a bad character (e.g. ';'). */
|
2002-07-25 06:33:24 +02:00
|
|
|
|
error (_("Invalid character '%c' in expression"), c);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
/* It's a name. See how long it is. */
|
|
|
|
|
namelen = 0;
|
|
|
|
|
for (c = tokstart[namelen];
|
|
|
|
|
(c == '_'
|
|
|
|
|
|| c == '$'
|
|
|
|
|
|| (c >= '0' && c <= '9')
|
|
|
|
|
|| (c >= 'a' && c <= 'z')
|
|
|
|
|
|| (c >= 'A' && c <= 'Z')
|
|
|
|
|
|| c == '<');
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
if (c == '<')
|
|
|
|
|
{
|
|
|
|
|
int i = namelen;
|
|
|
|
|
while (tokstart[++i] && tokstart[i] != '>');
|
|
|
|
|
if (tokstart[i] == '>')
|
|
|
|
|
namelen = i;
|
|
|
|
|
}
|
|
|
|
|
c = tokstart[++namelen];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The token "if" terminates the expression and is NOT
|
|
|
|
|
removed from the input stream. */
|
|
|
|
|
if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lexptr += namelen;
|
|
|
|
|
|
|
|
|
|
tryname:
|
|
|
|
|
|
|
|
|
|
/* Catch specific keywords. Should be done with a data structure. */
|
|
|
|
|
switch (namelen)
|
|
|
|
|
{
|
|
|
|
|
case 7:
|
2008-01-18 10:12:19 +01:00
|
|
|
|
if (strncmp (tokstart, "boolean", 7) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return BOOLEAN;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
2008-01-18 10:12:19 +01:00
|
|
|
|
if (strncmp (tokstart, "double", 6) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return DOUBLE;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
2008-01-18 10:12:19 +01:00
|
|
|
|
if (strncmp (tokstart, "short", 5) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return SHORT;
|
2008-01-18 10:12:19 +01:00
|
|
|
|
if (strncmp (tokstart, "false", 5) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
yylval.lval = 0;
|
|
|
|
|
return BOOLEAN_LITERAL;
|
|
|
|
|
}
|
2008-01-18 10:12:19 +01:00
|
|
|
|
if (strncmp (tokstart, "super", 5) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return SUPER;
|
2008-01-18 10:12:19 +01:00
|
|
|
|
if (strncmp (tokstart, "float", 5) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return FLOAT;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
2008-01-18 10:12:19 +01:00
|
|
|
|
if (strncmp (tokstart, "long", 4) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return LONG;
|
2008-01-18 10:12:19 +01:00
|
|
|
|
if (strncmp (tokstart, "byte", 4) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return BYTE;
|
2008-01-18 10:12:19 +01:00
|
|
|
|
if (strncmp (tokstart, "char", 4) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return CHAR;
|
2008-01-18 10:12:19 +01:00
|
|
|
|
if (strncmp (tokstart, "true", 4) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
yylval.lval = 1;
|
|
|
|
|
return BOOLEAN_LITERAL;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2003-11-06 23:54:02 +01:00
|
|
|
|
if (strncmp (tokstart, "int", 3) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return INT;
|
2003-11-06 23:54:02 +01:00
|
|
|
|
if (strncmp (tokstart, "new", 3) == 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return NEW;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yylval.sval.ptr = tokstart;
|
|
|
|
|
yylval.sval.length = namelen;
|
|
|
|
|
|
|
|
|
|
if (*tokstart == '$')
|
|
|
|
|
{
|
|
|
|
|
write_dollar_variable (yylval.sval);
|
|
|
|
|
return VARIABLE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Input names that aren't symbols but ARE valid hex numbers,
|
|
|
|
|
when the input radix permits them, can be names or numbers
|
|
|
|
|
depending on the parse. Note we support radixes > 16 here. */
|
|
|
|
|
if (((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
|
|
|
|
|
(tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
|
|
|
|
|
{
|
|
|
|
|
YYSTYPE newlval; /* Its value is ignored. */
|
|
|
|
|
int hextype = parse_number (tokstart, namelen, 0, &newlval);
|
|
|
|
|
if (hextype == INTEGER_LITERAL)
|
|
|
|
|
return NAME_OR_INT;
|
|
|
|
|
}
|
|
|
|
|
return IDENTIFIER;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2008-09-27 19:03:16 +02:00
|
|
|
|
yyerror (char *msg)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
2002-05-03 10:23:12 +02:00
|
|
|
|
if (prev_lexptr)
|
|
|
|
|
lexptr = prev_lexptr;
|
|
|
|
|
|
2002-07-25 06:33:24 +02:00
|
|
|
|
if (msg)
|
|
|
|
|
error (_("%s: near `%s'"), msg, lexptr);
|
|
|
|
|
else
|
|
|
|
|
error (_("error in expression, near `%s'"), lexptr);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct type *
|
2008-09-27 19:03:16 +02:00
|
|
|
|
java_type_from_name (struct stoken name)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
char *tmp = copy_name (name);
|
|
|
|
|
struct type *typ = java_lookup_class (tmp);
|
|
|
|
|
if (typ == NULL || TYPE_CODE (typ) != TYPE_CODE_STRUCT)
|
2002-07-25 06:33:24 +02:00
|
|
|
|
error (_("No class named `%s'"), tmp);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return typ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If NAME is a valid variable name in this scope, push it and return 1.
|
2011-01-09 04:08:57 +01:00
|
|
|
|
Otherwise, return 0. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
static int
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 20:27:14 +02:00
|
|
|
|
push_variable (struct stoken name)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
char *tmp = copy_name (name);
|
2012-12-14 18:47:40 +01:00
|
|
|
|
struct field_of_this_result is_a_field_of_this;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
struct symbol *sym;
|
2003-05-14 Elena Zannoni <ezannoni@redhat.com>
* symtab.h (enum domain_enum): Rename from namespace_enum.
(UNDEF_DOMAIN, VAR_DOMAIN, STRUCT_DOMAIN, LABEL_DOMAIN,
VARIABLES_DOMAIN, FUNCTIONS_DOMAIN, TYPES_DOMAIN, METHODS_DOMAIN):
Rename from UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE,
LABEL_NAMESPACE, VARIABLES_NAMESPACE, FUNCTIONS_NAMESPACE,
TYPES_NAMESPACE, METHODS_NAMESPACE.
(SYMBOL_NAMESPACE): Rename to SYMBOL_DOMAIN.
(struct symbol, struct partial_symbol): Rename field
'namespace_enum namespace' to 'domain_enum domain'.
(PSYMBOL_NAMESPACE): Rename to PSYMBOL_DOMAIN.
Delete old define kludge for namespace.
* ada-exp.y, ada-lang.c, ada-lang.h, alpha-tdep.c, arm-tdep.c,
blockframe.c, c-exp.y, c-valprint.c, coffread.c, dbxread.c,
dwarf2read.c, dwarfread.c, f-exp.y, gdbtypes.c, gdbtypes.h,
gnu-v3-abi.c, hppa-tdep.c, hpread.c, jv-exp.y, jv-lang.c,
language.c, linespec.c, m2-exp.y, m3-nat.c, mdebugread.c,
mips-tdep.c, nlmread.c, objc-exp.y, objc-lang.c, objfiles.c,
p-exp.y, p-valprint.c, parse.c, printcmd.c, scm-lang.c, source.c,
stabsread.c, stack.c, symfile.c, symfile.h, symmisc.c, symtab.c,
valops.c, values.c, xcoffread.c, xstormy16-tdep.c: Replace all
occurrences of the above.
2003-05-12 Elena Zannoni <ezannoni@redhat.com>
* mi-mi-cmd-stack.c (list_args_or_locals): Rename VAR_NAMESPACE to
VAR_DOMAIN.
2003-05-14 19:43:20 +02:00
|
|
|
|
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
|
* symtab.h (lookup_symbol_in_language): Remove SYMTAB parameter.
(lookup_symbol): Likewise.
* symtab.c (lookup_symbol_in_language): Remove SYMTAB parameter.
(lookup_symbol): Likewise.
(search_symbols): Update.
* linespec.c (find_methods, collect_methods): Update.
(add_matching_methods, add_constructors): Update.
(decode_compound, decode_dollar, decode_variable): Update.
(lookup_prefix_sym): Update.
(symbol_found): Remove SYM_SYMTAB parameter.
Use SYMBOL_SYMTAB (sym) instead.
* gdbtypes.c (lookup_typename): Update.
(lookup_struct, lookup_union, lookup_enum): Update.
(lookup_template_type): Update.
(check_typedef): Update.
* language.c (lang_bool_type): Update.
* mdebugread.c (parse_procedure): Update.
* mi/mi-cmd-stack.c (list_args_or_locals): Update.
* parse.c (write_dollar_variable): Update.
* printcmd.c (address_info): Update.
* source.c (select_source_symtab): Update.
* stack.c (print_frame_args, print_frame_arg_vars): Update.
* valops.c (find_function_in_inferior): Update.
(value_struct_elt_for_reference): Update.
* value.c (value_static_field, value_fn_field): Update.
* alpha-mdebug-tdep.c (find_proc_desc): Update.
* arm-tdep.c (arm_skip_prologue): Update.
* mt-tdep.c (mt_skip_prologue): Update.
* xstormy16-tdep.c (xstormy16_skip_prologue): Update.
* ada-lang.h (struct ada_symbol_info): Remove SYMTAB member.
* ada-lang.c (ada_add_block_symbols): Remove SYMTAB parameter.
(add_defn_to_vec): Likewise.
(ada_add_block_symbols): Likewise.
(lookup_cached_symbol, cache_symbol): Likewise.
(standard_lookup): Update.
(ada_lookup_symbol_list): Update.
* c-valprint.c (c_val_print): Update.
* cp-support.c (cp_lookup_rtti_type): Update.
* jv-lang.c (java_lookup_class, get_java_object_type): Update.
* objc-lang.c (lookup_struct_typedef, find_imps): Update.
* p-valprint.c (pascal_val_print): Update.
* scm-lang.c (scm_lookup_name): Update.
* c-exp.y: Update.
* f-exp.y: Update.
* jv-exp.y: Update.
* m2-exp.y: Update.
* objc-exp.y: Update.
* p-exp.y: Update.
2008-05-19 17:50:10 +02:00
|
|
|
|
&is_a_field_of_this);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
|
|
|
|
|
{
|
|
|
|
|
if (symbol_read_needs_frame (sym))
|
|
|
|
|
{
|
|
|
|
|
if (innermost_block == 0 ||
|
|
|
|
|
contained_in (block_found, innermost_block))
|
|
|
|
|
innermost_block = block_found;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
write_exp_elt_opcode (OP_VAR_VALUE);
|
|
|
|
|
/* We want to use the selected frame, not another more inner frame
|
|
|
|
|
which happens to be in the same block. */
|
|
|
|
|
write_exp_elt_block (NULL);
|
|
|
|
|
write_exp_elt_sym (sym);
|
|
|
|
|
write_exp_elt_opcode (OP_VAR_VALUE);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2012-12-14 18:47:40 +01:00
|
|
|
|
if (is_a_field_of_this.type != NULL)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
/* it hangs off of `this'. Must not inadvertently convert from a
|
|
|
|
|
method call to data ref. */
|
|
|
|
|
if (innermost_block == 0 ||
|
|
|
|
|
contained_in (block_found, innermost_block))
|
|
|
|
|
innermost_block = block_found;
|
|
|
|
|
write_exp_elt_opcode (OP_THIS);
|
|
|
|
|
write_exp_elt_opcode (OP_THIS);
|
|
|
|
|
write_exp_elt_opcode (STRUCTOP_PTR);
|
|
|
|
|
write_exp_string (name);
|
|
|
|
|
write_exp_elt_opcode (STRUCTOP_PTR);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Assuming a reference expression has been pushed, emit the
|
2007-05-14 18:44:27 +02:00
|
|
|
|
STRUCTOP_PTR ops to access the field named NAME. If NAME is a
|
2011-01-09 04:08:57 +01:00
|
|
|
|
qualified name (has '.'), generate a field access for each part. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2008-09-27 19:03:16 +02:00
|
|
|
|
push_fieldnames (struct stoken name)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
struct stoken token;
|
|
|
|
|
token.ptr = name.ptr;
|
|
|
|
|
for (i = 0; ; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i == name.length || name.ptr[i] == '.')
|
|
|
|
|
{
|
2011-01-09 04:08:57 +01:00
|
|
|
|
/* token.ptr is start of current field name. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
token.length = &name.ptr[i] - token.ptr;
|
2007-05-14 18:44:27 +02:00
|
|
|
|
write_exp_elt_opcode (STRUCTOP_PTR);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
write_exp_string (token);
|
2007-05-14 18:44:27 +02:00
|
|
|
|
write_exp_elt_opcode (STRUCTOP_PTR);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
token.ptr += token.length + 1;
|
|
|
|
|
}
|
|
|
|
|
if (i >= name.length)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Helper routine for push_expression_name.
|
|
|
|
|
Handle a qualified name, where DOT_INDEX is the index of the first '.' */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 20:27:14 +02:00
|
|
|
|
push_qualified_expression_name (struct stoken name, int dot_index)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
struct stoken token;
|
|
|
|
|
char *tmp;
|
|
|
|
|
struct type *typ;
|
|
|
|
|
|
|
|
|
|
token.ptr = name.ptr;
|
|
|
|
|
token.length = dot_index;
|
|
|
|
|
|
|
|
|
|
if (push_variable (token))
|
|
|
|
|
{
|
|
|
|
|
token.ptr = name.ptr + dot_index + 1;
|
|
|
|
|
token.length = name.length - dot_index - 1;
|
|
|
|
|
push_fieldnames (token);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
token.ptr = name.ptr;
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
token.length = dot_index;
|
|
|
|
|
tmp = copy_name (token);
|
|
|
|
|
typ = java_lookup_class (tmp);
|
|
|
|
|
if (typ != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (dot_index == name.length)
|
|
|
|
|
{
|
|
|
|
|
write_exp_elt_opcode(OP_TYPE);
|
|
|
|
|
write_exp_elt_type(typ);
|
|
|
|
|
write_exp_elt_opcode(OP_TYPE);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
dot_index++; /* Skip '.' */
|
|
|
|
|
name.ptr += dot_index;
|
|
|
|
|
name.length -= dot_index;
|
|
|
|
|
dot_index = 0;
|
|
|
|
|
while (dot_index < name.length && name.ptr[dot_index] != '.')
|
|
|
|
|
dot_index++;
|
|
|
|
|
token.ptr = name.ptr;
|
|
|
|
|
token.length = dot_index;
|
|
|
|
|
write_exp_elt_opcode (OP_SCOPE);
|
|
|
|
|
write_exp_elt_type (typ);
|
|
|
|
|
write_exp_string (token);
|
|
|
|
|
write_exp_elt_opcode (OP_SCOPE);
|
|
|
|
|
if (dot_index < name.length)
|
|
|
|
|
{
|
|
|
|
|
dot_index++;
|
|
|
|
|
name.ptr += dot_index;
|
|
|
|
|
name.length -= dot_index;
|
|
|
|
|
push_fieldnames (name);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (dot_index >= name.length)
|
|
|
|
|
break;
|
|
|
|
|
dot_index++; /* Skip '.' */
|
|
|
|
|
while (dot_index < name.length && name.ptr[dot_index] != '.')
|
|
|
|
|
dot_index++;
|
|
|
|
|
}
|
2002-07-25 06:33:24 +02:00
|
|
|
|
error (_("unknown type `%.*s'"), name.length, name.ptr);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Handle Name in an expression (or LHS).
|
2011-01-09 04:08:57 +01:00
|
|
|
|
Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2008-09-27 19:03:16 +02:00
|
|
|
|
push_expression_name (struct stoken name)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
char *tmp;
|
|
|
|
|
struct type *typ;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < name.length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (name.ptr[i] == '.')
|
|
|
|
|
{
|
2011-01-09 04:08:57 +01:00
|
|
|
|
/* It's a Qualified Expression Name. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
push_qualified_expression_name (name, i);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-09 04:08:57 +01:00
|
|
|
|
/* It's a Simple Expression Name. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
if (push_variable (name))
|
|
|
|
|
return;
|
|
|
|
|
tmp = copy_name (name);
|
|
|
|
|
typ = java_lookup_class (tmp);
|
|
|
|
|
if (typ != NULL)
|
|
|
|
|
{
|
|
|
|
|
write_exp_elt_opcode(OP_TYPE);
|
|
|
|
|
write_exp_elt_type(typ);
|
|
|
|
|
write_exp_elt_opcode(OP_TYPE);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
struct minimal_symbol *msymbol;
|
|
|
|
|
|
|
|
|
|
msymbol = lookup_minimal_symbol (tmp, NULL, NULL);
|
|
|
|
|
if (msymbol != NULL)
|
2008-09-11 16:08:33 +02:00
|
|
|
|
write_exp_msymbol (msymbol);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
else if (!have_full_symbols () && !have_partial_symbols ())
|
2002-07-25 06:33:24 +02:00
|
|
|
|
error (_("No symbol table is loaded. Use the \"file\" command"));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
else
|
2012-08-24 05:17:13 +02:00
|
|
|
|
error (_("No symbol \"%s\" in current context."), tmp);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* The following two routines, copy_exp and insert_exp, aren't specific to
|
|
|
|
|
Java, so they could go in parse.c, but their only purpose is to support
|
|
|
|
|
the parsing kludges we use in this file, so maybe it's best to isolate
|
|
|
|
|
them here. */
|
|
|
|
|
|
|
|
|
|
/* Copy the expression whose last element is at index ENDPOS - 1 in EXPR
|
|
|
|
|
into a freshly malloc'ed struct expression. Its language_defn is set
|
|
|
|
|
to null. */
|
|
|
|
|
static struct expression *
|
2008-09-27 19:03:16 +02:00
|
|
|
|
copy_exp (struct expression *expr, int endpos)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
int len = length_of_subexp (expr, endpos);
|
|
|
|
|
struct expression *new
|
|
|
|
|
= (struct expression *) malloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
|
|
|
|
|
new->nelts = len;
|
|
|
|
|
memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
|
|
|
|
|
new->language_defn = 0;
|
|
|
|
|
|
|
|
|
|
return new;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Insert the expression NEW into the current expression (expout) at POS. */
|
|
|
|
|
static void
|
2008-09-27 19:03:16 +02:00
|
|
|
|
insert_exp (int pos, struct expression *new)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
int newlen = new->nelts;
|
|
|
|
|
|
|
|
|
|
/* Grow expout if necessary. In this function's only use at present,
|
|
|
|
|
this should never be necessary. */
|
|
|
|
|
if (expout_ptr + newlen > expout_size)
|
|
|
|
|
{
|
|
|
|
|
expout_size = max (expout_size * 2, expout_ptr + newlen + 10);
|
|
|
|
|
expout = (struct expression *)
|
|
|
|
|
realloc ((char *) expout, (sizeof (struct expression)
|
|
|
|
|
+ EXP_ELEM_TO_BYTES (expout_size)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = expout_ptr - 1; i >= pos; i--)
|
|
|
|
|
expout->elts[i + newlen] = expout->elts[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memcpy (expout->elts + pos, new->elts, EXP_ELEM_TO_BYTES (newlen));
|
|
|
|
|
expout_ptr += newlen;
|
|
|
|
|
}
|