Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@gnat.com>
To: Paul Koning <pkoning@equallogic.com>
Cc: jimb@redhat.com, gdb-patches@sources.redhat.com
Subject: Re: [RFA] parse and eval breakpoint conditions with correct language
Date: Thu, 11 Sep 2003 19:30:00 -0000	[thread overview]
Message-ID: <20030911192958.GE945@gnat.com> (raw)
In-Reply-To: <16224.49692.542476.869174@gargle.gargle.HOWL>

> Could the same sort of trouble occur when evaluating watchpoint
> expressions?  The parsing should be done according to the language in
> effect when the watchpoint is defined (either explicit, or from the
> current block language given this patch) -- not the one that happens
> to be in effect when gdb is checking for watch hits during execution. 

That would be an issue that's a bit outside of the context of this
patch, but I had a quick look. And we don't seem to consider the
language when resetting watchpoints:

breakpoint_re_set_one(): 

    case bp_watchpoint:
    case bp_hardware_watchpoint:
    case bp_read_watchpoint:
    case bp_access_watchpoint:
      innermost_block = NULL;
      /* The issue arises of what context to evaluate this in.  The
         same one as when it was set, but what does that mean when
         symbols have been re-read?  We could save the filename and
         functionname, but if the context is more local than that, the
         best we could do would be something like how many levels deep
         and which index at that particular level, but that's going to
         be less stable than filenames or function names.  */

      /* So for now, just use a global context.  */
      if (b->exp)
        xfree (b->exp);
      b->exp = parse_expression (b->exp_string);

I made a small experiment with an Ada program, and it did not go
too well :-(. I had to use GDB 5.3 as I don't have under my immediate
reach an Ada-aware version of GDB based on the current head sources.
But I think the same problem applies there too.

        % gdb foo
        (gdb) watch light
        Hardware watchpoint 1: pck.light
        (gdb) set lang c
        (gdb) run
        Starting program: /[...]/foo 
        Error in re-setting breakpoint 1:
        No symbol "light" in current context.
        zsh: 24784 segmentation fault (core dumped)  gdb foo

The following patch seems to be fixing it, but I would need more
time to really think about it more thouroughly. 

--- breakpoint.c        5 Sep 2003 21:51:24 -0000       1.4
+++ breakpoint.c        11 Sep 2003 19:23:08 -0000
@@ -7089,6 +7089,7 @@ breakpoint_re_set_one (PTR bint)
       /* So for now, just use a global context.  */
       if (b->exp)
        xfree (b->exp);
+      set_language (b->language);
       b->exp = parse_expression (b->exp_string);
       b->exp_valid_block = innermost_block;
       mark = value_mark ();

-- 
Joel


  reply	other threads:[~2003-09-11 19:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-10  1:54 Joel Brobecker
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 [this message]
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=20030911192958.GE945@gnat.com \
    --to=brobecker@gnat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@redhat.com \
    --cc=pkoning@equallogic.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