This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] parse and eval breakpoint conditions with correct language


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]