Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Missing breakpoint-modify events
@ 2002-06-13 21:59 Keith Seitz
  2002-06-13 22:49 ` Michael Snyder
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Seitz @ 2002-06-13 21:59 UTC (permalink / raw)
  To: gdb-patches

Hi,

When conditions, commands, and ignore counts are added to an existing
breakpoint, gdb fails to send an event notification informing UIs of that
the breakpoint has been modified. This patch fixes this.

I've only added event notifications. Are the hooks still needed? (I'm
operating under the assumption that they are all deprecated and can be
whacked...)

I've also inserted a little clean up into ignore_command which will only
print the newline when from_tty is set. This cleans up the MI output when
-break-after is used.

Keith

ChangeLog
2002-06-13  Keith Seitz  <keiths@redhat.com>

        * breakpoint.c (condition_command): Post breakpoint_modify
        when a condition is added to an existing breakpoint.
        (commands_command): Likewise for commands.
        (set_ignore_count): Likewise for ignore counts.
        If no tty, do not simply return, still need to send event
        notification.
        (ignore_command): Only print a newline if the command came
        from a tty.
	Don't call breakpoints_changed, since this is now properly
	handled by set_ignore_count.

Patch
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.76
diff -p -r1.76 breakpoint.c
*** breakpoint.c	10 Jun 2002 23:25:50 -0000	1.76
--- breakpoint.c	14 Jun 2002 04:49:37 -0000
*************** condition_command (char *arg, int from_t
*** 553,558 ****
--- 553,559 ----
  	    error ("Junk at end of expression");
  	}
        breakpoints_changed ();
+       breakpoint_modify_event (b->number);
        return;
      }

*************** commands_command (char *arg, int from_tt
*** 592,597 ****
--- 593,599 ----
        free_command_lines (&b->commands);
        b->commands = l;
        breakpoints_changed ();
+       breakpoint_modify_event (b->number);
        return;
      }
    error ("No breakpoint number %d.", bnum);
*************** set_ignore_count (int bptnum, int count,
*** 7071,7088 ****
      if (b->number == bptnum)
      {
        b->ignore_count = count;
!       if (!from_tty)
! 	return;
!       else if (count == 0)
! 	printf_filtered ("Will stop next time breakpoint %d is reached.",
! 			 bptnum);
!       else if (count == 1)
! 	printf_filtered ("Will ignore next crossing of breakpoint %d.",
! 			 bptnum);
!       else
! 	printf_filtered ("Will ignore next %d crossings of breakpoint %d.",
! 			 count, bptnum);
        breakpoints_changed ();
        return;
      }

--- 7073,7092 ----
      if (b->number == bptnum)
      {
        b->ignore_count = count;
!       if (from_tty)
! 	{
! 	  if (count == 0)
! 	    printf_filtered ("Will stop next time breakpoint %d is reached.",
! 			     bptnum);
! 	  else if (count == 1)
! 	    printf_filtered ("Will ignore next crossing of breakpoint %d.",
! 			     bptnum);
! 	  else
! 	    printf_filtered ("Will ignore next %d crossings of breakpoint %d.",
! 			     count, bptnum);
! 	}
        breakpoints_changed ();
+       breakpoint_modify_event (b->number);
        return;
      }

*************** ignore_command (char *args, int from_tty
*** 7119,7126 ****
    set_ignore_count (num,
  		    longest_to_int (value_as_long (parse_and_eval (p))),
  		    from_tty);
!   printf_filtered ("\n");
!   breakpoints_changed ();
  }

  /* Call FUNCTION on each of the breakpoints
--- 7123,7130 ----
    set_ignore_count (num,
  		    longest_to_int (value_as_long (parse_and_eval (p))),
  		    from_tty);
!   if (from_tty)
!     printf_filtered ("\n");
  }

  /* Call FUNCTION on each of the breakpoints


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Missing breakpoint-modify events
  2002-06-13 21:59 [RFA] Missing breakpoint-modify events Keith Seitz
@ 2002-06-13 22:49 ` Michael Snyder
  2002-06-18 10:47   ` Keith Seitz
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2002-06-13 22:49 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches

Keith Seitz wrote:
> 
> Hi,
> 
> When conditions, commands, and ignore counts are added to an existing
> breakpoint, gdb fails to send an event notification informing UIs of that
> the breakpoint has been modified. This patch fixes this.

Approved.  Would that all patches were so easy to review.   ;-)

> I've only added event notifications. Are the hooks still needed? (I'm
> operating under the assumption that they are all deprecated and can be
> whacked...)

You would know better than I, I think.

> I've also inserted a little clean up into ignore_command which will only
> print the newline when from_tty is set. This cleans up the MI output when
> -break-after is used.

Hmmm... have you checked whether this affects output from scripts?
I'm thinking --
    %> gdb -x myscript >& mylog


> 
> ChangeLog
> 2002-06-13  Keith Seitz  <keiths@redhat.com>
> 
>         * breakpoint.c (condition_command): Post breakpoint_modify
>         when a condition is added to an existing breakpoint.
>         (commands_command): Likewise for commands.
>         (set_ignore_count): Likewise for ignore counts.
>         If no tty, do not simply return, still need to send event
>         notification.
>         (ignore_command): Only print a newline if the command came
>         from a tty.
>         Don't call breakpoints_changed, since this is now properly
>         handled by set_ignore_count.
> 
> Patch
> Index: breakpoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/breakpoint.c,v
> retrieving revision 1.76
> diff -p -r1.76 breakpoint.c
> *** breakpoint.c        10 Jun 2002 23:25:50 -0000      1.76
> --- breakpoint.c        14 Jun 2002 04:49:37 -0000
> *************** condition_command (char *arg, int from_t
> *** 553,558 ****
> --- 553,559 ----
>             error ("Junk at end of expression");
>         }
>         breakpoints_changed ();
> +       breakpoint_modify_event (b->number);
>         return;
>       }
> 
> *************** commands_command (char *arg, int from_tt
> *** 592,597 ****
> --- 593,599 ----
>         free_command_lines (&b->commands);
>         b->commands = l;
>         breakpoints_changed ();
> +       breakpoint_modify_event (b->number);
>         return;
>       }
>     error ("No breakpoint number %d.", bnum);
> *************** set_ignore_count (int bptnum, int count,
> *** 7071,7088 ****
>       if (b->number == bptnum)
>       {
>         b->ignore_count = count;
> !       if (!from_tty)
> !       return;
> !       else if (count == 0)
> !       printf_filtered ("Will stop next time breakpoint %d is reached.",
> !                        bptnum);
> !       else if (count == 1)
> !       printf_filtered ("Will ignore next crossing of breakpoint %d.",
> !                        bptnum);
> !       else
> !       printf_filtered ("Will ignore next %d crossings of breakpoint %d.",
> !                        count, bptnum);
>         breakpoints_changed ();
>         return;
>       }
> 
> --- 7073,7092 ----
>       if (b->number == bptnum)
>       {
>         b->ignore_count = count;
> !       if (from_tty)
> !       {
> !         if (count == 0)
> !           printf_filtered ("Will stop next time breakpoint %d is reached.",
> !                            bptnum);
> !         else if (count == 1)
> !           printf_filtered ("Will ignore next crossing of breakpoint %d.",
> !                            bptnum);
> !         else
> !           printf_filtered ("Will ignore next %d crossings of breakpoint %d.",
> !                            count, bptnum);
> !       }
>         breakpoints_changed ();
> +       breakpoint_modify_event (b->number);
>         return;
>       }
> 
> *************** ignore_command (char *args, int from_tty
> *** 7119,7126 ****
>     set_ignore_count (num,
>                     longest_to_int (value_as_long (parse_and_eval (p))),
>                     from_tty);
> !   printf_filtered ("\n");
> !   breakpoints_changed ();
>   }
> 
>   /* Call FUNCTION on each of the breakpoints
> --- 7123,7130 ----
>     set_ignore_count (num,
>                     longest_to_int (value_as_long (parse_and_eval (p))),
>                     from_tty);
> !   if (from_tty)
> !     printf_filtered ("\n");
>   }
> 
>   /* Call FUNCTION on each of the breakpoints


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Missing breakpoint-modify events
  2002-06-13 22:49 ` Michael Snyder
