From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30911 invoked by alias); 10 Sep 2003 01:54:05 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30487 invoked from network); 10 Sep 2003 01:54:01 -0000 Received: from unknown (HELO takamaka.act-europe.fr) (209.53.17.87) by sources.redhat.com with SMTP; 10 Sep 2003 01:54:01 -0000 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 700BBD2DAF; Tue, 9 Sep 2003 18:54:00 -0700 (PDT) Date: Wed, 10 Sep 2003 01:54:00 -0000 From: Joel Brobecker To: gdb-patches@sources.redhat.com Subject: [RFA] parse and eval breakpoint conditions with correct language Message-ID: <20030910015400.GS423@gnat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="WChQLJJJfbwij+9x" Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2003-09/txt/msg00195.txt.bz2 --WChQLJJJfbwij+9x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 582 This RFA is a followup on the thread started on gdb@: http://sources.redhat.com/ml/gdb/2003-09/msg00082.html I incorporated Jim's comments (set expout->language_defn, handle NULL expression_context_block). There was also another gotcha that the testsuite detected which is to handle the cases when the context block language is not null, but the unknown language. 2003-09-09 J. Brobecker * parse.c (parse_exp_1): Use the language associated to the context block when parsing an expression. Tested on x86-linux. Ok to apply? -- Joel --WChQLJJJfbwij+9x Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="parse.c.diff" Content-length: 1670 Index: parse.c =================================================================== RCS file: /cvs/src/src/gdb/parse.c,v retrieving revision 1.36 diff -u -p -r1.36 parse.c --- parse.c 9 Sep 2003 08:05:42 -0000 1.36 +++ parse.c 10 Sep 2003 01:51:40 -0000 @@ -1107,6 +1107,7 @@ struct expression * parse_exp_1 (char **stringptr, struct block *block, int comma) { struct cleanup *old_chain; + const struct language_defn *lang = NULL; lexptr = *stringptr; prev_lexptr = NULL; @@ -1130,16 +1131,29 @@ parse_exp_1 (char **stringptr, struct bl else expression_context_block = get_selected_block (&expression_context_pc); + if (language_mode == language_mode_auto && expression_context_block != NULL) + { + /* Find the language associated to the context block. + Default to the current language if it can not be determined. */ + const struct symbol *func = block_function (expression_context_block); + if (func != NULL) + lang = language_def (SYMBOL_LANGUAGE (func)); + if (lang == NULL || lang->la_language == language_unknown) + lang = current_language; + } + else + lang = current_language; + namecopy = (char *) alloca (strlen (lexptr) + 1); expout_size = 10; expout_ptr = 0; expout = (struct expression *) xmalloc (sizeof (struct expression) + EXP_ELEM_TO_BYTES (expout_size)); - expout->language_defn = current_language; + expout->language_defn = lang; make_cleanup (free_current_contents, &expout); - if (current_language->la_parser ()) - current_language->la_error (NULL); + if (lang->la_parser ()) + lang->la_error (NULL); discard_cleanups (old_chain); --WChQLJJJfbwij+9x--