This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH:MI] Use observers for breakpoints
> > Following Aleksandar Ristovski's patch for catchpoints in GDB/MI,
> > here's a patch to demonstrate the use of observers for breakpoints.
> > This relates to earlier patches I've submitted which uses event
> > notification to communicate a change in state rather than using
> > command output directly. Among other things this allows the use of
> > CLI commands with MI.
> I missed the earlier patch, but I think that the idea is sound.
Here's one reference:
Like Daniel says, the frame-changed notification would probably fire too often,
but the thread-changed one still seems a good idea and I have submitted a patch
to do this with annotations too:
> I suggest you change the observer profile to take a breakpoint
> rather than a breakpoint number, to avoid having going from
> the breakpoint number back to the breakpoint itself should an
> observer need it.
My observer just uses a function called breakpoint_query (based on
gdb_breakpoint_query) which only needs the breakpoint number. I
think this is an internal detail which could easily be changed should
the need arise.
> I'm wondering if it might be useful to create two specific events
> for breakpoint created and deleted. Particularly for the "deleted"
> event, where you end up outputing the entire description of a breakpoint
> that is obsolete.
Sure, it's just a sketch. There are three types of event:
I don't know if there's much to be gained in differentiating between
creating and modifying a breakpoint but it would certainly make sense
to have two observers, breakpoints_changed and breakpoints_deleted, say.
If this patch goes in we could start dismantling the events mechanism. They're
only used in a few other places, e.g, tracepoints, and presumably observers
could be used there too.
> Just as an aside, I don't know how others would feel about that,
> but I wouldn't mind seeing annotate.c:breakpoints_changed being
> renamed to annotate_breakpoints_changed.
This function was moved from breakpoint.c. A couple of years ago I submitted
a patch to remove this and some other annotations, just keeping the level
three annotations. If we are going to keep it, I suggest calling it
annotate_breakpoints_invalid after the name of the associated annotation
and to be consistent with annotate_frames_invalid.