This is the mail archive of the gdb@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: [RFC] Register sets


   From: Jim Blandy <jimb@redhat.com>
   Date: 05 Sep 2003 19:01:34 -0500

   Daniel Jacobowitz <drow@mvista.com> writes:
   > struct regset
   > {
   >   void (*supply_regset)(struct regcache *, const void *, size_t, int);
   >   void (*read_regset)(struct regcache *, void *, size_t, int);
   > };

   If you want to allow people to define regset formats via the CLI, it
   seems to me you probably want some kind of closure argument in there,
   like this:

       struct regset
       {
	 /* Always pass this to the supply_regset and read_regset
	    functions below as their first argument.  */
	 void *closure;
	 void (*supply_regset)(void *closure,
			       struct regcache *, const void *, size_t, int);
	 void (*read_regset)(void *closure,
			     struct regcache *, void *, size_t, int);
       };

   This gives you the hook you need to have a single function for all
   CLI-defined regsets, interpreting the layout the user supplies to the
   CLI command.

Actually I need this closure argument for the corefile regset stuff
too.  For the i386 I have a single supply_regset function for all the
different "gregsets", and I define a table with offsets that defines
rhe proper mapping in `struct gdbarch_tdep'.  I could get at that
mapping since I was passing the architecture in, but that's just a
special case of the closure argument you propose.

Mark


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