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 3/11] Add MIPS_MAX_REGISTER_SIZE (2/4)


On 05/25/2017 12:43 PM, Yao Qi wrote:
>>> >>  static void
>>> >>  supply_32bit_reg (struct regcache *regcache, int regnum, const void *addr)
>>> >>  {
>>> >> -  struct gdbarch *gdbarch = get_regcache_arch (regcache);
>>> >> -  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
>>> >> -  gdb_byte buf[MAX_REGISTER_SIZE];
>>> >> -  store_signed_integer (buf, register_size (gdbarch, regnum), byte_order,
>>> >> -			extract_signed_integer ((const gdb_byte *) addr, 4,
>>> >> -						byte_order));
>>> >> -  regcache_raw_supply (regcache, regnum, buf);
>>> >> +  regcache->raw_supply_integer (regnum, (const gdb_byte *) addr, 4, true);
>>> >>  }
>> >
>> > Nice.  :-)
>> > [snip several "nice"s]
>> >
> Likewise, remove supply_32bit_reg and use regcache->raw_supply_integer.

There are multiple calls to it, so inlining it would require writing
the "4, true" arguments at all call sites.
Leaving supply_32bit_reg (etc.) as small wrapper functions helps
readability, IMHO.

Thanks,
Pedro Alves


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