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]

Re: [RFA] New register definition interface


Nick Duffek wrote:
> 
> On 16-Jan-2001, Andrew Cagney wrote:
> 
> >4.     Add a function like:
> >
> >               set_gdbarch_data (struct gdbarch *gdbarch,
> >                       struct gdbarch_data *handle,
> >                       void *value);
> [...]
> >       gdbarch calls ..._gdbarch_init()
> >       -> calls your_module's_init_or_setup_or_something()
> >       -> calls set_gdbarch_data (gdbarch, your_modules_handle,
> >your_modules_data);
> >       -> calls set_various_other_methods (...);
> 
> That looks good to me.  It's very similar to what regs.c does, except that
> it calls set_gdbarch_register_list() instead of set_gdbarch_data().

The difference is that the data is kept private to the regs.c file
(those interfaces again).  It isn't possible for external code to go
grubbing around in internals when you're not looking.

> Since we're talking hacks, I think I might as well use REGISTER_LIST
> rather than adding a new REGISTER_MODULE_INSTALLED_P method.

The nice thing about REGISTER_MODULE_INSTALLED_P() is that it is so
informative that the caller can conclude nothing about the actual
module.  This is a good thing :-)

	Andrew

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