From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20029 invoked by alias); 5 Jun 2012 07:39:58 -0000 Received: (qmail 19542 invoked by uid 22791); 5 Jun 2012 07:39:51 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,FSL_RCVD_USER,KHOP_THREADED,MSGID_MULTIPLE_AT,TW_CP,TW_XF,TW_YY X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.154) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Jun 2012 07:39:32 +0000 Received: from md15.u-strasbg.fr (md15.u-strasbg.fr [130.79.200.204]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q557dLWE025136 ; Tue, 5 Jun 2012 09:39:22 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms17.u-strasbg.fr [130.79.204.117]) by md15.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q557dLNl024748 ; Tue, 5 Jun 2012 09:39:21 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q557dKng027094 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Tue, 5 Jun 2012 09:39:20 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Sergio Durigan Junior'" , "'GDB Patches'" Cc: "'Tom Tromey'" References: <1338665528-5932-1-git-send-email-sergiodj@redhat.com> <1338665528-5932-10-git-send-email-sergiodj@redhat.com> In-Reply-To: <1338665528-5932-10-git-send-email-sergiodj@redhat.com> Subject: RE: [PATCH 09/10] Pascal language Date: Tue, 05 Jun 2012 07:39:00 -0000 Message-ID: <004a01cd42ee$516d7530$f4485f90$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00113.txt.bz2 As pascal language maintainer, I looked at your patch. It seems that this patch is pretty mechanical=20 given the changes to the parameter list of the used functions. Thus you can consider this patch approved=20 with similar changes to the C counterpart. Pierre Muller GDB pascal language maintainer > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Sergio Durigan Junior > Envoy=E9=A0: samedi 2 juin 2012 21:32 > =C0=A0: GDB Patches > Cc=A0: Tom Tromey; Sergio Durigan Junior > Objet=A0: [PATCH 09/10] Pascal language >=20 > Patch for the Pascal language. Similar to the C language one. >=20 > --- > gdb/p-exp.y | 327 +++++++++++++++++++++++++++++++------------------------ > --- > gdb/p-lang.h | 5 +- > 2 files changed, 178 insertions(+), 154 deletions(-) >=20 > diff --git a/gdb/p-exp.y b/gdb/p-exp.y > index 5d344a4..43c4f30 100644 > --- a/gdb/p-exp.y > +++ b/gdb/p-exp.y > @@ -56,7 +56,7 @@ > #include "objfiles.h" /* For have_full_symbols and have_partial_symbols. > */ > #include "block.h" >=20 > -#define parse_type builtin_type (parse_gdbarch) > +#define parse_type(ps) builtin_type (parse_gdbarch (ps)) >=20 > /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), > as well as gratuitiously global symbol names, so we can have multiple > @@ -66,7 +66,7 @@ > generators need to be fixed instead of adding those names to this list. > */ >=20 > #define yymaxdepth pascal_maxdepth > -#define yyparse pascal_parse > +#define yyparse _pascal_parse > #define yylex pascal_lex > #define yyerror pascal_error > #define yylval pascal_lval > @@ -118,6 +118,11 @@ >=20 > #define YYFPRINTF parser_fprintf >=20 > +/* The state of the parser, used internally when we are parsing the > + expression. */ > + > +static struct parser_state *pstate =3D NULL; > + > int yyparse (void); >=20 > static int yylex (void); > @@ -158,7 +163,7 @@ static char * uptok (char *, int); >=20 > %{ > /* YYSTYPE gets defined by %union */ > -static int parse_number (char *, int, int, YYSTYPE *); > +static int parse_number (struct parser_state *, char *, int, int, YYSTYPE > *); >=20 > static struct type *current_type; > static struct internalvar *intvar; > @@ -251,44 +256,44 @@ normal_start : > ; >=20 > type_exp: type > - { write_exp_elt_opcode(OP_TYPE); > - write_exp_elt_type($1); > - write_exp_elt_opcode(OP_TYPE); > + { write_exp_elt_opcode (pstate, OP_TYPE); > + write_exp_elt_type (pstate, $1); > + write_exp_elt_opcode (pstate, OP_TYPE); > current_type =3D $1; } ; >=20 > /* Expressions, including the comma operator. */ > exp1 : exp > | exp1 ',' exp > - { write_exp_elt_opcode (BINOP_COMMA); } > + { write_exp_elt_opcode (pstate, BINOP_COMMA); } > ; >=20 > /* Expressions, not including the comma operator. */ > exp : exp '^' %prec UNARY > - { write_exp_elt_opcode (UNOP_IND); > + { write_exp_elt_opcode (pstate, UNOP_IND); > if (current_type) > current_type =3D TYPE_TARGET_TYPE (current_type); } > ; >=20 > exp : '@' exp %prec UNARY > - { write_exp_elt_opcode (UNOP_ADDR); > + { write_exp_elt_opcode (pstate, UNOP_ADDR); > if (current_type) > current_type =3D TYPE_POINTER_TYPE (current_type); } > ; >=20 > exp : '-' exp %prec UNARY > - { write_exp_elt_opcode (UNOP_NEG); } > + { write_exp_elt_opcode (pstate, UNOP_NEG); } > ; >=20 > exp : NOT exp %prec UNARY > - { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } > + { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); } > ; >=20 > exp : INCREMENT '(' exp ')' %prec UNARY > - { write_exp_elt_opcode (UNOP_PREINCREMENT); } > + { write_exp_elt_opcode (pstate, UNOP_PREINCREMENT); } > ; >=20 > exp : DECREMENT '(' exp ')' %prec UNARY > - { write_exp_elt_opcode (UNOP_PREDECREMENT); } > + { write_exp_elt_opcode (pstate, UNOP_PREDECREMENT); } > ; >=20 >=20 > @@ -297,9 +302,9 @@ field_exp : exp '.' %prec UNARY > ; >=20 > exp : field_exp FIELDNAME > - { write_exp_elt_opcode (STRUCTOP_STRUCT); > - write_exp_string ($2); > - write_exp_elt_opcode (STRUCTOP_STRUCT); > + { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); > + write_exp_string (pstate, $2); > + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); > search_field =3D 0; > if (current_type) > { > @@ -315,10 +320,10 @@ exp : field_exp FIELDNAME >=20 >=20 > exp : field_exp name > - { mark_struct_expression (); > - write_exp_elt_opcode (STRUCTOP_STRUCT); > - write_exp_string ($2); > - write_exp_elt_opcode (STRUCTOP_STRUCT); > + { mark_struct_expression (pstate); > + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); > + write_exp_string (pstate, $2); > + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); > search_field =3D 0; > if (current_type) > { > @@ -334,12 +339,12 @@ exp : field_exp name >=20 > exp : field_exp COMPLETE > { struct stoken s; > - mark_struct_expression (); > - write_exp_elt_opcode (STRUCTOP_STRUCT); > + mark_struct_expression (pstate); > + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); > s.ptr =3D ""; > s.length =3D 0; > - write_exp_string (s); > - write_exp_elt_opcode (STRUCTOP_STRUCT); } > + write_exp_string (pstate, s); > + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } > ; >=20 > exp : exp '[' > @@ -357,14 +362,14 @@ exp : exp '[' > strcpy (stringsval.ptr, arrayname); > current_type =3D TYPE_FIELD_TYPE (current_type, > arrayfieldindex - 1); > - write_exp_elt_opcode (STRUCTOP_STRUCT); > - write_exp_string (stringsval); > - write_exp_elt_opcode (STRUCTOP_STRUCT); > + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); > + write_exp_string (pstate, stringsval); > + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); > } > push_current_type (); } > exp1 ']' > { pop_current_type (); > - write_exp_elt_opcode (BINOP_SUBSCRIPT); > + write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); > if (current_type) > current_type =3D TYPE_TARGET_TYPE (current_type); } > ; > @@ -375,9 +380,9 @@ exp : exp '(' > { push_current_type (); > start_arglist (); } > arglist ')' %prec ARROW > - { write_exp_elt_opcode (OP_FUNCALL); > - write_exp_elt_longcst ((LONGEST) end_arglist ()); > - write_exp_elt_opcode (OP_FUNCALL); > + { write_exp_elt_opcode (pstate, OP_FUNCALL); > + write_exp_elt_longcst (pstate, (LONGEST) end_arglist > ()); > + write_exp_elt_opcode (pstate, OP_FUNCALL); > pop_current_type (); > if (current_type) > current_type =3D TYPE_TARGET_TYPE (current_type); > @@ -398,11 +403,11 @@ exp : type '(' exp ')' %prec UNARY > if ((TYPE_CODE (current_type) =3D=3D TYPE_CODE_PTR) > && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) > =3D=3D TYPE_CODE_CLASS) > && (TYPE_CODE ($1) =3D=3D 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_type ($1); > - write_exp_elt_opcode (UNOP_CAST); > + write_exp_elt_opcode (pstate, UNOP_CAST); > + write_exp_elt_type (pstate, $1); > + write_exp_elt_opcode (pstate, UNOP_CAST); > current_type =3D $1; } > ; >=20 > @@ -413,7 +418,7 @@ exp : '(' exp1 ')' > /* Binary operators in order of decreasing precedence. */ >=20 > exp : exp '*' exp > - { write_exp_elt_opcode (BINOP_MUL); } > + { write_exp_elt_opcode (pstate, BINOP_MUL); } > ; >=20 > exp : exp '/' { > @@ -425,135 +430,137 @@ exp : exp '/' { > if (leftdiv_is_integer && current_type > && is_integral_type (current_type)) > { > - write_exp_elt_opcode (UNOP_CAST); > - write_exp_elt_type (parse_type- > >builtin_long_double); > - current_type =3D parse_type->builtin_long_double; > - write_exp_elt_opcode (UNOP_CAST); > + write_exp_elt_opcode (pstate, UNOP_CAST); > + write_exp_elt_type (pstate, > + parse_type (pstate) > + ->builtin_long_double); > + current_type =3D parse_type (pstate)- > >builtin_long_double; > + write_exp_elt_opcode (pstate, UNOP_CAST); > leftdiv_is_integer =3D 0; > } >=20 > - write_exp_elt_opcode (BINOP_DIV); > + write_exp_elt_opcode (pstate, BINOP_DIV); > } > ; >=20 > exp : exp DIV exp > - { write_exp_elt_opcode (BINOP_INTDIV); } > + { write_exp_elt_opcode (pstate, BINOP_INTDIV); } > ; >=20 > exp : exp MOD exp > - { write_exp_elt_opcode (BINOP_REM); } > + { write_exp_elt_opcode (pstate, BINOP_REM); } > ; >=20 > exp : exp '+' exp > - { write_exp_elt_opcode (BINOP_ADD); } > + { write_exp_elt_opcode (pstate, BINOP_ADD); } > ; >=20 > exp : exp '-' exp > - { write_exp_elt_opcode (BINOP_SUB); } > + { write_exp_elt_opcode (pstate, BINOP_SUB); } > ; >=20 > exp : exp LSH exp > - { write_exp_elt_opcode (BINOP_LSH); } > + { write_exp_elt_opcode (pstate, BINOP_LSH); } > ; >=20 > exp : exp RSH exp > - { write_exp_elt_opcode (BINOP_RSH); } > + { write_exp_elt_opcode (pstate, BINOP_RSH); } > ; >=20 > exp : exp '=3D' exp > - { write_exp_elt_opcode (BINOP_EQUAL); > - current_type =3D parse_type->builtin_bool; > + { write_exp_elt_opcode (pstate, BINOP_EQUAL); > + current_type =3D parse_type (pstate)->builtin_bool; > } > ; >=20 > exp : exp NOTEQUAL exp > - { write_exp_elt_opcode (BINOP_NOTEQUAL); > - current_type =3D parse_type->builtin_bool; > + { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); > + current_type =3D parse_type (pstate)->builtin_bool; > } > ; >=20 > exp : exp LEQ exp > - { write_exp_elt_opcode (BINOP_LEQ); > - current_type =3D parse_type->builtin_bool; > + { write_exp_elt_opcode (pstate, BINOP_LEQ); > + current_type =3D parse_type (pstate)->builtin_bool; > } > ; >=20 > exp : exp GEQ exp > - { write_exp_elt_opcode (BINOP_GEQ); > - current_type =3D parse_type->builtin_bool; > + { write_exp_elt_opcode (pstate, BINOP_GEQ); > + current_type =3D parse_type (pstate)->builtin_bool; > } > ; >=20 > exp : exp '<' exp > - { write_exp_elt_opcode (BINOP_LESS); > - current_type =3D parse_type->builtin_bool; > + { write_exp_elt_opcode (pstate, BINOP_LESS); > + current_type =3D parse_type (pstate)->builtin_bool; > } > ; >=20 > exp : exp '>' exp > - { write_exp_elt_opcode (BINOP_GTR); > - current_type =3D parse_type->builtin_bool; > + { write_exp_elt_opcode (pstate, BINOP_GTR); > + current_type =3D parse_type (pstate)->builtin_bool; > } > ; >=20 > exp : exp ANDAND exp > - { write_exp_elt_opcode (BINOP_BITWISE_AND); } > + { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); } > ; >=20 > exp : exp XOR exp > - { write_exp_elt_opcode (BINOP_BITWISE_XOR); } > + { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); } > ; >=20 > exp : exp OR exp > - { write_exp_elt_opcode (BINOP_BITWISE_IOR); } > + { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); } > ; >=20 > exp : exp ASSIGN exp > - { write_exp_elt_opcode (BINOP_ASSIGN); } > + { write_exp_elt_opcode (pstate, BINOP_ASSIGN); } > ; >=20 > exp : TRUEKEYWORD > - { write_exp_elt_opcode (OP_BOOL); > - write_exp_elt_longcst ((LONGEST) $1); > - current_type =3D parse_type->builtin_bool; > - write_exp_elt_opcode (OP_BOOL); } > + { write_exp_elt_opcode (pstate, OP_BOOL); > + write_exp_elt_longcst (pstate, (LONGEST) $1); > + current_type =3D parse_type (pstate)->builtin_bool; > + write_exp_elt_opcode (pstate, OP_BOOL); } > ; >=20 > exp : FALSEKEYWORD > - { write_exp_elt_opcode (OP_BOOL); > - write_exp_elt_longcst ((LONGEST) $1); > - current_type =3D parse_type->builtin_bool; > - write_exp_elt_opcode (OP_BOOL); } > + { write_exp_elt_opcode (pstate, OP_BOOL); > + write_exp_elt_longcst (pstate, (LONGEST) $1); > + current_type =3D parse_type (pstate)->builtin_bool; > + write_exp_elt_opcode (pstate, OP_BOOL); } > ; >=20 > exp : INT > - { write_exp_elt_opcode (OP_LONG); > - write_exp_elt_type ($1.type); > + { write_exp_elt_opcode (pstate, OP_LONG); > + write_exp_elt_type (pstate, $1.type); > current_type =3D $1.type; > - write_exp_elt_longcst ((LONGEST)($1.val)); > - write_exp_elt_opcode (OP_LONG); } > + write_exp_elt_longcst (pstate, (LONGEST)($1.val)); > + write_exp_elt_opcode (pstate, OP_LONG); } > ; >=20 > exp : NAME_OR_INT > { YYSTYPE val; > - parse_number ($1.stoken.ptr, > + parse_number (pstate, $1.stoken.ptr, > $1.stoken.length, 0, &val); > - write_exp_elt_opcode (OP_LONG); > - write_exp_elt_type (val.typed_val_int.type); > + write_exp_elt_opcode (pstate, OP_LONG); > + write_exp_elt_type (pstate, val.typed_val_int.type); > current_type =3D val.typed_val_int.type; > - write_exp_elt_longcst ((LONGEST) > + write_exp_elt_longcst (pstate, (LONGEST) > val.typed_val_int.val); > - write_exp_elt_opcode (OP_LONG); > + write_exp_elt_opcode (pstate, OP_LONG); > } > ; >=20 >=20 > exp : FLOAT > - { write_exp_elt_opcode (OP_DOUBLE); > - write_exp_elt_type ($1.type); > + { write_exp_elt_opcode (pstate, OP_DOUBLE); > + write_exp_elt_type (pstate, $1.type); > current_type =3D $1.type; > - write_exp_elt_dblcst ($1.dval); > - write_exp_elt_opcode (OP_DOUBLE); } > + write_exp_elt_dblcst (pstate, $1.dval); > + write_exp_elt_opcode (pstate, OP_DOUBLE); } > ; >=20 > exp : variable > @@ -566,7 +573,7 @@ exp : VARIABLE > struct value * val, * mark; >=20 > mark =3D value_mark (); > - val =3D value_of_internalvar (parse_gdbarch, > + val =3D value_of_internalvar (parse_gdbarch (pstate), > intvar); > current_type =3D value_type (val); > value_release_to_mark (mark); > @@ -575,15 +582,16 @@ exp : VARIABLE > ; >=20 > exp : SIZEOF '(' type ')' %prec UNARY > - { write_exp_elt_opcode (OP_LONG); > - write_exp_elt_type (parse_type->builtin_int); > + { write_exp_elt_opcode (pstate, OP_LONG); > + write_exp_elt_type (pstate, parse_type (pstate)- > >builtin_int); > CHECK_TYPEDEF ($3); > - write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3)); > - write_exp_elt_opcode (OP_LONG); } > + write_exp_elt_longcst (pstate, > + (LONGEST) TYPE_LENGTH ($3)); > + write_exp_elt_opcode (pstate, OP_LONG); } > ; >=20 > exp : SIZEOF '(' exp ')' %prec UNARY > - { write_exp_elt_opcode (UNOP_SIZEOF); } > + { write_exp_elt_opcode (pstate, UNOP_SIZEOF); } >=20 > exp : STRING > { /* C strings are converted into array constants with > @@ -594,19 +602,23 @@ exp : STRING > char *sp =3D $1.ptr; int count =3D $1.length; > while (count-- > 0) > { > - write_exp_elt_opcode (OP_LONG); > - write_exp_elt_type (parse_type->builtin_char); > - write_exp_elt_longcst ((LONGEST)(*sp++)); > - write_exp_elt_opcode (OP_LONG); > + write_exp_elt_opcode (pstate, OP_LONG); > + write_exp_elt_type (pstate, > + parse_type (pstate) > + ->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_type (parse_type->builtin_char); > - write_exp_elt_longcst ((LONGEST)'\0'); > - write_exp_elt_opcode (OP_LONG); > - write_exp_elt_opcode (OP_ARRAY); > - write_exp_elt_longcst ((LONGEST) 0); > - write_exp_elt_longcst ((LONGEST) ($1.length)); > - write_exp_elt_opcode (OP_ARRAY); } > + write_exp_elt_opcode (pstate, OP_LONG); > + write_exp_elt_type (pstate, > + parse_type (pstate) > + ->builtin_char); > + write_exp_elt_longcst (pstate, (LONGEST)'\0'); > + write_exp_elt_opcode (pstate, OP_LONG); > + write_exp_elt_opcode (pstate, OP_ARRAY); > + write_exp_elt_longcst (pstate, (LONGEST) 0); > + write_exp_elt_longcst (pstate, (LONGEST) ($1.length)); > + write_exp_elt_opcode (pstate, OP_ARRAY); } > ; >=20 > /* Object pascal */ > @@ -614,10 +626,10 @@ exp : THIS > { > struct value * this_val; > struct type * this_type; > - write_exp_elt_opcode (OP_THIS); > - write_exp_elt_opcode (OP_THIS); > + write_exp_elt_opcode (pstate, OP_THIS); > + write_exp_elt_opcode (pstate, OP_THIS); > /* We need type of this. */ > - this_val =3D value_of_this_silent (parse_language); > + this_val =3D value_of_this_silent (parse_language > (pstate)); > if (this_val) > this_type =3D value_type (this_val); > else > @@ -627,7 +639,7 @@ exp : THIS > if (TYPE_CODE (this_type) =3D=3D TYPE_CODE_PTR) > { > this_type =3D TYPE_TARGET_TYPE (this_type); > - write_exp_elt_opcode (UNOP_IND); > + write_exp_elt_opcode (pstate, UNOP_IND); > } > } >=20 > @@ -673,11 +685,11 @@ variable: block COLONCOLON name > error (_("No symbol \"%s\" in specified context."), > copy_name ($3)); >=20 > - write_exp_elt_opcode (OP_VAR_VALUE); > + write_exp_elt_opcode (pstate, OP_VAR_VALUE); > /* block_found is set by lookup_symbol. */ > - write_exp_elt_block (block_found); > - write_exp_elt_sym (sym); > - write_exp_elt_opcode (OP_VAR_VALUE); } > + write_exp_elt_block (pstate, block_found); > + write_exp_elt_sym (pstate, sym); > + write_exp_elt_opcode (pstate, OP_VAR_VALUE); } > ; >=20 > qualified_name: typebase COLONCOLON name > @@ -688,10 +700,10 @@ qualified_name: typebase COLONCOLON name > error (_("`%s' is not defined as an aggregate > type."), > TYPE_NAME (type)); >=20 > - write_exp_elt_opcode (OP_SCOPE); > - write_exp_elt_type (type); > - write_exp_string ($3); > - write_exp_elt_opcode (OP_SCOPE); > + write_exp_elt_opcode (pstate, OP_SCOPE); > + write_exp_elt_type (pstate, type); > + write_exp_string (pstate, $3); > + write_exp_elt_opcode (pstate, OP_SCOPE); > } > ; >=20 > @@ -707,16 +719,16 @@ variable: qualified_name > VAR_DOMAIN, (int *) NULL); > if (sym) > { > - write_exp_elt_opcode (OP_VAR_VALUE); > - write_exp_elt_block (NULL); > - write_exp_elt_sym (sym); > - write_exp_elt_opcode (OP_VAR_VALUE); > + write_exp_elt_opcode (pstate, OP_VAR_VALUE); > + write_exp_elt_block (pstate, NULL); > + write_exp_elt_sym (pstate, sym); > + write_exp_elt_opcode (pstate, OP_VAR_VALUE); > break; > } >=20 > msymbol =3D lookup_minimal_symbol (name, NULL, NULL); > if (msymbol !=3D NULL) > - write_exp_msymbol (msymbol); > + write_exp_msymbol (pstate, msymbol); > else if (!have_full_symbols () > && !have_partial_symbols ()) > error (_("No symbol table is loaded. " > @@ -740,13 +752,13 @@ variable: name_not_typename > innermost_block =3D block_found; > } >=20 > - write_exp_elt_opcode (OP_VAR_VALUE); > + write_exp_elt_opcode (pstate, OP_VAR_VALUE); > /* We want to use the selected frame, not > another more inner frame which happens to > be in the same block. */ > - write_exp_elt_block (NULL); > - write_exp_elt_sym (sym); > - write_exp_elt_opcode (OP_VAR_VALUE); > + write_exp_elt_block (pstate, NULL); > + write_exp_elt_sym (pstate, sym); > + write_exp_elt_opcode (pstate, OP_VAR_VALUE); > current_type =3D sym->type; } > else if ($1.is_a_field_of_this) > { > @@ -759,13 +771,13 @@ variable: name_not_typename > || contained_in (block_found, > innermost_block)) > innermost_block =3D block_found; > - write_exp_elt_opcode (OP_THIS); > - write_exp_elt_opcode (OP_THIS); > - write_exp_elt_opcode (STRUCTOP_PTR); > - write_exp_string ($1.stoken); > - write_exp_elt_opcode (STRUCTOP_PTR); > + write_exp_elt_opcode (pstate, OP_THIS); > + write_exp_elt_opcode (pstate, OP_THIS); > + write_exp_elt_opcode (pstate, STRUCTOP_PTR); > + write_exp_string (pstate, $1.stoken); > + write_exp_elt_opcode (pstate, STRUCTOP_PTR); > /* We need type of this. */ > - this_val =3D value_of_this_silent (parse_language); > + this_val =3D value_of_this_silent (parse_language > (pstate)); > if (this_val) > this_type =3D value_type (this_val); > else > @@ -785,7 +797,7 @@ variable: name_not_typename > msymbol =3D > lookup_minimal_symbol (arg, NULL, NULL); > if (msymbol !=3D NULL) > - write_exp_msymbol (msymbol); > + write_exp_msymbol (pstate, msymbol); > else if (!have_full_symbols () > && !have_partial_symbols ()) > error (_("No symbol table is loaded. " > @@ -854,7 +866,8 @@ name_not_typename : NAME > /*** Needs some error checking for the float case ***/ >=20 > static int > -parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere) > +parse_number (struct parser_state *par_state, char *p, int len, > + int parsed_float, YYSTYPE *putithere) > { > /* 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. */ > @@ -879,7 +892,7 @@ parse_number (char *p, int len, int parsed_float, > YYSTYPE *putithere) >=20 > 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.type)) > return ERROR; > @@ -985,9 +998,9 @@ parse_number (char *p, int len, int parsed_float, > YYSTYPE *putithere) >=20 > un =3D (ULONGEST)n >> 2; > if (long_p =3D=3D 0 > - && (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) =3D=3D 0) > + && (un >> (gdbarch_int_bit (parse_gdbarch (par_state)) - 2)) =3D= =3D 0) > { > - high_bit =3D ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1= ); > + high_bit =3D ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch > (par_state)) - 1); >=20 > /* A large decimal (not hex or octal) constant (between INT_MAX > and UINT_MAX) is a long or unsigned long, according to ANSI, > @@ -995,28 +1008,28 @@ parse_number (char *p, int len, int parsed_float, > YYSTYPE *putithere) > int. This probably should be fixed. GCC gives a warning on > such constants. */ >=20 > - unsigned_type =3D parse_type->builtin_unsigned_int; > - signed_type =3D parse_type->builtin_int; > + unsigned_type =3D parse_type (par_state)->builtin_unsigned_int; > + signed_type =3D parse_type (par_state)->builtin_int; > } > else if (long_p <=3D 1 > - && (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) =3D=3D 0) > + && (un >> (gdbarch_long_bit (parse_gdbarch (par_state)) - 2)) =3D=3D > 0) > { > - high_bit =3D ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - = 1); > - unsigned_type =3D parse_type->builtin_unsigned_long; > - signed_type =3D parse_type->builtin_long; > + high_bit =3D ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch > (par_state)) - 1); > + unsigned_type =3D parse_type (par_state)->builtin_unsigned_long; > + signed_type =3D parse_type (par_state)->builtin_long; > } > else > { > int shift; > 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. */ > shift =3D (sizeof (ULONGEST) * HOST_CHAR_BIT - 1); > else > - shift =3D (gdbarch_long_long_bit (parse_gdbarch) - 1); > + shift =3D (gdbarch_long_long_bit (parse_gdbarch (par_state)) - 1); > high_bit =3D (ULONGEST) 1 << shift; > - unsigned_type =3D parse_type->builtin_unsigned_long_long; > - signed_type =3D parse_type->builtin_long_long; > + unsigned_type =3D parse_type (par_state)->builtin_unsigned_long_lo= ng; > + signed_type =3D parse_type (par_state)->builtin_long_long; > } >=20 > putithere->typed_val_int.val =3D n; > @@ -1190,12 +1203,12 @@ yylex (void) > lexptr++; > c =3D *lexptr++; > if (c =3D=3D '\\') > - c =3D parse_escape (parse_gdbarch, &lexptr); > + c =3D parse_escape (parse_gdbarch (pstate), &lexptr); > else if (c =3D=3D '\'') > error (_("Empty character constant.")); >=20 > yylval.typed_val_int.val =3D c; > - yylval.typed_val_int.type =3D parse_type->builtin_char; > + yylval.typed_val_int.type =3D parse_type (pstate)->builtin_char; >=20 > c =3D *lexptr++; > if (c !=3D '\'') > @@ -1295,7 +1308,7 @@ yylex (void) > && (*p < 'A' || *p > 'Z'))) > break; > } > - toktype =3D parse_number (tokstart, > + toktype =3D parse_number (pstate, tokstart, > p - tokstart, got_dot | got_e, &yylval); > if (toktype =3D=3D ERROR) > { > @@ -1362,7 +1375,7 @@ yylex (void) > break; > case '\\': > tokptr++; > - c =3D parse_escape (parse_gdbarch, &tokptr); > + c =3D parse_escape (parse_gdbarch (pstate), &tokptr); > if (c =3D=3D -1) > { > continue; > @@ -1504,7 +1517,7 @@ yylex (void) > but this conflicts with the GDB use for debugger variables > so in expression to enter hexadecimal values > we still need to use C syntax with 0xff */ > - write_dollar_variable (yylval.sval); > + write_dollar_variable (pstate, yylval.sval); > c =3D tokstart[namelen]; > tokstart[namelen] =3D 0; > intvar =3D lookup_only_internalvar (++tokstart); > @@ -1702,8 +1715,8 @@ yylex (void) > return TYPENAME; > } > yylval.tsym.type > - =3D language_lookup_primitive_type_by_name (parse_language, > - parse_gdbarch, tmp); > + =3D language_lookup_primitive_type_by_name (parse_language (pstate= ), > + parse_gdbarch (pstate), tmp); > if (yylval.tsym.type !=3D NULL) > { > free (uptokstart); > @@ -1718,7 +1731,7 @@ yylex (void) > || (tokstart[0] >=3D 'A' && tokstart[0] < 'A' + input_radix - > 10))) > { > YYSTYPE newlval; /* Its value is ignored. */ > - hextype =3D parse_number (tokstart, namelen, 0, &newlval); > + hextype =3D parse_number (pstate, tokstart, namelen, 0, &newlval); > if (hextype =3D=3D INT) > { > yylval.ssym.sym =3D sym; > @@ -1736,6 +1749,16 @@ yylex (void) > } > } >=20 > +int > +pascal_parse (struct parser_state *par_state) > +{ > + /* Setting up the parser state. */ > + gdb_assert (par_state !=3D NULL); > + pstate =3D par_state; > + > + return _pascal_parse (); > +} > + > void > yyerror (char *msg) > { > diff --git a/gdb/p-lang.h b/gdb/p-lang.h > index b1e218c..a5168f8 100644 > --- a/gdb/p-lang.h > +++ b/gdb/p-lang.h > @@ -20,13 +20,14 @@ > /* This file is derived from c-lang.h */ >=20 > struct value; > +struct parser_state; >=20 > /* Defined in p-lang.c */ > extern const char *pascal_main_name (void); >=20 > -extern int pascal_parse (void); /* Defined in p-exp.y */ > +extern int pascal_parse (struct parser_state *); /* Defined in p-exp.y */ >=20 > -extern void pascal_error (char *); /* Defined in p-exp.y */ > +extern void pascal_error (char *); /* Defined in p-exp.y */ >=20 > /* Defined in p-typeprint.c */ > extern void pascal_print_type (struct type *, const char *, struct ui_file > *, > -- > 1.7.7.6