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: Re-initializing a list after the control returns to gdb...


[Sorry for answering late, got preempted...]


In hindsite, it needs to be converted to an observer model (or a new observer model introduced and the current gdb-hooks changed to one of the many observers).


One model that works extremely well is the signals system implemented in
glib. I find it very nicely done. It would be nice if we could reuse
this, but this is a very very complex machinery doing probably way too
much for what we need in GDB.

Yes. GDB just needs a single consistent event mechanism.


I would instead suggest something much more simple, like this:

   enum notice_kinds
   {
     breakpoint_created_notice,
     breakpoint_deleted_notice,
     ...
     invalid_last_notice,   /* Should always be last.  */
   };

gdb-events.sh used individual wrapper functions rather than trusting an enum, a void *, and dodgy casts. This was to ensure that the external iterfaces were all strongly typed (calls checked with -Werror) and all nasty casts were burried in the .c file.


It did that right.

It, however, made several mistakes:

- it tried to group all the events together (you've proposed individual registration which is much more incremental)

- it didn't implement broadcast (as proposed here)

- `event' in GDB has multiple meanings so the name is confusing.

So, can you get a prototype observer working for just your ada event (but keep in mind that other events will be boiler-plated)?

As for the names, just use the terminology found in the patterns book - observer.[hc]. observer_update_xxx (or notify_xxx), observer_attach_xxx, observer_detach_xxx I think. If GDB needs more than one observer, there's a problem.

(oh, unless you've an immediate need for that data/context parameter, i'd leave it out - such a mechanis can be left to the person that actually needs)

(shh, doco - but I have a cunning plan - see my recent post about revamping gdbarch.sh into doc/gdbarch.texi).

Andrew



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