Re: [RFA] breakpoint.c: don't generate bp events for internal bps

Fernando Nasser
2001-05-11T08:54:00Z

Keith Seitz wrote:
>
> On Fri, 11 May 2001, Fernando Nasser wrote:
>
> > It is OK to only generate events for visible breakpoints, but the hook
> > must run for all breakpoints. Whatever is using the hook may need to
> > know about the internal ones as well.
>
> Despite the fact that NOTHING uses the hook, here is a revised patch:
>

Keith, you have attached the same old patch!

I am not against removing the hook. I would not be so certain that
NOTHING is using it as there are too many obscure academic projects
going on using Free Software. That is how Free Software started (and
how I started hacking GDB) and I would not like to discard them. But,
whoever is doing anything with GDB should be monitoring this list. So,
if you post to gdb@sources saying that you will get rid of these hooks
and nobody answers in a reasonable time, "off with their heads"!

> Index: breakpoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/breakpoint.c,v
> retrieving revision 1.35
> diff -u -p -r1.35 breakpoint.c
> --- breakpoint.c 2001/05/06 22:22:02 1.35
> +++ breakpoint.c 2001/05/11 03:23:55
> @@ -318,6 +318,15 @@ int exception_support_initialized = 0;
> error ("catch of library unloads not yet implemented on this platform")
> #endif
>
> +/* Is this breakpoint interesting to a user interface? */
> +#define REPORT_BREAKPOINT_EVENT(bp) \
> +((bp)->type == bp_breakpoint \
> + || (bp)->type == bp_hardware_breakpoint \
> + || (bp)->type == bp_watchpoint \
> + || (bp)->type == bp_hardware_watchpoint \
> + || (bp)->type == bp_read_watchpoint \
> + || (bp)->type == bp_access_watchpoint)
> +
> /* Set breakpoint count to NUM. */
>
> void
> @@ -4373,9 +4382,12 @@ mention (struct breakpoint *b)
> clean this up and at the same time replace the random calls to
> breakpoint_changed with this hook, as has already been done for
> delete_breakpoint_hook and so on. */
> - if (create_breakpoint_hook)
> - create_breakpoint_hook (b);
> - breakpoint_create_event (b->number);
> + if (REPORT_BREAKPOINT_EVENT (b))
> + {
> + if (create_breakpoint_hook)
> + create_breakpoint_hook (b);
> + breakpoint_create_event (b->number);
> + }
>
> switch (b->type)
> {
> @@ -6733,9 +6745,12 @@ delete_breakpoint (struct breakpoint *bp
> if (bpt->type == bp_none)
> return;
>
> - if (delete_breakpoint_hook)
> - delete_breakpoint_hook (bpt);
> - breakpoint_delete_event (bpt->number);
> + if (REPORT_BREAKPOINT_EVENT (bpt))
> + {
> + if (delete_breakpoint_hook)
> + delete_breakpoint_hook (bpt);
> + breakpoint_delete_event (bpt->number);
> + }
>
> if (bpt->inserted)
> remove_breakpoint (bpt, mark_uninserted);
> @@ -7302,9 +7317,12 @@ disable_breakpoint (struct breakpoint *b
>
> check_duplicates (bpt);
>
> - if (modify_breakpoint_hook)
> - modify_breakpoint_hook (bpt);
> - breakpoint_modify_event (bpt->number);
> + if (REPORT_BREAKPOINT_EVENT (bpt))
> + {
> + if (modify_breakpoint_hook)
> + modify_breakpoint_hook (bpt);
> + breakpoint_modify_event (bpt->number);
> + }
> }
>
> /* ARGSUSED */
> @@ -7430,10 +7448,14 @@ have been allocated for other watchpoint
> if (save_selected_frame_level >= 0)
> select_frame (save_selected_frame, save_selected_frame_level);
> value_free_to_mark (mark);
> + }
> +
> + if (REPORT_BREAKPOINT_EVENT (bpt))
> + {
> + if (modify_breakpoint_hook)
> + modify_breakpoint_hook (bpt);
> + breakpoint_modify_event (bpt->number);
> }
> - if (modify_breakpoint_hook)
> - modify_breakpoint_hook (bpt);
> - breakpoint_modify_event (bpt->number);
> }
>
> void

--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9