mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-02 04:27:46 +08:00
Remove `expout*' globals from parser-defs.h
This commit removes the "expout*" globals from our parser code, turning them into a structure that is passed when an expression needs to be evaluated. This is the initial step to make our parser less "globalized". This is mostly a mechanical patch, which creates a structure containing the "expout*" globals and then modify all the functions that handle them in order to take the structure as argument. It is big, and has been reviewed at least 4 times, so I think everything is covered. Below you can see the message links from the discussions: - First attempt: <https://sourceware.org/ml/gdb-patches/2012-01/msg00522.html> Message-ID: <m3k44s7qej.fsf@gmail.com> - Second attempt: <https://sourceware.org/ml/gdb-patches/2012-06/msg00054.html> Message-Id: <1338665528-5932-1-git-send-email-sergiodj@redhat.com> - Third attempt: <https://sourceware.org/ml/gdb-patches/2014-01/msg00949.html> Message-Id: <1390629467-27139-1-git-send-email-sergiodj@redhat.com> - Fourth (last) attempt: <https://sourceware.org/ml/gdb-patches/2014-03/msg00546.html> Message-Id: <1395463432-29750-1-git-send-email-sergiodj@redhat.com> gdb/ 2014-03-27 Sergio Durigan Junior <sergiodj@redhat.com> Remove some globals from our parser. * language.c (unk_lang_parser): Add "struct parser_state" argument. * language.h (struct language_defn) <la_parser>: Likewise. * parse.c (expout, expout_size, expout_ptr): Remove variables. (initialize_expout): Add "struct parser_state" argument. Rewrite function to use the parser state. (reallocate_expout, write_exp_elt, write_exp_elt_opcode, write_exp_elt_sym, write_exp_elt_block, write_exp_elt_objfile, write_exp_elt_longcst, write_exp_elt_dblcst, write_exp_elt_decfloatcst, write_exp_elt_type, write_exp_elt_intern, write_exp_string, write_exp_string_vector, write_exp_bitstring, write_exp_msymbol, mark_struct_expression, write_dollar_variable): Likewise. (parse_exp_in_context_1): Use parser state. (insert_type_address_space): Add "struct parser_state" argument. Use parser state. (increase_expout_size): New function. * parser-defs.h: Forward declare "struct language_defn" and "struct parser_state". (expout, expout_size, expout_ptr): Remove extern declarations. (parse_gdbarch, parse_language): Rewrite macro declarations to accept the parser state. (struct parser_state): New struct. (initialize_expout, reallocate_expout, write_exp_elt_opcode, write_exp_elt_sym, write_exp_elt_longcst, write_exp_elt_dblcst, write_exp_elt_decfloatcst, write_exp_elt_type, write_exp_elt_intern, write_exp_string, write_exp_string_vector, write_exp_bitstring, write_exp_elt_block, write_exp_elt_objfile, write_exp_msymbol, write_dollar_variable, mark_struct_expression, insert_type_address_space): Add "struct parser_state" argument. (increase_expout_size): New function. * utils.c (do_clear_parser_state): New function. (make_cleanup_clear_parser_state): Likewise. * utils.h (make_cleanup_clear_parser_state): New function prototype. * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Update calls to write_exp* in order to pass the parser state. * arm-linux-tdep.c (arm_stap_parse_special_token): Likewise. * i386-tdep.c (i386_stap_parse_special_token_triplet): Likewise. (i386_stap_parse_special_token_three_arg_disp): Likewise. * ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise. * stap-probe.c (stap_parse_register_operand): Likewise. (stap_parse_single_operand): Likewise. (stap_parse_argument_1): Likewise. (stap_parse_argument): Use parser state. * stap-probe.h: Include "parser-defs.h". (struct stap_parse_info) <pstate>: New field. * c-exp.y (parse_type): Rewrite to use parser state. (yyparse): Redefine to c_parse_internal. (pstate): New global variable. (parse_number): Add "struct parser_state" argument. (write_destructor_name): Likewise. (type_exp): Update calls to write_exp* and similars in order to use parser state. (exp1, exp, variable, qualified_name, space_identifier, typename, typebase): Likewise. (write_destructor_name, parse_number, lex_one_token, classify_name, classify_inner_name, c_parse): Add "struct parser_state" argument. Update function to use parser state. * c-lang.h: Forward declare "struct parser_state". (c_parse): Add "struct parser_state" argument. * ada-exp.y (parse_type): Rewrite macro to use parser state. (yyparse): Redefine macro to ada_parse_internal. (pstate): New variable. (write_int, write_object_renaming, write_var_or_type, write_name_assoc, write_exp_op_with_string, write_ambiguous_var, type_int, type_long, type_long_long, type_float, type_double, type_long_double, type_char, type_boolean, type_system_address): Add "struct parser_state" argument. (exp1, primary, simple_exp, relation, and_exp, and_then_exp, or_exp, or_else_exp, xor_exp, type_prefix, opt_type_prefix, var_or_type, aggregate, aggregate_component_list, positional_list, others, component_group, component_associations): Update calls to write_exp* and similar functions in order to use parser state. (ada_parse, write_var_from_sym, write_int, write_exp_op_with_string, write_object_renaming, find_primitive_type, write_selectors, write_ambiguous_var, write_var_or_type, write_name_assoc, type_int, type_long, type_long_long, type_float, type_double, type_long_double, type_char, type_boolean, type_system_address): Add "struct parser_state" argument. Adjust function to use parser state. * ada-lang.c (parse): Likewise. * ada-lang.h: Forward declare "struct parser_state". (ada_parse): Add "struct parser_state" argument. * ada-lex.l (processInt, processReal): Likewise. Adjust all calls to both functions. * f-exp.y (parse_type, parse_f_type): Rewrite macros to use parser state. (yyparse): Redefine macro to f_parse_internal. (pstate): New variable. (parse_number): Add "struct parser_state" argument. (type_exp, exp, subrange, typebase): Update calls to write_exp* and similars in order to use parser state. (parse_number): Adjust code to use parser state. (yylex): Likewise. (f_parse): New function. * f-lang.h: Forward declare "struct parser_state". (f_parse): Add "struct parser_state" argument. * jv-exp.y (parse_type, parse_java_type): Rewrite macros to use parser state. (yyparse): Redefine macro for java_parse_internal. (pstate): New variable. (push_expression_name, push_expression_name, insert_exp): Add "struct parser_state" argument. (type_exp, StringLiteral, Literal, PrimitiveType, IntegralType, FloatingPointType, exp1, PrimaryNoNewArray, FieldAccess, FuncStart, MethodInvocation, ArrayAccess, PostfixExpression, PostIncrementExpression, PostDecrementExpression, UnaryExpression, PreIncrementExpression, PreDecrementExpression, UnaryExpressionNotPlusMinus, CastExpression, MultiplicativeExpression, AdditiveExpression, ShiftExpression, RelationalExpression, EqualityExpression, AndExpression, ExclusiveOrExpression, InclusiveOrExpression, ConditionalAndExpression, ConditionalOrExpression, ConditionalExpression, Assignment, LeftHandSide): Update calls to write_exp* and similars in order to use parser state. (parse_number): Ajust code to use parser state. (yylex): Likewise. (java_parse): New function. (push_variable): Add "struct parser_state" argument. Adjust code to user parser state. (push_fieldnames, push_qualified_expression_name, push_expression_name, insert_exp): Likewise. * jv-lang.h: Forward declare "struct parser_state". (java_parse): Add "struct parser_state" argument. * m2-exp.y (parse_type, parse_m2_type): Rewrite macros to use parser state. (yyparse): Redefine macro to m2_parse_internal. (pstate): New variable. (type_exp, exp, fblock, variable, type): Update calls to write_exp* and similars to use parser state. (yylex): Likewise. (m2_parse): New function. * m2-lang.h: Forward declare "struct parser_state". (m2_parse): Add "struct parser_state" argument. * objc-lang.c (end_msglist): Add "struct parser_state" argument. * objc-lang.h: Forward declare "struct parser_state". (end_msglist): Add "struct parser_state" argument. * p-exp.y (parse_type): Rewrite macro to use parser state. (yyparse): Redefine macro to pascal_parse_internal. (pstate): New variable. (parse_number): Add "struct parser_state" argument. (type_exp, exp1, exp, qualified_name, variable): Update calls to write_exp* and similars in order to use parser state. (parse_number, yylex): Adjust code to use parser state. (pascal_parse): New function. * p-lang.h: Forward declare "struct parser_state". (pascal_parse): Add "struct parser_state" argument. * go-exp.y (parse_type): Rewrite macro to use parser state. (yyparse): Redefine macro to go_parse_internal. (pstate): New variable. (parse_number): Add "struct parser_state" argument. (type_exp, exp1, exp, variable, type): Update calls to write_exp* and similars in order to use parser state. (parse_number, lex_one_token, classify_name, yylex): Adjust code to use parser state. (go_parse): Likewise. * go-lang.h: Forward declare "struct parser_state". (go_parse): Add "struct parser_state" argument.
This commit is contained in:
165
gdb/ChangeLog
165
gdb/ChangeLog
@ -1,3 +1,168 @@
|
|||||||
|
2014-03-27 Sergio Durigan Junior <sergiodj@redhat.com>
|
||||||
|
|
||||||
|
Remove some globals from our parser.
|
||||||
|
* language.c (unk_lang_parser): Add "struct parser_state"
|
||||||
|
argument.
|
||||||
|
* language.h (struct language_defn) <la_parser>: Likewise.
|
||||||
|
* parse.c (expout, expout_size, expout_ptr): Remove variables.
|
||||||
|
(initialize_expout): Add "struct parser_state" argument.
|
||||||
|
Rewrite function to use the parser state.
|
||||||
|
(reallocate_expout, write_exp_elt, write_exp_elt_opcode,
|
||||||
|
write_exp_elt_sym, write_exp_elt_block, write_exp_elt_objfile,
|
||||||
|
write_exp_elt_longcst, write_exp_elt_dblcst,
|
||||||
|
write_exp_elt_decfloatcst, write_exp_elt_type,
|
||||||
|
write_exp_elt_intern, write_exp_string, write_exp_string_vector,
|
||||||
|
write_exp_bitstring, write_exp_msymbol, mark_struct_expression,
|
||||||
|
write_dollar_variable): Likewise.
|
||||||
|
(parse_exp_in_context_1): Use parser state.
|
||||||
|
(insert_type_address_space): Add "struct parser_state" argument.
|
||||||
|
Use parser state.
|
||||||
|
(increase_expout_size): New function.
|
||||||
|
* parser-defs.h: Forward declare "struct language_defn" and
|
||||||
|
"struct parser_state".
|
||||||
|
(expout, expout_size, expout_ptr): Remove extern declarations.
|
||||||
|
(parse_gdbarch, parse_language): Rewrite macro declarations to
|
||||||
|
accept the parser state.
|
||||||
|
(struct parser_state): New struct.
|
||||||
|
(initialize_expout, reallocate_expout, write_exp_elt_opcode,
|
||||||
|
write_exp_elt_sym, write_exp_elt_longcst, write_exp_elt_dblcst,
|
||||||
|
write_exp_elt_decfloatcst, write_exp_elt_type,
|
||||||
|
write_exp_elt_intern, write_exp_string, write_exp_string_vector,
|
||||||
|
write_exp_bitstring, write_exp_elt_block, write_exp_elt_objfile,
|
||||||
|
write_exp_msymbol, write_dollar_variable,
|
||||||
|
mark_struct_expression, insert_type_address_space): Add "struct
|
||||||
|
parser_state" argument.
|
||||||
|
(increase_expout_size): New function.
|
||||||
|
* utils.c (do_clear_parser_state): New function.
|
||||||
|
(make_cleanup_clear_parser_state): Likewise.
|
||||||
|
* utils.h (make_cleanup_clear_parser_state): New function
|
||||||
|
prototype.
|
||||||
|
* aarch64-linux-tdep.c (aarch64_stap_parse_special_token):
|
||||||
|
Update calls to write_exp* in order to pass the parser state.
|
||||||
|
* arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
|
||||||
|
* i386-tdep.c (i386_stap_parse_special_token_triplet): Likewise.
|
||||||
|
(i386_stap_parse_special_token_three_arg_disp): Likewise.
|
||||||
|
* ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
|
||||||
|
* stap-probe.c (stap_parse_register_operand): Likewise.
|
||||||
|
(stap_parse_single_operand): Likewise.
|
||||||
|
(stap_parse_argument_1): Likewise.
|
||||||
|
(stap_parse_argument): Use parser state.
|
||||||
|
* stap-probe.h: Include "parser-defs.h".
|
||||||
|
(struct stap_parse_info) <pstate>: New field.
|
||||||
|
* c-exp.y (parse_type): Rewrite to use parser state.
|
||||||
|
(yyparse): Redefine to c_parse_internal.
|
||||||
|
(pstate): New global variable.
|
||||||
|
(parse_number): Add "struct parser_state" argument.
|
||||||
|
(write_destructor_name): Likewise.
|
||||||
|
(type_exp): Update calls to write_exp* and similars in order to
|
||||||
|
use parser state.
|
||||||
|
(exp1, exp, variable, qualified_name, space_identifier,
|
||||||
|
typename, typebase): Likewise.
|
||||||
|
(write_destructor_name, parse_number, lex_one_token,
|
||||||
|
classify_name, classify_inner_name, c_parse): Add "struct
|
||||||
|
parser_state" argument. Update function to use parser state.
|
||||||
|
* c-lang.h: Forward declare "struct parser_state".
|
||||||
|
(c_parse): Add "struct parser_state" argument.
|
||||||
|
* ada-exp.y (parse_type): Rewrite macro to use parser state.
|
||||||
|
(yyparse): Redefine macro to ada_parse_internal.
|
||||||
|
(pstate): New variable.
|
||||||
|
(write_int, write_object_renaming, write_var_or_type,
|
||||||
|
write_name_assoc, write_exp_op_with_string, write_ambiguous_var,
|
||||||
|
type_int, type_long, type_long_long, type_float, type_double,
|
||||||
|
type_long_double, type_char, type_boolean, type_system_address):
|
||||||
|
Add "struct parser_state" argument.
|
||||||
|
(exp1, primary, simple_exp, relation, and_exp, and_then_exp,
|
||||||
|
or_exp, or_else_exp, xor_exp, type_prefix, opt_type_prefix,
|
||||||
|
var_or_type, aggregate, aggregate_component_list,
|
||||||
|
positional_list, others, component_group,
|
||||||
|
component_associations): Update calls to write_exp* and similar
|
||||||
|
functions in order to use parser state.
|
||||||
|
(ada_parse, write_var_from_sym, write_int,
|
||||||
|
write_exp_op_with_string, write_object_renaming,
|
||||||
|
find_primitive_type, write_selectors, write_ambiguous_var,
|
||||||
|
write_var_or_type, write_name_assoc, type_int, type_long,
|
||||||
|
type_long_long, type_float, type_double, type_long_double,
|
||||||
|
type_char, type_boolean, type_system_address): Add "struct
|
||||||
|
parser_state" argument. Adjust function to use parser state.
|
||||||
|
* ada-lang.c (parse): Likewise.
|
||||||
|
* ada-lang.h: Forward declare "struct parser_state".
|
||||||
|
(ada_parse): Add "struct parser_state" argument.
|
||||||
|
* ada-lex.l (processInt, processReal): Likewise. Adjust all
|
||||||
|
calls to both functions.
|
||||||
|
* f-exp.y (parse_type, parse_f_type): Rewrite macros to use
|
||||||
|
parser state.
|
||||||
|
(yyparse): Redefine macro to f_parse_internal.
|
||||||
|
(pstate): New variable.
|
||||||
|
(parse_number): Add "struct parser_state" argument.
|
||||||
|
(type_exp, exp, subrange, typebase): Update calls to write_exp*
|
||||||
|
and similars in order to use parser state.
|
||||||
|
(parse_number): Adjust code to use parser state.
|
||||||
|
(yylex): Likewise.
|
||||||
|
(f_parse): New function.
|
||||||
|
* f-lang.h: Forward declare "struct parser_state".
|
||||||
|
(f_parse): Add "struct parser_state" argument.
|
||||||
|
* jv-exp.y (parse_type, parse_java_type): Rewrite macros to use
|
||||||
|
parser state.
|
||||||
|
(yyparse): Redefine macro for java_parse_internal.
|
||||||
|
(pstate): New variable.
|
||||||
|
(push_expression_name, push_expression_name, insert_exp): Add
|
||||||
|
"struct parser_state" argument.
|
||||||
|
(type_exp, StringLiteral, Literal, PrimitiveType, IntegralType,
|
||||||
|
FloatingPointType, exp1, PrimaryNoNewArray, FieldAccess,
|
||||||
|
FuncStart, MethodInvocation, ArrayAccess, PostfixExpression,
|
||||||
|
PostIncrementExpression, PostDecrementExpression,
|
||||||
|
UnaryExpression, PreIncrementExpression, PreDecrementExpression,
|
||||||
|
UnaryExpressionNotPlusMinus, CastExpression,
|
||||||
|
MultiplicativeExpression, AdditiveExpression, ShiftExpression,
|
||||||
|
RelationalExpression, EqualityExpression, AndExpression,
|
||||||
|
ExclusiveOrExpression, InclusiveOrExpression,
|
||||||
|
ConditionalAndExpression, ConditionalOrExpression,
|
||||||
|
ConditionalExpression, Assignment, LeftHandSide): Update
|
||||||
|
calls to write_exp* and similars in order to use parser state.
|
||||||
|
(parse_number): Ajust code to use parser state.
|
||||||
|
(yylex): Likewise.
|
||||||
|
(java_parse): New function.
|
||||||
|
(push_variable): Add "struct parser_state" argument. Adjust
|
||||||
|
code to user parser state.
|
||||||
|
(push_fieldnames, push_qualified_expression_name,
|
||||||
|
push_expression_name, insert_exp): Likewise.
|
||||||
|
* jv-lang.h: Forward declare "struct parser_state".
|
||||||
|
(java_parse): Add "struct parser_state" argument.
|
||||||
|
* m2-exp.y (parse_type, parse_m2_type): Rewrite macros to use
|
||||||
|
parser state.
|
||||||
|
(yyparse): Redefine macro to m2_parse_internal.
|
||||||
|
(pstate): New variable.
|
||||||
|
(type_exp, exp, fblock, variable, type): Update calls to
|
||||||
|
write_exp* and similars to use parser state.
|
||||||
|
(yylex): Likewise.
|
||||||
|
(m2_parse): New function.
|
||||||
|
* m2-lang.h: Forward declare "struct parser_state".
|
||||||
|
(m2_parse): Add "struct parser_state" argument.
|
||||||
|
* objc-lang.c (end_msglist): Add "struct parser_state" argument.
|
||||||
|
* objc-lang.h: Forward declare "struct parser_state".
|
||||||
|
(end_msglist): Add "struct parser_state" argument.
|
||||||
|
* p-exp.y (parse_type): Rewrite macro to use parser state.
|
||||||
|
(yyparse): Redefine macro to pascal_parse_internal.
|
||||||
|
(pstate): New variable.
|
||||||
|
(parse_number): Add "struct parser_state" argument.
|
||||||
|
(type_exp, exp1, exp, qualified_name, variable): Update calls to
|
||||||
|
write_exp* and similars in order to use parser state.
|
||||||
|
(parse_number, yylex): Adjust code to use parser state.
|
||||||
|
(pascal_parse): New function.
|
||||||
|
* p-lang.h: Forward declare "struct parser_state".
|
||||||
|
(pascal_parse): Add "struct parser_state" argument.
|
||||||
|
* go-exp.y (parse_type): Rewrite macro to use parser state.
|
||||||
|
(yyparse): Redefine macro to go_parse_internal.
|
||||||
|
(pstate): New variable.
|
||||||
|
(parse_number): Add "struct parser_state" argument.
|
||||||
|
(type_exp, exp1, exp, variable, type): Update calls to
|
||||||
|
write_exp* and similars in order to use parser state.
|
||||||
|
(parse_number, lex_one_token, classify_name, yylex): Adjust code
|
||||||
|
to use parser state.
|
||||||
|
(go_parse): Likewise.
|
||||||
|
* go-lang.h: Forward declare "struct parser_state".
|
||||||
|
(go_parse): Add "struct parser_state" argument.
|
||||||
|
|
||||||
2014-03-27 Doug Evans <dje@google.com>
|
2014-03-27 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
* dwarf2read.c (read_str_index): Delete arg cu. All callers updated.
|
* dwarf2read.c (read_str_index): Delete arg cu. All callers updated.
|
||||||
|
@ -352,28 +352,28 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* The displacement. */
|
/* The displacement. */
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
|
write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
|
||||||
write_exp_elt_longcst (displacement);
|
write_exp_elt_longcst (&p->pstate, displacement);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
if (got_minus)
|
if (got_minus)
|
||||||
write_exp_elt_opcode (UNOP_NEG);
|
write_exp_elt_opcode (&p->pstate, UNOP_NEG);
|
||||||
|
|
||||||
/* The register name. */
|
/* The register name. */
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
str.ptr = regname;
|
str.ptr = regname;
|
||||||
str.length = len;
|
str.length = len;
|
||||||
write_exp_string (str);
|
write_exp_string (&p->pstate, str);
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
|
|
||||||
write_exp_elt_opcode (BINOP_ADD);
|
write_exp_elt_opcode (&p->pstate, BINOP_ADD);
|
||||||
|
|
||||||
/* Casting to the expected type. */
|
/* Casting to the expected type. */
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
write_exp_elt_type (lookup_pointer_type (p->arg_type));
|
write_exp_elt_type (&p->pstate, lookup_pointer_type (p->arg_type));
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
|
|
||||||
write_exp_elt_opcode (UNOP_IND);
|
write_exp_elt_opcode (&p->pstate, UNOP_IND);
|
||||||
|
|
||||||
p->arg = tmp;
|
p->arg = tmp;
|
||||||
}
|
}
|
||||||
|
488
gdb/ada-exp.y
488
gdb/ada-exp.y
File diff suppressed because it is too large
Load Diff
@ -13376,10 +13376,10 @@ emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse (void)
|
parse (struct parser_state *ps)
|
||||||
{
|
{
|
||||||
warnings_issued = 0;
|
warnings_issued = 0;
|
||||||
return ada_parse ();
|
return ada_parse (ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct exp_descriptor ada_exp_descriptor = {
|
static const struct exp_descriptor ada_exp_descriptor = {
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
struct frame_info;
|
struct frame_info;
|
||||||
struct inferior;
|
struct inferior;
|
||||||
struct type_print_options;
|
struct type_print_options;
|
||||||
|
struct parser_state;
|
||||||
|
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
#include "gdbtypes.h"
|
#include "gdbtypes.h"
|
||||||
@ -169,7 +170,7 @@ extern int ada_get_field_index (const struct type *type,
|
|||||||
const char *field_name,
|
const char *field_name,
|
||||||
int maybe_missing);
|
int maybe_missing);
|
||||||
|
|
||||||
extern int ada_parse (void); /* Defined in ada-exp.y */
|
extern int ada_parse (struct parser_state *); /* Defined in ada-exp.y */
|
||||||
|
|
||||||
extern void ada_error (char *); /* Defined in ada-exp.y */
|
extern void ada_error (char *); /* Defined in ada-exp.y */
|
||||||
|
|
||||||
|
@ -48,8 +48,9 @@ POSEXP (e"+"?{NUM10})
|
|||||||
static char numbuf[NUMERAL_WIDTH];
|
static char numbuf[NUMERAL_WIDTH];
|
||||||
static void canonicalizeNumeral (char *s1, const char *);
|
static void canonicalizeNumeral (char *s1, const char *);
|
||||||
static struct stoken processString (const char*, int);
|
static struct stoken processString (const char*, int);
|
||||||
static int processInt (const char *, const char *, const char *);
|
static int processInt (struct parser_state *, const char *, const char *,
|
||||||
static int processReal (const char *);
|
const char *);
|
||||||
|
static int processReal (struct parser_state *, const char *);
|
||||||
static struct stoken processId (const char *, int);
|
static struct stoken processId (const char *, int);
|
||||||
static int processAttribute (const char *);
|
static int processAttribute (const char *);
|
||||||
static int find_dot_all (const char *);
|
static int find_dot_all (const char *);
|
||||||
@ -89,40 +90,42 @@ static int find_dot_all (const char *);
|
|||||||
|
|
||||||
{NUM10}{POSEXP} {
|
{NUM10}{POSEXP} {
|
||||||
canonicalizeNumeral (numbuf, yytext);
|
canonicalizeNumeral (numbuf, yytext);
|
||||||
return processInt (NULL, numbuf, strrchr(numbuf, 'e')+1);
|
return processInt (pstate, NULL, numbuf,
|
||||||
|
strrchr (numbuf, 'e') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
{NUM10} {
|
{NUM10} {
|
||||||
canonicalizeNumeral (numbuf, yytext);
|
canonicalizeNumeral (numbuf, yytext);
|
||||||
return processInt (NULL, numbuf, NULL);
|
return processInt (pstate, NULL, numbuf, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
{NUM10}"#"{HEXDIG}({HEXDIG}|_)*"#"{POSEXP} {
|
{NUM10}"#"{HEXDIG}({HEXDIG}|_)*"#"{POSEXP} {
|
||||||
canonicalizeNumeral (numbuf, yytext);
|
canonicalizeNumeral (numbuf, yytext);
|
||||||
return processInt (numbuf,
|
return processInt (pstate, numbuf,
|
||||||
strchr (numbuf, '#') + 1,
|
strchr (numbuf, '#') + 1,
|
||||||
strrchr(numbuf, '#') + 1);
|
strrchr(numbuf, '#') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
{NUM10}"#"{HEXDIG}({HEXDIG}|_)*"#" {
|
{NUM10}"#"{HEXDIG}({HEXDIG}|_)*"#" {
|
||||||
canonicalizeNumeral (numbuf, yytext);
|
canonicalizeNumeral (numbuf, yytext);
|
||||||
return processInt (numbuf, strchr (numbuf, '#') + 1, NULL);
|
return processInt (pstate, numbuf, strchr (numbuf, '#') + 1,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
"0x"{HEXDIG}+ {
|
"0x"{HEXDIG}+ {
|
||||||
canonicalizeNumeral (numbuf, yytext+2);
|
canonicalizeNumeral (numbuf, yytext+2);
|
||||||
return processInt ("16#", numbuf, NULL);
|
return processInt (pstate, "16#", numbuf, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{NUM10}"."{NUM10}{EXP} {
|
{NUM10}"."{NUM10}{EXP} {
|
||||||
canonicalizeNumeral (numbuf, yytext);
|
canonicalizeNumeral (numbuf, yytext);
|
||||||
return processReal (numbuf);
|
return processReal (pstate, numbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
{NUM10}"."{NUM10} {
|
{NUM10}"."{NUM10} {
|
||||||
canonicalizeNumeral (numbuf, yytext);
|
canonicalizeNumeral (numbuf, yytext);
|
||||||
return processReal (numbuf);
|
return processReal (pstate, numbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
{NUM10}"#"{NUM16}"."{NUM16}"#"{EXP} {
|
{NUM10}"#"{NUM16}"."{NUM16}"#"{EXP} {
|
||||||
@ -134,14 +137,14 @@ static int find_dot_all (const char *);
|
|||||||
}
|
}
|
||||||
|
|
||||||
<INITIAL>"'"({GRAPHIC}|\")"'" {
|
<INITIAL>"'"({GRAPHIC}|\")"'" {
|
||||||
yylval.typed_val.type = type_char ();
|
yylval.typed_val.type = type_char (pstate);
|
||||||
yylval.typed_val.val = yytext[1];
|
yylval.typed_val.val = yytext[1];
|
||||||
return CHARLIT;
|
return CHARLIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
<INITIAL>"'[\""{HEXDIG}{2}"\"]'" {
|
<INITIAL>"'[\""{HEXDIG}{2}"\"]'" {
|
||||||
int v;
|
int v;
|
||||||
yylval.typed_val.type = type_char ();
|
yylval.typed_val.type = type_char (pstate);
|
||||||
sscanf (yytext+3, "%2x", &v);
|
sscanf (yytext+3, "%2x", &v);
|
||||||
yylval.typed_val.val = v;
|
yylval.typed_val.val = v;
|
||||||
return CHARLIT;
|
return CHARLIT;
|
||||||
@ -324,7 +327,8 @@ canonicalizeNumeral (char *s1, const char *s2)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
processInt (const char *base0, const char *num0, const char *exp0)
|
processInt (struct parser_state *par_state, const char *base0,
|
||||||
|
const char *num0, const char *exp0)
|
||||||
{
|
{
|
||||||
ULONGEST result;
|
ULONGEST result;
|
||||||
long exp;
|
long exp;
|
||||||
@ -360,11 +364,11 @@ processInt (const char *base0, const char *num0, const char *exp0)
|
|||||||
exp -= 1;
|
exp -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result >> (gdbarch_int_bit (parse_gdbarch)-1)) == 0)
|
if ((result >> (gdbarch_int_bit (parse_gdbarch (par_state))-1)) == 0)
|
||||||
yylval.typed_val.type = type_int ();
|
yylval.typed_val.type = type_int (par_state);
|
||||||
else if ((result >> (gdbarch_long_bit (parse_gdbarch)-1)) == 0)
|
else if ((result >> (gdbarch_long_bit (parse_gdbarch (par_state))-1)) == 0)
|
||||||
yylval.typed_val.type = type_long ();
|
yylval.typed_val.type = type_long (par_state);
|
||||||
else if (((result >> (gdbarch_long_bit (parse_gdbarch)-1)) >> 1) == 0)
|
else if (((result >> (gdbarch_long_bit (parse_gdbarch (par_state))-1)) >> 1) == 0)
|
||||||
{
|
{
|
||||||
/* We have a number representable as an unsigned integer quantity.
|
/* We have a number representable as an unsigned integer quantity.
|
||||||
For consistency with the C treatment, we will treat it as an
|
For consistency with the C treatment, we will treat it as an
|
||||||
@ -374,7 +378,7 @@ processInt (const char *base0, const char *num0, const char *exp0)
|
|||||||
assignment does the trick (no, it doesn't; read the reference manual).
|
assignment does the trick (no, it doesn't; read the reference manual).
|
||||||
*/
|
*/
|
||||||
yylval.typed_val.type
|
yylval.typed_val.type
|
||||||
= builtin_type (parse_gdbarch)->builtin_unsigned_long;
|
= builtin_type (parse_gdbarch (par_state))->builtin_unsigned_long;
|
||||||
if (result & LONGEST_SIGN)
|
if (result & LONGEST_SIGN)
|
||||||
yylval.typed_val.val =
|
yylval.typed_val.val =
|
||||||
(LONGEST) (result & ~LONGEST_SIGN)
|
(LONGEST) (result & ~LONGEST_SIGN)
|
||||||
@ -384,24 +388,24 @@ processInt (const char *base0, const char *num0, const char *exp0)
|
|||||||
return INT;
|
return INT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yylval.typed_val.type = type_long_long ();
|
yylval.typed_val.type = type_long_long (par_state);
|
||||||
|
|
||||||
yylval.typed_val.val = (LONGEST) result;
|
yylval.typed_val.val = (LONGEST) result;
|
||||||
return INT;
|
return INT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
processReal (const char *num0)
|
processReal (struct parser_state *par_state, const char *num0)
|
||||||
{
|
{
|
||||||
sscanf (num0, "%" DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval);
|
sscanf (num0, "%" DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval);
|
||||||
|
|
||||||
yylval.typed_val_float.type = type_float ();
|
yylval.typed_val_float.type = type_float (par_state);
|
||||||
if (sizeof(DOUBLEST) >= gdbarch_double_bit (parse_gdbarch)
|
if (sizeof(DOUBLEST) >= gdbarch_double_bit (parse_gdbarch (par_state))
|
||||||
/ TARGET_CHAR_BIT)
|
/ TARGET_CHAR_BIT)
|
||||||
yylval.typed_val_float.type = type_double ();
|
yylval.typed_val_float.type = type_double (par_state);
|
||||||
if (sizeof(DOUBLEST) >= gdbarch_long_double_bit (parse_gdbarch)
|
if (sizeof(DOUBLEST) >= gdbarch_long_double_bit (parse_gdbarch (par_state))
|
||||||
/ TARGET_CHAR_BIT)
|
/ TARGET_CHAR_BIT)
|
||||||
yylval.typed_val_float.type = type_long_double ();
|
yylval.typed_val_float.type = type_long_double (par_state);
|
||||||
|
|
||||||
return FLOAT;
|
return FLOAT;
|
||||||
}
|
}
|
||||||
|
@ -1206,28 +1206,28 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* The displacement. */
|
/* The displacement. */
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
|
write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
|
||||||
write_exp_elt_longcst (displacement);
|
write_exp_elt_longcst (&p->pstate, displacement);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
if (got_minus)
|
if (got_minus)
|
||||||
write_exp_elt_opcode (UNOP_NEG);
|
write_exp_elt_opcode (&p->pstate, UNOP_NEG);
|
||||||
|
|
||||||
/* The register name. */
|
/* The register name. */
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
str.ptr = regname;
|
str.ptr = regname;
|
||||||
str.length = len;
|
str.length = len;
|
||||||
write_exp_string (str);
|
write_exp_string (&p->pstate, str);
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
|
|
||||||
write_exp_elt_opcode (BINOP_ADD);
|
write_exp_elt_opcode (&p->pstate, BINOP_ADD);
|
||||||
|
|
||||||
/* Casting to the expected type. */
|
/* Casting to the expected type. */
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
write_exp_elt_type (lookup_pointer_type (p->arg_type));
|
write_exp_elt_type (&p->pstate, lookup_pointer_type (p->arg_type));
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
|
|
||||||
write_exp_elt_opcode (UNOP_IND);
|
write_exp_elt_opcode (&p->pstate, UNOP_IND);
|
||||||
|
|
||||||
p->arg = tmp;
|
p->arg = tmp;
|
||||||
}
|
}
|
||||||
|
698
gdb/c-exp.y
698
gdb/c-exp.y
File diff suppressed because it is too large
Load Diff
@ -24,6 +24,7 @@
|
|||||||
struct ui_file;
|
struct ui_file;
|
||||||
struct language_arch_info;
|
struct language_arch_info;
|
||||||
struct type_print_options;
|
struct type_print_options;
|
||||||
|
struct parser_state;
|
||||||
|
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
#include "macroexp.h"
|
#include "macroexp.h"
|
||||||
@ -57,7 +58,7 @@ enum c_string_type
|
|||||||
|
|
||||||
/* Defined in c-exp.y. */
|
/* Defined in c-exp.y. */
|
||||||
|
|
||||||
extern int c_parse (void);
|
extern int c_parse (struct parser_state *);
|
||||||
|
|
||||||
extern void c_error (char *);
|
extern void c_error (char *);
|
||||||
|
|
||||||
|
276
gdb/f-exp.y
276
gdb/f-exp.y
@ -54,8 +54,8 @@
|
|||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#define parse_type builtin_type (parse_gdbarch)
|
#define parse_type(ps) builtin_type (parse_gdbarch (ps))
|
||||||
#define parse_f_type builtin_f_type (parse_gdbarch)
|
#define parse_f_type(ps) builtin_f_type (parse_gdbarch (ps))
|
||||||
|
|
||||||
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
||||||
as well as gratuitiously global symbol names, so we can have multiple
|
as well as gratuitiously global symbol names, so we can have multiple
|
||||||
@ -65,7 +65,7 @@
|
|||||||
generators need to be fixed instead of adding those names to this list. */
|
generators need to be fixed instead of adding those names to this list. */
|
||||||
|
|
||||||
#define yymaxdepth f_maxdepth
|
#define yymaxdepth f_maxdepth
|
||||||
#define yyparse f_parse
|
#define yyparse f_parse_internal
|
||||||
#define yylex f_lex
|
#define yylex f_lex
|
||||||
#define yyerror f_error
|
#define yyerror f_error
|
||||||
#define yylval f_lval
|
#define yylval f_lval
|
||||||
@ -117,6 +117,11 @@
|
|||||||
|
|
||||||
#define YYFPRINTF parser_fprintf
|
#define YYFPRINTF parser_fprintf
|
||||||
|
|
||||||
|
/* The state of the parser, used internally when we are parsing the
|
||||||
|
expression. */
|
||||||
|
|
||||||
|
static struct parser_state *pstate = NULL;
|
||||||
|
|
||||||
int yyparse (void);
|
int yyparse (void);
|
||||||
|
|
||||||
static int yylex (void);
|
static int yylex (void);
|
||||||
@ -157,7 +162,8 @@ static int match_string_literal (void);
|
|||||||
|
|
||||||
%{
|
%{
|
||||||
/* YYSTYPE gets defined by %union */
|
/* YYSTYPE gets defined by %union */
|
||||||
static int parse_number (const char *, int, int, YYSTYPE *);
|
static int parse_number (struct parser_state *, const char *, int,
|
||||||
|
int, YYSTYPE *);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%type <voidval> exp type_exp start variable
|
%type <voidval> exp type_exp start variable
|
||||||
@ -239,9 +245,9 @@ start : exp
|
|||||||
;
|
;
|
||||||
|
|
||||||
type_exp: type
|
type_exp: type
|
||||||
{ write_exp_elt_opcode(OP_TYPE);
|
{ write_exp_elt_opcode (pstate, OP_TYPE);
|
||||||
write_exp_elt_type($1);
|
write_exp_elt_type (pstate, $1);
|
||||||
write_exp_elt_opcode(OP_TYPE); }
|
write_exp_elt_opcode (pstate, OP_TYPE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '(' exp ')'
|
exp : '(' exp ')'
|
||||||
@ -250,27 +256,27 @@ exp : '(' exp ')'
|
|||||||
|
|
||||||
/* Expressions, not including the comma operator. */
|
/* Expressions, not including the comma operator. */
|
||||||
exp : '*' exp %prec UNARY
|
exp : '*' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_IND); }
|
{ write_exp_elt_opcode (pstate, UNOP_IND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '&' exp %prec UNARY
|
exp : '&' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_ADDR); }
|
{ write_exp_elt_opcode (pstate, UNOP_ADDR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '-' exp %prec UNARY
|
exp : '-' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_NEG); }
|
{ write_exp_elt_opcode (pstate, UNOP_NEG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : BOOL_NOT exp %prec UNARY
|
exp : BOOL_NOT exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
|
{ write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '~' exp %prec UNARY
|
exp : '~' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_COMPLEMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_COMPLEMENT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : SIZEOF exp %prec UNARY
|
exp : SIZEOF exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_SIZEOF); }
|
{ write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* No more explicit array operators, we treat everything in F77 as
|
/* No more explicit array operators, we treat everything in F77 as
|
||||||
@ -281,9 +287,12 @@ exp : SIZEOF exp %prec UNARY
|
|||||||
exp : exp '('
|
exp : exp '('
|
||||||
{ start_arglist (); }
|
{ start_arglist (); }
|
||||||
arglist ')'
|
arglist ')'
|
||||||
{ write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST);
|
{ write_exp_elt_opcode (pstate,
|
||||||
write_exp_elt_longcst ((LONGEST) end_arglist ());
|
OP_F77_UNDETERMINED_ARGLIST);
|
||||||
write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST); }
|
write_exp_elt_longcst (pstate,
|
||||||
|
(LONGEST) end_arglist ());
|
||||||
|
write_exp_elt_opcode (pstate,
|
||||||
|
OP_F77_UNDETERMINED_ARGLIST); }
|
||||||
;
|
;
|
||||||
|
|
||||||
arglist :
|
arglist :
|
||||||
@ -304,27 +313,27 @@ arglist : arglist ',' exp %prec ABOVE_COMMA
|
|||||||
/* There are four sorts of subrange types in F90. */
|
/* There are four sorts of subrange types in F90. */
|
||||||
|
|
||||||
subrange: exp ':' exp %prec ABOVE_COMMA
|
subrange: exp ':' exp %prec ABOVE_COMMA
|
||||||
{ write_exp_elt_opcode (OP_F90_RANGE);
|
{ write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||||
write_exp_elt_longcst (NONE_BOUND_DEFAULT);
|
write_exp_elt_longcst (pstate, NONE_BOUND_DEFAULT);
|
||||||
write_exp_elt_opcode (OP_F90_RANGE); }
|
write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
subrange: exp ':' %prec ABOVE_COMMA
|
subrange: exp ':' %prec ABOVE_COMMA
|
||||||
{ write_exp_elt_opcode (OP_F90_RANGE);
|
{ write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||||
write_exp_elt_longcst (HIGH_BOUND_DEFAULT);
|
write_exp_elt_longcst (pstate, HIGH_BOUND_DEFAULT);
|
||||||
write_exp_elt_opcode (OP_F90_RANGE); }
|
write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
subrange: ':' exp %prec ABOVE_COMMA
|
subrange: ':' exp %prec ABOVE_COMMA
|
||||||
{ write_exp_elt_opcode (OP_F90_RANGE);
|
{ write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||||
write_exp_elt_longcst (LOW_BOUND_DEFAULT);
|
write_exp_elt_longcst (pstate, LOW_BOUND_DEFAULT);
|
||||||
write_exp_elt_opcode (OP_F90_RANGE); }
|
write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
subrange: ':' %prec ABOVE_COMMA
|
subrange: ':' %prec ABOVE_COMMA
|
||||||
{ write_exp_elt_opcode (OP_F90_RANGE);
|
{ write_exp_elt_opcode (pstate, OP_F90_RANGE);
|
||||||
write_exp_elt_longcst (BOTH_BOUND_DEFAULT);
|
write_exp_elt_longcst (pstate, BOTH_BOUND_DEFAULT);
|
||||||
write_exp_elt_opcode (OP_F90_RANGE); }
|
write_exp_elt_opcode (pstate, OP_F90_RANGE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
complexnum: exp ',' exp
|
complexnum: exp ',' exp
|
||||||
@ -332,133 +341,139 @@ complexnum: exp ',' exp
|
|||||||
;
|
;
|
||||||
|
|
||||||
exp : '(' complexnum ')'
|
exp : '(' complexnum ')'
|
||||||
{ write_exp_elt_opcode(OP_COMPLEX);
|
{ write_exp_elt_opcode (pstate, OP_COMPLEX);
|
||||||
write_exp_elt_type (parse_f_type->builtin_complex_s16);
|
write_exp_elt_type (pstate,
|
||||||
write_exp_elt_opcode(OP_COMPLEX); }
|
parse_f_type (pstate)
|
||||||
|
->builtin_complex_s16);
|
||||||
|
write_exp_elt_opcode (pstate, OP_COMPLEX); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '(' type ')' exp %prec UNARY
|
exp : '(' type ')' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_CAST);
|
{ write_exp_elt_opcode (pstate, UNOP_CAST);
|
||||||
write_exp_elt_type ($2);
|
write_exp_elt_type (pstate, $2);
|
||||||
write_exp_elt_opcode (UNOP_CAST); }
|
write_exp_elt_opcode (pstate, UNOP_CAST); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '%' name
|
exp : exp '%' name
|
||||||
{ write_exp_elt_opcode (STRUCTOP_STRUCT);
|
{ write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
write_exp_string ($3);
|
write_exp_string (pstate, $3);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT); }
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Binary operators in order of decreasing precedence. */
|
/* Binary operators in order of decreasing precedence. */
|
||||||
|
|
||||||
exp : exp '@' exp
|
exp : exp '@' exp
|
||||||
{ write_exp_elt_opcode (BINOP_REPEAT); }
|
{ write_exp_elt_opcode (pstate, BINOP_REPEAT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp STARSTAR exp
|
exp : exp STARSTAR exp
|
||||||
{ write_exp_elt_opcode (BINOP_EXP); }
|
{ write_exp_elt_opcode (pstate, BINOP_EXP); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '*' exp
|
exp : exp '*' exp
|
||||||
{ write_exp_elt_opcode (BINOP_MUL); }
|
{ write_exp_elt_opcode (pstate, BINOP_MUL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '/' exp
|
exp : exp '/' exp
|
||||||
{ write_exp_elt_opcode (BINOP_DIV); }
|
{ write_exp_elt_opcode (pstate, BINOP_DIV); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '+' exp
|
exp : exp '+' exp
|
||||||
{ write_exp_elt_opcode (BINOP_ADD); }
|
{ write_exp_elt_opcode (pstate, BINOP_ADD); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '-' exp
|
exp : exp '-' exp
|
||||||
{ write_exp_elt_opcode (BINOP_SUB); }
|
{ write_exp_elt_opcode (pstate, BINOP_SUB); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp LSH exp
|
exp : exp LSH exp
|
||||||
{ write_exp_elt_opcode (BINOP_LSH); }
|
{ write_exp_elt_opcode (pstate, BINOP_LSH); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp RSH exp
|
exp : exp RSH exp
|
||||||
{ write_exp_elt_opcode (BINOP_RSH); }
|
{ write_exp_elt_opcode (pstate, BINOP_RSH); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp EQUAL exp
|
exp : exp EQUAL exp
|
||||||
{ write_exp_elt_opcode (BINOP_EQUAL); }
|
{ write_exp_elt_opcode (pstate, BINOP_EQUAL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp NOTEQUAL exp
|
exp : exp NOTEQUAL exp
|
||||||
{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
|
{ write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp LEQ exp
|
exp : exp LEQ exp
|
||||||
{ write_exp_elt_opcode (BINOP_LEQ); }
|
{ write_exp_elt_opcode (pstate, BINOP_LEQ); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp GEQ exp
|
exp : exp GEQ exp
|
||||||
{ write_exp_elt_opcode (BINOP_GEQ); }
|
{ write_exp_elt_opcode (pstate, BINOP_GEQ); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp LESSTHAN exp
|
exp : exp LESSTHAN exp
|
||||||
{ write_exp_elt_opcode (BINOP_LESS); }
|
{ write_exp_elt_opcode (pstate, BINOP_LESS); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp GREATERTHAN exp
|
exp : exp GREATERTHAN exp
|
||||||
{ write_exp_elt_opcode (BINOP_GTR); }
|
{ write_exp_elt_opcode (pstate, BINOP_GTR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '&' exp
|
exp : exp '&' exp
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_AND); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '^' exp
|
exp : exp '^' exp
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_XOR); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '|' exp
|
exp : exp '|' exp
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_IOR); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp BOOL_AND exp
|
exp : exp BOOL_AND exp
|
||||||
{ write_exp_elt_opcode (BINOP_LOGICAL_AND); }
|
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
exp : exp BOOL_OR exp
|
exp : exp BOOL_OR exp
|
||||||
{ write_exp_elt_opcode (BINOP_LOGICAL_OR); }
|
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '=' exp
|
exp : exp '=' exp
|
||||||
{ write_exp_elt_opcode (BINOP_ASSIGN); }
|
{ write_exp_elt_opcode (pstate, BINOP_ASSIGN); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp ASSIGN_MODIFY exp
|
exp : exp ASSIGN_MODIFY exp
|
||||||
{ write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
|
{ write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY);
|
||||||
write_exp_elt_opcode ($2);
|
write_exp_elt_opcode (pstate, $2);
|
||||||
write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
|
write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : INT
|
exp : INT
|
||||||
{ write_exp_elt_opcode (OP_LONG);
|
{ write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type ($1.type);
|
write_exp_elt_type (pstate, $1.type);
|
||||||
write_exp_elt_longcst ((LONGEST)($1.val));
|
write_exp_elt_longcst (pstate, (LONGEST) ($1.val));
|
||||||
write_exp_elt_opcode (OP_LONG); }
|
write_exp_elt_opcode (pstate, OP_LONG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : NAME_OR_INT
|
exp : NAME_OR_INT
|
||||||
{ YYSTYPE val;
|
{ YYSTYPE val;
|
||||||
parse_number ($1.stoken.ptr, $1.stoken.length, 0, &val);
|
parse_number (pstate, $1.stoken.ptr,
|
||||||
write_exp_elt_opcode (OP_LONG);
|
$1.stoken.length, 0, &val);
|
||||||
write_exp_elt_type (val.typed_val.type);
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_longcst ((LONGEST)val.typed_val.val);
|
write_exp_elt_type (pstate, val.typed_val.type);
|
||||||
write_exp_elt_opcode (OP_LONG); }
|
write_exp_elt_longcst (pstate,
|
||||||
|
(LONGEST)val.typed_val.val);
|
||||||
|
write_exp_elt_opcode (pstate, OP_LONG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : FLOAT
|
exp : FLOAT
|
||||||
{ write_exp_elt_opcode (OP_DOUBLE);
|
{ write_exp_elt_opcode (pstate, OP_DOUBLE);
|
||||||
write_exp_elt_type (parse_f_type->builtin_real_s8);
|
write_exp_elt_type (pstate,
|
||||||
write_exp_elt_dblcst ($1);
|
parse_f_type (pstate)
|
||||||
write_exp_elt_opcode (OP_DOUBLE); }
|
->builtin_real_s8);
|
||||||
|
write_exp_elt_dblcst (pstate, $1);
|
||||||
|
write_exp_elt_opcode (pstate, OP_DOUBLE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : variable
|
exp : variable
|
||||||
@ -468,25 +483,28 @@ exp : VARIABLE
|
|||||||
;
|
;
|
||||||
|
|
||||||
exp : SIZEOF '(' type ')' %prec UNARY
|
exp : SIZEOF '(' type ')' %prec UNARY
|
||||||
{ write_exp_elt_opcode (OP_LONG);
|
{ write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (parse_f_type->builtin_integer);
|
write_exp_elt_type (pstate,
|
||||||
|
parse_f_type (pstate)
|
||||||
|
->builtin_integer);
|
||||||
CHECK_TYPEDEF ($3);
|
CHECK_TYPEDEF ($3);
|
||||||
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
|
write_exp_elt_longcst (pstate,
|
||||||
write_exp_elt_opcode (OP_LONG); }
|
(LONGEST) TYPE_LENGTH ($3));
|
||||||
|
write_exp_elt_opcode (pstate, OP_LONG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : BOOLEAN_LITERAL
|
exp : BOOLEAN_LITERAL
|
||||||
{ write_exp_elt_opcode (OP_BOOL);
|
{ write_exp_elt_opcode (pstate, OP_BOOL);
|
||||||
write_exp_elt_longcst ((LONGEST) $1);
|
write_exp_elt_longcst (pstate, (LONGEST) $1);
|
||||||
write_exp_elt_opcode (OP_BOOL);
|
write_exp_elt_opcode (pstate, OP_BOOL);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : STRING_LITERAL
|
exp : STRING_LITERAL
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_STRING);
|
write_exp_elt_opcode (pstate, OP_STRING);
|
||||||
write_exp_string ($1);
|
write_exp_string (pstate, $1);
|
||||||
write_exp_elt_opcode (OP_STRING);
|
write_exp_elt_opcode (pstate, OP_STRING);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -502,13 +520,13 @@ variable: name_not_typename
|
|||||||
innermost_block))
|
innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = block_found;
|
||||||
}
|
}
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
/* We want to use the selected frame, not
|
/* We want to use the selected frame, not
|
||||||
another more inner frame which happens to
|
another more inner frame which happens to
|
||||||
be in the same block. */
|
be in the same block. */
|
||||||
write_exp_elt_block (NULL);
|
write_exp_elt_block (pstate, NULL);
|
||||||
write_exp_elt_sym (sym);
|
write_exp_elt_sym (pstate, sym);
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -519,7 +537,7 @@ variable: name_not_typename
|
|||||||
msymbol =
|
msymbol =
|
||||||
lookup_bound_minimal_symbol (arg);
|
lookup_bound_minimal_symbol (arg);
|
||||||
if (msymbol.minsym != NULL)
|
if (msymbol.minsym != NULL)
|
||||||
write_exp_msymbol (msymbol);
|
write_exp_msymbol (pstate, msymbol);
|
||||||
else if (!have_full_symbols () && !have_partial_symbols ())
|
else if (!have_full_symbols () && !have_partial_symbols ())
|
||||||
error (_("No symbol table is loaded. Use the \"file\" command."));
|
error (_("No symbol table is loaded. Use the \"file\" command."));
|
||||||
else
|
else
|
||||||
@ -560,7 +578,8 @@ ptype : typebase
|
|||||||
{
|
{
|
||||||
range_type =
|
range_type =
|
||||||
create_range_type ((struct type *) NULL,
|
create_range_type ((struct type *) NULL,
|
||||||
parse_f_type->builtin_integer,
|
parse_f_type (pstate)
|
||||||
|
->builtin_integer,
|
||||||
0, array_size - 1);
|
0, array_size - 1);
|
||||||
follow_type =
|
follow_type =
|
||||||
create_array_type ((struct type *) NULL,
|
create_array_type ((struct type *) NULL,
|
||||||
@ -606,31 +625,31 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
|
|||||||
: TYPENAME
|
: TYPENAME
|
||||||
{ $$ = $1.type; }
|
{ $$ = $1.type; }
|
||||||
| INT_KEYWORD
|
| INT_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_integer; }
|
{ $$ = parse_f_type (pstate)->builtin_integer; }
|
||||||
| INT_S2_KEYWORD
|
| INT_S2_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_integer_s2; }
|
{ $$ = parse_f_type (pstate)->builtin_integer_s2; }
|
||||||
| CHARACTER
|
| CHARACTER
|
||||||
{ $$ = parse_f_type->builtin_character; }
|
{ $$ = parse_f_type (pstate)->builtin_character; }
|
||||||
| LOGICAL_S8_KEYWORD
|
| LOGICAL_S8_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_logical_s8; }
|
{ $$ = parse_f_type (pstate)->builtin_logical_s8; }
|
||||||
| LOGICAL_KEYWORD
|
| LOGICAL_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_logical; }
|
{ $$ = parse_f_type (pstate)->builtin_logical; }
|
||||||
| LOGICAL_S2_KEYWORD
|
| LOGICAL_S2_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_logical_s2; }
|
{ $$ = parse_f_type (pstate)->builtin_logical_s2; }
|
||||||
| LOGICAL_S1_KEYWORD
|
| LOGICAL_S1_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_logical_s1; }
|
{ $$ = parse_f_type (pstate)->builtin_logical_s1; }
|
||||||
| REAL_KEYWORD
|
| REAL_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_real; }
|
{ $$ = parse_f_type (pstate)->builtin_real; }
|
||||||
| REAL_S8_KEYWORD
|
| REAL_S8_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_real_s8; }
|
{ $$ = parse_f_type (pstate)->builtin_real_s8; }
|
||||||
| REAL_S16_KEYWORD
|
| REAL_S16_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_real_s16; }
|
{ $$ = parse_f_type (pstate)->builtin_real_s16; }
|
||||||
| COMPLEX_S8_KEYWORD
|
| COMPLEX_S8_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_complex_s8; }
|
{ $$ = parse_f_type (pstate)->builtin_complex_s8; }
|
||||||
| COMPLEX_S16_KEYWORD
|
| COMPLEX_S16_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_complex_s16; }
|
{ $$ = parse_f_type (pstate)->builtin_complex_s16; }
|
||||||
| COMPLEX_S32_KEYWORD
|
| COMPLEX_S32_KEYWORD
|
||||||
{ $$ = parse_f_type->builtin_complex_s32; }
|
{ $$ = parse_f_type (pstate)->builtin_complex_s32; }
|
||||||
;
|
;
|
||||||
|
|
||||||
nonempty_typelist
|
nonempty_typelist
|
||||||
@ -669,7 +688,8 @@ name_not_typename : NAME
|
|||||||
/*** Needs some error checking for the float case ***/
|
/*** Needs some error checking for the float case ***/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
parse_number (struct parser_state *par_state,
|
||||||
|
const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
||||||
{
|
{
|
||||||
LONGEST n = 0;
|
LONGEST n = 0;
|
||||||
LONGEST prevn = 0;
|
LONGEST prevn = 0;
|
||||||
@ -775,20 +795,24 @@ parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
|||||||
are the same size. So we shift it twice, with fewer bits
|
are the same size. So we shift it twice, with fewer bits
|
||||||
each time, for the same result. */
|
each time, for the same result. */
|
||||||
|
|
||||||
if ((gdbarch_int_bit (parse_gdbarch) != gdbarch_long_bit (parse_gdbarch)
|
if ((gdbarch_int_bit (parse_gdbarch (par_state))
|
||||||
|
!= gdbarch_long_bit (parse_gdbarch (par_state))
|
||||||
&& ((n >> 2)
|
&& ((n >> 2)
|
||||||
>> (gdbarch_int_bit (parse_gdbarch)-2))) /* Avoid shift warning */
|
>> (gdbarch_int_bit (parse_gdbarch (par_state))-2))) /* Avoid
|
||||||
|
shift warning */
|
||||||
|| long_p)
|
|| long_p)
|
||||||
{
|
{
|
||||||
high_bit = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch)-1);
|
high_bit = ((ULONGEST)1)
|
||||||
unsigned_type = parse_type->builtin_unsigned_long;
|
<< (gdbarch_long_bit (parse_gdbarch (par_state))-1);
|
||||||
signed_type = parse_type->builtin_long;
|
unsigned_type = parse_type (par_state)->builtin_unsigned_long;
|
||||||
|
signed_type = parse_type (par_state)->builtin_long;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
high_bit = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch)-1);
|
high_bit =
|
||||||
unsigned_type = parse_type->builtin_unsigned_int;
|
((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch (par_state)) - 1);
|
||||||
signed_type = parse_type->builtin_int;
|
unsigned_type = parse_type (par_state)->builtin_unsigned_int;
|
||||||
|
signed_type = parse_type (par_state)->builtin_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
putithere->typed_val.val = n;
|
putithere->typed_val.val = n;
|
||||||
@ -1090,7 +1114,8 @@ yylex (void)
|
|||||||
&& (*p < 'A' || *p > 'Z')))
|
&& (*p < 'A' || *p > 'Z')))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toktype = parse_number (tokstart, p - tokstart, got_dot|got_e|got_d,
|
toktype = parse_number (pstate, tokstart, p - tokstart,
|
||||||
|
got_dot|got_e|got_d,
|
||||||
&yylval);
|
&yylval);
|
||||||
if (toktype == ERROR)
|
if (toktype == ERROR)
|
||||||
{
|
{
|
||||||
@ -1164,7 +1189,7 @@ yylex (void)
|
|||||||
|
|
||||||
if (*tokstart == '$')
|
if (*tokstart == '$')
|
||||||
{
|
{
|
||||||
write_dollar_variable (yylval.sval);
|
write_dollar_variable (pstate, yylval.sval);
|
||||||
return VARIABLE;
|
return VARIABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1192,8 +1217,8 @@ yylex (void)
|
|||||||
|
|
||||||
sym = lookup_symbol (tmp, expression_context_block,
|
sym = lookup_symbol (tmp, expression_context_block,
|
||||||
lookup_domains[i],
|
lookup_domains[i],
|
||||||
parse_language->la_language == language_cplus
|
parse_language (pstate)->la_language
|
||||||
? &is_a_field_of_this : NULL);
|
== language_cplus ? &is_a_field_of_this : NULL);
|
||||||
if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
||||||
{
|
{
|
||||||
yylval.tsym.type = SYMBOL_TYPE (sym);
|
yylval.tsym.type = SYMBOL_TYPE (sym);
|
||||||
@ -1205,8 +1230,8 @@ yylex (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
yylval.tsym.type
|
yylval.tsym.type
|
||||||
= language_lookup_primitive_type_by_name (parse_language,
|
= language_lookup_primitive_type_by_name (parse_language (pstate),
|
||||||
parse_gdbarch, tmp);
|
parse_gdbarch (pstate), tmp);
|
||||||
if (yylval.tsym.type != NULL)
|
if (yylval.tsym.type != NULL)
|
||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
|
|
||||||
@ -1218,7 +1243,7 @@ yylex (void)
|
|||||||
|| (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
|
|| (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
|
||||||
{
|
{
|
||||||
YYSTYPE newlval; /* Its value is ignored. */
|
YYSTYPE newlval; /* Its value is ignored. */
|
||||||
hextype = parse_number (tokstart, namelen, 0, &newlval);
|
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
|
||||||
if (hextype == INT)
|
if (hextype == INT)
|
||||||
{
|
{
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym = sym;
|
||||||
@ -1234,6 +1259,21 @@ yylex (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
f_parse (struct parser_state *par_state)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
|
||||||
|
|
||||||
|
/* Setting up the parser state. */
|
||||||
|
gdb_assert (par_state != NULL);
|
||||||
|
pstate = par_state;
|
||||||
|
|
||||||
|
result = yyparse ();
|
||||||
|
do_cleanups (c);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
yyerror (char *msg)
|
yyerror (char *msg)
|
||||||
{
|
{
|
||||||
|
@ -21,8 +21,9 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
struct type_print_options;
|
struct type_print_options;
|
||||||
|
struct parser_state;
|
||||||
|
|
||||||
extern int f_parse (void);
|
extern int f_parse (struct parser_state *);
|
||||||
|
|
||||||
extern void f_error (char *); /* Defined in f-exp.y */
|
extern void f_error (char *); /* Defined in f-exp.y */
|
||||||
|
|
||||||
|
268
gdb/go-exp.y
268
gdb/go-exp.y
@ -66,7 +66,7 @@
|
|||||||
#include "charset.h"
|
#include "charset.h"
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
|
|
||||||
#define parse_type builtin_type (parse_gdbarch)
|
#define parse_type(ps) builtin_type (parse_gdbarch (ps))
|
||||||
|
|
||||||
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
||||||
as well as gratuitiously global symbol names, so we can have multiple
|
as well as gratuitiously global symbol names, so we can have multiple
|
||||||
@ -122,6 +122,11 @@
|
|||||||
|
|
||||||
#define YYFPRINTF parser_fprintf
|
#define YYFPRINTF parser_fprintf
|
||||||
|
|
||||||
|
/* The state of the parser, used internally when we are parsing the
|
||||||
|
expression. */
|
||||||
|
|
||||||
|
static struct parser_state *pstate = NULL;
|
||||||
|
|
||||||
int yyparse (void);
|
int yyparse (void);
|
||||||
|
|
||||||
static int yylex (void);
|
static int yylex (void);
|
||||||
@ -158,7 +163,8 @@ void yyerror (char *);
|
|||||||
|
|
||||||
%{
|
%{
|
||||||
/* YYSTYPE gets defined by %union. */
|
/* YYSTYPE gets defined by %union. */
|
||||||
static int parse_number (const char *, int, int, YYSTYPE *);
|
static int parse_number (struct parser_state *,
|
||||||
|
const char *, int, int, YYSTYPE *);
|
||||||
static int parse_go_float (struct gdbarch *gdbarch, const char *p, int len,
|
static int parse_go_float (struct gdbarch *gdbarch, const char *p, int len,
|
||||||
DOUBLEST *d, struct type **t);
|
DOUBLEST *d, struct type **t);
|
||||||
%}
|
%}
|
||||||
@ -239,77 +245,77 @@ start : exp1
|
|||||||
;
|
;
|
||||||
|
|
||||||
type_exp: type
|
type_exp: type
|
||||||
{ write_exp_elt_opcode(OP_TYPE);
|
{ write_exp_elt_opcode (pstate, OP_TYPE);
|
||||||
write_exp_elt_type($1);
|
write_exp_elt_type (pstate, $1);
|
||||||
write_exp_elt_opcode(OP_TYPE); }
|
write_exp_elt_opcode (pstate, OP_TYPE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Expressions, including the comma operator. */
|
/* Expressions, including the comma operator. */
|
||||||
exp1 : exp
|
exp1 : exp
|
||||||
| exp1 ',' exp
|
| exp1 ',' exp
|
||||||
{ write_exp_elt_opcode (BINOP_COMMA); }
|
{ write_exp_elt_opcode (pstate, BINOP_COMMA); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Expressions, not including the comma operator. */
|
/* Expressions, not including the comma operator. */
|
||||||
exp : '*' exp %prec UNARY
|
exp : '*' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_IND); }
|
{ write_exp_elt_opcode (pstate, UNOP_IND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '&' exp %prec UNARY
|
exp : '&' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_ADDR); }
|
{ write_exp_elt_opcode (pstate, UNOP_ADDR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '-' exp %prec UNARY
|
exp : '-' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_NEG); }
|
{ write_exp_elt_opcode (pstate, UNOP_NEG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '+' exp %prec UNARY
|
exp : '+' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_PLUS); }
|
{ write_exp_elt_opcode (pstate, UNOP_PLUS); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '!' exp %prec UNARY
|
exp : '!' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
|
{ write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '^' exp %prec UNARY
|
exp : '^' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_COMPLEMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_COMPLEMENT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp INCREMENT %prec UNARY
|
exp : exp INCREMENT %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_POSTINCREMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_POSTINCREMENT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp DECREMENT %prec UNARY
|
exp : exp DECREMENT %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_POSTDECREMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_POSTDECREMENT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* foo->bar is not in Go. May want as a gdb extension. Later. */
|
/* foo->bar is not in Go. May want as a gdb extension. Later. */
|
||||||
|
|
||||||
exp : exp '.' name_not_typename
|
exp : exp '.' name_not_typename
|
||||||
{ write_exp_elt_opcode (STRUCTOP_STRUCT);
|
{ write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
write_exp_string ($3.stoken);
|
write_exp_string (pstate, $3.stoken);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT); }
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '.' name_not_typename COMPLETE
|
exp : exp '.' name_not_typename COMPLETE
|
||||||
{ mark_struct_expression ();
|
{ mark_struct_expression (pstate);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT);
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
write_exp_string ($3.stoken);
|
write_exp_string (pstate, $3.stoken);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT); }
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '.' COMPLETE
|
exp : exp '.' COMPLETE
|
||||||
{ struct stoken s;
|
{ struct stoken s;
|
||||||
mark_struct_expression ();
|
mark_struct_expression (pstate);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT);
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
s.ptr = "";
|
s.ptr = "";
|
||||||
s.length = 0;
|
s.length = 0;
|
||||||
write_exp_string (s);
|
write_exp_string (pstate, s);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT); }
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '[' exp1 ']'
|
exp : exp '[' exp1 ']'
|
||||||
{ write_exp_elt_opcode (BINOP_SUBSCRIPT); }
|
{ write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '('
|
exp : exp '('
|
||||||
@ -317,9 +323,10 @@ exp : exp '('
|
|||||||
being accumulated by an outer function call. */
|
being accumulated by an outer function call. */
|
||||||
{ start_arglist (); }
|
{ start_arglist (); }
|
||||||
arglist ')' %prec LEFT_ARROW
|
arglist ')' %prec LEFT_ARROW
|
||||||
{ write_exp_elt_opcode (OP_FUNCALL);
|
{ write_exp_elt_opcode (pstate, OP_FUNCALL);
|
||||||
write_exp_elt_longcst ((LONGEST) end_arglist ());
|
write_exp_elt_longcst (pstate,
|
||||||
write_exp_elt_opcode (OP_FUNCALL); }
|
(LONGEST) end_arglist ());
|
||||||
|
write_exp_elt_opcode (pstate, OP_FUNCALL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
lcurly : '{'
|
lcurly : '{'
|
||||||
@ -342,15 +349,15 @@ rcurly : '}'
|
|||||||
;
|
;
|
||||||
|
|
||||||
exp : lcurly type rcurly exp %prec UNARY
|
exp : lcurly type rcurly exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_MEMVAL);
|
{ write_exp_elt_opcode (pstate, UNOP_MEMVAL);
|
||||||
write_exp_elt_type ($2);
|
write_exp_elt_type (pstate, $2);
|
||||||
write_exp_elt_opcode (UNOP_MEMVAL); }
|
write_exp_elt_opcode (pstate, UNOP_MEMVAL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : type '(' exp ')' %prec UNARY
|
exp : type '(' exp ')' %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_CAST);
|
{ write_exp_elt_opcode (pstate, UNOP_CAST);
|
||||||
write_exp_elt_type ($1);
|
write_exp_elt_type (pstate, $1);
|
||||||
write_exp_elt_opcode (UNOP_CAST); }
|
write_exp_elt_opcode (pstate, UNOP_CAST); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '(' exp1 ')'
|
exp : '(' exp1 ')'
|
||||||
@ -360,100 +367,100 @@ exp : '(' exp1 ')'
|
|||||||
/* Binary operators in order of decreasing precedence. */
|
/* Binary operators in order of decreasing precedence. */
|
||||||
|
|
||||||
exp : exp '@' exp
|
exp : exp '@' exp
|
||||||
{ write_exp_elt_opcode (BINOP_REPEAT); }
|
{ write_exp_elt_opcode (pstate, BINOP_REPEAT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '*' exp
|
exp : exp '*' exp
|
||||||
{ write_exp_elt_opcode (BINOP_MUL); }
|
{ write_exp_elt_opcode (pstate, BINOP_MUL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '/' exp
|
exp : exp '/' exp
|
||||||
{ write_exp_elt_opcode (BINOP_DIV); }
|
{ write_exp_elt_opcode (pstate, BINOP_DIV); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '%' exp
|
exp : exp '%' exp
|
||||||
{ write_exp_elt_opcode (BINOP_REM); }
|
{ write_exp_elt_opcode (pstate, BINOP_REM); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '+' exp
|
exp : exp '+' exp
|
||||||
{ write_exp_elt_opcode (BINOP_ADD); }
|
{ write_exp_elt_opcode (pstate, BINOP_ADD); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '-' exp
|
exp : exp '-' exp
|
||||||
{ write_exp_elt_opcode (BINOP_SUB); }
|
{ write_exp_elt_opcode (pstate, BINOP_SUB); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp LSH exp
|
exp : exp LSH exp
|
||||||
{ write_exp_elt_opcode (BINOP_LSH); }
|
{ write_exp_elt_opcode (pstate, BINOP_LSH); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp RSH exp
|
exp : exp RSH exp
|
||||||
{ write_exp_elt_opcode (BINOP_RSH); }
|
{ write_exp_elt_opcode (pstate, BINOP_RSH); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp EQUAL exp
|
exp : exp EQUAL exp
|
||||||
{ write_exp_elt_opcode (BINOP_EQUAL); }
|
{ write_exp_elt_opcode (pstate, BINOP_EQUAL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp NOTEQUAL exp
|
exp : exp NOTEQUAL exp
|
||||||
{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
|
{ write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp LEQ exp
|
exp : exp LEQ exp
|
||||||
{ write_exp_elt_opcode (BINOP_LEQ); }
|
{ write_exp_elt_opcode (pstate, BINOP_LEQ); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp GEQ exp
|
exp : exp GEQ exp
|
||||||
{ write_exp_elt_opcode (BINOP_GEQ); }
|
{ write_exp_elt_opcode (pstate, BINOP_GEQ); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '<' exp
|
exp : exp '<' exp
|
||||||
{ write_exp_elt_opcode (BINOP_LESS); }
|
{ write_exp_elt_opcode (pstate, BINOP_LESS); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '>' exp
|
exp : exp '>' exp
|
||||||
{ write_exp_elt_opcode (BINOP_GTR); }
|
{ write_exp_elt_opcode (pstate, BINOP_GTR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '&' exp
|
exp : exp '&' exp
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_AND); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '^' exp
|
exp : exp '^' exp
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_XOR); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '|' exp
|
exp : exp '|' exp
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_IOR); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp ANDAND exp
|
exp : exp ANDAND exp
|
||||||
{ write_exp_elt_opcode (BINOP_LOGICAL_AND); }
|
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp OROR exp
|
exp : exp OROR exp
|
||||||
{ write_exp_elt_opcode (BINOP_LOGICAL_OR); }
|
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '?' exp ':' exp %prec '?'
|
exp : exp '?' exp ':' exp %prec '?'
|
||||||
{ write_exp_elt_opcode (TERNOP_COND); }
|
{ write_exp_elt_opcode (pstate, TERNOP_COND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '=' exp
|
exp : exp '=' exp
|
||||||
{ write_exp_elt_opcode (BINOP_ASSIGN); }
|
{ write_exp_elt_opcode (pstate, BINOP_ASSIGN); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp ASSIGN_MODIFY exp
|
exp : exp ASSIGN_MODIFY exp
|
||||||
{ write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
|
{ write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY);
|
||||||
write_exp_elt_opcode ($2);
|
write_exp_elt_opcode (pstate, $2);
|
||||||
write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
|
write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : INT
|
exp : INT
|
||||||
{ write_exp_elt_opcode (OP_LONG);
|
{ write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type ($1.type);
|
write_exp_elt_type (pstate, $1.type);
|
||||||
write_exp_elt_longcst ((LONGEST)($1.val));
|
write_exp_elt_longcst (pstate, (LONGEST)($1.val));
|
||||||
write_exp_elt_opcode (OP_LONG); }
|
write_exp_elt_opcode (pstate, OP_LONG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : CHAR
|
exp : CHAR
|
||||||
@ -461,28 +468,28 @@ exp : CHAR
|
|||||||
struct stoken_vector vec;
|
struct stoken_vector vec;
|
||||||
vec.len = 1;
|
vec.len = 1;
|
||||||
vec.tokens = &$1;
|
vec.tokens = &$1;
|
||||||
write_exp_string_vector ($1.type, &vec);
|
write_exp_string_vector (pstate, $1.type, &vec);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : NAME_OR_INT
|
exp : NAME_OR_INT
|
||||||
{ YYSTYPE val;
|
{ YYSTYPE val;
|
||||||
parse_number ($1.stoken.ptr, $1.stoken.length,
|
parse_number (pstate, $1.stoken.ptr,
|
||||||
0, &val);
|
$1.stoken.length, 0, &val);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (val.typed_val_int.type);
|
write_exp_elt_type (pstate, val.typed_val_int.type);
|
||||||
write_exp_elt_longcst ((LONGEST)
|
write_exp_elt_longcst (pstate, (LONGEST)
|
||||||
val.typed_val_int.val);
|
val.typed_val_int.val);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
exp : FLOAT
|
exp : FLOAT
|
||||||
{ write_exp_elt_opcode (OP_DOUBLE);
|
{ write_exp_elt_opcode (pstate, OP_DOUBLE);
|
||||||
write_exp_elt_type ($1.type);
|
write_exp_elt_type (pstate, $1.type);
|
||||||
write_exp_elt_dblcst ($1.dval);
|
write_exp_elt_dblcst (pstate, $1.dval);
|
||||||
write_exp_elt_opcode (OP_DOUBLE); }
|
write_exp_elt_opcode (pstate, OP_DOUBLE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : variable
|
exp : variable
|
||||||
@ -490,26 +497,29 @@ exp : variable
|
|||||||
|
|
||||||
exp : DOLLAR_VARIABLE
|
exp : DOLLAR_VARIABLE
|
||||||
{
|
{
|
||||||
write_dollar_variable ($1);
|
write_dollar_variable (pstate, $1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : SIZEOF_KEYWORD '(' type ')' %prec UNARY
|
exp : SIZEOF_KEYWORD '(' type ')' %prec UNARY
|
||||||
{
|
{
|
||||||
/* TODO(dje): Go objects in structs. */
|
/* TODO(dje): Go objects in structs. */
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
/* TODO(dje): What's the right type here? */
|
/* TODO(dje): What's the right type here? */
|
||||||
write_exp_elt_type (parse_type->builtin_unsigned_int);
|
write_exp_elt_type
|
||||||
|
(pstate,
|
||||||
|
parse_type (pstate)->builtin_unsigned_int);
|
||||||
CHECK_TYPEDEF ($3);
|
CHECK_TYPEDEF ($3);
|
||||||
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
|
write_exp_elt_longcst (pstate,
|
||||||
write_exp_elt_opcode (OP_LONG);
|
(LONGEST) TYPE_LENGTH ($3));
|
||||||
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : SIZEOF_KEYWORD '(' exp ')' %prec UNARY
|
exp : SIZEOF_KEYWORD '(' exp ')' %prec UNARY
|
||||||
{
|
{
|
||||||
/* TODO(dje): Go objects in structs. */
|
/* TODO(dje): Go objects in structs. */
|
||||||
write_exp_elt_opcode (UNOP_SIZEOF);
|
write_exp_elt_opcode (pstate, UNOP_SIZEOF);
|
||||||
}
|
}
|
||||||
|
|
||||||
string_exp:
|
string_exp:
|
||||||
@ -552,7 +562,8 @@ exp : string_exp %prec ABOVE_COMMA
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
write_exp_string_vector (0 /*always utf8*/, &$1);
|
write_exp_string_vector (pstate, 0 /*always utf8*/,
|
||||||
|
&$1);
|
||||||
for (i = 0; i < $1.len; ++i)
|
for (i = 0; i < $1.len; ++i)
|
||||||
free ($1.tokens[i].ptr);
|
free ($1.tokens[i].ptr);
|
||||||
free ($1.tokens);
|
free ($1.tokens);
|
||||||
@ -560,15 +571,15 @@ exp : string_exp %prec ABOVE_COMMA
|
|||||||
;
|
;
|
||||||
|
|
||||||
exp : TRUE_KEYWORD
|
exp : TRUE_KEYWORD
|
||||||
{ write_exp_elt_opcode (OP_BOOL);
|
{ write_exp_elt_opcode (pstate, OP_BOOL);
|
||||||
write_exp_elt_longcst ((LONGEST) $1);
|
write_exp_elt_longcst (pstate, (LONGEST) $1);
|
||||||
write_exp_elt_opcode (OP_BOOL); }
|
write_exp_elt_opcode (pstate, OP_BOOL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : FALSE_KEYWORD
|
exp : FALSE_KEYWORD
|
||||||
{ write_exp_elt_opcode (OP_BOOL);
|
{ write_exp_elt_opcode (pstate, OP_BOOL);
|
||||||
write_exp_elt_longcst ((LONGEST) $1);
|
write_exp_elt_longcst (pstate, (LONGEST) $1);
|
||||||
write_exp_elt_opcode (OP_BOOL); }
|
write_exp_elt_opcode (pstate, OP_BOOL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
variable: name_not_typename ENTRY
|
variable: name_not_typename ENTRY
|
||||||
@ -581,9 +592,9 @@ variable: name_not_typename ENTRY
|
|||||||
"parameters, not for \"%s\""),
|
"parameters, not for \"%s\""),
|
||||||
copy_name ($1.stoken));
|
copy_name ($1.stoken));
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_VAR_ENTRY_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_ENTRY_VALUE);
|
||||||
write_exp_elt_sym (sym);
|
write_exp_elt_sym (pstate, sym);
|
||||||
write_exp_elt_opcode (OP_VAR_ENTRY_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_ENTRY_VALUE);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -600,13 +611,13 @@ variable: name_not_typename
|
|||||||
innermost_block = block_found;
|
innermost_block = block_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
/* We want to use the selected frame, not
|
/* We want to use the selected frame, not
|
||||||
another more inner frame which happens to
|
another more inner frame which happens to
|
||||||
be in the same block. */
|
be in the same block. */
|
||||||
write_exp_elt_block (NULL);
|
write_exp_elt_block (pstate, NULL);
|
||||||
write_exp_elt_sym (sym);
|
write_exp_elt_sym (pstate, sym);
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
}
|
}
|
||||||
else if ($1.is_a_field_of_this)
|
else if ($1.is_a_field_of_this)
|
||||||
{
|
{
|
||||||
@ -622,7 +633,7 @@ variable: name_not_typename
|
|||||||
msymbol =
|
msymbol =
|
||||||
lookup_bound_minimal_symbol (arg);
|
lookup_bound_minimal_symbol (arg);
|
||||||
if (msymbol.minsym != NULL)
|
if (msymbol.minsym != NULL)
|
||||||
write_exp_msymbol (msymbol);
|
write_exp_msymbol (pstate, msymbol);
|
||||||
else if (!have_full_symbols ()
|
else if (!have_full_symbols ()
|
||||||
&& !have_partial_symbols ())
|
&& !have_partial_symbols ())
|
||||||
error (_("No symbol table is loaded. "
|
error (_("No symbol table is loaded. "
|
||||||
@ -652,7 +663,7 @@ type /* Implements (approximately): [*] type-specifier */
|
|||||||
expression_context_block); }
|
expression_context_block); }
|
||||||
*/
|
*/
|
||||||
| BYTE_KEYWORD
|
| BYTE_KEYWORD
|
||||||
{ $$ = builtin_go_type (parse_gdbarch)
|
{ $$ = builtin_go_type (parse_gdbarch (pstate))
|
||||||
->builtin_uint8; }
|
->builtin_uint8; }
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -704,7 +715,8 @@ parse_go_float (struct gdbarch *gdbarch, const char *p, int len,
|
|||||||
as our YYSTYPE is different than c-exp.y's */
|
as our YYSTYPE is different than c-exp.y's */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
parse_number (struct parser_state *par_state,
|
||||||
|
const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
||||||
{
|
{
|
||||||
/* FIXME: Shouldn't these be unsigned? We don't deal with negative values
|
/* FIXME: Shouldn't these be unsigned? We don't deal with negative values
|
||||||
here, and we do kind of silly things like cast to unsigned. */
|
here, and we do kind of silly things like cast to unsigned. */
|
||||||
@ -729,7 +741,7 @@ parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
|||||||
|
|
||||||
if (parsed_float)
|
if (parsed_float)
|
||||||
{
|
{
|
||||||
if (! parse_go_float (parse_gdbarch, p, len,
|
if (! parse_go_float (parse_gdbarch (par_state), p, len,
|
||||||
&putithere->typed_val_float.dval,
|
&putithere->typed_val_float.dval,
|
||||||
&putithere->typed_val_float.type))
|
&putithere->typed_val_float.type))
|
||||||
return ERROR;
|
return ERROR;
|
||||||
@ -845,9 +857,10 @@ parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
|||||||
|
|
||||||
un = (ULONGEST)n >> 2;
|
un = (ULONGEST)n >> 2;
|
||||||
if (long_p == 0
|
if (long_p == 0
|
||||||
&& (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
|
&& (un >> (gdbarch_int_bit (parse_gdbarch (par_state)) - 2)) == 0)
|
||||||
{
|
{
|
||||||
high_bit = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
|
high_bit
|
||||||
|
= ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch (par_state)) - 1);
|
||||||
|
|
||||||
/* A large decimal (not hex or octal) constant (between INT_MAX
|
/* A large decimal (not hex or octal) constant (between INT_MAX
|
||||||
and UINT_MAX) is a long or unsigned long, according to ANSI,
|
and UINT_MAX) is a long or unsigned long, according to ANSI,
|
||||||
@ -855,28 +868,29 @@ parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
|||||||
int. This probably should be fixed. GCC gives a warning on
|
int. This probably should be fixed. GCC gives a warning on
|
||||||
such constants. */
|
such constants. */
|
||||||
|
|
||||||
unsigned_type = parse_type->builtin_unsigned_int;
|
unsigned_type = parse_type (par_state)->builtin_unsigned_int;
|
||||||
signed_type = parse_type->builtin_int;
|
signed_type = parse_type (par_state)->builtin_int;
|
||||||
}
|
}
|
||||||
else if (long_p <= 1
|
else if (long_p <= 1
|
||||||
&& (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
|
&& (un >> (gdbarch_long_bit (parse_gdbarch (par_state)) - 2)) == 0)
|
||||||
{
|
{
|
||||||
high_bit = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
|
high_bit
|
||||||
unsigned_type = parse_type->builtin_unsigned_long;
|
= ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch (par_state)) - 1);
|
||||||
signed_type = parse_type->builtin_long;
|
unsigned_type = parse_type (par_state)->builtin_unsigned_long;
|
||||||
|
signed_type = parse_type (par_state)->builtin_long;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int shift;
|
int shift;
|
||||||
if (sizeof (ULONGEST) * HOST_CHAR_BIT
|
if (sizeof (ULONGEST) * HOST_CHAR_BIT
|
||||||
< gdbarch_long_long_bit (parse_gdbarch))
|
< gdbarch_long_long_bit (parse_gdbarch (par_state)))
|
||||||
/* A long long does not fit in a LONGEST. */
|
/* A long long does not fit in a LONGEST. */
|
||||||
shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
|
shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
|
||||||
else
|
else
|
||||||
shift = (gdbarch_long_long_bit (parse_gdbarch) - 1);
|
shift = (gdbarch_long_long_bit (parse_gdbarch (par_state)) - 1);
|
||||||
high_bit = (ULONGEST) 1 << shift;
|
high_bit = (ULONGEST) 1 << shift;
|
||||||
unsigned_type = parse_type->builtin_unsigned_long_long;
|
unsigned_type = parse_type (par_state)->builtin_unsigned_long_long;
|
||||||
signed_type = parse_type->builtin_long_long;
|
signed_type = parse_type (par_state)->builtin_long_long;
|
||||||
}
|
}
|
||||||
|
|
||||||
putithere->typed_val_int.val = n;
|
putithere->typed_val_int.val = n;
|
||||||
@ -1044,7 +1058,7 @@ static int last_was_structop;
|
|||||||
/* Read one token, getting characters through lexptr. */
|
/* Read one token, getting characters through lexptr. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
lex_one_token (void)
|
lex_one_token (struct parser_state *par_state)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int namelen;
|
int namelen;
|
||||||
@ -1175,7 +1189,8 @@ lex_one_token (void)
|
|||||||
&& (*p < 'A' || *p > 'Z')))
|
&& (*p < 'A' || *p > 'Z')))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
|
toktype = parse_number (par_state, tokstart, p - tokstart,
|
||||||
|
got_dot|got_e, &yylval);
|
||||||
if (toktype == ERROR)
|
if (toktype == ERROR)
|
||||||
{
|
{
|
||||||
char *err_copy = (char *) alloca (p - tokstart + 1);
|
char *err_copy = (char *) alloca (p - tokstart + 1);
|
||||||
@ -1431,7 +1446,7 @@ classify_packaged_name (const struct block *block)
|
|||||||
The result is one of NAME, NAME_OR_INT, or TYPENAME. */
|
The result is one of NAME, NAME_OR_INT, or TYPENAME. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
classify_name (const struct block *block)
|
classify_name (struct parser_state *par_state, const struct block *block)
|
||||||
{
|
{
|
||||||
struct type *type;
|
struct type *type;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
@ -1441,8 +1456,9 @@ classify_name (const struct block *block)
|
|||||||
copy = copy_name (yylval.sval);
|
copy = copy_name (yylval.sval);
|
||||||
|
|
||||||
/* Try primitive types first so they win over bad/weird debug info. */
|
/* Try primitive types first so they win over bad/weird debug info. */
|
||||||
type = language_lookup_primitive_type_by_name (parse_language,
|
type = language_lookup_primitive_type_by_name (parse_language (par_state),
|
||||||
parse_gdbarch, copy);
|
parse_gdbarch (par_state),
|
||||||
|
copy);
|
||||||
if (type != NULL)
|
if (type != NULL)
|
||||||
{
|
{
|
||||||
/* NOTE: We take advantage of the fact that yylval coming in was a
|
/* NOTE: We take advantage of the fact that yylval coming in was a
|
||||||
@ -1498,7 +1514,8 @@ classify_name (const struct block *block)
|
|||||||
|| (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10))
|
|| (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10))
|
||||||
{
|
{
|
||||||
YYSTYPE newlval; /* Its value is ignored. */
|
YYSTYPE newlval; /* Its value is ignored. */
|
||||||
int hextype = parse_number (copy, yylval.sval.length, 0, &newlval);
|
int hextype = parse_number (par_state, copy, yylval.sval.length,
|
||||||
|
0, &newlval);
|
||||||
if (hextype == INT)
|
if (hextype == INT)
|
||||||
{
|
{
|
||||||
yylval.ssym.sym = NULL;
|
yylval.ssym.sym = NULL;
|
||||||
@ -1531,7 +1548,7 @@ yylex (void)
|
|||||||
}
|
}
|
||||||
popping = 0;
|
popping = 0;
|
||||||
|
|
||||||
current.token = lex_one_token ();
|
current.token = lex_one_token (pstate);
|
||||||
|
|
||||||
/* TODO: Need a way to force specifying name1 as a package.
|
/* TODO: Need a way to force specifying name1 as a package.
|
||||||
.name1.name2 ? */
|
.name1.name2 ? */
|
||||||
@ -1542,14 +1559,14 @@ yylex (void)
|
|||||||
/* See if we have "name1 . name2". */
|
/* See if we have "name1 . name2". */
|
||||||
|
|
||||||
current.value = yylval;
|
current.value = yylval;
|
||||||
next.token = lex_one_token ();
|
next.token = lex_one_token (pstate);
|
||||||
next.value = yylval;
|
next.value = yylval;
|
||||||
|
|
||||||
if (next.token == '.')
|
if (next.token == '.')
|
||||||
{
|
{
|
||||||
token_and_value name2;
|
token_and_value name2;
|
||||||
|
|
||||||
name2.token = lex_one_token ();
|
name2.token = lex_one_token (pstate);
|
||||||
name2.value = yylval;
|
name2.value = yylval;
|
||||||
|
|
||||||
if (name2.token == NAME)
|
if (name2.token == NAME)
|
||||||
@ -1588,16 +1605,23 @@ yylex (void)
|
|||||||
|
|
||||||
popping = 1;
|
popping = 1;
|
||||||
yylval = current.value;
|
yylval = current.value;
|
||||||
return classify_name (expression_context_block);
|
return classify_name (pstate, expression_context_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
go_parse (void)
|
go_parse (struct parser_state *par_state)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
|
struct cleanup *back_to;
|
||||||
|
|
||||||
|
/* Setting up the parser state. */
|
||||||
|
gdb_assert (par_state != NULL);
|
||||||
|
pstate = par_state;
|
||||||
|
|
||||||
|
back_to = make_cleanup (null_cleanup, NULL);
|
||||||
|
|
||||||
make_cleanup_restore_integer (&yydebug);
|
make_cleanup_restore_integer (&yydebug);
|
||||||
|
make_cleanup_clear_parser_state (&pstate);
|
||||||
yydebug = parser_debug;
|
yydebug = parser_debug;
|
||||||
|
|
||||||
/* Initialize some state used by the lexer. */
|
/* Initialize some state used by the lexer. */
|
||||||
|
@ -26,6 +26,8 @@ struct type_print_options;
|
|||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
|
|
||||||
|
struct parser_state;
|
||||||
|
|
||||||
struct builtin_go_type
|
struct builtin_go_type
|
||||||
{
|
{
|
||||||
struct type *builtin_void;
|
struct type *builtin_void;
|
||||||
@ -56,7 +58,7 @@ enum go_type
|
|||||||
|
|
||||||
/* Defined in go-exp.y. */
|
/* Defined in go-exp.y. */
|
||||||
|
|
||||||
extern int go_parse (void);
|
extern int go_parse (struct parser_state *);
|
||||||
|
|
||||||
extern void go_error (char *);
|
extern void go_error (char *);
|
||||||
|
|
||||||
|
@ -3766,33 +3766,36 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
|
|||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
|
write_exp_elt_type
|
||||||
write_exp_elt_longcst (displacements[i]);
|
(&p->pstate, builtin_type (gdbarch)->builtin_long);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_longcst (&p->pstate, displacements[i]);
|
||||||
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
if (got_minus[i])
|
if (got_minus[i])
|
||||||
write_exp_elt_opcode (UNOP_NEG);
|
write_exp_elt_opcode (&p->pstate, UNOP_NEG);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
str.ptr = regname;
|
str.ptr = regname;
|
||||||
str.length = len;
|
str.length = len;
|
||||||
write_exp_string (str);
|
write_exp_string (&p->pstate, str);
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
|
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
write_exp_elt_type (builtin_type (gdbarch)->builtin_data_ptr);
|
write_exp_elt_type (&p->pstate,
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
builtin_type (gdbarch)->builtin_data_ptr);
|
||||||
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
|
|
||||||
write_exp_elt_opcode (BINOP_ADD);
|
write_exp_elt_opcode (&p->pstate, BINOP_ADD);
|
||||||
write_exp_elt_opcode (BINOP_ADD);
|
write_exp_elt_opcode (&p->pstate, BINOP_ADD);
|
||||||
write_exp_elt_opcode (BINOP_ADD);
|
write_exp_elt_opcode (&p->pstate, BINOP_ADD);
|
||||||
|
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
write_exp_elt_type (lookup_pointer_type (p->arg_type));
|
write_exp_elt_type (&p->pstate,
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
lookup_pointer_type (p->arg_type));
|
||||||
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
|
|
||||||
write_exp_elt_opcode (UNOP_IND);
|
write_exp_elt_opcode (&p->pstate, UNOP_IND);
|
||||||
|
|
||||||
p->arg = s;
|
p->arg = s;
|
||||||
|
|
||||||
@ -3912,47 +3915,50 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
|
|||||||
|
|
||||||
if (offset)
|
if (offset)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
|
write_exp_elt_type (&p->pstate,
|
||||||
write_exp_elt_longcst (offset);
|
builtin_type (gdbarch)->builtin_long);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_longcst (&p->pstate, offset);
|
||||||
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
if (offset_minus)
|
if (offset_minus)
|
||||||
write_exp_elt_opcode (UNOP_NEG);
|
write_exp_elt_opcode (&p->pstate, UNOP_NEG);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
base_token.ptr = base;
|
base_token.ptr = base;
|
||||||
base_token.length = len_base;
|
base_token.length = len_base;
|
||||||
write_exp_string (base_token);
|
write_exp_string (&p->pstate, base_token);
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
|
|
||||||
if (offset)
|
if (offset)
|
||||||
write_exp_elt_opcode (BINOP_ADD);
|
write_exp_elt_opcode (&p->pstate, BINOP_ADD);
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
index_token.ptr = index;
|
index_token.ptr = index;
|
||||||
index_token.length = len_index;
|
index_token.length = len_index;
|
||||||
write_exp_string (index_token);
|
write_exp_string (&p->pstate, index_token);
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
|
|
||||||
if (size)
|
if (size)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
|
write_exp_elt_type (&p->pstate,
|
||||||
write_exp_elt_longcst (size);
|
builtin_type (gdbarch)->builtin_long);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_longcst (&p->pstate, size);
|
||||||
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
if (size_minus)
|
if (size_minus)
|
||||||
write_exp_elt_opcode (UNOP_NEG);
|
write_exp_elt_opcode (&p->pstate, UNOP_NEG);
|
||||||
write_exp_elt_opcode (BINOP_MUL);
|
write_exp_elt_opcode (&p->pstate, BINOP_MUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (BINOP_ADD);
|
write_exp_elt_opcode (&p->pstate, BINOP_ADD);
|
||||||
|
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
write_exp_elt_type (lookup_pointer_type (p->arg_type));
|
write_exp_elt_type (&p->pstate,
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
lookup_pointer_type (p->arg_type));
|
||||||
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
|
|
||||||
write_exp_elt_opcode (UNOP_IND);
|
write_exp_elt_opcode (&p->pstate, UNOP_IND);
|
||||||
|
|
||||||
p->arg = s;
|
p->arg = s;
|
||||||
|
|
||||||
|
368
gdb/jv-exp.y
368
gdb/jv-exp.y
@ -49,8 +49,8 @@
|
|||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include "completer.h"
|
#include "completer.h"
|
||||||
|
|
||||||
#define parse_type builtin_type (parse_gdbarch)
|
#define parse_type(ps) builtin_type (parse_gdbarch (ps))
|
||||||
#define parse_java_type builtin_java_type (parse_gdbarch)
|
#define parse_java_type(ps) builtin_java_type (parse_gdbarch (ps))
|
||||||
|
|
||||||
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
||||||
as well as gratuitiously global symbol names, so we can have multiple
|
as well as gratuitiously global symbol names, so we can have multiple
|
||||||
@ -60,7 +60,7 @@
|
|||||||
generators need to be fixed instead of adding those names to this list. */
|
generators need to be fixed instead of adding those names to this list. */
|
||||||
|
|
||||||
#define yymaxdepth java_maxdepth
|
#define yymaxdepth java_maxdepth
|
||||||
#define yyparse java_parse
|
#define yyparse java_parse_internal
|
||||||
#define yylex java_lex
|
#define yylex java_lex
|
||||||
#define yyerror java_error
|
#define yyerror java_error
|
||||||
#define yylval java_lval
|
#define yylval java_lval
|
||||||
@ -112,6 +112,11 @@
|
|||||||
|
|
||||||
#define YYFPRINTF parser_fprintf
|
#define YYFPRINTF parser_fprintf
|
||||||
|
|
||||||
|
/* The state of the parser, used internally when we are parsing the
|
||||||
|
expression. */
|
||||||
|
|
||||||
|
static struct parser_state *pstate = NULL;
|
||||||
|
|
||||||
int yyparse (void);
|
int yyparse (void);
|
||||||
|
|
||||||
static int yylex (void);
|
static int yylex (void);
|
||||||
@ -119,11 +124,11 @@ static int yylex (void);
|
|||||||
void yyerror (char *);
|
void yyerror (char *);
|
||||||
|
|
||||||
static struct type *java_type_from_name (struct stoken);
|
static struct type *java_type_from_name (struct stoken);
|
||||||
static void push_expression_name (struct stoken);
|
static void push_expression_name (struct parser_state *, struct stoken);
|
||||||
static void push_fieldnames (struct stoken);
|
static void push_fieldnames (struct parser_state *, struct stoken);
|
||||||
|
|
||||||
static struct expression *copy_exp (struct expression *, int);
|
static struct expression *copy_exp (struct expression *, int);
|
||||||
static void insert_exp (int, struct expression *);
|
static void insert_exp (struct parser_state *, int, struct expression *);
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
@ -155,7 +160,8 @@ static void insert_exp (int, struct expression *);
|
|||||||
|
|
||||||
%{
|
%{
|
||||||
/* YYSTYPE gets defined by %union */
|
/* YYSTYPE gets defined by %union */
|
||||||
static int parse_number (const char *, int, int, YYSTYPE *);
|
static int parse_number (struct parser_state *, const char *, int,
|
||||||
|
int, YYSTYPE *);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%type <lval> rcurly Dims Dims_opt
|
%type <lval> rcurly Dims Dims_opt
|
||||||
@ -215,9 +221,9 @@ start : exp1
|
|||||||
|
|
||||||
type_exp: PrimitiveOrArrayType
|
type_exp: PrimitiveOrArrayType
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode(OP_TYPE);
|
write_exp_elt_opcode (pstate, OP_TYPE);
|
||||||
write_exp_elt_type($1);
|
write_exp_elt_type (pstate, $1);
|
||||||
write_exp_elt_opcode(OP_TYPE);
|
write_exp_elt_opcode (pstate, OP_TYPE);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -229,36 +235,38 @@ PrimitiveOrArrayType:
|
|||||||
StringLiteral:
|
StringLiteral:
|
||||||
STRING_LITERAL
|
STRING_LITERAL
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_STRING);
|
write_exp_elt_opcode (pstate, OP_STRING);
|
||||||
write_exp_string ($1);
|
write_exp_string (pstate, $1);
|
||||||
write_exp_elt_opcode (OP_STRING);
|
write_exp_elt_opcode (pstate, OP_STRING);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
Literal:
|
Literal:
|
||||||
INTEGER_LITERAL
|
INTEGER_LITERAL
|
||||||
{ write_exp_elt_opcode (OP_LONG);
|
{ write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type ($1.type);
|
write_exp_elt_type (pstate, $1.type);
|
||||||
write_exp_elt_longcst ((LONGEST)($1.val));
|
write_exp_elt_longcst (pstate, (LONGEST)($1.val));
|
||||||
write_exp_elt_opcode (OP_LONG); }
|
write_exp_elt_opcode (pstate, OP_LONG); }
|
||||||
| NAME_OR_INT
|
| NAME_OR_INT
|
||||||
{ YYSTYPE val;
|
{ YYSTYPE val;
|
||||||
parse_number ($1.ptr, $1.length, 0, &val);
|
parse_number (pstate, $1.ptr, $1.length, 0, &val);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (val.typed_val_int.type);
|
write_exp_elt_type (pstate, val.typed_val_int.type);
|
||||||
write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
|
write_exp_elt_longcst (pstate,
|
||||||
write_exp_elt_opcode (OP_LONG);
|
(LONGEST) val.typed_val_int.val);
|
||||||
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
}
|
}
|
||||||
| FLOATING_POINT_LITERAL
|
| FLOATING_POINT_LITERAL
|
||||||
{ write_exp_elt_opcode (OP_DOUBLE);
|
{ write_exp_elt_opcode (pstate, OP_DOUBLE);
|
||||||
write_exp_elt_type ($1.type);
|
write_exp_elt_type (pstate, $1.type);
|
||||||
write_exp_elt_dblcst ($1.dval);
|
write_exp_elt_dblcst (pstate, $1.dval);
|
||||||
write_exp_elt_opcode (OP_DOUBLE); }
|
write_exp_elt_opcode (pstate, OP_DOUBLE); }
|
||||||
| BOOLEAN_LITERAL
|
| BOOLEAN_LITERAL
|
||||||
{ write_exp_elt_opcode (OP_LONG);
|
{ write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (parse_java_type->builtin_boolean);
|
write_exp_elt_type (pstate,
|
||||||
write_exp_elt_longcst ((LONGEST)$1);
|
parse_java_type (pstate)->builtin_boolean);
|
||||||
write_exp_elt_opcode (OP_LONG); }
|
write_exp_elt_longcst (pstate, (LONGEST)$1);
|
||||||
|
write_exp_elt_opcode (pstate, OP_LONG); }
|
||||||
| StringLiteral
|
| StringLiteral
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -272,7 +280,7 @@ Type:
|
|||||||
PrimitiveType:
|
PrimitiveType:
|
||||||
NumericType
|
NumericType
|
||||||
| BOOLEAN
|
| BOOLEAN
|
||||||
{ $$ = parse_java_type->builtin_boolean; }
|
{ $$ = parse_java_type (pstate)->builtin_boolean; }
|
||||||
;
|
;
|
||||||
|
|
||||||
NumericType:
|
NumericType:
|
||||||
@ -282,22 +290,22 @@ NumericType:
|
|||||||
|
|
||||||
IntegralType:
|
IntegralType:
|
||||||
BYTE
|
BYTE
|
||||||
{ $$ = parse_java_type->builtin_byte; }
|
{ $$ = parse_java_type (pstate)->builtin_byte; }
|
||||||
| SHORT
|
| SHORT
|
||||||
{ $$ = parse_java_type->builtin_short; }
|
{ $$ = parse_java_type (pstate)->builtin_short; }
|
||||||
| INT
|
| INT
|
||||||
{ $$ = parse_java_type->builtin_int; }
|
{ $$ = parse_java_type (pstate)->builtin_int; }
|
||||||
| LONG
|
| LONG
|
||||||
{ $$ = parse_java_type->builtin_long; }
|
{ $$ = parse_java_type (pstate)->builtin_long; }
|
||||||
| CHAR
|
| CHAR
|
||||||
{ $$ = parse_java_type->builtin_char; }
|
{ $$ = parse_java_type (pstate)->builtin_char; }
|
||||||
;
|
;
|
||||||
|
|
||||||
FloatingPointType:
|
FloatingPointType:
|
||||||
FLOAT
|
FLOAT
|
||||||
{ $$ = parse_java_type->builtin_float; }
|
{ $$ = parse_java_type (pstate)->builtin_float; }
|
||||||
| DOUBLE
|
| DOUBLE
|
||||||
{ $$ = parse_java_type->builtin_double; }
|
{ $$ = parse_java_type (pstate)->builtin_double; }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* UNUSED:
|
/* UNUSED:
|
||||||
@ -367,7 +375,7 @@ type_exp: type
|
|||||||
/* Expressions, including the comma operator. */
|
/* Expressions, including the comma operator. */
|
||||||
exp1 : Expression
|
exp1 : Expression
|
||||||
| exp1 ',' Expression
|
| exp1 ',' Expression
|
||||||
{ write_exp_elt_opcode (BINOP_COMMA); }
|
{ write_exp_elt_opcode (pstate, BINOP_COMMA); }
|
||||||
;
|
;
|
||||||
|
|
||||||
Primary:
|
Primary:
|
||||||
@ -383,10 +391,10 @@ PrimaryNoNewArray:
|
|||||||
| MethodInvocation
|
| MethodInvocation
|
||||||
| ArrayAccess
|
| ArrayAccess
|
||||||
| lcurly ArgumentList rcurly
|
| lcurly ArgumentList rcurly
|
||||||
{ write_exp_elt_opcode (OP_ARRAY);
|
{ write_exp_elt_opcode (pstate, OP_ARRAY);
|
||||||
write_exp_elt_longcst ((LONGEST) 0);
|
write_exp_elt_longcst (pstate, (LONGEST) 0);
|
||||||
write_exp_elt_longcst ((LONGEST) $3);
|
write_exp_elt_longcst (pstate, (LONGEST) $3);
|
||||||
write_exp_elt_opcode (OP_ARRAY); }
|
write_exp_elt_opcode (pstate, OP_ARRAY); }
|
||||||
;
|
;
|
||||||
|
|
||||||
lcurly:
|
lcurly:
|
||||||
@ -451,24 +459,24 @@ Dims_opt:
|
|||||||
|
|
||||||
FieldAccess:
|
FieldAccess:
|
||||||
Primary '.' SimpleName
|
Primary '.' SimpleName
|
||||||
{ push_fieldnames ($3); }
|
{ push_fieldnames (pstate, $3); }
|
||||||
| VARIABLE '.' SimpleName
|
| VARIABLE '.' SimpleName
|
||||||
{ push_fieldnames ($3); }
|
{ push_fieldnames (pstate, $3); }
|
||||||
/*| SUPER '.' SimpleName { FIXME } */
|
/*| SUPER '.' SimpleName { FIXME } */
|
||||||
;
|
;
|
||||||
|
|
||||||
FuncStart:
|
FuncStart:
|
||||||
Name '('
|
Name '('
|
||||||
{ push_expression_name ($1); }
|
{ push_expression_name (pstate, $1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
MethodInvocation:
|
MethodInvocation:
|
||||||
FuncStart
|
FuncStart
|
||||||
{ start_arglist(); }
|
{ start_arglist(); }
|
||||||
ArgumentList_opt ')'
|
ArgumentList_opt ')'
|
||||||
{ write_exp_elt_opcode (OP_FUNCALL);
|
{ write_exp_elt_opcode (pstate, OP_FUNCALL);
|
||||||
write_exp_elt_longcst ((LONGEST) end_arglist ());
|
write_exp_elt_longcst (pstate, (LONGEST) end_arglist ());
|
||||||
write_exp_elt_opcode (OP_FUNCALL); }
|
write_exp_elt_opcode (pstate, OP_FUNCALL); }
|
||||||
| Primary '.' SimpleName '(' ArgumentList_opt ')'
|
| Primary '.' SimpleName '(' ArgumentList_opt ')'
|
||||||
{ error (_("Form of method invocation not implemented")); }
|
{ error (_("Form of method invocation not implemented")); }
|
||||||
| SUPER '.' SimpleName '(' ArgumentList_opt ')'
|
| SUPER '.' SimpleName '(' ArgumentList_opt ')'
|
||||||
@ -485,24 +493,27 @@ ArrayAccess:
|
|||||||
for our parsing kludges. */
|
for our parsing kludges. */
|
||||||
struct expression *name_expr;
|
struct expression *name_expr;
|
||||||
|
|
||||||
push_expression_name ($1);
|
push_expression_name (pstate, $1);
|
||||||
name_expr = copy_exp (expout, expout_ptr);
|
name_expr = copy_exp (pstate->expout, pstate->expout_ptr);
|
||||||
expout_ptr -= name_expr->nelts;
|
pstate->expout_ptr -= name_expr->nelts;
|
||||||
insert_exp (expout_ptr-length_of_subexp (expout, expout_ptr),
|
insert_exp (pstate,
|
||||||
|
pstate->expout_ptr
|
||||||
|
- length_of_subexp (pstate->expout,
|
||||||
|
pstate->expout_ptr),
|
||||||
name_expr);
|
name_expr);
|
||||||
free (name_expr);
|
free (name_expr);
|
||||||
write_exp_elt_opcode (BINOP_SUBSCRIPT);
|
write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT);
|
||||||
}
|
}
|
||||||
| VARIABLE '[' Expression ']'
|
| VARIABLE '[' Expression ']'
|
||||||
{ write_exp_elt_opcode (BINOP_SUBSCRIPT); }
|
{ write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); }
|
||||||
| PrimaryNoNewArray '[' Expression ']'
|
| PrimaryNoNewArray '[' Expression ']'
|
||||||
{ write_exp_elt_opcode (BINOP_SUBSCRIPT); }
|
{ write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
PostfixExpression:
|
PostfixExpression:
|
||||||
Primary
|
Primary
|
||||||
| Name
|
| Name
|
||||||
{ push_expression_name ($1); }
|
{ push_expression_name (pstate, $1); }
|
||||||
| VARIABLE
|
| VARIABLE
|
||||||
/* Already written by write_dollar_variable. */
|
/* Already written by write_dollar_variable. */
|
||||||
| PostIncrementExpression
|
| PostIncrementExpression
|
||||||
@ -511,12 +522,12 @@ PostfixExpression:
|
|||||||
|
|
||||||
PostIncrementExpression:
|
PostIncrementExpression:
|
||||||
PostfixExpression INCREMENT
|
PostfixExpression INCREMENT
|
||||||
{ write_exp_elt_opcode (UNOP_POSTINCREMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_POSTINCREMENT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
PostDecrementExpression:
|
PostDecrementExpression:
|
||||||
PostfixExpression DECREMENT
|
PostfixExpression DECREMENT
|
||||||
{ write_exp_elt_opcode (UNOP_POSTDECREMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_POSTDECREMENT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
UnaryExpression:
|
UnaryExpression:
|
||||||
@ -524,144 +535,151 @@ UnaryExpression:
|
|||||||
| PreDecrementExpression
|
| PreDecrementExpression
|
||||||
| '+' UnaryExpression
|
| '+' UnaryExpression
|
||||||
| '-' UnaryExpression
|
| '-' UnaryExpression
|
||||||
{ write_exp_elt_opcode (UNOP_NEG); }
|
{ write_exp_elt_opcode (pstate, UNOP_NEG); }
|
||||||
| '*' UnaryExpression
|
| '*' UnaryExpression
|
||||||
{ write_exp_elt_opcode (UNOP_IND); } /*FIXME not in Java */
|
{ write_exp_elt_opcode (pstate,
|
||||||
|
UNOP_IND); } /*FIXME not in Java */
|
||||||
| UnaryExpressionNotPlusMinus
|
| UnaryExpressionNotPlusMinus
|
||||||
;
|
;
|
||||||
|
|
||||||
PreIncrementExpression:
|
PreIncrementExpression:
|
||||||
INCREMENT UnaryExpression
|
INCREMENT UnaryExpression
|
||||||
{ write_exp_elt_opcode (UNOP_PREINCREMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_PREINCREMENT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
PreDecrementExpression:
|
PreDecrementExpression:
|
||||||
DECREMENT UnaryExpression
|
DECREMENT UnaryExpression
|
||||||
{ write_exp_elt_opcode (UNOP_PREDECREMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_PREDECREMENT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
UnaryExpressionNotPlusMinus:
|
UnaryExpressionNotPlusMinus:
|
||||||
PostfixExpression
|
PostfixExpression
|
||||||
| '~' UnaryExpression
|
| '~' UnaryExpression
|
||||||
{ write_exp_elt_opcode (UNOP_COMPLEMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_COMPLEMENT); }
|
||||||
| '!' UnaryExpression
|
| '!' UnaryExpression
|
||||||
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
|
{ write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); }
|
||||||
| CastExpression
|
| CastExpression
|
||||||
;
|
;
|
||||||
|
|
||||||
CastExpression:
|
CastExpression:
|
||||||
'(' PrimitiveType Dims_opt ')' UnaryExpression
|
'(' PrimitiveType Dims_opt ')' UnaryExpression
|
||||||
{ write_exp_elt_opcode (UNOP_CAST);
|
{ write_exp_elt_opcode (pstate, UNOP_CAST);
|
||||||
write_exp_elt_type (java_array_type ($2, $3));
|
write_exp_elt_type (pstate, java_array_type ($2, $3));
|
||||||
write_exp_elt_opcode (UNOP_CAST); }
|
write_exp_elt_opcode (pstate, UNOP_CAST); }
|
||||||
| '(' Expression ')' UnaryExpressionNotPlusMinus
|
| '(' Expression ')' UnaryExpressionNotPlusMinus
|
||||||
{
|
{
|
||||||
int last_exp_size = length_of_subexp(expout, expout_ptr);
|
int last_exp_size = length_of_subexp (pstate->expout,
|
||||||
|
pstate->expout_ptr);
|
||||||
struct type *type;
|
struct type *type;
|
||||||
int i;
|
int i;
|
||||||
int base = expout_ptr - last_exp_size - 3;
|
int base = pstate->expout_ptr - last_exp_size - 3;
|
||||||
if (base < 0 || expout->elts[base+2].opcode != OP_TYPE)
|
|
||||||
|
if (base < 0
|
||||||
|
|| pstate->expout->elts[base+2].opcode != OP_TYPE)
|
||||||
error (_("Invalid cast expression"));
|
error (_("Invalid cast expression"));
|
||||||
type = expout->elts[base+1].type;
|
type = pstate->expout->elts[base+1].type;
|
||||||
/* Remove the 'Expression' and slide the
|
/* Remove the 'Expression' and slide the
|
||||||
UnaryExpressionNotPlusMinus down to replace it. */
|
UnaryExpressionNotPlusMinus down to replace it. */
|
||||||
for (i = 0; i < last_exp_size; i++)
|
for (i = 0; i < last_exp_size; i++)
|
||||||
expout->elts[base + i] = expout->elts[base + i + 3];
|
pstate->expout->elts[base + i]
|
||||||
expout_ptr -= 3;
|
= pstate->expout->elts[base + i + 3];
|
||||||
|
pstate->expout_ptr -= 3;
|
||||||
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
|
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
|
||||||
type = lookup_pointer_type (type);
|
type = lookup_pointer_type (type);
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (pstate, UNOP_CAST);
|
||||||
write_exp_elt_type (type);
|
write_exp_elt_type (pstate, type);
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (pstate, UNOP_CAST);
|
||||||
}
|
}
|
||||||
| '(' Name Dims ')' UnaryExpressionNotPlusMinus
|
| '(' Name Dims ')' UnaryExpressionNotPlusMinus
|
||||||
{ write_exp_elt_opcode (UNOP_CAST);
|
{ write_exp_elt_opcode (pstate, UNOP_CAST);
|
||||||
write_exp_elt_type (java_array_type (java_type_from_name ($2), $3));
|
write_exp_elt_type (pstate,
|
||||||
write_exp_elt_opcode (UNOP_CAST); }
|
java_array_type (java_type_from_name
|
||||||
|
($2), $3));
|
||||||
|
write_exp_elt_opcode (pstate, UNOP_CAST); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
MultiplicativeExpression:
|
MultiplicativeExpression:
|
||||||
UnaryExpression
|
UnaryExpression
|
||||||
| MultiplicativeExpression '*' UnaryExpression
|
| MultiplicativeExpression '*' UnaryExpression
|
||||||
{ write_exp_elt_opcode (BINOP_MUL); }
|
{ write_exp_elt_opcode (pstate, BINOP_MUL); }
|
||||||
| MultiplicativeExpression '/' UnaryExpression
|
| MultiplicativeExpression '/' UnaryExpression
|
||||||
{ write_exp_elt_opcode (BINOP_DIV); }
|
{ write_exp_elt_opcode (pstate, BINOP_DIV); }
|
||||||
| MultiplicativeExpression '%' UnaryExpression
|
| MultiplicativeExpression '%' UnaryExpression
|
||||||
{ write_exp_elt_opcode (BINOP_REM); }
|
{ write_exp_elt_opcode (pstate, BINOP_REM); }
|
||||||
;
|
;
|
||||||
|
|
||||||
AdditiveExpression:
|
AdditiveExpression:
|
||||||
MultiplicativeExpression
|
MultiplicativeExpression
|
||||||
| AdditiveExpression '+' MultiplicativeExpression
|
| AdditiveExpression '+' MultiplicativeExpression
|
||||||
{ write_exp_elt_opcode (BINOP_ADD); }
|
{ write_exp_elt_opcode (pstate, BINOP_ADD); }
|
||||||
| AdditiveExpression '-' MultiplicativeExpression
|
| AdditiveExpression '-' MultiplicativeExpression
|
||||||
{ write_exp_elt_opcode (BINOP_SUB); }
|
{ write_exp_elt_opcode (pstate, BINOP_SUB); }
|
||||||
;
|
;
|
||||||
|
|
||||||
ShiftExpression:
|
ShiftExpression:
|
||||||
AdditiveExpression
|
AdditiveExpression
|
||||||
| ShiftExpression LSH AdditiveExpression
|
| ShiftExpression LSH AdditiveExpression
|
||||||
{ write_exp_elt_opcode (BINOP_LSH); }
|
{ write_exp_elt_opcode (pstate, BINOP_LSH); }
|
||||||
| ShiftExpression RSH AdditiveExpression
|
| ShiftExpression RSH AdditiveExpression
|
||||||
{ write_exp_elt_opcode (BINOP_RSH); }
|
{ write_exp_elt_opcode (pstate, BINOP_RSH); }
|
||||||
/* | ShiftExpression >>> AdditiveExpression { FIXME } */
|
/* | ShiftExpression >>> AdditiveExpression { FIXME } */
|
||||||
;
|
;
|
||||||
|
|
||||||
RelationalExpression:
|
RelationalExpression:
|
||||||
ShiftExpression
|
ShiftExpression
|
||||||
| RelationalExpression '<' ShiftExpression
|
| RelationalExpression '<' ShiftExpression
|
||||||
{ write_exp_elt_opcode (BINOP_LESS); }
|
{ write_exp_elt_opcode (pstate, BINOP_LESS); }
|
||||||
| RelationalExpression '>' ShiftExpression
|
| RelationalExpression '>' ShiftExpression
|
||||||
{ write_exp_elt_opcode (BINOP_GTR); }
|
{ write_exp_elt_opcode (pstate, BINOP_GTR); }
|
||||||
| RelationalExpression LEQ ShiftExpression
|
| RelationalExpression LEQ ShiftExpression
|
||||||
{ write_exp_elt_opcode (BINOP_LEQ); }
|
{ write_exp_elt_opcode (pstate, BINOP_LEQ); }
|
||||||
| RelationalExpression GEQ ShiftExpression
|
| RelationalExpression GEQ ShiftExpression
|
||||||
{ write_exp_elt_opcode (BINOP_GEQ); }
|
{ write_exp_elt_opcode (pstate, BINOP_GEQ); }
|
||||||
/* | RelationalExpresion INSTANCEOF ReferenceType { FIXME } */
|
/* | RelationalExpresion INSTANCEOF ReferenceType { FIXME } */
|
||||||
;
|
;
|
||||||
|
|
||||||
EqualityExpression:
|
EqualityExpression:
|
||||||
RelationalExpression
|
RelationalExpression
|
||||||
| EqualityExpression EQUAL RelationalExpression
|
| EqualityExpression EQUAL RelationalExpression
|
||||||
{ write_exp_elt_opcode (BINOP_EQUAL); }
|
{ write_exp_elt_opcode (pstate, BINOP_EQUAL); }
|
||||||
| EqualityExpression NOTEQUAL RelationalExpression
|
| EqualityExpression NOTEQUAL RelationalExpression
|
||||||
{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
|
{ write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
AndExpression:
|
AndExpression:
|
||||||
EqualityExpression
|
EqualityExpression
|
||||||
| AndExpression '&' EqualityExpression
|
| AndExpression '&' EqualityExpression
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_AND); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
ExclusiveOrExpression:
|
ExclusiveOrExpression:
|
||||||
AndExpression
|
AndExpression
|
||||||
| ExclusiveOrExpression '^' AndExpression
|
| ExclusiveOrExpression '^' AndExpression
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_XOR); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); }
|
||||||
;
|
;
|
||||||
InclusiveOrExpression:
|
InclusiveOrExpression:
|
||||||
ExclusiveOrExpression
|
ExclusiveOrExpression
|
||||||
| InclusiveOrExpression '|' ExclusiveOrExpression
|
| InclusiveOrExpression '|' ExclusiveOrExpression
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_IOR); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
ConditionalAndExpression:
|
ConditionalAndExpression:
|
||||||
InclusiveOrExpression
|
InclusiveOrExpression
|
||||||
| ConditionalAndExpression ANDAND InclusiveOrExpression
|
| ConditionalAndExpression ANDAND InclusiveOrExpression
|
||||||
{ write_exp_elt_opcode (BINOP_LOGICAL_AND); }
|
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
ConditionalOrExpression:
|
ConditionalOrExpression:
|
||||||
ConditionalAndExpression
|
ConditionalAndExpression
|
||||||
| ConditionalOrExpression OROR ConditionalAndExpression
|
| ConditionalOrExpression OROR ConditionalAndExpression
|
||||||
{ write_exp_elt_opcode (BINOP_LOGICAL_OR); }
|
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
ConditionalExpression:
|
ConditionalExpression:
|
||||||
ConditionalOrExpression
|
ConditionalOrExpression
|
||||||
| ConditionalOrExpression '?' Expression ':' ConditionalExpression
|
| ConditionalOrExpression '?' Expression ':' ConditionalExpression
|
||||||
{ write_exp_elt_opcode (TERNOP_COND); }
|
{ write_exp_elt_opcode (pstate, TERNOP_COND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
AssignmentExpression:
|
AssignmentExpression:
|
||||||
@ -671,16 +689,16 @@ AssignmentExpression:
|
|||||||
|
|
||||||
Assignment:
|
Assignment:
|
||||||
LeftHandSide '=' ConditionalExpression
|
LeftHandSide '=' ConditionalExpression
|
||||||
{ write_exp_elt_opcode (BINOP_ASSIGN); }
|
{ write_exp_elt_opcode (pstate, BINOP_ASSIGN); }
|
||||||
| LeftHandSide ASSIGN_MODIFY ConditionalExpression
|
| LeftHandSide ASSIGN_MODIFY ConditionalExpression
|
||||||
{ write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
|
{ write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY);
|
||||||
write_exp_elt_opcode ($2);
|
write_exp_elt_opcode (pstate, $2);
|
||||||
write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
|
write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); }
|
||||||
;
|
;
|
||||||
|
|
||||||
LeftHandSide:
|
LeftHandSide:
|
||||||
ForcedName
|
ForcedName
|
||||||
{ push_expression_name ($1); }
|
{ push_expression_name (pstate, $1); }
|
||||||
| VARIABLE
|
| VARIABLE
|
||||||
/* Already written by write_dollar_variable. */
|
/* Already written by write_dollar_variable. */
|
||||||
| FieldAccess
|
| FieldAccess
|
||||||
@ -700,7 +718,8 @@ Expression:
|
|||||||
/*** Needs some error checking for the float case ***/
|
/*** Needs some error checking for the float case ***/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
parse_number (struct parser_state *par_state,
|
||||||
|
const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
||||||
{
|
{
|
||||||
ULONGEST n = 0;
|
ULONGEST n = 0;
|
||||||
ULONGEST limit, limit_div_base;
|
ULONGEST limit, limit_div_base;
|
||||||
@ -721,16 +740,17 @@ parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
|||||||
suffix_len = p + len - suffix;
|
suffix_len = p + len - suffix;
|
||||||
|
|
||||||
if (suffix_len == 0)
|
if (suffix_len == 0)
|
||||||
putithere->typed_val_float.type = parse_type->builtin_double;
|
putithere->typed_val_float.type
|
||||||
|
= parse_type (par_state)->builtin_double;
|
||||||
else if (suffix_len == 1)
|
else if (suffix_len == 1)
|
||||||
{
|
{
|
||||||
/* See if it has `f' or `d' suffix (float or double). */
|
/* See if it has `f' or `d' suffix (float or double). */
|
||||||
if (tolower (*suffix) == 'f')
|
if (tolower (*suffix) == 'f')
|
||||||
putithere->typed_val_float.type =
|
putithere->typed_val_float.type =
|
||||||
parse_type->builtin_float;
|
parse_type (par_state)->builtin_float;
|
||||||
else if (tolower (*suffix) == 'd')
|
else if (tolower (*suffix) == 'd')
|
||||||
putithere->typed_val_float.type =
|
putithere->typed_val_float.type =
|
||||||
parse_type->builtin_double;
|
parse_type (par_state)->builtin_double;
|
||||||
else
|
else
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
@ -777,12 +797,12 @@ parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
|||||||
limit = ((limit << 16) << 16) | limit;
|
limit = ((limit << 16) << 16) | limit;
|
||||||
if (c == 'l' || c == 'L')
|
if (c == 'l' || c == 'L')
|
||||||
{
|
{
|
||||||
type = parse_java_type->builtin_long;
|
type = parse_java_type (par_state)->builtin_long;
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
type = parse_java_type->builtin_int;
|
type = parse_java_type (par_state)->builtin_int;
|
||||||
}
|
}
|
||||||
limit_div_base = limit / (ULONGEST) base;
|
limit_div_base = limit / (ULONGEST) base;
|
||||||
|
|
||||||
@ -807,11 +827,13 @@ parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
|||||||
|
|
||||||
/* If the type is bigger than a 32-bit signed integer can be, implicitly
|
/* If the type is bigger than a 32-bit signed integer can be, implicitly
|
||||||
promote to long. Java does not do this, so mark it as
|
promote to long. Java does not do this, so mark it as
|
||||||
parse_type->builtin_uint64 rather than parse_java_type->builtin_long.
|
parse_type (par_state)->builtin_uint64 rather than
|
||||||
|
parse_java_type (par_state)->builtin_long.
|
||||||
0x80000000 will become -0x80000000 instead of 0x80000000L, because we
|
0x80000000 will become -0x80000000 instead of 0x80000000L, because we
|
||||||
don't know the sign at this point. */
|
don't know the sign at this point. */
|
||||||
if (type == parse_java_type->builtin_int && n > (ULONGEST)0x80000000)
|
if (type == parse_java_type (par_state)->builtin_int
|
||||||
type = parse_type->builtin_uint64;
|
&& n > (ULONGEST)0x80000000)
|
||||||
|
type = parse_type (par_state)->builtin_uint64;
|
||||||
|
|
||||||
putithere->typed_val_int.val = n;
|
putithere->typed_val_int.val = n;
|
||||||
putithere->typed_val_int.type = type;
|
putithere->typed_val_int.type = type;
|
||||||
@ -909,12 +931,12 @@ yylex (void)
|
|||||||
lexptr++;
|
lexptr++;
|
||||||
c = *lexptr++;
|
c = *lexptr++;
|
||||||
if (c == '\\')
|
if (c == '\\')
|
||||||
c = parse_escape (parse_gdbarch, &lexptr);
|
c = parse_escape (parse_gdbarch (pstate), &lexptr);
|
||||||
else if (c == '\'')
|
else if (c == '\'')
|
||||||
error (_("Empty character constant"));
|
error (_("Empty character constant"));
|
||||||
|
|
||||||
yylval.typed_val_int.val = c;
|
yylval.typed_val_int.val = c;
|
||||||
yylval.typed_val_int.type = parse_java_type->builtin_char;
|
yylval.typed_val_int.type = parse_java_type (pstate)->builtin_char;
|
||||||
|
|
||||||
c = *lexptr++;
|
c = *lexptr++;
|
||||||
if (c != '\'')
|
if (c != '\'')
|
||||||
@ -1007,7 +1029,8 @@ yylex (void)
|
|||||||
&& (*p < 'A' || *p > 'Z')))
|
&& (*p < 'A' || *p > 'Z')))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
|
toktype = parse_number (pstate, tokstart, p - tokstart,
|
||||||
|
got_dot|got_e, &yylval);
|
||||||
if (toktype == ERROR)
|
if (toktype == ERROR)
|
||||||
{
|
{
|
||||||
char *err_copy = (char *) alloca (p - tokstart + 1);
|
char *err_copy = (char *) alloca (p - tokstart + 1);
|
||||||
@ -1072,7 +1095,7 @@ yylex (void)
|
|||||||
break;
|
break;
|
||||||
case '\\':
|
case '\\':
|
||||||
tokptr++;
|
tokptr++;
|
||||||
c = parse_escape (parse_gdbarch, &tokptr);
|
c = parse_escape (parse_gdbarch (pstate), &tokptr);
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -1184,7 +1207,7 @@ yylex (void)
|
|||||||
|
|
||||||
if (*tokstart == '$')
|
if (*tokstart == '$')
|
||||||
{
|
{
|
||||||
write_dollar_variable (yylval.sval);
|
write_dollar_variable (pstate, yylval.sval);
|
||||||
return VARIABLE;
|
return VARIABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1195,13 +1218,29 @@ yylex (void)
|
|||||||
(tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
|
(tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
|
||||||
{
|
{
|
||||||
YYSTYPE newlval; /* Its value is ignored. */
|
YYSTYPE newlval; /* Its value is ignored. */
|
||||||
int hextype = parse_number (tokstart, namelen, 0, &newlval);
|
int hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
|
||||||
if (hextype == INTEGER_LITERAL)
|
if (hextype == INTEGER_LITERAL)
|
||||||
return NAME_OR_INT;
|
return NAME_OR_INT;
|
||||||
}
|
}
|
||||||
return IDENTIFIER;
|
return IDENTIFIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
java_parse (struct parser_state *par_state)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
|
||||||
|
|
||||||
|
/* Setting up the parser state. */
|
||||||
|
gdb_assert (par_state != NULL);
|
||||||
|
pstate = par_state;
|
||||||
|
|
||||||
|
result = yyparse ();
|
||||||
|
do_cleanups (c);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
yyerror (char *msg)
|
yyerror (char *msg)
|
||||||
{
|
{
|
||||||
@ -1228,11 +1267,12 @@ java_type_from_name (struct stoken name)
|
|||||||
Otherwise, return 0. */
|
Otherwise, return 0. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
push_variable (struct stoken name)
|
push_variable (struct parser_state *par_state, struct stoken name)
|
||||||
{
|
{
|
||||||
char *tmp = copy_name (name);
|
char *tmp = copy_name (name);
|
||||||
struct field_of_this_result is_a_field_of_this;
|
struct field_of_this_result is_a_field_of_this;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
|
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
|
||||||
&is_a_field_of_this);
|
&is_a_field_of_this);
|
||||||
if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
|
if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
|
||||||
@ -1244,12 +1284,12 @@ push_variable (struct stoken name)
|
|||||||
innermost_block = block_found;
|
innermost_block = block_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (par_state, OP_VAR_VALUE);
|
||||||
/* We want to use the selected frame, not another more inner frame
|
/* We want to use the selected frame, not another more inner frame
|
||||||
which happens to be in the same block. */
|
which happens to be in the same block. */
|
||||||
write_exp_elt_block (NULL);
|
write_exp_elt_block (par_state, NULL);
|
||||||
write_exp_elt_sym (sym);
|
write_exp_elt_sym (par_state, sym);
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (par_state, OP_VAR_VALUE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (is_a_field_of_this.type != NULL)
|
if (is_a_field_of_this.type != NULL)
|
||||||
@ -1259,11 +1299,11 @@ push_variable (struct stoken name)
|
|||||||
if (innermost_block == 0 ||
|
if (innermost_block == 0 ||
|
||||||
contained_in (block_found, innermost_block))
|
contained_in (block_found, innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = block_found;
|
||||||
write_exp_elt_opcode (OP_THIS);
|
write_exp_elt_opcode (par_state, OP_THIS);
|
||||||
write_exp_elt_opcode (OP_THIS);
|
write_exp_elt_opcode (par_state, OP_THIS);
|
||||||
write_exp_elt_opcode (STRUCTOP_PTR);
|
write_exp_elt_opcode (par_state, STRUCTOP_PTR);
|
||||||
write_exp_string (name);
|
write_exp_string (par_state, name);
|
||||||
write_exp_elt_opcode (STRUCTOP_PTR);
|
write_exp_elt_opcode (par_state, STRUCTOP_PTR);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1274,7 +1314,7 @@ push_variable (struct stoken name)
|
|||||||
qualified name (has '.'), generate a field access for each part. */
|
qualified name (has '.'), generate a field access for each part. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
push_fieldnames (struct stoken name)
|
push_fieldnames (struct parser_state *par_state, struct stoken name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct stoken token;
|
struct stoken token;
|
||||||
@ -1285,9 +1325,9 @@ push_fieldnames (struct stoken name)
|
|||||||
{
|
{
|
||||||
/* token.ptr is start of current field name. */
|
/* token.ptr is start of current field name. */
|
||||||
token.length = &name.ptr[i] - token.ptr;
|
token.length = &name.ptr[i] - token.ptr;
|
||||||
write_exp_elt_opcode (STRUCTOP_PTR);
|
write_exp_elt_opcode (par_state, STRUCTOP_PTR);
|
||||||
write_exp_string (token);
|
write_exp_string (par_state, token);
|
||||||
write_exp_elt_opcode (STRUCTOP_PTR);
|
write_exp_elt_opcode (par_state, STRUCTOP_PTR);
|
||||||
token.ptr += token.length + 1;
|
token.ptr += token.length + 1;
|
||||||
}
|
}
|
||||||
if (i >= name.length)
|
if (i >= name.length)
|
||||||
@ -1299,7 +1339,8 @@ push_fieldnames (struct stoken name)
|
|||||||
Handle a qualified name, where DOT_INDEX is the index of the first '.' */
|
Handle a qualified name, where DOT_INDEX is the index of the first '.' */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
push_qualified_expression_name (struct stoken name, int dot_index)
|
push_qualified_expression_name (struct parser_state *par_state,
|
||||||
|
struct stoken name, int dot_index)
|
||||||
{
|
{
|
||||||
struct stoken token;
|
struct stoken token;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
@ -1308,11 +1349,11 @@ push_qualified_expression_name (struct stoken name, int dot_index)
|
|||||||
token.ptr = name.ptr;
|
token.ptr = name.ptr;
|
||||||
token.length = dot_index;
|
token.length = dot_index;
|
||||||
|
|
||||||
if (push_variable (token))
|
if (push_variable (par_state, token))
|
||||||
{
|
{
|
||||||
token.ptr = name.ptr + dot_index + 1;
|
token.ptr = name.ptr + dot_index + 1;
|
||||||
token.length = name.length - dot_index - 1;
|
token.length = name.length - dot_index - 1;
|
||||||
push_fieldnames (token);
|
push_fieldnames (par_state, token);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1326,9 +1367,9 @@ push_qualified_expression_name (struct stoken name, int dot_index)
|
|||||||
{
|
{
|
||||||
if (dot_index == name.length)
|
if (dot_index == name.length)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode(OP_TYPE);
|
write_exp_elt_opcode (par_state, OP_TYPE);
|
||||||
write_exp_elt_type(typ);
|
write_exp_elt_type (par_state, typ);
|
||||||
write_exp_elt_opcode(OP_TYPE);
|
write_exp_elt_opcode (par_state, OP_TYPE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dot_index++; /* Skip '.' */
|
dot_index++; /* Skip '.' */
|
||||||
@ -1339,16 +1380,16 @@ push_qualified_expression_name (struct stoken name, int dot_index)
|
|||||||
dot_index++;
|
dot_index++;
|
||||||
token.ptr = name.ptr;
|
token.ptr = name.ptr;
|
||||||
token.length = dot_index;
|
token.length = dot_index;
|
||||||
write_exp_elt_opcode (OP_SCOPE);
|
write_exp_elt_opcode (par_state, OP_SCOPE);
|
||||||
write_exp_elt_type (typ);
|
write_exp_elt_type (par_state, typ);
|
||||||
write_exp_string (token);
|
write_exp_string (par_state, token);
|
||||||
write_exp_elt_opcode (OP_SCOPE);
|
write_exp_elt_opcode (par_state, OP_SCOPE);
|
||||||
if (dot_index < name.length)
|
if (dot_index < name.length)
|
||||||
{
|
{
|
||||||
dot_index++;
|
dot_index++;
|
||||||
name.ptr += dot_index;
|
name.ptr += dot_index;
|
||||||
name.length -= dot_index;
|
name.length -= dot_index;
|
||||||
push_fieldnames (name);
|
push_fieldnames (par_state, name);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1365,7 +1406,7 @@ push_qualified_expression_name (struct stoken name, int dot_index)
|
|||||||
Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */
|
Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
push_expression_name (struct stoken name)
|
push_expression_name (struct parser_state *par_state, struct stoken name)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
struct type *typ;
|
struct type *typ;
|
||||||
@ -1376,22 +1417,22 @@ push_expression_name (struct stoken name)
|
|||||||
if (name.ptr[i] == '.')
|
if (name.ptr[i] == '.')
|
||||||
{
|
{
|
||||||
/* It's a Qualified Expression Name. */
|
/* It's a Qualified Expression Name. */
|
||||||
push_qualified_expression_name (name, i);
|
push_qualified_expression_name (par_state, name, i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It's a Simple Expression Name. */
|
/* It's a Simple Expression Name. */
|
||||||
|
|
||||||
if (push_variable (name))
|
if (push_variable (par_state, name))
|
||||||
return;
|
return;
|
||||||
tmp = copy_name (name);
|
tmp = copy_name (name);
|
||||||
typ = java_lookup_class (tmp);
|
typ = java_lookup_class (tmp);
|
||||||
if (typ != NULL)
|
if (typ != NULL)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode(OP_TYPE);
|
write_exp_elt_opcode (par_state, OP_TYPE);
|
||||||
write_exp_elt_type(typ);
|
write_exp_elt_type (par_state, typ);
|
||||||
write_exp_elt_opcode(OP_TYPE);
|
write_exp_elt_opcode (par_state, OP_TYPE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1399,7 +1440,7 @@ push_expression_name (struct stoken name)
|
|||||||
|
|
||||||
msymbol = lookup_bound_minimal_symbol (tmp);
|
msymbol = lookup_bound_minimal_symbol (tmp);
|
||||||
if (msymbol.minsym != NULL)
|
if (msymbol.minsym != NULL)
|
||||||
write_exp_msymbol (msymbol);
|
write_exp_msymbol (par_state, msymbol);
|
||||||
else if (!have_full_symbols () && !have_partial_symbols ())
|
else if (!have_full_symbols () && !have_partial_symbols ())
|
||||||
error (_("No symbol table is loaded. Use the \"file\" command"));
|
error (_("No symbol table is loaded. Use the \"file\" command"));
|
||||||
else
|
else
|
||||||
@ -1423,6 +1464,7 @@ copy_exp (struct expression *expr, int endpos)
|
|||||||
int len = length_of_subexp (expr, endpos);
|
int len = length_of_subexp (expr, endpos);
|
||||||
struct expression *new
|
struct expression *new
|
||||||
= (struct expression *) malloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
|
= (struct expression *) malloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
|
||||||
|
|
||||||
new->nelts = len;
|
new->nelts = len;
|
||||||
memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
|
memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
|
||||||
new->language_defn = 0;
|
new->language_defn = 0;
|
||||||
@ -1432,27 +1474,19 @@ copy_exp (struct expression *expr, int endpos)
|
|||||||
|
|
||||||
/* Insert the expression NEW into the current expression (expout) at POS. */
|
/* Insert the expression NEW into the current expression (expout) at POS. */
|
||||||
static void
|
static void
|
||||||
insert_exp (int pos, struct expression *new)
|
insert_exp (struct parser_state *par_state, int pos, struct expression *new)
|
||||||
{
|
{
|
||||||
int newlen = new->nelts;
|
int newlen = new->nelts;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* Grow expout if necessary. In this function's only use at present,
|
/* Grow expout if necessary. In this function's only use at present,
|
||||||
this should never be necessary. */
|
this should never be necessary. */
|
||||||
if (expout_ptr + newlen > expout_size)
|
increase_expout_size (par_state, newlen);
|
||||||
{
|
|
||||||
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)));
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
for (i = par_state->expout_ptr - 1; i >= pos; i--)
|
||||||
int i;
|
par_state->expout->elts[i + newlen] = par_state->expout->elts[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));
|
memcpy (par_state->expout->elts + pos, new->elts,
|
||||||
expout_ptr += newlen;
|
EXP_ELEM_TO_BYTES (newlen));
|
||||||
|
par_state->expout_ptr += newlen;
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,9 @@
|
|||||||
|
|
||||||
struct value;
|
struct value;
|
||||||
struct type_print_options;
|
struct type_print_options;
|
||||||
|
struct parser_state;
|
||||||
|
|
||||||
extern int java_parse (void); /* Defined in jv-exp.y */
|
extern int java_parse (struct parser_state *); /* Defined in jv-exp.y */
|
||||||
|
|
||||||
extern void java_error (char *); /* Defined in jv-exp.y */
|
extern void java_error (char *); /* Defined in jv-exp.y */
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ extern void _initialize_language (void);
|
|||||||
|
|
||||||
static void unk_lang_error (char *);
|
static void unk_lang_error (char *);
|
||||||
|
|
||||||
static int unk_lang_parser (void);
|
static int unk_lang_parser (struct parser_state *);
|
||||||
|
|
||||||
static void show_check (char *, int);
|
static void show_check (char *, int);
|
||||||
|
|
||||||
@ -694,7 +694,7 @@ default_get_string (struct value *value, gdb_byte **buffer, int *length,
|
|||||||
/* Define the language that is no language. */
|
/* Define the language that is no language. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
unk_lang_parser (void)
|
unk_lang_parser (struct parser_state *ps)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ struct ui_file;
|
|||||||
struct value_print_options;
|
struct value_print_options;
|
||||||
struct type_print_options;
|
struct type_print_options;
|
||||||
struct lang_varobj_ops;
|
struct lang_varobj_ops;
|
||||||
|
struct parser_state;
|
||||||
|
|
||||||
#define MAX_FORTRAN_DIMS 7 /* Maximum number of F77 array dims. */
|
#define MAX_FORTRAN_DIMS 7 /* Maximum number of F77 array dims. */
|
||||||
|
|
||||||
@ -164,7 +165,7 @@ struct language_defn
|
|||||||
|
|
||||||
/* Parser function. */
|
/* Parser function. */
|
||||||
|
|
||||||
int (*la_parser) (void);
|
int (*la_parser) (struct parser_state *);
|
||||||
|
|
||||||
/* Parser error function. */
|
/* Parser error function. */
|
||||||
|
|
||||||
|
275
gdb/m2-exp.y
275
gdb/m2-exp.y
@ -49,8 +49,8 @@
|
|||||||
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
|
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
|
|
||||||
#define parse_type builtin_type (parse_gdbarch)
|
#define parse_type(ps) builtin_type (parse_gdbarch (ps))
|
||||||
#define parse_m2_type builtin_m2_type (parse_gdbarch)
|
#define parse_m2_type(ps) builtin_m2_type (parse_gdbarch (ps))
|
||||||
|
|
||||||
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
||||||
as well as gratuitiously global symbol names, so we can have multiple
|
as well as gratuitiously global symbol names, so we can have multiple
|
||||||
@ -60,7 +60,7 @@
|
|||||||
generators need to be fixed instead of adding those names to this list. */
|
generators need to be fixed instead of adding those names to this list. */
|
||||||
|
|
||||||
#define yymaxdepth m2_maxdepth
|
#define yymaxdepth m2_maxdepth
|
||||||
#define yyparse m2_parse
|
#define yyparse m2_parse_internal
|
||||||
#define yylex m2_lex
|
#define yylex m2_lex
|
||||||
#define yyerror m2_error
|
#define yyerror m2_error
|
||||||
#define yylval m2_lval
|
#define yylval m2_lval
|
||||||
@ -112,6 +112,11 @@
|
|||||||
|
|
||||||
#define YYFPRINTF parser_fprintf
|
#define YYFPRINTF parser_fprintf
|
||||||
|
|
||||||
|
/* The state of the parser, used internally when we are parsing the
|
||||||
|
expression. */
|
||||||
|
|
||||||
|
static struct parser_state *pstate = NULL;
|
||||||
|
|
||||||
int yyparse (void);
|
int yyparse (void);
|
||||||
|
|
||||||
static int yylex (void);
|
static int yylex (void);
|
||||||
@ -204,31 +209,31 @@ start : exp
|
|||||||
;
|
;
|
||||||
|
|
||||||
type_exp: type
|
type_exp: type
|
||||||
{ write_exp_elt_opcode(OP_TYPE);
|
{ write_exp_elt_opcode (pstate, OP_TYPE);
|
||||||
write_exp_elt_type($1);
|
write_exp_elt_type (pstate, $1);
|
||||||
write_exp_elt_opcode(OP_TYPE);
|
write_exp_elt_opcode (pstate, OP_TYPE);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Expressions */
|
/* Expressions */
|
||||||
|
|
||||||
exp : exp '^' %prec UNARY
|
exp : exp '^' %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_IND); }
|
{ write_exp_elt_opcode (pstate, UNOP_IND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '-'
|
exp : '-'
|
||||||
{ number_sign = -1; }
|
{ number_sign = -1; }
|
||||||
exp %prec UNARY
|
exp %prec UNARY
|
||||||
{ number_sign = 1;
|
{ number_sign = 1;
|
||||||
write_exp_elt_opcode (UNOP_NEG); }
|
write_exp_elt_opcode (pstate, UNOP_NEG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '+' exp %prec UNARY
|
exp : '+' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode(UNOP_PLUS); }
|
{ write_exp_elt_opcode (pstate, UNOP_PLUS); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : not_exp exp %prec UNARY
|
exp : not_exp exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
|
{ write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
not_exp : NOT
|
not_exp : NOT
|
||||||
@ -236,88 +241,90 @@ not_exp : NOT
|
|||||||
;
|
;
|
||||||
|
|
||||||
exp : CAP '(' exp ')'
|
exp : CAP '(' exp ')'
|
||||||
{ write_exp_elt_opcode (UNOP_CAP); }
|
{ write_exp_elt_opcode (pstate, UNOP_CAP); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : ORD '(' exp ')'
|
exp : ORD '(' exp ')'
|
||||||
{ write_exp_elt_opcode (UNOP_ORD); }
|
{ write_exp_elt_opcode (pstate, UNOP_ORD); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : ABS '(' exp ')'
|
exp : ABS '(' exp ')'
|
||||||
{ write_exp_elt_opcode (UNOP_ABS); }
|
{ write_exp_elt_opcode (pstate, UNOP_ABS); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : HIGH '(' exp ')'
|
exp : HIGH '(' exp ')'
|
||||||
{ write_exp_elt_opcode (UNOP_HIGH); }
|
{ write_exp_elt_opcode (pstate, UNOP_HIGH); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : MIN_FUNC '(' type ')'
|
exp : MIN_FUNC '(' type ')'
|
||||||
{ write_exp_elt_opcode (UNOP_MIN);
|
{ write_exp_elt_opcode (pstate, UNOP_MIN);
|
||||||
write_exp_elt_type ($3);
|
write_exp_elt_type (pstate, $3);
|
||||||
write_exp_elt_opcode (UNOP_MIN); }
|
write_exp_elt_opcode (pstate, UNOP_MIN); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : MAX_FUNC '(' type ')'
|
exp : MAX_FUNC '(' type ')'
|
||||||
{ write_exp_elt_opcode (UNOP_MAX);
|
{ write_exp_elt_opcode (pstate, UNOP_MAX);
|
||||||
write_exp_elt_type ($3);
|
write_exp_elt_type (pstate, $3);
|
||||||
write_exp_elt_opcode (UNOP_MAX); }
|
write_exp_elt_opcode (pstate, UNOP_MAX); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : FLOAT_FUNC '(' exp ')'
|
exp : FLOAT_FUNC '(' exp ')'
|
||||||
{ write_exp_elt_opcode (UNOP_FLOAT); }
|
{ write_exp_elt_opcode (pstate, UNOP_FLOAT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : VAL '(' type ',' exp ')'
|
exp : VAL '(' type ',' exp ')'
|
||||||
{ write_exp_elt_opcode (BINOP_VAL);
|
{ write_exp_elt_opcode (pstate, BINOP_VAL);
|
||||||
write_exp_elt_type ($3);
|
write_exp_elt_type (pstate, $3);
|
||||||
write_exp_elt_opcode (BINOP_VAL); }
|
write_exp_elt_opcode (pstate, BINOP_VAL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : CHR '(' exp ')'
|
exp : CHR '(' exp ')'
|
||||||
{ write_exp_elt_opcode (UNOP_CHR); }
|
{ write_exp_elt_opcode (pstate, UNOP_CHR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : ODD '(' exp ')'
|
exp : ODD '(' exp ')'
|
||||||
{ write_exp_elt_opcode (UNOP_ODD); }
|
{ write_exp_elt_opcode (pstate, UNOP_ODD); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : TRUNC '(' exp ')'
|
exp : TRUNC '(' exp ')'
|
||||||
{ write_exp_elt_opcode (UNOP_TRUNC); }
|
{ write_exp_elt_opcode (pstate, UNOP_TRUNC); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : TSIZE '(' exp ')'
|
exp : TSIZE '(' exp ')'
|
||||||
{ write_exp_elt_opcode (UNOP_SIZEOF); }
|
{ write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : SIZE exp %prec UNARY
|
exp : SIZE exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_SIZEOF); }
|
{ write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
exp : INC '(' exp ')'
|
exp : INC '(' exp ')'
|
||||||
{ write_exp_elt_opcode(UNOP_PREINCREMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_PREINCREMENT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : INC '(' exp ',' exp ')'
|
exp : INC '(' exp ',' exp ')'
|
||||||
{ write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
|
{ write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY);
|
||||||
write_exp_elt_opcode(BINOP_ADD);
|
write_exp_elt_opcode (pstate, BINOP_ADD);
|
||||||
write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); }
|
write_exp_elt_opcode (pstate,
|
||||||
|
BINOP_ASSIGN_MODIFY); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : DEC '(' exp ')'
|
exp : DEC '(' exp ')'
|
||||||
{ write_exp_elt_opcode(UNOP_PREDECREMENT);}
|
{ write_exp_elt_opcode (pstate, UNOP_PREDECREMENT);}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : DEC '(' exp ',' exp ')'
|
exp : DEC '(' exp ',' exp ')'
|
||||||
{ write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
|
{ write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY);
|
||||||
write_exp_elt_opcode(BINOP_SUB);
|
write_exp_elt_opcode (pstate, BINOP_SUB);
|
||||||
write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); }
|
write_exp_elt_opcode (pstate,
|
||||||
|
BINOP_ASSIGN_MODIFY); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp DOT NAME
|
exp : exp DOT NAME
|
||||||
{ write_exp_elt_opcode (STRUCTOP_STRUCT);
|
{ write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
write_exp_string ($3);
|
write_exp_string (pstate, $3);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT); }
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : set
|
exp : set
|
||||||
@ -349,13 +356,14 @@ exp : exp '['
|
|||||||
function types */
|
function types */
|
||||||
{ start_arglist(); }
|
{ start_arglist(); }
|
||||||
non_empty_arglist ']' %prec DOT
|
non_empty_arglist ']' %prec DOT
|
||||||
{ write_exp_elt_opcode (MULTI_SUBSCRIPT);
|
{ write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT);
|
||||||
write_exp_elt_longcst ((LONGEST) end_arglist());
|
write_exp_elt_longcst (pstate,
|
||||||
write_exp_elt_opcode (MULTI_SUBSCRIPT); }
|
(LONGEST) end_arglist());
|
||||||
|
write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '[' exp ']'
|
exp : exp '[' exp ']'
|
||||||
{ write_exp_elt_opcode (BINOP_SUBSCRIPT); }
|
{ write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '('
|
exp : exp '('
|
||||||
@ -363,9 +371,10 @@ exp : exp '('
|
|||||||
being accumulated by an outer function call. */
|
being accumulated by an outer function call. */
|
||||||
{ start_arglist (); }
|
{ start_arglist (); }
|
||||||
arglist ')' %prec DOT
|
arglist ')' %prec DOT
|
||||||
{ write_exp_elt_opcode (OP_FUNCALL);
|
{ write_exp_elt_opcode (pstate, OP_FUNCALL);
|
||||||
write_exp_elt_longcst ((LONGEST) end_arglist ());
|
write_exp_elt_longcst (pstate,
|
||||||
write_exp_elt_opcode (OP_FUNCALL); }
|
(LONGEST) end_arglist ());
|
||||||
|
write_exp_elt_opcode (pstate, OP_FUNCALL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
arglist :
|
arglist :
|
||||||
@ -391,15 +400,15 @@ non_empty_arglist
|
|||||||
|
|
||||||
/* GDB construct */
|
/* GDB construct */
|
||||||
exp : '{' type '}' exp %prec UNARY
|
exp : '{' type '}' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_MEMVAL);
|
{ write_exp_elt_opcode (pstate, UNOP_MEMVAL);
|
||||||
write_exp_elt_type ($2);
|
write_exp_elt_type (pstate, $2);
|
||||||
write_exp_elt_opcode (UNOP_MEMVAL); }
|
write_exp_elt_opcode (pstate, UNOP_MEMVAL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : type '(' exp ')' %prec UNARY
|
exp : type '(' exp ')' %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_CAST);
|
{ write_exp_elt_opcode (pstate, UNOP_CAST);
|
||||||
write_exp_elt_type ($1);
|
write_exp_elt_type (pstate, $1);
|
||||||
write_exp_elt_opcode (UNOP_CAST); }
|
write_exp_elt_opcode (pstate, UNOP_CAST); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '(' exp ')'
|
exp : '(' exp ')'
|
||||||
@ -411,131 +420,140 @@ exp : '(' exp ')'
|
|||||||
|
|
||||||
/* GDB construct */
|
/* GDB construct */
|
||||||
exp : exp '@' exp
|
exp : exp '@' exp
|
||||||
{ write_exp_elt_opcode (BINOP_REPEAT); }
|
{ write_exp_elt_opcode (pstate, BINOP_REPEAT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '*' exp
|
exp : exp '*' exp
|
||||||
{ write_exp_elt_opcode (BINOP_MUL); }
|
{ write_exp_elt_opcode (pstate, BINOP_MUL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '/' exp
|
exp : exp '/' exp
|
||||||
{ write_exp_elt_opcode (BINOP_DIV); }
|
{ write_exp_elt_opcode (pstate, BINOP_DIV); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp DIV exp
|
exp : exp DIV exp
|
||||||
{ write_exp_elt_opcode (BINOP_INTDIV); }
|
{ write_exp_elt_opcode (pstate, BINOP_INTDIV); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp MOD exp
|
exp : exp MOD exp
|
||||||
{ write_exp_elt_opcode (BINOP_REM); }
|
{ write_exp_elt_opcode (pstate, BINOP_REM); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '+' exp
|
exp : exp '+' exp
|
||||||
{ write_exp_elt_opcode (BINOP_ADD); }
|
{ write_exp_elt_opcode (pstate, BINOP_ADD); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '-' exp
|
exp : exp '-' exp
|
||||||
{ write_exp_elt_opcode (BINOP_SUB); }
|
{ write_exp_elt_opcode (pstate, BINOP_SUB); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '=' exp
|
exp : exp '=' exp
|
||||||
{ write_exp_elt_opcode (BINOP_EQUAL); }
|
{ write_exp_elt_opcode (pstate, BINOP_EQUAL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp NOTEQUAL exp
|
exp : exp NOTEQUAL exp
|
||||||
{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
|
{ write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
|
||||||
| exp '#' exp
|
| exp '#' exp
|
||||||
{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
|
{ write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp LEQ exp
|
exp : exp LEQ exp
|
||||||
{ write_exp_elt_opcode (BINOP_LEQ); }
|
{ write_exp_elt_opcode (pstate, BINOP_LEQ); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp GEQ exp
|
exp : exp GEQ exp
|
||||||
{ write_exp_elt_opcode (BINOP_GEQ); }
|
{ write_exp_elt_opcode (pstate, BINOP_GEQ); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '<' exp
|
exp : exp '<' exp
|
||||||
{ write_exp_elt_opcode (BINOP_LESS); }
|
{ write_exp_elt_opcode (pstate, BINOP_LESS); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '>' exp
|
exp : exp '>' exp
|
||||||
{ write_exp_elt_opcode (BINOP_GTR); }
|
{ write_exp_elt_opcode (pstate, BINOP_GTR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp LOGICAL_AND exp
|
exp : exp LOGICAL_AND exp
|
||||||
{ write_exp_elt_opcode (BINOP_LOGICAL_AND); }
|
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp OROR exp
|
exp : exp OROR exp
|
||||||
{ write_exp_elt_opcode (BINOP_LOGICAL_OR); }
|
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp ASSIGN exp
|
exp : exp ASSIGN exp
|
||||||
{ write_exp_elt_opcode (BINOP_ASSIGN); }
|
{ write_exp_elt_opcode (pstate, BINOP_ASSIGN); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
/* Constants */
|
||||||
|
|
||||||
exp : M2_TRUE
|
exp : M2_TRUE
|
||||||
{ write_exp_elt_opcode (OP_BOOL);
|
{ write_exp_elt_opcode (pstate, OP_BOOL);
|
||||||
write_exp_elt_longcst ((LONGEST) $1);
|
write_exp_elt_longcst (pstate, (LONGEST) $1);
|
||||||
write_exp_elt_opcode (OP_BOOL); }
|
write_exp_elt_opcode (pstate, OP_BOOL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : M2_FALSE
|
exp : M2_FALSE
|
||||||
{ write_exp_elt_opcode (OP_BOOL);
|
{ write_exp_elt_opcode (pstate, OP_BOOL);
|
||||||
write_exp_elt_longcst ((LONGEST) $1);
|
write_exp_elt_longcst (pstate, (LONGEST) $1);
|
||||||
write_exp_elt_opcode (OP_BOOL); }
|
write_exp_elt_opcode (pstate, OP_BOOL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : INT
|
exp : INT
|
||||||
{ write_exp_elt_opcode (OP_LONG);
|
{ write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (parse_m2_type->builtin_int);
|
write_exp_elt_type (pstate,
|
||||||
write_exp_elt_longcst ((LONGEST) $1);
|
parse_m2_type (pstate)->builtin_int);
|
||||||
write_exp_elt_opcode (OP_LONG); }
|
write_exp_elt_longcst (pstate, (LONGEST) $1);
|
||||||
|
write_exp_elt_opcode (pstate, OP_LONG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : UINT
|
exp : UINT
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (parse_m2_type->builtin_card);
|
write_exp_elt_type (pstate,
|
||||||
write_exp_elt_longcst ((LONGEST) $1);
|
parse_m2_type (pstate)
|
||||||
write_exp_elt_opcode (OP_LONG);
|
->builtin_card);
|
||||||
|
write_exp_elt_longcst (pstate, (LONGEST) $1);
|
||||||
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : CHAR
|
exp : CHAR
|
||||||
{ write_exp_elt_opcode (OP_LONG);
|
{ write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (parse_m2_type->builtin_char);
|
write_exp_elt_type (pstate,
|
||||||
write_exp_elt_longcst ((LONGEST) $1);
|
parse_m2_type (pstate)
|
||||||
write_exp_elt_opcode (OP_LONG); }
|
->builtin_char);
|
||||||
|
write_exp_elt_longcst (pstate, (LONGEST) $1);
|
||||||
|
write_exp_elt_opcode (pstate, OP_LONG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
exp : FLOAT
|
exp : FLOAT
|
||||||
{ write_exp_elt_opcode (OP_DOUBLE);
|
{ write_exp_elt_opcode (pstate, OP_DOUBLE);
|
||||||
write_exp_elt_type (parse_m2_type->builtin_real);
|
write_exp_elt_type (pstate,
|
||||||
write_exp_elt_dblcst ($1);
|
parse_m2_type (pstate)
|
||||||
write_exp_elt_opcode (OP_DOUBLE); }
|
->builtin_real);
|
||||||
|
write_exp_elt_dblcst (pstate, $1);
|
||||||
|
write_exp_elt_opcode (pstate, OP_DOUBLE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : variable
|
exp : variable
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : SIZE '(' type ')' %prec UNARY
|
exp : SIZE '(' type ')' %prec UNARY
|
||||||
{ write_exp_elt_opcode (OP_LONG);
|
{ write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (parse_type->builtin_int);
|
write_exp_elt_type (pstate,
|
||||||
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
|
parse_type (pstate)->builtin_int);
|
||||||
write_exp_elt_opcode (OP_LONG); }
|
write_exp_elt_longcst (pstate,
|
||||||
|
(LONGEST) TYPE_LENGTH ($3));
|
||||||
|
write_exp_elt_opcode (pstate, OP_LONG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : STRING
|
exp : STRING
|
||||||
{ write_exp_elt_opcode (OP_M2_STRING);
|
{ write_exp_elt_opcode (pstate, OP_M2_STRING);
|
||||||
write_exp_string ($1);
|
write_exp_string (pstate, $1);
|
||||||
write_exp_elt_opcode (OP_M2_STRING); }
|
write_exp_elt_opcode (pstate, OP_M2_STRING); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* This will be used for extensions later. Like adding modules. */
|
/* This will be used for extensions later. Like adding modules. */
|
||||||
@ -545,7 +563,8 @@ block : fblock
|
|||||||
|
|
||||||
fblock : BLOCKNAME
|
fblock : BLOCKNAME
|
||||||
{ struct symbol *sym
|
{ struct symbol *sym
|
||||||
= lookup_symbol (copy_name ($1), expression_context_block,
|
= lookup_symbol (copy_name ($1),
|
||||||
|
expression_context_block,
|
||||||
VAR_DOMAIN, 0);
|
VAR_DOMAIN, 0);
|
||||||
$$ = sym;}
|
$$ = sym;}
|
||||||
;
|
;
|
||||||
@ -565,10 +584,10 @@ fblock : block COLONCOLON BLOCKNAME
|
|||||||
|
|
||||||
/* Useful for assigning to PROCEDURE variables */
|
/* Useful for assigning to PROCEDURE variables */
|
||||||
variable: fblock
|
variable: fblock
|
||||||
{ write_exp_elt_opcode(OP_VAR_VALUE);
|
{ write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
write_exp_elt_block (NULL);
|
write_exp_elt_block (pstate, NULL);
|
||||||
write_exp_elt_sym ($1);
|
write_exp_elt_sym (pstate, $1);
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE); }
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* GDB internal ($foo) variable */
|
/* GDB internal ($foo) variable */
|
||||||
@ -591,11 +610,11 @@ variable: block COLONCOLON NAME
|
|||||||
innermost_block = block_found;
|
innermost_block = block_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
/* block_found is set by lookup_symbol. */
|
/* block_found is set by lookup_symbol. */
|
||||||
write_exp_elt_block (block_found);
|
write_exp_elt_block (pstate, block_found);
|
||||||
write_exp_elt_sym (sym);
|
write_exp_elt_sym (pstate, sym);
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE); }
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Base case for variables. */
|
/* Base case for variables. */
|
||||||
@ -617,13 +636,13 @@ variable: NAME
|
|||||||
innermost_block = block_found;
|
innermost_block = block_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
/* We want to use the selected frame, not
|
/* We want to use the selected frame, not
|
||||||
another more inner frame which happens to
|
another more inner frame which happens to
|
||||||
be in the same block. */
|
be in the same block. */
|
||||||
write_exp_elt_block (NULL);
|
write_exp_elt_block (pstate, NULL);
|
||||||
write_exp_elt_sym (sym);
|
write_exp_elt_sym (pstate, sym);
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -633,7 +652,7 @@ variable: NAME
|
|||||||
msymbol =
|
msymbol =
|
||||||
lookup_bound_minimal_symbol (arg);
|
lookup_bound_minimal_symbol (arg);
|
||||||
if (msymbol.minsym != NULL)
|
if (msymbol.minsym != NULL)
|
||||||
write_exp_msymbol (msymbol);
|
write_exp_msymbol (pstate, msymbol);
|
||||||
else if (!have_full_symbols () && !have_partial_symbols ())
|
else if (!have_full_symbols () && !have_partial_symbols ())
|
||||||
error (_("No symbol table is loaded. Use the \"symbol-file\" command."));
|
error (_("No symbol table is loaded. Use the \"symbol-file\" command."));
|
||||||
else
|
else
|
||||||
@ -645,7 +664,8 @@ variable: NAME
|
|||||||
|
|
||||||
type
|
type
|
||||||
: TYPENAME
|
: TYPENAME
|
||||||
{ $$ = lookup_typename (parse_language, parse_gdbarch,
|
{ $$ = lookup_typename (parse_language (pstate),
|
||||||
|
parse_gdbarch (pstate),
|
||||||
copy_name ($1),
|
copy_name ($1),
|
||||||
expression_context_block, 0); }
|
expression_context_block, 0); }
|
||||||
|
|
||||||
@ -805,8 +825,8 @@ static struct keyword keytab[] =
|
|||||||
|
|
||||||
/* Read one token, getting characters through lexptr. */
|
/* Read one token, getting characters through lexptr. */
|
||||||
|
|
||||||
/* This is where we will check to make sure that the language and the operators used are
|
/* This is where we will check to make sure that the language and the
|
||||||
compatible */
|
operators used are compatible */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
yylex (void)
|
yylex (void)
|
||||||
@ -992,7 +1012,7 @@ yylex (void)
|
|||||||
|
|
||||||
if (*tokstart == '$')
|
if (*tokstart == '$')
|
||||||
{
|
{
|
||||||
write_dollar_variable (yylval.sval);
|
write_dollar_variable (pstate, yylval.sval);
|
||||||
return INTERNAL_VAR;
|
return INTERNAL_VAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1012,8 +1032,9 @@ yylex (void)
|
|||||||
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0);
|
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0);
|
||||||
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
||||||
return BLOCKNAME;
|
return BLOCKNAME;
|
||||||
if (lookup_typename (parse_language, parse_gdbarch,
|
if (lookup_typename (parse_language (pstate), parse_gdbarch (pstate),
|
||||||
copy_name (yylval.sval), expression_context_block, 1))
|
copy_name (yylval.sval),
|
||||||
|
expression_context_block, 1))
|
||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
|
|
||||||
if(sym)
|
if(sym)
|
||||||
@ -1070,6 +1091,22 @@ yylex (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
m2_parse (struct parser_state *par_state)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
|
||||||
|
|
||||||
|
/* Setting up the parser state. */
|
||||||
|
gdb_assert (par_state != NULL);
|
||||||
|
pstate = par_state;
|
||||||
|
|
||||||
|
result = yyparse ();
|
||||||
|
do_cleanups (c);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
yyerror (char *msg)
|
yyerror (char *msg)
|
||||||
{
|
{
|
||||||
|
@ -18,8 +18,9 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
struct type_print_options;
|
struct type_print_options;
|
||||||
|
struct parser_state;
|
||||||
|
|
||||||
extern int m2_parse (void); /* Defined in m2-exp.y */
|
extern int m2_parse (struct parser_state *); /* Defined in m2-exp.y */
|
||||||
|
|
||||||
extern void m2_error (char *); /* Defined in m2-exp.y */
|
extern void m2_error (char *); /* Defined in m2-exp.y */
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ add_msglist(struct stoken *str, int addcolon)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
end_msglist(void)
|
end_msglist (struct parser_state *ps)
|
||||||
{
|
{
|
||||||
int val = msglist_len;
|
int val = msglist_len;
|
||||||
struct selname *sel = selname_chain;
|
struct selname *sel = selname_chain;
|
||||||
@ -475,12 +475,12 @@ end_msglist(void)
|
|||||||
selname_chain = sel->next;
|
selname_chain = sel->next;
|
||||||
msglist_len = sel->msglist_len;
|
msglist_len = sel->msglist_len;
|
||||||
msglist_sel = sel->msglist_sel;
|
msglist_sel = sel->msglist_sel;
|
||||||
selid = lookup_child_selector (parse_gdbarch, p);
|
selid = lookup_child_selector (parse_gdbarch (ps), p);
|
||||||
if (!selid)
|
if (!selid)
|
||||||
error (_("Can't find selector \"%s\""), p);
|
error (_("Can't find selector \"%s\""), p);
|
||||||
write_exp_elt_longcst (selid);
|
write_exp_elt_longcst (ps, selid);
|
||||||
xfree(p);
|
xfree(p);
|
||||||
write_exp_elt_longcst (val); /* Number of args */
|
write_exp_elt_longcst (ps, val); /* Number of args */
|
||||||
xfree(sel);
|
xfree(sel);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
|
@ -26,6 +26,7 @@ struct stoken;
|
|||||||
|
|
||||||
struct value;
|
struct value;
|
||||||
struct block;
|
struct block;
|
||||||
|
struct parser_state;
|
||||||
|
|
||||||
extern CORE_ADDR lookup_objc_class (struct gdbarch *gdbarch,
|
extern CORE_ADDR lookup_objc_class (struct gdbarch *gdbarch,
|
||||||
char *classname);
|
char *classname);
|
||||||
@ -45,7 +46,7 @@ extern struct value *value_nsstring (struct gdbarch *gdbarch,
|
|||||||
/* for parsing Objective C */
|
/* for parsing Objective C */
|
||||||
extern void start_msglist (void);
|
extern void start_msglist (void);
|
||||||
extern void add_msglist (struct stoken *str, int addcolon);
|
extern void add_msglist (struct stoken *str, int addcolon);
|
||||||
extern int end_msglist (void);
|
extern int end_msglist (struct parser_state *);
|
||||||
|
|
||||||
struct symbol *lookup_struct_typedef (char *name, const struct block *block,
|
struct symbol *lookup_struct_typedef (char *name, const struct block *block,
|
||||||
int noerr);
|
int noerr);
|
||||||
|
352
gdb/p-exp.y
352
gdb/p-exp.y
@ -57,7 +57,7 @@
|
|||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include "completer.h"
|
#include "completer.h"
|
||||||
|
|
||||||
#define parse_type builtin_type (parse_gdbarch)
|
#define parse_type(ps) builtin_type (parse_gdbarch (ps))
|
||||||
|
|
||||||
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
||||||
as well as gratuitiously global symbol names, so we can have multiple
|
as well as gratuitiously global symbol names, so we can have multiple
|
||||||
@ -67,7 +67,7 @@
|
|||||||
generators need to be fixed instead of adding those names to this list. */
|
generators need to be fixed instead of adding those names to this list. */
|
||||||
|
|
||||||
#define yymaxdepth pascal_maxdepth
|
#define yymaxdepth pascal_maxdepth
|
||||||
#define yyparse pascal_parse
|
#define yyparse pascal_parse_internal
|
||||||
#define yylex pascal_lex
|
#define yylex pascal_lex
|
||||||
#define yyerror pascal_error
|
#define yyerror pascal_error
|
||||||
#define yylval pascal_lval
|
#define yylval pascal_lval
|
||||||
@ -119,6 +119,11 @@
|
|||||||
|
|
||||||
#define YYFPRINTF parser_fprintf
|
#define YYFPRINTF parser_fprintf
|
||||||
|
|
||||||
|
/* The state of the parser, used internally when we are parsing the
|
||||||
|
expression. */
|
||||||
|
|
||||||
|
static struct parser_state *pstate = NULL;
|
||||||
|
|
||||||
int yyparse (void);
|
int yyparse (void);
|
||||||
|
|
||||||
static int yylex (void);
|
static int yylex (void);
|
||||||
@ -159,7 +164,8 @@ static char *uptok (const char *, int);
|
|||||||
|
|
||||||
%{
|
%{
|
||||||
/* YYSTYPE gets defined by %union */
|
/* YYSTYPE gets defined by %union */
|
||||||
static int parse_number (const char *, int, int, YYSTYPE *);
|
static int parse_number (struct parser_state *,
|
||||||
|
const char *, int, int, YYSTYPE *);
|
||||||
|
|
||||||
static struct type *current_type;
|
static struct type *current_type;
|
||||||
static struct internalvar *intvar;
|
static struct internalvar *intvar;
|
||||||
@ -252,44 +258,44 @@ normal_start :
|
|||||||
;
|
;
|
||||||
|
|
||||||
type_exp: type
|
type_exp: type
|
||||||
{ write_exp_elt_opcode(OP_TYPE);
|
{ write_exp_elt_opcode (pstate, OP_TYPE);
|
||||||
write_exp_elt_type($1);
|
write_exp_elt_type (pstate, $1);
|
||||||
write_exp_elt_opcode(OP_TYPE);
|
write_exp_elt_opcode (pstate, OP_TYPE);
|
||||||
current_type = $1; } ;
|
current_type = $1; } ;
|
||||||
|
|
||||||
/* Expressions, including the comma operator. */
|
/* Expressions, including the comma operator. */
|
||||||
exp1 : exp
|
exp1 : exp
|
||||||
| exp1 ',' exp
|
| exp1 ',' exp
|
||||||
{ write_exp_elt_opcode (BINOP_COMMA); }
|
{ write_exp_elt_opcode (pstate, BINOP_COMMA); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Expressions, not including the comma operator. */
|
/* Expressions, not including the comma operator. */
|
||||||
exp : exp '^' %prec UNARY
|
exp : exp '^' %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_IND);
|
{ write_exp_elt_opcode (pstate, UNOP_IND);
|
||||||
if (current_type)
|
if (current_type)
|
||||||
current_type = TYPE_TARGET_TYPE (current_type); }
|
current_type = TYPE_TARGET_TYPE (current_type); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '@' exp %prec UNARY
|
exp : '@' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_ADDR);
|
{ write_exp_elt_opcode (pstate, UNOP_ADDR);
|
||||||
if (current_type)
|
if (current_type)
|
||||||
current_type = TYPE_POINTER_TYPE (current_type); }
|
current_type = TYPE_POINTER_TYPE (current_type); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : '-' exp %prec UNARY
|
exp : '-' exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_NEG); }
|
{ write_exp_elt_opcode (pstate, UNOP_NEG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : NOT exp %prec UNARY
|
exp : NOT exp %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
|
{ write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : INCREMENT '(' exp ')' %prec UNARY
|
exp : INCREMENT '(' exp ')' %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_PREINCREMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_PREINCREMENT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : DECREMENT '(' exp ')' %prec UNARY
|
exp : DECREMENT '(' exp ')' %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_PREDECREMENT); }
|
{ write_exp_elt_opcode (pstate, UNOP_PREDECREMENT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@ -298,9 +304,9 @@ field_exp : exp '.' %prec UNARY
|
|||||||
;
|
;
|
||||||
|
|
||||||
exp : field_exp FIELDNAME
|
exp : field_exp FIELDNAME
|
||||||
{ write_exp_elt_opcode (STRUCTOP_STRUCT);
|
{ write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
write_exp_string ($2);
|
write_exp_string (pstate, $2);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT);
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
search_field = 0;
|
search_field = 0;
|
||||||
if (current_type)
|
if (current_type)
|
||||||
{
|
{
|
||||||
@ -316,9 +322,9 @@ exp : field_exp FIELDNAME
|
|||||||
|
|
||||||
|
|
||||||
exp : field_exp name
|
exp : field_exp name
|
||||||
{ write_exp_elt_opcode (STRUCTOP_STRUCT);
|
{ write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
write_exp_string ($2);
|
write_exp_string (pstate, $2);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT);
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
search_field = 0;
|
search_field = 0;
|
||||||
if (current_type)
|
if (current_type)
|
||||||
{
|
{
|
||||||
@ -332,19 +338,19 @@ exp : field_exp name
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
exp : field_exp name COMPLETE
|
exp : field_exp name COMPLETE
|
||||||
{ mark_struct_expression ();
|
{ mark_struct_expression (pstate);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT);
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
write_exp_string ($2);
|
write_exp_string (pstate, $2);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT); }
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
|
||||||
;
|
;
|
||||||
exp : field_exp COMPLETE
|
exp : field_exp COMPLETE
|
||||||
{ struct stoken s;
|
{ struct stoken s;
|
||||||
mark_struct_expression ();
|
mark_struct_expression (pstate);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT);
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
s.ptr = "";
|
s.ptr = "";
|
||||||
s.length = 0;
|
s.length = 0;
|
||||||
write_exp_string (s);
|
write_exp_string (pstate, s);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT); }
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '['
|
exp : exp '['
|
||||||
@ -365,14 +371,14 @@ exp : exp '['
|
|||||||
strcpy (buf, arrayname);
|
strcpy (buf, arrayname);
|
||||||
current_type = TYPE_FIELD_TYPE (current_type,
|
current_type = TYPE_FIELD_TYPE (current_type,
|
||||||
arrayfieldindex - 1);
|
arrayfieldindex - 1);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT);
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
write_exp_string (stringsval);
|
write_exp_string (pstate, stringsval);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT);
|
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
|
||||||
}
|
}
|
||||||
push_current_type (); }
|
push_current_type (); }
|
||||||
exp1 ']'
|
exp1 ']'
|
||||||
{ pop_current_type ();
|
{ pop_current_type ();
|
||||||
write_exp_elt_opcode (BINOP_SUBSCRIPT);
|
write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT);
|
||||||
if (current_type)
|
if (current_type)
|
||||||
current_type = TYPE_TARGET_TYPE (current_type); }
|
current_type = TYPE_TARGET_TYPE (current_type); }
|
||||||
;
|
;
|
||||||
@ -383,9 +389,10 @@ exp : exp '('
|
|||||||
{ push_current_type ();
|
{ push_current_type ();
|
||||||
start_arglist (); }
|
start_arglist (); }
|
||||||
arglist ')' %prec ARROW
|
arglist ')' %prec ARROW
|
||||||
{ write_exp_elt_opcode (OP_FUNCALL);
|
{ write_exp_elt_opcode (pstate, OP_FUNCALL);
|
||||||
write_exp_elt_longcst ((LONGEST) end_arglist ());
|
write_exp_elt_longcst (pstate,
|
||||||
write_exp_elt_opcode (OP_FUNCALL);
|
(LONGEST) end_arglist ());
|
||||||
|
write_exp_elt_opcode (pstate, OP_FUNCALL);
|
||||||
pop_current_type ();
|
pop_current_type ();
|
||||||
if (current_type)
|
if (current_type)
|
||||||
current_type = TYPE_TARGET_TYPE (current_type);
|
current_type = TYPE_TARGET_TYPE (current_type);
|
||||||
@ -406,11 +413,11 @@ exp : type '(' exp ')' %prec UNARY
|
|||||||
if ((TYPE_CODE (current_type) == TYPE_CODE_PTR)
|
if ((TYPE_CODE (current_type) == TYPE_CODE_PTR)
|
||||||
&& (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_CLASS)
|
&& (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_CLASS)
|
||||||
&& (TYPE_CODE ($1) == TYPE_CODE_CLASS))
|
&& (TYPE_CODE ($1) == TYPE_CODE_CLASS))
|
||||||
write_exp_elt_opcode (UNOP_IND);
|
write_exp_elt_opcode (pstate, UNOP_IND);
|
||||||
}
|
}
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (pstate, UNOP_CAST);
|
||||||
write_exp_elt_type ($1);
|
write_exp_elt_type (pstate, $1);
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (pstate, UNOP_CAST);
|
||||||
current_type = $1; }
|
current_type = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -421,7 +428,7 @@ exp : '(' exp1 ')'
|
|||||||
/* Binary operators in order of decreasing precedence. */
|
/* Binary operators in order of decreasing precedence. */
|
||||||
|
|
||||||
exp : exp '*' exp
|
exp : exp '*' exp
|
||||||
{ write_exp_elt_opcode (BINOP_MUL); }
|
{ write_exp_elt_opcode (pstate, BINOP_MUL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '/' {
|
exp : exp '/' {
|
||||||
@ -433,135 +440,138 @@ exp : exp '/' {
|
|||||||
if (leftdiv_is_integer && current_type
|
if (leftdiv_is_integer && current_type
|
||||||
&& is_integral_type (current_type))
|
&& is_integral_type (current_type))
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (pstate, UNOP_CAST);
|
||||||
write_exp_elt_type (parse_type->builtin_long_double);
|
write_exp_elt_type (pstate,
|
||||||
current_type = parse_type->builtin_long_double;
|
parse_type (pstate)
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
->builtin_long_double);
|
||||||
|
current_type
|
||||||
|
= parse_type (pstate)->builtin_long_double;
|
||||||
|
write_exp_elt_opcode (pstate, UNOP_CAST);
|
||||||
leftdiv_is_integer = 0;
|
leftdiv_is_integer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (BINOP_DIV);
|
write_exp_elt_opcode (pstate, BINOP_DIV);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp DIV exp
|
exp : exp DIV exp
|
||||||
{ write_exp_elt_opcode (BINOP_INTDIV); }
|
{ write_exp_elt_opcode (pstate, BINOP_INTDIV); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp MOD exp
|
exp : exp MOD exp
|
||||||
{ write_exp_elt_opcode (BINOP_REM); }
|
{ write_exp_elt_opcode (pstate, BINOP_REM); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '+' exp
|
exp : exp '+' exp
|
||||||
{ write_exp_elt_opcode (BINOP_ADD); }
|
{ write_exp_elt_opcode (pstate, BINOP_ADD); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '-' exp
|
exp : exp '-' exp
|
||||||
{ write_exp_elt_opcode (BINOP_SUB); }
|
{ write_exp_elt_opcode (pstate, BINOP_SUB); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp LSH exp
|
exp : exp LSH exp
|
||||||
{ write_exp_elt_opcode (BINOP_LSH); }
|
{ write_exp_elt_opcode (pstate, BINOP_LSH); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp RSH exp
|
exp : exp RSH exp
|
||||||
{ write_exp_elt_opcode (BINOP_RSH); }
|
{ write_exp_elt_opcode (pstate, BINOP_RSH); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '=' exp
|
exp : exp '=' exp
|
||||||
{ write_exp_elt_opcode (BINOP_EQUAL);
|
{ write_exp_elt_opcode (pstate, BINOP_EQUAL);
|
||||||
current_type = parse_type->builtin_bool;
|
current_type = parse_type (pstate)->builtin_bool;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp NOTEQUAL exp
|
exp : exp NOTEQUAL exp
|
||||||
{ write_exp_elt_opcode (BINOP_NOTEQUAL);
|
{ write_exp_elt_opcode (pstate, BINOP_NOTEQUAL);
|
||||||
current_type = parse_type->builtin_bool;
|
current_type = parse_type (pstate)->builtin_bool;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp LEQ exp
|
exp : exp LEQ exp
|
||||||
{ write_exp_elt_opcode (BINOP_LEQ);
|
{ write_exp_elt_opcode (pstate, BINOP_LEQ);
|
||||||
current_type = parse_type->builtin_bool;
|
current_type = parse_type (pstate)->builtin_bool;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp GEQ exp
|
exp : exp GEQ exp
|
||||||
{ write_exp_elt_opcode (BINOP_GEQ);
|
{ write_exp_elt_opcode (pstate, BINOP_GEQ);
|
||||||
current_type = parse_type->builtin_bool;
|
current_type = parse_type (pstate)->builtin_bool;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '<' exp
|
exp : exp '<' exp
|
||||||
{ write_exp_elt_opcode (BINOP_LESS);
|
{ write_exp_elt_opcode (pstate, BINOP_LESS);
|
||||||
current_type = parse_type->builtin_bool;
|
current_type = parse_type (pstate)->builtin_bool;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp '>' exp
|
exp : exp '>' exp
|
||||||
{ write_exp_elt_opcode (BINOP_GTR);
|
{ write_exp_elt_opcode (pstate, BINOP_GTR);
|
||||||
current_type = parse_type->builtin_bool;
|
current_type = parse_type (pstate)->builtin_bool;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp ANDAND exp
|
exp : exp ANDAND exp
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_AND); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp XOR exp
|
exp : exp XOR exp
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_XOR); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp OR exp
|
exp : exp OR exp
|
||||||
{ write_exp_elt_opcode (BINOP_BITWISE_IOR); }
|
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp ASSIGN exp
|
exp : exp ASSIGN exp
|
||||||
{ write_exp_elt_opcode (BINOP_ASSIGN); }
|
{ write_exp_elt_opcode (pstate, BINOP_ASSIGN); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : TRUEKEYWORD
|
exp : TRUEKEYWORD
|
||||||
{ write_exp_elt_opcode (OP_BOOL);
|
{ write_exp_elt_opcode (pstate, OP_BOOL);
|
||||||
write_exp_elt_longcst ((LONGEST) $1);
|
write_exp_elt_longcst (pstate, (LONGEST) $1);
|
||||||
current_type = parse_type->builtin_bool;
|
current_type = parse_type (pstate)->builtin_bool;
|
||||||
write_exp_elt_opcode (OP_BOOL); }
|
write_exp_elt_opcode (pstate, OP_BOOL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : FALSEKEYWORD
|
exp : FALSEKEYWORD
|
||||||
{ write_exp_elt_opcode (OP_BOOL);
|
{ write_exp_elt_opcode (pstate, OP_BOOL);
|
||||||
write_exp_elt_longcst ((LONGEST) $1);
|
write_exp_elt_longcst (pstate, (LONGEST) $1);
|
||||||
current_type = parse_type->builtin_bool;
|
current_type = parse_type (pstate)->builtin_bool;
|
||||||
write_exp_elt_opcode (OP_BOOL); }
|
write_exp_elt_opcode (pstate, OP_BOOL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : INT
|
exp : INT
|
||||||
{ write_exp_elt_opcode (OP_LONG);
|
{ write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type ($1.type);
|
write_exp_elt_type (pstate, $1.type);
|
||||||
current_type = $1.type;
|
current_type = $1.type;
|
||||||
write_exp_elt_longcst ((LONGEST)($1.val));
|
write_exp_elt_longcst (pstate, (LONGEST)($1.val));
|
||||||
write_exp_elt_opcode (OP_LONG); }
|
write_exp_elt_opcode (pstate, OP_LONG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : NAME_OR_INT
|
exp : NAME_OR_INT
|
||||||
{ YYSTYPE val;
|
{ YYSTYPE val;
|
||||||
parse_number ($1.stoken.ptr,
|
parse_number (pstate, $1.stoken.ptr,
|
||||||
$1.stoken.length, 0, &val);
|
$1.stoken.length, 0, &val);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (val.typed_val_int.type);
|
write_exp_elt_type (pstate, val.typed_val_int.type);
|
||||||
current_type = val.typed_val_int.type;
|
current_type = val.typed_val_int.type;
|
||||||
write_exp_elt_longcst ((LONGEST)
|
write_exp_elt_longcst (pstate, (LONGEST)
|
||||||
val.typed_val_int.val);
|
val.typed_val_int.val);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
exp : FLOAT
|
exp : FLOAT
|
||||||
{ write_exp_elt_opcode (OP_DOUBLE);
|
{ write_exp_elt_opcode (pstate, OP_DOUBLE);
|
||||||
write_exp_elt_type ($1.type);
|
write_exp_elt_type (pstate, $1.type);
|
||||||
current_type = $1.type;
|
current_type = $1.type;
|
||||||
write_exp_elt_dblcst ($1.dval);
|
write_exp_elt_dblcst (pstate, $1.dval);
|
||||||
write_exp_elt_opcode (OP_DOUBLE); }
|
write_exp_elt_opcode (pstate, OP_DOUBLE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : variable
|
exp : variable
|
||||||
@ -574,7 +584,7 @@ exp : VARIABLE
|
|||||||
struct value * val, * mark;
|
struct value * val, * mark;
|
||||||
|
|
||||||
mark = value_mark ();
|
mark = value_mark ();
|
||||||
val = value_of_internalvar (parse_gdbarch,
|
val = value_of_internalvar (parse_gdbarch (pstate),
|
||||||
intvar);
|
intvar);
|
||||||
current_type = value_type (val);
|
current_type = value_type (val);
|
||||||
value_release_to_mark (mark);
|
value_release_to_mark (mark);
|
||||||
@ -583,17 +593,19 @@ exp : VARIABLE
|
|||||||
;
|
;
|
||||||
|
|
||||||
exp : SIZEOF '(' type ')' %prec UNARY
|
exp : SIZEOF '(' type ')' %prec UNARY
|
||||||
{ write_exp_elt_opcode (OP_LONG);
|
{ write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (parse_type->builtin_int);
|
write_exp_elt_type (pstate,
|
||||||
current_type = parse_type->builtin_int;
|
parse_type (pstate)->builtin_int);
|
||||||
|
current_type = parse_type (pstate)->builtin_int;
|
||||||
CHECK_TYPEDEF ($3);
|
CHECK_TYPEDEF ($3);
|
||||||
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
|
write_exp_elt_longcst (pstate,
|
||||||
write_exp_elt_opcode (OP_LONG); }
|
(LONGEST) TYPE_LENGTH ($3));
|
||||||
|
write_exp_elt_opcode (pstate, OP_LONG); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : SIZEOF '(' exp ')' %prec UNARY
|
exp : SIZEOF '(' exp ')' %prec UNARY
|
||||||
{ write_exp_elt_opcode (UNOP_SIZEOF);
|
{ write_exp_elt_opcode (pstate, UNOP_SIZEOF);
|
||||||
current_type = parse_type->builtin_int; }
|
current_type = parse_type (pstate)->builtin_int; }
|
||||||
|
|
||||||
exp : STRING
|
exp : STRING
|
||||||
{ /* C strings are converted into array constants with
|
{ /* C strings are converted into array constants with
|
||||||
@ -605,19 +617,25 @@ exp : STRING
|
|||||||
|
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (parse_type->builtin_char);
|
write_exp_elt_type (pstate,
|
||||||
write_exp_elt_longcst ((LONGEST)(*sp++));
|
parse_type (pstate)
|
||||||
write_exp_elt_opcode (OP_LONG);
|
->builtin_char);
|
||||||
|
write_exp_elt_longcst (pstate,
|
||||||
|
(LONGEST) (*sp++));
|
||||||
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
}
|
}
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_type (parse_type->builtin_char);
|
write_exp_elt_type (pstate,
|
||||||
write_exp_elt_longcst ((LONGEST)'\0');
|
parse_type (pstate)
|
||||||
write_exp_elt_opcode (OP_LONG);
|
->builtin_char);
|
||||||
write_exp_elt_opcode (OP_ARRAY);
|
write_exp_elt_longcst (pstate, (LONGEST)'\0');
|
||||||
write_exp_elt_longcst ((LONGEST) 0);
|
write_exp_elt_opcode (pstate, OP_LONG);
|
||||||
write_exp_elt_longcst ((LONGEST) ($1.length));
|
write_exp_elt_opcode (pstate, OP_ARRAY);
|
||||||
write_exp_elt_opcode (OP_ARRAY); }
|
write_exp_elt_longcst (pstate, (LONGEST) 0);
|
||||||
|
write_exp_elt_longcst (pstate,
|
||||||
|
(LONGEST) ($1.length));
|
||||||
|
write_exp_elt_opcode (pstate, OP_ARRAY); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Object pascal */
|
/* Object pascal */
|
||||||
@ -625,10 +643,11 @@ exp : THIS
|
|||||||
{
|
{
|
||||||
struct value * this_val;
|
struct value * this_val;
|
||||||
struct type * this_type;
|
struct type * this_type;
|
||||||
write_exp_elt_opcode (OP_THIS);
|
write_exp_elt_opcode (pstate, OP_THIS);
|
||||||
write_exp_elt_opcode (OP_THIS);
|
write_exp_elt_opcode (pstate, OP_THIS);
|
||||||
/* We need type of this. */
|
/* We need type of this. */
|
||||||
this_val = value_of_this_silent (parse_language);
|
this_val
|
||||||
|
= value_of_this_silent (parse_language (pstate));
|
||||||
if (this_val)
|
if (this_val)
|
||||||
this_type = value_type (this_val);
|
this_type = value_type (this_val);
|
||||||
else
|
else
|
||||||
@ -638,7 +657,7 @@ exp : THIS
|
|||||||
if (TYPE_CODE (this_type) == TYPE_CODE_PTR)
|
if (TYPE_CODE (this_type) == TYPE_CODE_PTR)
|
||||||
{
|
{
|
||||||
this_type = TYPE_TARGET_TYPE (this_type);
|
this_type = TYPE_TARGET_TYPE (this_type);
|
||||||
write_exp_elt_opcode (UNOP_IND);
|
write_exp_elt_opcode (pstate, UNOP_IND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,11 +703,11 @@ variable: block COLONCOLON name
|
|||||||
error (_("No symbol \"%s\" in specified context."),
|
error (_("No symbol \"%s\" in specified context."),
|
||||||
copy_name ($3));
|
copy_name ($3));
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
/* block_found is set by lookup_symbol. */
|
/* block_found is set by lookup_symbol. */
|
||||||
write_exp_elt_block (block_found);
|
write_exp_elt_block (pstate, block_found);
|
||||||
write_exp_elt_sym (sym);
|
write_exp_elt_sym (pstate, sym);
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE); }
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
qualified_name: typebase COLONCOLON name
|
qualified_name: typebase COLONCOLON name
|
||||||
@ -699,10 +718,10 @@ qualified_name: typebase COLONCOLON name
|
|||||||
error (_("`%s' is not defined as an aggregate type."),
|
error (_("`%s' is not defined as an aggregate type."),
|
||||||
TYPE_NAME (type));
|
TYPE_NAME (type));
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_SCOPE);
|
write_exp_elt_opcode (pstate, OP_SCOPE);
|
||||||
write_exp_elt_type (type);
|
write_exp_elt_type (pstate, type);
|
||||||
write_exp_string ($3);
|
write_exp_string (pstate, $3);
|
||||||
write_exp_elt_opcode (OP_SCOPE);
|
write_exp_elt_opcode (pstate, OP_SCOPE);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -718,16 +737,16 @@ variable: qualified_name
|
|||||||
VAR_DOMAIN, NULL);
|
VAR_DOMAIN, NULL);
|
||||||
if (sym)
|
if (sym)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
write_exp_elt_block (NULL);
|
write_exp_elt_block (pstate, NULL);
|
||||||
write_exp_elt_sym (sym);
|
write_exp_elt_sym (pstate, sym);
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
msymbol = lookup_bound_minimal_symbol (name);
|
msymbol = lookup_bound_minimal_symbol (name);
|
||||||
if (msymbol.minsym != NULL)
|
if (msymbol.minsym != NULL)
|
||||||
write_exp_msymbol (msymbol);
|
write_exp_msymbol (pstate, msymbol);
|
||||||
else if (!have_full_symbols ()
|
else if (!have_full_symbols ()
|
||||||
&& !have_partial_symbols ())
|
&& !have_partial_symbols ())
|
||||||
error (_("No symbol table is loaded. "
|
error (_("No symbol table is loaded. "
|
||||||
@ -751,13 +770,13 @@ variable: name_not_typename
|
|||||||
innermost_block = block_found;
|
innermost_block = block_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
/* We want to use the selected frame, not
|
/* We want to use the selected frame, not
|
||||||
another more inner frame which happens to
|
another more inner frame which happens to
|
||||||
be in the same block. */
|
be in the same block. */
|
||||||
write_exp_elt_block (NULL);
|
write_exp_elt_block (pstate, NULL);
|
||||||
write_exp_elt_sym (sym);
|
write_exp_elt_sym (pstate, sym);
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
current_type = sym->type; }
|
current_type = sym->type; }
|
||||||
else if ($1.is_a_field_of_this)
|
else if ($1.is_a_field_of_this)
|
||||||
{
|
{
|
||||||
@ -770,13 +789,14 @@ variable: name_not_typename
|
|||||||
|| contained_in (block_found,
|
|| contained_in (block_found,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = block_found;
|
||||||
write_exp_elt_opcode (OP_THIS);
|
write_exp_elt_opcode (pstate, OP_THIS);
|
||||||
write_exp_elt_opcode (OP_THIS);
|
write_exp_elt_opcode (pstate, OP_THIS);
|
||||||
write_exp_elt_opcode (STRUCTOP_PTR);
|
write_exp_elt_opcode (pstate, STRUCTOP_PTR);
|
||||||
write_exp_string ($1.stoken);
|
write_exp_string (pstate, $1.stoken);
|
||||||
write_exp_elt_opcode (STRUCTOP_PTR);
|
write_exp_elt_opcode (pstate, STRUCTOP_PTR);
|
||||||
/* We need type of this. */
|
/* We need type of this. */
|
||||||
this_val = value_of_this_silent (parse_language);
|
this_val
|
||||||
|
= value_of_this_silent (parse_language (pstate));
|
||||||
if (this_val)
|
if (this_val)
|
||||||
this_type = value_type (this_val);
|
this_type = value_type (this_val);
|
||||||
else
|
else
|
||||||
@ -796,7 +816,7 @@ variable: name_not_typename
|
|||||||
msymbol =
|
msymbol =
|
||||||
lookup_bound_minimal_symbol (arg);
|
lookup_bound_minimal_symbol (arg);
|
||||||
if (msymbol.minsym != NULL)
|
if (msymbol.minsym != NULL)
|
||||||
write_exp_msymbol (msymbol);
|
write_exp_msymbol (pstate, msymbol);
|
||||||
else if (!have_full_symbols ()
|
else if (!have_full_symbols ()
|
||||||
&& !have_partial_symbols ())
|
&& !have_partial_symbols ())
|
||||||
error (_("No symbol table is loaded. "
|
error (_("No symbol table is loaded. "
|
||||||
@ -865,7 +885,8 @@ name_not_typename : NAME
|
|||||||
/*** Needs some error checking for the float case ***/
|
/*** Needs some error checking for the float case ***/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
parse_number (struct parser_state *par_state,
|
||||||
|
const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
||||||
{
|
{
|
||||||
/* FIXME: Shouldn't these be unsigned? We don't deal with negative values
|
/* FIXME: Shouldn't these be unsigned? We don't deal with negative values
|
||||||
here, and we do kind of silly things like cast to unsigned. */
|
here, and we do kind of silly things like cast to unsigned. */
|
||||||
@ -890,7 +911,7 @@ parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
|||||||
|
|
||||||
if (parsed_float)
|
if (parsed_float)
|
||||||
{
|
{
|
||||||
if (! parse_c_float (parse_gdbarch, p, len,
|
if (! parse_c_float (parse_gdbarch (par_state), p, len,
|
||||||
&putithere->typed_val_float.dval,
|
&putithere->typed_val_float.dval,
|
||||||
&putithere->typed_val_float.type))
|
&putithere->typed_val_float.type))
|
||||||
return ERROR;
|
return ERROR;
|
||||||
@ -996,9 +1017,10 @@ parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
|||||||
|
|
||||||
un = (ULONGEST)n >> 2;
|
un = (ULONGEST)n >> 2;
|
||||||
if (long_p == 0
|
if (long_p == 0
|
||||||
&& (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
|
&& (un >> (gdbarch_int_bit (parse_gdbarch (par_state)) - 2)) == 0)
|
||||||
{
|
{
|
||||||
high_bit = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
|
high_bit
|
||||||
|
= ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch (par_state)) - 1);
|
||||||
|
|
||||||
/* A large decimal (not hex or octal) constant (between INT_MAX
|
/* A large decimal (not hex or octal) constant (between INT_MAX
|
||||||
and UINT_MAX) is a long or unsigned long, according to ANSI,
|
and UINT_MAX) is a long or unsigned long, according to ANSI,
|
||||||
@ -1006,28 +1028,29 @@ parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
|||||||
int. This probably should be fixed. GCC gives a warning on
|
int. This probably should be fixed. GCC gives a warning on
|
||||||
such constants. */
|
such constants. */
|
||||||
|
|
||||||
unsigned_type = parse_type->builtin_unsigned_int;
|
unsigned_type = parse_type (par_state)->builtin_unsigned_int;
|
||||||
signed_type = parse_type->builtin_int;
|
signed_type = parse_type (par_state)->builtin_int;
|
||||||
}
|
}
|
||||||
else if (long_p <= 1
|
else if (long_p <= 1
|
||||||
&& (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
|
&& (un >> (gdbarch_long_bit (parse_gdbarch (par_state)) - 2)) == 0)
|
||||||
{
|
{
|
||||||
high_bit = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
|
high_bit
|
||||||
unsigned_type = parse_type->builtin_unsigned_long;
|
= ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch (par_state)) - 1);
|
||||||
signed_type = parse_type->builtin_long;
|
unsigned_type = parse_type (par_state)->builtin_unsigned_long;
|
||||||
|
signed_type = parse_type (par_state)->builtin_long;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int shift;
|
int shift;
|
||||||
if (sizeof (ULONGEST) * HOST_CHAR_BIT
|
if (sizeof (ULONGEST) * HOST_CHAR_BIT
|
||||||
< gdbarch_long_long_bit (parse_gdbarch))
|
< gdbarch_long_long_bit (parse_gdbarch (par_state)))
|
||||||
/* A long long does not fit in a LONGEST. */
|
/* A long long does not fit in a LONGEST. */
|
||||||
shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
|
shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
|
||||||
else
|
else
|
||||||
shift = (gdbarch_long_long_bit (parse_gdbarch) - 1);
|
shift = (gdbarch_long_long_bit (parse_gdbarch (par_state)) - 1);
|
||||||
high_bit = (ULONGEST) 1 << shift;
|
high_bit = (ULONGEST) 1 << shift;
|
||||||
unsigned_type = parse_type->builtin_unsigned_long_long;
|
unsigned_type = parse_type (par_state)->builtin_unsigned_long_long;
|
||||||
signed_type = parse_type->builtin_long_long;
|
signed_type = parse_type (par_state)->builtin_long_long;
|
||||||
}
|
}
|
||||||
|
|
||||||
putithere->typed_val_int.val = n;
|
putithere->typed_val_int.val = n;
|
||||||
@ -1195,12 +1218,12 @@ yylex (void)
|
|||||||
lexptr++;
|
lexptr++;
|
||||||
c = *lexptr++;
|
c = *lexptr++;
|
||||||
if (c == '\\')
|
if (c == '\\')
|
||||||
c = parse_escape (parse_gdbarch, &lexptr);
|
c = parse_escape (parse_gdbarch (pstate), &lexptr);
|
||||||
else if (c == '\'')
|
else if (c == '\'')
|
||||||
error (_("Empty character constant."));
|
error (_("Empty character constant."));
|
||||||
|
|
||||||
yylval.typed_val_int.val = c;
|
yylval.typed_val_int.val = c;
|
||||||
yylval.typed_val_int.type = parse_type->builtin_char;
|
yylval.typed_val_int.type = parse_type (pstate)->builtin_char;
|
||||||
|
|
||||||
c = *lexptr++;
|
c = *lexptr++;
|
||||||
if (c != '\'')
|
if (c != '\'')
|
||||||
@ -1298,7 +1321,7 @@ yylex (void)
|
|||||||
&& (*p < 'A' || *p > 'Z')))
|
&& (*p < 'A' || *p > 'Z')))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toktype = parse_number (tokstart,
|
toktype = parse_number (pstate, tokstart,
|
||||||
p - tokstart, got_dot | got_e, &yylval);
|
p - tokstart, got_dot | got_e, &yylval);
|
||||||
if (toktype == ERROR)
|
if (toktype == ERROR)
|
||||||
{
|
{
|
||||||
@ -1365,7 +1388,7 @@ yylex (void)
|
|||||||
break;
|
break;
|
||||||
case '\\':
|
case '\\':
|
||||||
++tokptr;
|
++tokptr;
|
||||||
c = parse_escape (parse_gdbarch, &tokptr);
|
c = parse_escape (parse_gdbarch (pstate), &tokptr);
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -1508,7 +1531,7 @@ yylex (void)
|
|||||||
but this conflicts with the GDB use for debugger variables
|
but this conflicts with the GDB use for debugger variables
|
||||||
so in expression to enter hexadecimal values
|
so in expression to enter hexadecimal values
|
||||||
we still need to use C syntax with 0xff */
|
we still need to use C syntax with 0xff */
|
||||||
write_dollar_variable (yylval.sval);
|
write_dollar_variable (pstate, yylval.sval);
|
||||||
tmp = alloca (namelen + 1);
|
tmp = alloca (namelen + 1);
|
||||||
memcpy (tmp, tokstart, namelen);
|
memcpy (tmp, tokstart, namelen);
|
||||||
tmp[namelen] = '\0';
|
tmp[namelen] = '\0';
|
||||||
@ -1688,8 +1711,8 @@ yylex (void)
|
|||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
}
|
}
|
||||||
yylval.tsym.type
|
yylval.tsym.type
|
||||||
= language_lookup_primitive_type_by_name (parse_language,
|
= language_lookup_primitive_type_by_name (parse_language (pstate),
|
||||||
parse_gdbarch, tmp);
|
parse_gdbarch (pstate), tmp);
|
||||||
if (yylval.tsym.type != NULL)
|
if (yylval.tsym.type != NULL)
|
||||||
{
|
{
|
||||||
free (uptokstart);
|
free (uptokstart);
|
||||||
@ -1704,7 +1727,7 @@ yylex (void)
|
|||||||
|| (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
|
|| (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
|
||||||
{
|
{
|
||||||
YYSTYPE newlval; /* Its value is ignored. */
|
YYSTYPE newlval; /* Its value is ignored. */
|
||||||
hextype = parse_number (tokstart, namelen, 0, &newlval);
|
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
|
||||||
if (hextype == INT)
|
if (hextype == INT)
|
||||||
{
|
{
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym = sym;
|
||||||
@ -1722,6 +1745,21 @@ yylex (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
pascal_parse (struct parser_state *par_state)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
|
||||||
|
|
||||||
|
/* Setting up the parser state. */
|
||||||
|
gdb_assert (par_state != NULL);
|
||||||
|
pstate = par_state;
|
||||||
|
|
||||||
|
result = yyparse ();
|
||||||
|
do_cleanups (c);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
yyerror (char *msg)
|
yyerror (char *msg)
|
||||||
{
|
{
|
||||||
|
@ -20,11 +20,12 @@
|
|||||||
/* This file is derived from c-lang.h */
|
/* This file is derived from c-lang.h */
|
||||||
|
|
||||||
struct value;
|
struct value;
|
||||||
|
struct parser_state;
|
||||||
|
|
||||||
/* Defined in p-lang.c */
|
/* Defined in p-lang.c */
|
||||||
extern const char *pascal_main_name (void);
|
extern const char *pascal_main_name (void);
|
||||||
|
|
||||||
extern int pascal_parse (void); /* Defined in p-exp.y */
|
extern int pascal_parse (struct parser_state *); /* Defined in p-exp.y */
|
||||||
|
|
||||||
extern void pascal_error (char *); /* Defined in p-exp.y */
|
extern void pascal_error (char *); /* Defined in p-exp.y */
|
||||||
|
|
||||||
|
277
gdb/parse.c
277
gdb/parse.c
@ -67,9 +67,6 @@ const struct exp_descriptor exp_descriptor_standard =
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Global variables declared in parser-defs.h (and commented there). */
|
/* Global variables declared in parser-defs.h (and commented there). */
|
||||||
struct expression *expout;
|
|
||||||
int expout_size;
|
|
||||||
int expout_ptr;
|
|
||||||
const struct block *expression_context_block;
|
const struct block *expression_context_block;
|
||||||
CORE_ADDR expression_context_pc;
|
CORE_ADDR expression_context_pc;
|
||||||
const struct block *innermost_block;
|
const struct block *innermost_block;
|
||||||
@ -185,118 +182,121 @@ free_funcalls (void *ignore)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This page contains the functions for adding data to the struct expression
|
|
||||||
being constructed. */
|
|
||||||
|
|
||||||
/* See definition in parser-defs.h. */
|
/* See definition in parser-defs.h. */
|
||||||
|
|
||||||
void
|
void
|
||||||
initialize_expout (int initial_size, const struct language_defn *lang,
|
initialize_expout (struct parser_state *ps, size_t initial_size,
|
||||||
|
const struct language_defn *lang,
|
||||||
struct gdbarch *gdbarch)
|
struct gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
expout_size = initial_size;
|
ps->expout_size = initial_size;
|
||||||
expout_ptr = 0;
|
ps->expout_ptr = 0;
|
||||||
expout = xmalloc (sizeof (struct expression)
|
ps->expout = xmalloc (sizeof (struct expression)
|
||||||
+ EXP_ELEM_TO_BYTES (expout_size));
|
+ EXP_ELEM_TO_BYTES (ps->expout_size));
|
||||||
expout->language_defn = lang;
|
ps->expout->language_defn = lang;
|
||||||
expout->gdbarch = gdbarch;
|
ps->expout->gdbarch = gdbarch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See definition in parser-defs.h. */
|
/* See definition in parser-defs.h. */
|
||||||
|
|
||||||
void
|
void
|
||||||
reallocate_expout (void)
|
reallocate_expout (struct parser_state *ps)
|
||||||
{
|
{
|
||||||
/* Record the actual number of expression elements, and then
|
/* Record the actual number of expression elements, and then
|
||||||
reallocate the expression memory so that we free up any
|
reallocate the expression memory so that we free up any
|
||||||
excess elements. */
|
excess elements. */
|
||||||
|
|
||||||
expout->nelts = expout_ptr;
|
ps->expout->nelts = ps->expout_ptr;
|
||||||
expout = xrealloc ((char *) expout,
|
ps->expout = (struct expression *)
|
||||||
sizeof (struct expression)
|
xrealloc (ps->expout,
|
||||||
+ EXP_ELEM_TO_BYTES (expout_ptr));
|
sizeof (struct expression)
|
||||||
|
+ EXP_ELEM_TO_BYTES (ps->expout_ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This page contains the functions for adding data to the struct expression
|
||||||
|
being constructed. */
|
||||||
|
|
||||||
/* Add one element to the end of the expression. */
|
/* Add one element to the end of the expression. */
|
||||||
|
|
||||||
/* To avoid a bug in the Sun 4 compiler, we pass things that can fit into
|
/* To avoid a bug in the Sun 4 compiler, we pass things that can fit into
|
||||||
a register through here. */
|
a register through here. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_exp_elt (const union exp_element *expelt)
|
write_exp_elt (struct parser_state *ps, const union exp_element *expelt)
|
||||||
{
|
{
|
||||||
if (expout_ptr >= expout_size)
|
if (ps->expout_ptr >= ps->expout_size)
|
||||||
{
|
{
|
||||||
expout_size *= 2;
|
ps->expout_size *= 2;
|
||||||
expout = (struct expression *)
|
ps->expout = (struct expression *)
|
||||||
xrealloc ((char *) expout, sizeof (struct expression)
|
xrealloc (ps->expout, sizeof (struct expression)
|
||||||
+ EXP_ELEM_TO_BYTES (expout_size));
|
+ EXP_ELEM_TO_BYTES (ps->expout_size));
|
||||||
}
|
}
|
||||||
expout->elts[expout_ptr++] = *expelt;
|
ps->expout->elts[ps->expout_ptr++] = *expelt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_elt_opcode (enum exp_opcode expelt)
|
write_exp_elt_opcode (struct parser_state *ps, enum exp_opcode expelt)
|
||||||
{
|
{
|
||||||
union exp_element tmp;
|
union exp_element tmp;
|
||||||
|
|
||||||
memset (&tmp, 0, sizeof (union exp_element));
|
memset (&tmp, 0, sizeof (union exp_element));
|
||||||
tmp.opcode = expelt;
|
tmp.opcode = expelt;
|
||||||
write_exp_elt (&tmp);
|
write_exp_elt (ps, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_elt_sym (struct symbol *expelt)
|
write_exp_elt_sym (struct parser_state *ps, struct symbol *expelt)
|
||||||
{
|
{
|
||||||
union exp_element tmp;
|
union exp_element tmp;
|
||||||
|
|
||||||
memset (&tmp, 0, sizeof (union exp_element));
|
memset (&tmp, 0, sizeof (union exp_element));
|
||||||
tmp.symbol = expelt;
|
tmp.symbol = expelt;
|
||||||
write_exp_elt (&tmp);
|
write_exp_elt (ps, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_elt_block (const struct block *b)
|
write_exp_elt_block (struct parser_state *ps, const struct block *b)
|
||||||
{
|
{
|
||||||
union exp_element tmp;
|
union exp_element tmp;
|
||||||
|
|
||||||
memset (&tmp, 0, sizeof (union exp_element));
|
memset (&tmp, 0, sizeof (union exp_element));
|
||||||
tmp.block = b;
|
tmp.block = b;
|
||||||
write_exp_elt (&tmp);
|
write_exp_elt (ps, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_elt_objfile (struct objfile *objfile)
|
write_exp_elt_objfile (struct parser_state *ps, struct objfile *objfile)
|
||||||
{
|
{
|
||||||
union exp_element tmp;
|
union exp_element tmp;
|
||||||
|
|
||||||
memset (&tmp, 0, sizeof (union exp_element));
|
memset (&tmp, 0, sizeof (union exp_element));
|
||||||
tmp.objfile = objfile;
|
tmp.objfile = objfile;
|
||||||
write_exp_elt (&tmp);
|
write_exp_elt (ps, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_elt_longcst (LONGEST expelt)
|
write_exp_elt_longcst (struct parser_state *ps, LONGEST expelt)
|
||||||
{
|
{
|
||||||
union exp_element tmp;
|
union exp_element tmp;
|
||||||
|
|
||||||
memset (&tmp, 0, sizeof (union exp_element));
|
memset (&tmp, 0, sizeof (union exp_element));
|
||||||
tmp.longconst = expelt;
|
tmp.longconst = expelt;
|
||||||
write_exp_elt (&tmp);
|
write_exp_elt (ps, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_elt_dblcst (DOUBLEST expelt)
|
write_exp_elt_dblcst (struct parser_state *ps, DOUBLEST expelt)
|
||||||
{
|
{
|
||||||
union exp_element tmp;
|
union exp_element tmp;
|
||||||
|
|
||||||
memset (&tmp, 0, sizeof (union exp_element));
|
memset (&tmp, 0, sizeof (union exp_element));
|
||||||
tmp.doubleconst = expelt;
|
tmp.doubleconst = expelt;
|
||||||
write_exp_elt (&tmp);
|
write_exp_elt (ps, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_elt_decfloatcst (gdb_byte expelt[16])
|
write_exp_elt_decfloatcst (struct parser_state *ps, gdb_byte expelt[16])
|
||||||
{
|
{
|
||||||
union exp_element tmp;
|
union exp_element tmp;
|
||||||
int index;
|
int index;
|
||||||
@ -304,27 +304,27 @@ write_exp_elt_decfloatcst (gdb_byte expelt[16])
|
|||||||
for (index = 0; index < 16; index++)
|
for (index = 0; index < 16; index++)
|
||||||
tmp.decfloatconst[index] = expelt[index];
|
tmp.decfloatconst[index] = expelt[index];
|
||||||
|
|
||||||
write_exp_elt (&tmp);
|
write_exp_elt (ps, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_elt_type (struct type *expelt)
|
write_exp_elt_type (struct parser_state *ps, struct type *expelt)
|
||||||
{
|
{
|
||||||
union exp_element tmp;
|
union exp_element tmp;
|
||||||
|
|
||||||
memset (&tmp, 0, sizeof (union exp_element));
|
memset (&tmp, 0, sizeof (union exp_element));
|
||||||
tmp.type = expelt;
|
tmp.type = expelt;
|
||||||
write_exp_elt (&tmp);
|
write_exp_elt (ps, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_elt_intern (struct internalvar *expelt)
|
write_exp_elt_intern (struct parser_state *ps, struct internalvar *expelt)
|
||||||
{
|
{
|
||||||
union exp_element tmp;
|
union exp_element tmp;
|
||||||
|
|
||||||
memset (&tmp, 0, sizeof (union exp_element));
|
memset (&tmp, 0, sizeof (union exp_element));
|
||||||
tmp.internalvar = expelt;
|
tmp.internalvar = expelt;
|
||||||
write_exp_elt (&tmp);
|
write_exp_elt (ps, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add a string constant to the end of the expression.
|
/* Add a string constant to the end of the expression.
|
||||||
@ -349,10 +349,10 @@ write_exp_elt_intern (struct internalvar *expelt)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_string (struct stoken str)
|
write_exp_string (struct parser_state *ps, struct stoken str)
|
||||||
{
|
{
|
||||||
int len = str.length;
|
int len = str.length;
|
||||||
int lenelt;
|
size_t lenelt;
|
||||||
char *strdata;
|
char *strdata;
|
||||||
|
|
||||||
/* Compute the number of expression elements required to hold the string
|
/* Compute the number of expression elements required to hold the string
|
||||||
@ -362,28 +362,19 @@ write_exp_string (struct stoken str)
|
|||||||
|
|
||||||
lenelt = 2 + BYTES_TO_EXP_ELEM (len + 1);
|
lenelt = 2 + BYTES_TO_EXP_ELEM (len + 1);
|
||||||
|
|
||||||
/* Ensure that we have enough available expression elements to store
|
increase_expout_size (ps, lenelt);
|
||||||
everything. */
|
|
||||||
|
|
||||||
if ((expout_ptr + lenelt) >= expout_size)
|
|
||||||
{
|
|
||||||
expout_size = max (expout_size * 2, expout_ptr + lenelt + 10);
|
|
||||||
expout = (struct expression *)
|
|
||||||
xrealloc ((char *) expout, (sizeof (struct expression)
|
|
||||||
+ EXP_ELEM_TO_BYTES (expout_size)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write the leading length expression element (which advances the current
|
/* Write the leading length expression element (which advances the current
|
||||||
expression element index), then write the string constant followed by a
|
expression element index), then write the string constant followed by a
|
||||||
terminating null byte, and then write the trailing length expression
|
terminating null byte, and then write the trailing length expression
|
||||||
element. */
|
element. */
|
||||||
|
|
||||||
write_exp_elt_longcst ((LONGEST) len);
|
write_exp_elt_longcst (ps, (LONGEST) len);
|
||||||
strdata = (char *) &expout->elts[expout_ptr];
|
strdata = (char *) &ps->expout->elts[ps->expout_ptr];
|
||||||
memcpy (strdata, str.ptr, len);
|
memcpy (strdata, str.ptr, len);
|
||||||
*(strdata + len) = '\0';
|
*(strdata + len) = '\0';
|
||||||
expout_ptr += lenelt - 2;
|
ps->expout_ptr += lenelt - 2;
|
||||||
write_exp_elt_longcst ((LONGEST) len);
|
write_exp_elt_longcst (ps, (LONGEST) len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add a vector of string constants to the end of the expression.
|
/* Add a vector of string constants to the end of the expression.
|
||||||
@ -400,9 +391,11 @@ write_exp_string (struct stoken str)
|
|||||||
long constant, followed by the contents of the string. */
|
long constant, followed by the contents of the string. */
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_string_vector (int type, struct stoken_vector *vec)
|
write_exp_string_vector (struct parser_state *ps, int type,
|
||||||
|
struct stoken_vector *vec)
|
||||||
{
|
{
|
||||||
int i, n_slots, len;
|
int i, len;
|
||||||
|
size_t n_slots;
|
||||||
|
|
||||||
/* Compute the size. We compute the size in number of slots to
|
/* Compute the size. We compute the size in number of slots to
|
||||||
avoid issues with string padding. */
|
avoid issues with string padding. */
|
||||||
@ -421,28 +414,22 @@ write_exp_string_vector (int type, struct stoken_vector *vec)
|
|||||||
len = EXP_ELEM_TO_BYTES (n_slots) - 1;
|
len = EXP_ELEM_TO_BYTES (n_slots) - 1;
|
||||||
|
|
||||||
n_slots += 4;
|
n_slots += 4;
|
||||||
if ((expout_ptr + n_slots) >= expout_size)
|
increase_expout_size (ps, n_slots);
|
||||||
{
|
|
||||||
expout_size = max (expout_size * 2, expout_ptr + n_slots + 10);
|
|
||||||
expout = (struct expression *)
|
|
||||||
xrealloc ((char *) expout, (sizeof (struct expression)
|
|
||||||
+ EXP_ELEM_TO_BYTES (expout_size)));
|
|
||||||
}
|
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_STRING);
|
write_exp_elt_opcode (ps, OP_STRING);
|
||||||
write_exp_elt_longcst (len);
|
write_exp_elt_longcst (ps, len);
|
||||||
write_exp_elt_longcst (type);
|
write_exp_elt_longcst (ps, type);
|
||||||
|
|
||||||
for (i = 0; i < vec->len; ++i)
|
for (i = 0; i < vec->len; ++i)
|
||||||
{
|
{
|
||||||
write_exp_elt_longcst (vec->tokens[i].length);
|
write_exp_elt_longcst (ps, vec->tokens[i].length);
|
||||||
memcpy (&expout->elts[expout_ptr], vec->tokens[i].ptr,
|
memcpy (&ps->expout->elts[ps->expout_ptr], vec->tokens[i].ptr,
|
||||||
vec->tokens[i].length);
|
vec->tokens[i].length);
|
||||||
expout_ptr += BYTES_TO_EXP_ELEM (vec->tokens[i].length);
|
ps->expout_ptr += BYTES_TO_EXP_ELEM (vec->tokens[i].length);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_longcst (len);
|
write_exp_elt_longcst (ps, len);
|
||||||
write_exp_elt_opcode (OP_STRING);
|
write_exp_elt_opcode (ps, OP_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add a bitstring constant to the end of the expression.
|
/* Add a bitstring constant to the end of the expression.
|
||||||
@ -457,11 +444,11 @@ write_exp_string_vector (int type, struct stoken_vector *vec)
|
|||||||
either end of the bitstring. */
|
either end of the bitstring. */
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_bitstring (struct stoken str)
|
write_exp_bitstring (struct parser_state *ps, struct stoken str)
|
||||||
{
|
{
|
||||||
int bits = str.length; /* length in bits */
|
int bits = str.length; /* length in bits */
|
||||||
int len = (bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
|
int len = (bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
|
||||||
int lenelt;
|
size_t lenelt;
|
||||||
char *strdata;
|
char *strdata;
|
||||||
|
|
||||||
/* Compute the number of expression elements required to hold the bitstring,
|
/* Compute the number of expression elements required to hold the bitstring,
|
||||||
@ -470,33 +457,25 @@ write_exp_bitstring (struct stoken str)
|
|||||||
|
|
||||||
lenelt = 2 + BYTES_TO_EXP_ELEM (len);
|
lenelt = 2 + BYTES_TO_EXP_ELEM (len);
|
||||||
|
|
||||||
/* Ensure that we have enough available expression elements to store
|
increase_expout_size (ps, lenelt);
|
||||||
everything. */
|
|
||||||
|
|
||||||
if ((expout_ptr + lenelt) >= expout_size)
|
|
||||||
{
|
|
||||||
expout_size = max (expout_size * 2, expout_ptr + lenelt + 10);
|
|
||||||
expout = (struct expression *)
|
|
||||||
xrealloc ((char *) expout, (sizeof (struct expression)
|
|
||||||
+ EXP_ELEM_TO_BYTES (expout_size)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write the leading length expression element (which advances the current
|
/* Write the leading length expression element (which advances the current
|
||||||
expression element index), then write the bitstring constant, and then
|
expression element index), then write the bitstring constant, and then
|
||||||
write the trailing length expression element. */
|
write the trailing length expression element. */
|
||||||
|
|
||||||
write_exp_elt_longcst ((LONGEST) bits);
|
write_exp_elt_longcst (ps, (LONGEST) bits);
|
||||||
strdata = (char *) &expout->elts[expout_ptr];
|
strdata = (char *) &ps->expout->elts[ps->expout_ptr];
|
||||||
memcpy (strdata, str.ptr, len);
|
memcpy (strdata, str.ptr, len);
|
||||||
expout_ptr += lenelt - 2;
|
ps->expout_ptr += lenelt - 2;
|
||||||
write_exp_elt_longcst ((LONGEST) bits);
|
write_exp_elt_longcst (ps, (LONGEST) bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the appropriate elements for a minimal symbol to the end of
|
/* Add the appropriate elements for a minimal symbol to the end of
|
||||||
the expression. */
|
the expression. */
|
||||||
|
|
||||||
void
|
void
|
||||||
write_exp_msymbol (struct bound_minimal_symbol bound_msym)
|
write_exp_msymbol (struct parser_state *ps,
|
||||||
|
struct bound_minimal_symbol bound_msym)
|
||||||
{
|
{
|
||||||
struct minimal_symbol *msymbol = bound_msym.minsym;
|
struct minimal_symbol *msymbol = bound_msym.minsym;
|
||||||
struct objfile *objfile = bound_msym.objfile;
|
struct objfile *objfile = bound_msym.objfile;
|
||||||
@ -536,62 +515,62 @@ write_exp_msymbol (struct bound_minimal_symbol bound_msym)
|
|||||||
if (overlay_debugging)
|
if (overlay_debugging)
|
||||||
addr = symbol_overlayed_address (addr, section);
|
addr = symbol_overlayed_address (addr, section);
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (ps, OP_LONG);
|
||||||
/* Let's make the type big enough to hold a 64-bit address. */
|
/* Let's make the type big enough to hold a 64-bit address. */
|
||||||
write_exp_elt_type (objfile_type (objfile)->builtin_core_addr);
|
write_exp_elt_type (ps, objfile_type (objfile)->builtin_core_addr);
|
||||||
write_exp_elt_longcst ((LONGEST) addr);
|
write_exp_elt_longcst (ps, (LONGEST) addr);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (ps, OP_LONG);
|
||||||
|
|
||||||
if (section && section->the_bfd_section->flags & SEC_THREAD_LOCAL)
|
if (section && section->the_bfd_section->flags & SEC_THREAD_LOCAL)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (UNOP_MEMVAL_TLS);
|
write_exp_elt_opcode (ps, UNOP_MEMVAL_TLS);
|
||||||
write_exp_elt_objfile (objfile);
|
write_exp_elt_objfile (ps, objfile);
|
||||||
write_exp_elt_type (objfile_type (objfile)->nodebug_tls_symbol);
|
write_exp_elt_type (ps, objfile_type (objfile)->nodebug_tls_symbol);
|
||||||
write_exp_elt_opcode (UNOP_MEMVAL_TLS);
|
write_exp_elt_opcode (ps, UNOP_MEMVAL_TLS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (UNOP_MEMVAL);
|
write_exp_elt_opcode (ps, UNOP_MEMVAL);
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case mst_text:
|
case mst_text:
|
||||||
case mst_file_text:
|
case mst_file_text:
|
||||||
case mst_solib_trampoline:
|
case mst_solib_trampoline:
|
||||||
write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol);
|
write_exp_elt_type (ps, objfile_type (objfile)->nodebug_text_symbol);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mst_text_gnu_ifunc:
|
case mst_text_gnu_ifunc:
|
||||||
write_exp_elt_type (objfile_type (objfile)
|
write_exp_elt_type (ps, objfile_type (objfile)
|
||||||
->nodebug_text_gnu_ifunc_symbol);
|
->nodebug_text_gnu_ifunc_symbol);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mst_data:
|
case mst_data:
|
||||||
case mst_file_data:
|
case mst_file_data:
|
||||||
case mst_bss:
|
case mst_bss:
|
||||||
case mst_file_bss:
|
case mst_file_bss:
|
||||||
write_exp_elt_type (objfile_type (objfile)->nodebug_data_symbol);
|
write_exp_elt_type (ps, objfile_type (objfile)->nodebug_data_symbol);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mst_slot_got_plt:
|
case mst_slot_got_plt:
|
||||||
write_exp_elt_type (objfile_type (objfile)->nodebug_got_plt_symbol);
|
write_exp_elt_type (ps, objfile_type (objfile)->nodebug_got_plt_symbol);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
write_exp_elt_type (objfile_type (objfile)->nodebug_unknown_symbol);
|
write_exp_elt_type (ps, objfile_type (objfile)->nodebug_unknown_symbol);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
write_exp_elt_opcode (UNOP_MEMVAL);
|
write_exp_elt_opcode (ps, UNOP_MEMVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark the current index as the starting location of a structure
|
/* Mark the current index as the starting location of a structure
|
||||||
expression. This is used when completing on field names. */
|
expression. This is used when completing on field names. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mark_struct_expression (void)
|
mark_struct_expression (struct parser_state *ps)
|
||||||
{
|
{
|
||||||
gdb_assert (parse_completion
|
gdb_assert (parse_completion
|
||||||
&& expout_tag_completion_type == TYPE_CODE_UNDEF);
|
&& expout_tag_completion_type == TYPE_CODE_UNDEF);
|
||||||
expout_last_struct = expout_ptr;
|
expout_last_struct = ps->expout_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Indicate that the current parser invocation is completing a tag.
|
/* Indicate that the current parser invocation is completing a tag.
|
||||||
@ -638,7 +617,7 @@ mark_completion_tag (enum type_code tag, const char *ptr, int length)
|
|||||||
value in the value history, I.e. $$1 */
|
value in the value history, I.e. $$1 */
|
||||||
|
|
||||||
void
|
void
|
||||||
write_dollar_variable (struct stoken str)
|
write_dollar_variable (struct parser_state *ps, struct stoken str)
|
||||||
{
|
{
|
||||||
struct symbol *sym = NULL;
|
struct symbol *sym = NULL;
|
||||||
struct bound_minimal_symbol msym;
|
struct bound_minimal_symbol msym;
|
||||||
@ -676,7 +655,7 @@ write_dollar_variable (struct stoken str)
|
|||||||
|
|
||||||
/* Handle tokens that refer to machine registers:
|
/* Handle tokens that refer to machine registers:
|
||||||
$ followed by a register name. */
|
$ followed by a register name. */
|
||||||
i = user_reg_map_name_to_regnum (parse_gdbarch,
|
i = user_reg_map_name_to_regnum (parse_gdbarch (ps),
|
||||||
str.ptr + 1, str.length - 1);
|
str.ptr + 1, str.length - 1);
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
goto handle_register;
|
goto handle_register;
|
||||||
@ -686,9 +665,9 @@ write_dollar_variable (struct stoken str)
|
|||||||
isym = lookup_only_internalvar (copy_name (str) + 1);
|
isym = lookup_only_internalvar (copy_name (str) + 1);
|
||||||
if (isym)
|
if (isym)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_INTERNALVAR);
|
write_exp_elt_opcode (ps, OP_INTERNALVAR);
|
||||||
write_exp_elt_intern (isym);
|
write_exp_elt_intern (ps, isym);
|
||||||
write_exp_elt_opcode (OP_INTERNALVAR);
|
write_exp_elt_opcode (ps, OP_INTERNALVAR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,36 +678,36 @@ write_dollar_variable (struct stoken str)
|
|||||||
VAR_DOMAIN, NULL);
|
VAR_DOMAIN, NULL);
|
||||||
if (sym)
|
if (sym)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (ps, OP_VAR_VALUE);
|
||||||
write_exp_elt_block (block_found); /* set by lookup_symbol */
|
write_exp_elt_block (ps, block_found); /* set by lookup_symbol */
|
||||||
write_exp_elt_sym (sym);
|
write_exp_elt_sym (ps, sym);
|
||||||
write_exp_elt_opcode (OP_VAR_VALUE);
|
write_exp_elt_opcode (ps, OP_VAR_VALUE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
msym = lookup_bound_minimal_symbol (copy_name (str));
|
msym = lookup_bound_minimal_symbol (copy_name (str));
|
||||||
if (msym.minsym)
|
if (msym.minsym)
|
||||||
{
|
{
|
||||||
write_exp_msymbol (msym);
|
write_exp_msymbol (ps, msym);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Any other names are assumed to be debugger internal variables. */
|
/* Any other names are assumed to be debugger internal variables. */
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_INTERNALVAR);
|
write_exp_elt_opcode (ps, OP_INTERNALVAR);
|
||||||
write_exp_elt_intern (create_internalvar (copy_name (str) + 1));
|
write_exp_elt_intern (ps, create_internalvar (copy_name (str) + 1));
|
||||||
write_exp_elt_opcode (OP_INTERNALVAR);
|
write_exp_elt_opcode (ps, OP_INTERNALVAR);
|
||||||
return;
|
return;
|
||||||
handle_last:
|
handle_last:
|
||||||
write_exp_elt_opcode (OP_LAST);
|
write_exp_elt_opcode (ps, OP_LAST);
|
||||||
write_exp_elt_longcst ((LONGEST) i);
|
write_exp_elt_longcst (ps, (LONGEST) i);
|
||||||
write_exp_elt_opcode (OP_LAST);
|
write_exp_elt_opcode (ps, OP_LAST);
|
||||||
return;
|
return;
|
||||||
handle_register:
|
handle_register:
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (ps, OP_REGISTER);
|
||||||
str.length--;
|
str.length--;
|
||||||
str.ptr++;
|
str.ptr++;
|
||||||
write_exp_string (str);
|
write_exp_string (ps, str);
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (ps, OP_REGISTER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1161,6 +1140,7 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
|
|||||||
volatile struct gdb_exception except;
|
volatile struct gdb_exception except;
|
||||||
struct cleanup *old_chain, *inner_chain;
|
struct cleanup *old_chain, *inner_chain;
|
||||||
const struct language_defn *lang = NULL;
|
const struct language_defn *lang = NULL;
|
||||||
|
struct parser_state ps;
|
||||||
int subexp;
|
int subexp;
|
||||||
|
|
||||||
lexptr = *stringptr;
|
lexptr = *stringptr;
|
||||||
@ -1233,47 +1213,48 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
|
|||||||
While we need CURRENT_LANGUAGE to be set to LANG (for lookup_symbol
|
While we need CURRENT_LANGUAGE to be set to LANG (for lookup_symbol
|
||||||
and others called from *.y) ensure CURRENT_LANGUAGE gets restored
|
and others called from *.y) ensure CURRENT_LANGUAGE gets restored
|
||||||
to the value matching SELECTED_FRAME as set by get_current_arch. */
|
to the value matching SELECTED_FRAME as set by get_current_arch. */
|
||||||
initialize_expout (10, lang, get_current_arch ());
|
|
||||||
|
initialize_expout (&ps, 10, lang, get_current_arch ());
|
||||||
inner_chain = make_cleanup_restore_current_language ();
|
inner_chain = make_cleanup_restore_current_language ();
|
||||||
set_language (lang->la_language);
|
set_language (lang->la_language);
|
||||||
|
|
||||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
if (lang->la_parser ())
|
if (lang->la_parser (&ps))
|
||||||
lang->la_error (NULL);
|
lang->la_error (NULL);
|
||||||
}
|
}
|
||||||
if (except.reason < 0)
|
if (except.reason < 0)
|
||||||
{
|
{
|
||||||
if (! parse_completion)
|
if (! parse_completion)
|
||||||
{
|
{
|
||||||
xfree (expout);
|
xfree (ps.expout);
|
||||||
throw_exception (except);
|
throw_exception (except);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reallocate_expout ();
|
reallocate_expout (&ps);
|
||||||
|
|
||||||
/* Convert expression from postfix form as generated by yacc
|
/* Convert expression from postfix form as generated by yacc
|
||||||
parser, to a prefix form. */
|
parser, to a prefix form. */
|
||||||
|
|
||||||
if (expressiondebug)
|
if (expressiondebug)
|
||||||
dump_raw_expression (expout, gdb_stdlog,
|
dump_raw_expression (ps.expout, gdb_stdlog,
|
||||||
"before conversion to prefix form");
|
"before conversion to prefix form");
|
||||||
|
|
||||||
subexp = prefixify_expression (expout);
|
subexp = prefixify_expression (ps.expout);
|
||||||
if (out_subexp)
|
if (out_subexp)
|
||||||
*out_subexp = subexp;
|
*out_subexp = subexp;
|
||||||
|
|
||||||
lang->la_post_parser (&expout, void_context_p);
|
lang->la_post_parser (&ps.expout, void_context_p);
|
||||||
|
|
||||||
if (expressiondebug)
|
if (expressiondebug)
|
||||||
dump_prefix_expression (expout, gdb_stdlog);
|
dump_prefix_expression (ps.expout, gdb_stdlog);
|
||||||
|
|
||||||
do_cleanups (inner_chain);
|
do_cleanups (inner_chain);
|
||||||
discard_cleanups (old_chain);
|
discard_cleanups (old_chain);
|
||||||
|
|
||||||
*stringptr = lexptr;
|
*stringptr = lexptr;
|
||||||
return expout;
|
return ps.expout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse STRING as an expression, and complain if this fails
|
/* Parse STRING as an expression, and complain if this fails
|
||||||
@ -1512,7 +1493,7 @@ push_type_int (int n)
|
|||||||
item. */
|
item. */
|
||||||
|
|
||||||
void
|
void
|
||||||
insert_type_address_space (char *string)
|
insert_type_address_space (struct parser_state *pstate, char *string)
|
||||||
{
|
{
|
||||||
union type_stack_elt element;
|
union type_stack_elt element;
|
||||||
int slot;
|
int slot;
|
||||||
@ -1527,7 +1508,8 @@ insert_type_address_space (char *string)
|
|||||||
|
|
||||||
element.piece = tp_space_identifier;
|
element.piece = tp_space_identifier;
|
||||||
insert_into_type_stack (slot, element);
|
insert_into_type_stack (slot, element);
|
||||||
element.int_val = address_space_name_to_int (parse_gdbarch, string);
|
element.int_val = address_space_name_to_int (parse_gdbarch (pstate),
|
||||||
|
string);
|
||||||
insert_into_type_stack (slot, element);
|
insert_into_type_stack (slot, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1909,6 +1891,21 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile)
|
|||||||
return exp_iterate (exp, exp_uses_objfile_iter, objfile);
|
return exp_iterate (exp, exp_uses_objfile_iter, objfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See definition in parser-defs.h. */
|
||||||
|
|
||||||
|
void
|
||||||
|
increase_expout_size (struct parser_state *ps, size_t lenelt)
|
||||||
|
{
|
||||||
|
if ((ps->expout_ptr + lenelt) >= ps->expout_size)
|
||||||
|
{
|
||||||
|
ps->expout_size = max (ps->expout_size * 2,
|
||||||
|
ps->expout_ptr + lenelt + 10);
|
||||||
|
ps->expout = (struct expression *)
|
||||||
|
xrealloc (ps->expout, (sizeof (struct expression)
|
||||||
|
+ EXP_ELEM_TO_BYTES (ps->expout_size)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_initialize_parse (void)
|
_initialize_parse (void)
|
||||||
{
|
{
|
||||||
|
@ -28,15 +28,29 @@
|
|||||||
#include "expression.h"
|
#include "expression.h"
|
||||||
|
|
||||||
struct block;
|
struct block;
|
||||||
|
struct language_defn;
|
||||||
|
struct internalvar;
|
||||||
|
|
||||||
extern int parser_debug;
|
extern int parser_debug;
|
||||||
|
|
||||||
extern struct expression *expout;
|
#define parse_gdbarch(ps) ((ps)->expout->gdbarch)
|
||||||
extern int expout_size;
|
#define parse_language(ps) ((ps)->expout->language_defn)
|
||||||
extern int expout_ptr;
|
|
||||||
|
|
||||||
#define parse_gdbarch (expout->gdbarch)
|
struct parser_state
|
||||||
#define parse_language (expout->language_defn)
|
{
|
||||||
|
/* The expression related to this parser state. */
|
||||||
|
|
||||||
|
struct expression *expout;
|
||||||
|
|
||||||
|
/* The size of the expression above. */
|
||||||
|
|
||||||
|
size_t expout_size;
|
||||||
|
|
||||||
|
/* The number of elements already in the expression. This is used
|
||||||
|
to know where to put new elements. */
|
||||||
|
|
||||||
|
size_t expout_ptr;
|
||||||
|
};
|
||||||
|
|
||||||
/* If this is nonzero, this block is used as the lexical context
|
/* If this is nonzero, this block is used as the lexical context
|
||||||
for symbol names. */
|
for symbol names. */
|
||||||
@ -148,19 +162,21 @@ struct type_stack
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Helper function to initialize the expout, expout_size, expout_ptr
|
/* Helper function to initialize the expout, expout_size, expout_ptr
|
||||||
trio before it is used to store expression elements created during
|
trio inside PS before it is used to store expression elements created
|
||||||
the parsing of an expression. INITIAL_SIZE is the initial size of
|
during the parsing of an expression. INITIAL_SIZE is the initial size of
|
||||||
the expout array. LANG is the language used to parse the expression.
|
the expout array. LANG is the language used to parse the expression.
|
||||||
And GDBARCH is the gdbarch to use during parsing. */
|
And GDBARCH is the gdbarch to use during parsing. */
|
||||||
|
|
||||||
extern void initialize_expout (int, const struct language_defn *,
|
extern void initialize_expout (struct parser_state *ps,
|
||||||
struct gdbarch *);
|
size_t initial_size,
|
||||||
|
const struct language_defn *lang,
|
||||||
|
struct gdbarch *gdbarch);
|
||||||
|
|
||||||
/* Helper function that frees any unsed space in the expout array.
|
/* Helper function that reallocates the EXPOUT inside PS in order to
|
||||||
It is generally used when the parser has just been parsed and
|
eliminate any unused space. It is generally used when the expression
|
||||||
created. */
|
has just been parsed and created. */
|
||||||
|
|
||||||
extern void reallocate_expout (void);
|
extern void reallocate_expout (struct parser_state *ps);
|
||||||
|
|
||||||
/* Reverse an expression from suffix form (in which it is constructed)
|
/* Reverse an expression from suffix form (in which it is constructed)
|
||||||
to prefix form (in which we can conveniently print or execute it).
|
to prefix form (in which we can conveniently print or execute it).
|
||||||
@ -171,35 +187,38 @@ extern void reallocate_expout (void);
|
|||||||
|
|
||||||
extern int prefixify_expression (struct expression *expr);
|
extern int prefixify_expression (struct expression *expr);
|
||||||
|
|
||||||
extern void write_exp_elt_opcode (enum exp_opcode);
|
extern void write_exp_elt_opcode (struct parser_state *, enum exp_opcode);
|
||||||
|
|
||||||
extern void write_exp_elt_sym (struct symbol *);
|
extern void write_exp_elt_sym (struct parser_state *, struct symbol *);
|
||||||
|
|
||||||
extern void write_exp_elt_longcst (LONGEST);
|
extern void write_exp_elt_longcst (struct parser_state *, LONGEST);
|
||||||
|
|
||||||
extern void write_exp_elt_dblcst (DOUBLEST);
|
extern void write_exp_elt_dblcst (struct parser_state *, DOUBLEST);
|
||||||
|
|
||||||
extern void write_exp_elt_decfloatcst (gdb_byte *);
|
extern void write_exp_elt_decfloatcst (struct parser_state *, gdb_byte *);
|
||||||
|
|
||||||
extern void write_exp_elt_type (struct type *);
|
extern void write_exp_elt_type (struct parser_state *, struct type *);
|
||||||
|
|
||||||
extern void write_exp_elt_intern (struct internalvar *);
|
extern void write_exp_elt_intern (struct parser_state *, struct internalvar *);
|
||||||
|
|
||||||
extern void write_exp_string (struct stoken);
|
extern void write_exp_string (struct parser_state *, struct stoken);
|
||||||
|
|
||||||
void write_exp_string_vector (int type, struct stoken_vector *vec);
|
void write_exp_string_vector (struct parser_state *, int type,
|
||||||
|
struct stoken_vector *vec);
|
||||||
|
|
||||||
extern void write_exp_bitstring (struct stoken);
|
extern void write_exp_bitstring (struct parser_state *, struct stoken);
|
||||||
|
|
||||||
extern void write_exp_elt_block (const struct block *);
|
extern void write_exp_elt_block (struct parser_state *, const struct block *);
|
||||||
|
|
||||||
extern void write_exp_elt_objfile (struct objfile *objfile);
|
extern void write_exp_elt_objfile (struct parser_state *,
|
||||||
|
struct objfile *objfile);
|
||||||
|
|
||||||
extern void write_exp_msymbol (struct bound_minimal_symbol);
|
extern void write_exp_msymbol (struct parser_state *,
|
||||||
|
struct bound_minimal_symbol);
|
||||||
|
|
||||||
extern void write_dollar_variable (struct stoken str);
|
extern void write_dollar_variable (struct parser_state *, struct stoken str);
|
||||||
|
|
||||||
extern void mark_struct_expression (void);
|
extern void mark_struct_expression (struct parser_state *);
|
||||||
|
|
||||||
extern const char *find_template_name_end (const char *);
|
extern const char *find_template_name_end (const char *);
|
||||||
|
|
||||||
@ -215,7 +234,7 @@ extern void push_type (enum type_pieces);
|
|||||||
|
|
||||||
extern void push_type_int (int);
|
extern void push_type_int (int);
|
||||||
|
|
||||||
extern void insert_type_address_space (char *);
|
extern void insert_type_address_space (struct parser_state *, char *);
|
||||||
|
|
||||||
extern enum type_pieces pop_type (void);
|
extern enum type_pieces pop_type (void);
|
||||||
|
|
||||||
@ -375,5 +394,11 @@ extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile);
|
|||||||
extern void mark_completion_tag (enum type_code, const char *ptr,
|
extern void mark_completion_tag (enum type_code, const char *ptr,
|
||||||
int length);
|
int length);
|
||||||
|
|
||||||
|
/* Reallocate the `expout' pointer inside PS so that it can accommodate
|
||||||
|
at least LENELT expression elements. This function does nothing if
|
||||||
|
there is enough room for the elements. */
|
||||||
|
|
||||||
|
extern void increase_expout_size (struct parser_state *ps, size_t lenelt);
|
||||||
|
|
||||||
#endif /* PARSER_DEFS_H */
|
#endif /* PARSER_DEFS_H */
|
||||||
|
|
||||||
|
@ -978,11 +978,11 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
|
|||||||
error (_("Invalid register name `%s' on expression `%s'."),
|
error (_("Invalid register name `%s' on expression `%s'."),
|
||||||
regname, p->saved_arg);
|
regname, p->saved_arg);
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
str.ptr = regname;
|
str.ptr = regname;
|
||||||
str.length = len;
|
str.length = len;
|
||||||
write_exp_string (str);
|
write_exp_string (&p->pstate, str);
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
|
|
||||||
p->arg = s;
|
p->arg = s;
|
||||||
}
|
}
|
||||||
|
@ -601,12 +601,12 @@ stap_parse_register_operand (struct stap_parse_info *p)
|
|||||||
p->arg = endp;
|
p->arg = endp;
|
||||||
|
|
||||||
/* Generating the expression for the displacement. */
|
/* Generating the expression for the displacement. */
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
|
write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
|
||||||
write_exp_elt_longcst (displacement);
|
write_exp_elt_longcst (&p->pstate, displacement);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
if (got_minus)
|
if (got_minus)
|
||||||
write_exp_elt_opcode (UNOP_NEG);
|
write_exp_elt_opcode (&p->pstate, UNOP_NEG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Getting rid of register indirection prefix. */
|
/* Getting rid of register indirection prefix. */
|
||||||
@ -660,23 +660,23 @@ stap_parse_register_operand (struct stap_parse_info *p)
|
|||||||
error (_("Invalid register name `%s' on expression `%s'."),
|
error (_("Invalid register name `%s' on expression `%s'."),
|
||||||
regname, p->saved_arg);
|
regname, p->saved_arg);
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
str.ptr = regname;
|
str.ptr = regname;
|
||||||
str.length = len;
|
str.length = len;
|
||||||
write_exp_string (str);
|
write_exp_string (&p->pstate, str);
|
||||||
write_exp_elt_opcode (OP_REGISTER);
|
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
|
||||||
|
|
||||||
if (indirect_p)
|
if (indirect_p)
|
||||||
{
|
{
|
||||||
if (disp_p)
|
if (disp_p)
|
||||||
write_exp_elt_opcode (BINOP_ADD);
|
write_exp_elt_opcode (&p->pstate, BINOP_ADD);
|
||||||
|
|
||||||
/* Casting to the expected type. */
|
/* Casting to the expected type. */
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
write_exp_elt_type (lookup_pointer_type (p->arg_type));
|
write_exp_elt_type (&p->pstate, lookup_pointer_type (p->arg_type));
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (&p->pstate, UNOP_CAST);
|
||||||
|
|
||||||
write_exp_elt_opcode (UNOP_IND);
|
write_exp_elt_opcode (&p->pstate, UNOP_IND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Getting rid of the register name suffix. */
|
/* Getting rid of the register name suffix. */
|
||||||
@ -767,9 +767,9 @@ stap_parse_single_operand (struct stap_parse_info *p)
|
|||||||
++p->arg;
|
++p->arg;
|
||||||
stap_parse_argument_conditionally (p);
|
stap_parse_argument_conditionally (p);
|
||||||
if (c == '-')
|
if (c == '-')
|
||||||
write_exp_elt_opcode (UNOP_NEG);
|
write_exp_elt_opcode (&p->pstate, UNOP_NEG);
|
||||||
else if (c == '~')
|
else if (c == '~')
|
||||||
write_exp_elt_opcode (UNOP_COMPLEMENT);
|
write_exp_elt_opcode (&p->pstate, UNOP_COMPLEMENT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -807,10 +807,11 @@ stap_parse_single_operand (struct stap_parse_info *p)
|
|||||||
const char *int_suffix;
|
const char *int_suffix;
|
||||||
|
|
||||||
/* We are dealing with a numeric constant. */
|
/* We are dealing with a numeric constant. */
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
|
write_exp_elt_type (&p->pstate,
|
||||||
write_exp_elt_longcst (number);
|
builtin_type (gdbarch)->builtin_long);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_longcst (&p->pstate, number);
|
||||||
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
|
|
||||||
p->arg = tmp;
|
p->arg = tmp;
|
||||||
|
|
||||||
@ -837,10 +838,10 @@ stap_parse_single_operand (struct stap_parse_info *p)
|
|||||||
number = strtol (p->arg, &endp, 10);
|
number = strtol (p->arg, &endp, 10);
|
||||||
p->arg = endp;
|
p->arg = endp;
|
||||||
|
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
|
write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
|
||||||
write_exp_elt_longcst (number);
|
write_exp_elt_longcst (&p->pstate, number);
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (&p->pstate, OP_LONG);
|
||||||
|
|
||||||
if (stap_check_integer_suffix (gdbarch, p->arg, &int_suffix))
|
if (stap_check_integer_suffix (gdbarch, p->arg, &int_suffix))
|
||||||
p->arg += strlen (int_suffix);
|
p->arg += strlen (int_suffix);
|
||||||
@ -987,7 +988,7 @@ stap_parse_argument_1 (struct stap_parse_info *p, int has_lhs,
|
|||||||
stap_parse_argument_1 (p, 1, lookahead_prec);
|
stap_parse_argument_1 (p, 1, lookahead_prec);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (opcode);
|
write_exp_elt_opcode (&p->pstate, opcode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1028,8 +1029,8 @@ stap_parse_argument (const char **arg, struct type *atype,
|
|||||||
/* We need to initialize the expression buffer, in order to begin
|
/* We need to initialize the expression buffer, in order to begin
|
||||||
our parsing efforts. The language here does not matter, since we
|
our parsing efforts. The language here does not matter, since we
|
||||||
are using our own parser. */
|
are using our own parser. */
|
||||||
initialize_expout (10, current_language, gdbarch);
|
initialize_expout (&p.pstate, 10, current_language, gdbarch);
|
||||||
back_to = make_cleanup (free_current_contents, &expout);
|
back_to = make_cleanup (free_current_contents, &p.pstate.expout);
|
||||||
|
|
||||||
p.saved_arg = *arg;
|
p.saved_arg = *arg;
|
||||||
p.arg = *arg;
|
p.arg = *arg;
|
||||||
@ -1044,16 +1045,17 @@ stap_parse_argument (const char **arg, struct type *atype,
|
|||||||
gdb_assert (p.inside_paren_p == 0);
|
gdb_assert (p.inside_paren_p == 0);
|
||||||
|
|
||||||
/* Casting the final expression to the appropriate type. */
|
/* Casting the final expression to the appropriate type. */
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (&p.pstate, UNOP_CAST);
|
||||||
write_exp_elt_type (atype);
|
write_exp_elt_type (&p.pstate, atype);
|
||||||
write_exp_elt_opcode (UNOP_CAST);
|
write_exp_elt_opcode (&p.pstate, UNOP_CAST);
|
||||||
|
|
||||||
reallocate_expout ();
|
reallocate_expout (&p.pstate);
|
||||||
|
|
||||||
p.arg = skip_spaces_const (p.arg);
|
p.arg = skip_spaces_const (p.arg);
|
||||||
*arg = p.arg;
|
*arg = p.arg;
|
||||||
|
|
||||||
return expout;
|
/* We can safely return EXPOUT here. */
|
||||||
|
return p.pstate.expout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function which parses an argument string from PROBE, correctly splitting
|
/* Function which parses an argument string from PROBE, correctly splitting
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
#if !defined (STAP_PROBE_H)
|
#if !defined (STAP_PROBE_H)
|
||||||
#define STAP_PROBE_H 1
|
#define STAP_PROBE_H 1
|
||||||
|
|
||||||
|
/* For `struct parser_state'. */
|
||||||
|
#include "parser-defs.h"
|
||||||
|
|
||||||
/* Structure which holds information about the parsing process of one probe's
|
/* Structure which holds information about the parsing process of one probe's
|
||||||
argument. */
|
argument. */
|
||||||
|
|
||||||
@ -28,6 +31,9 @@ struct stap_parse_info
|
|||||||
/* The probe's argument in a string format. */
|
/* The probe's argument in a string format. */
|
||||||
const char *arg;
|
const char *arg;
|
||||||
|
|
||||||
|
/* The parser state to be used when generating the expression. */
|
||||||
|
struct parser_state pstate;
|
||||||
|
|
||||||
/* A pointer to the full chain of arguments. This is useful for printing
|
/* A pointer to the full chain of arguments. This is useful for printing
|
||||||
error messages. The parser functions should not modify this argument
|
error messages. The parser functions should not modify this argument
|
||||||
directly; instead, they should use the ARG pointer above. */
|
directly; instead, they should use the ARG pointer above. */
|
||||||
|
18
gdb/utils.c
18
gdb/utils.c
@ -466,6 +466,24 @@ make_cleanup_restore_current_language (void)
|
|||||||
(void *) (uintptr_t) saved_lang);
|
(void *) (uintptr_t) saved_lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Helper function for make_cleanup_clear_parser_state. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
do_clear_parser_state (void *ptr)
|
||||||
|
{
|
||||||
|
struct parser_state **p = (struct parser_state **) ptr;
|
||||||
|
|
||||||
|
*p = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Clean (i.e., set to NULL) the parser state variable P. */
|
||||||
|
|
||||||
|
struct cleanup *
|
||||||
|
make_cleanup_clear_parser_state (struct parser_state **p)
|
||||||
|
{
|
||||||
|
return make_cleanup (do_clear_parser_state, (void *) p);
|
||||||
|
}
|
||||||
|
|
||||||
/* This function is useful for cleanups.
|
/* This function is useful for cleanups.
|
||||||
Do
|
Do
|
||||||
|
|
||||||
|
@ -115,6 +115,10 @@ extern struct cleanup *make_cleanup_restore_current_language (void);
|
|||||||
|
|
||||||
extern struct cleanup *make_cleanup_htab_delete (htab_t htab);
|
extern struct cleanup *make_cleanup_htab_delete (htab_t htab);
|
||||||
|
|
||||||
|
struct parser_state;
|
||||||
|
extern struct cleanup *make_cleanup_clear_parser_state
|
||||||
|
(struct parser_state **p);
|
||||||
|
|
||||||
extern void free_current_contents (void *);
|
extern void free_current_contents (void *);
|
||||||
|
|
||||||
extern void init_page_info (void);
|
extern void init_page_info (void);
|
||||||
|
Reference in New Issue
Block a user