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: RFA: use constructor to build 'struct regset' objects


   From: Jim Blandy <jimb@redhat.com>
   Date: 17 May 2004 16:28:29 -0500

   Jim Blandy <jimb@redhat.com> writes:
   > 2004-05-17  Jim Blandy  <jimb@redhat.com>
   > 
   > 	Use a constructor function to create regset structures.
   > 	* regset.h (supply_regset_ftype): New typedef.
   > 	(struct regset): Use supply_regset_ftype.
   > 	(readonly_regset_xmalloc): New declaration.
   > 	* regset.c: New file.
   > 	* am64-tdep.c (amd64_regset_from_core_section): Use
   > 	readonly_regset_xmalloc to construct regset structures.
   > 	* amd64obsd-tdep.c (amd64obsd_regset_from_core_section): Same.
   > 	* i386-tdep.c (i386_regset_from_core_section): Same.
   > 	* i386nbsd-tdep.c (i386nbsd_aout_regset_from_core_section): Same.
   > 	* i386obsd-tdep.c (i386obsd_aout_regset_from_core_section): Same.
   > 	* sparc64fbsd-tdep.c (sparc64fbsd_init_abi): Same.
   > 	* sparc64nbsd-tdep.c (sparc64nbsd_init_abi): Same.
   > 	* sparc64obsd-tdep.c (sparc64obsd_init_abi): Same.
   > 	* sparcnbsd-tdep.c (sparc32nbsd_init_abi): Same.
   > 	* Makefile.in (COMMON_OBS): Add regset.o.
   > 	(regset.o): New rule.

   So, that's the story.  What do people think?

Ah, you guessed my grand plan (that I never fully implemented).  It
would also be used for the gcore support.  So, yes, by all means go
for it!

   Is 'readonly_regset_xmalloc' a good name, or would something like
   'supplyonly_regset_malloc' be better?  I mean, both 'supply' and
   'fill' functions read one thing and write another; if you don't
   already know the plot, it's not clear which direction a 'readonly'
   regset would go.

I was wondering what readonly_ was supposed to mean in your first
patch.  Why not avoid inventing a wierd name at all.  Just call the
function `regset_xmalloc', and add a third argument right from the
start.  Just pass NULL as the third argument for now.

Mark


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