Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@gnat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] parse and eval breakpoint conditions with correct language
Date: Wed, 10 Sep 2003 01:54:00 -0000	[thread overview]
Message-ID: <20030910015400.GS423@gnat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 582 bytes --]

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  <brobecker@gnat.com>

        * 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

[-- Attachment #2: parse.c.diff --]
[-- Type: text/plain, Size: 1670 bytes --]

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);
 

             reply	other threads:[~2003-09-10  1:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-10  1:54 Joel Brobecker [this message]
2003-09-10 17:31 ` Jim Blandy
2003-09-11 18:09   ` Joel Brobecker
2003-09-11 18:42     ` Paul Koning
2003-09-11 19:30       ` Joel Brobecker
2003-09-12  1:33         ` Andrew Cagney
2003-09-12  5:46           ` Joel Brobecker
2003-09-15  3:09             ` Jim Blandy
2003-09-15 19:00               ` Joel Brobecker
2003-09-11 19:20     ` Andrew Cagney
2003-09-11 19:32       ` Joel Brobecker
2003-09-11 19:54       ` Daniel Jacobowitz
2003-09-11 22:20     ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030910015400.GS423@gnat.com \
    --to=brobecker@gnat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox