From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10243 invoked by alias); 11 Jan 2008 00:52:59 -0000 Received: (qmail 10153 invoked by uid 22791); 11 Jan 2008 00:52:57 -0000 X-Spam-Check-By: sourceware.org Received: from wa-out-1112.google.com (HELO wa-out-1112.google.com) (209.85.146.176) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 11 Jan 2008 00:52:40 +0000 Received: by wa-out-1112.google.com with SMTP id l35so1413043waf.12 for ; Thu, 10 Jan 2008 16:52:38 -0800 (PST) Received: by 10.114.73.1 with SMTP id v1mr3013757waa.16.1200012758207; Thu, 10 Jan 2008 16:52:38 -0800 (PST) Received: by 10.114.92.3 with HTTP; Thu, 10 Jan 2008 16:52:38 -0800 (PST) Message-ID: Date: Fri, 11 Jan 2008 00:52:00 -0000 From: "Rob Quill" To: "Jim Blandy" , msnyder@specifix.com Subject: Re: New scope checking patch Cc: gdb-patches@sourceware.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-IsSubscribed: yes 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: 2008-01/txt/msg00257.txt.bz2 Hi, Please find attached the revised and much simpler patch. One of the drawbacks of the new patch is that you cannot check the scope of structure members, which is quite inconvenient, but I can't really fix that without resorting to the old style of patch. I think that for the moment this patch is sufficient and definitely provides and improvement, but I think in future it would be good to be able to check arbitrary expressions, but as you say in your previous email, this requires some significant reworking of the patch. It also depends on how much people will find it useful. Michael, how do you feel about this? (As you seemed interested in the previous attempt) If there is enough interest then I am more than happy to spend some time reworking the old patch at a later date. Rob 2008-01-11 Rob Quill * c-exp.y : Add $in_scope as a type of expression. Index: gdb/c-exp.y =================================================================== RCS file: /cvs/src/src/gdb/c-exp.y,v retrieving revision 1.42 diff -r1.42 c-exp.y 210a211,212 > /* $in_scope opperator */ > %left IN_SCOPE 253a256,296 > exp : IN_SCOPE '(' name_not_typename ')' > { > YYSTYPE val; > struct symbol *sym = $3.sym; > > if (sym) > { > parse_number ("1", 1, 0, &val); > write_exp_elt_opcode (OP_LONG); > write_exp_elt_type (val.typed_val_int.type); > write_exp_elt_longcst ((LONGEST)val.typed_val_int.val); > write_exp_elt_opcode (OP_LONG); > } > else > { > struct minimal_symbol *msymbol; > char *arg = copy_name ($3.stoken); > > msymbol = lookup_minimal_symbol (arg, NULL, NULL); > if (msymbol != NULL) > { > parse_number ("1", 1, 0, &val); > write_exp_elt_opcode (OP_LONG); > write_exp_elt_type (val.typed_val_int.type); > write_exp_elt_longcst ((LONGEST)val.typed_val_int.val); > write_exp_elt_opcode (OP_LONG); > } > else if (!have_full_symbols () && !have_partial_symbols ()) > error ("No symbol table is loaded. Use the \"file\" command."); > else > { > parse_number ("0", 1, 0, &val); > write_exp_elt_opcode (OP_LONG); > write_exp_elt_type (val.typed_val_int.type); > write_exp_elt_longcst ((LONGEST)val.typed_val_int.val); > write_exp_elt_opcode (OP_LONG); > } > } > } > ; > 1313a1357,1361 > static const struct token tokentab9[] = > { > {"$in_scope", IN_SCOPE, BINOP_END} > }; > 1375a1424,1432 > /* Code for recognising the $in_scope token. */ > /* See if it is a special token of length 9. */ > for (i = 0; i < sizeof tokentab9 / sizeof tokentab9[0]; i++) > if (strncmp (tokstart, tokentab9[i].operator, 9) == 0) > { > lexptr += 9; > yylval.opcode = tokentab9[i].opcode; > return tokentab9[i].token; > }