This is the mail archive of the gdb-patches@sourceware.org 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: [PATCH] Removal of uses of MAX_REGISTER_SIZE


On 17-02-03 11:25:43, Alan Hayward wrote:
> If someone can ok the common patch, then I’ll make a second patch with the
> replacement of all remaining uses of MAX_REGISTER_SIZE in common code.

I'd like to do it in an iterative way, start from some simple places, like
arm, aarch64, and i386, in which you don't need to define new macros.  Then,
move to some *-tdep.c and *-nat.c, define ${ARCH}_MAX_REGISTER_SIZE when
necessary.  Finally, figure out how to remove MAX_REGISTER_SIZE from
arch-independent code.

> Ensuring it’s not used in common code will allow me to continue moving with the
> aarch64 SVE code.
> 
> 
> There are quite a lot of arch specific functions where we have a register number
> from which the register size could be extracted.  Eg:
> 
> void
> SOMEARCH_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
> 			    int regnum, const gdb_byte *buf)
> {
>   gdb_byte raw_buf[MAX_REGISTER_SIZE];
> 
> 
> This could become:
> 
> void
> SOMEARCH_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
> 			    int regnum, const gdb_byte *buf)
> {
>   gdb_byte buf[SOMEARCH_MAX_REGISTER_SIZE];
> 
> 
> Or:
> 
> void
> SOMEARCH_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
> 			    int regnum, const gdb_byte *buf)
> {
>   std::vector<gdb_byte> buf (register_size (gdbarch, regnum));
> 
> 
> I suspect people will want the first approach? It will result in quite a few new
> defines - ALPHA_MAX_REGISTER_SIZE, PPC_MAX_REGISTER_SIZE etc etc.
> 

That is fine, we've already had I386_MAX_REGISTER_SIZE and M68K_MAX_REGISTER_SIZE.
However, I think that we only have to add these macros when necessary.


-- 
Yao (齐尧)


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