@ 2002-06-18 10:47   ` Keith Seitz
  2002-06-18 14:40     ` Michael Snyder
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Seitz @ 2002-06-18 10:47 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

On Thu, 13 Jun 2002, Michael Snyder wrote:

> > I've also inserted a little clean up into ignore_command which will only
> > print the newline when from_tty is set. This cleans up the MI output when
> > -break-after is used.
>
> Hmmm... have you checked whether this affects output from scripts?
> I'm thinking --
>     %> gdb -x myscript >& mylog

Yes, it will make a small difference, I believe. Before this patch,
set_ignore_count will not print anything, but ignore_command will print a
newline.

After this patch, neither ignore_command nor set_ignore_count will print
anything. (Which is seems to be the correct behavior.)

I've run this through the testsuite (linux native), and there are no
regressions.

I'll wait to hear from you again if this is okay before committing.

Keith



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Missing breakpoint-modify events
  2002-06-18 10:47   ` Keith Seitz
@ 2002-06-18 14:40     ` Michael Snyder
  2002-06-18 14:59       ` Keith Seitz
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2002-06-18 14:40 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches

Keith Seitz wrote:
> 
> On Thu, 13 Jun 2002, Michael Snyder wrote:
> 
> > > I've also inserted a little clean up into ignore_command which will only
> > > print the newline when from_tty is set. This cleans up the MI output when
> > > -break-after is used.
> >
> > Hmmm... have you checked whether this affects output from scripts?
> > I'm thinking --
> >     %> gdb -x myscript >& mylog
> 
> Yes, it will make a small difference, I believe. Before this patch,
> set_ignore_count will not print anything, but ignore_command will print a
> newline.
> 
> After this patch, neither ignore_command nor set_ignore_count will print
> anything. (Which is seems to be the correct behavior.)
> 
> I've run this through the testsuite (linux native), and there are no
> regressions.
> 
> I'll wait to hear from you again if this is okay before committing.

Sounds like you've covered your bases.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Missing breakpoint-modify events
  2002-06-18 14:40     ` Michael Snyder
@ 2002-06-18 14:59       ` Keith Seitz
  0 siblings, 0 replies; 5+ messages in thread
From: Keith Seitz @ 2002-06-18 14:59 UTC (permalink / raw)
  To: gdb-patches

On Tue, 18 Jun 2002, Michael Snyder wrote:

> Sounds like you've covered your bases.

I've committed the change.

Thanks for reviewing it.
Keith



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-06-18 21:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-13 21:59 [RFA] Missing breakpoint-modify events Keith Seitz
2002-06-13 22:49 ` Michael Snyder
2002-06-18 10:47   ` Keith Seitz
2002-06-18 14:40     ` Michael Snyder
2002-06-18 14:59       ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox