[RFA 1/2] Fix TARGET_CHAR_BIT/HOST_CHAR_BIT confusion in gmp-utils.c

Joel Brobecker brobecker@adacore.com
Sat Dec 5 08:05:11 GMT 2020


> > In a couple of gdb_mpz methods, we are computing the number of
> > bits in a gdb::array_view of gdb_byte. Since gdb_byte is defined
> > using a host-side type (see common-types.h), the number of bits
> > in a gdb_byte should be HOST_CHAR_BIT, not TARGET_CHAR_BIT.
> 
> Right, and we are not supposed to use TARGET_CHAR_BIT anymore.  The same
> GDB could be debugging targets with different target char bit values, so
> a build-time constant like TARGET_CHAR_BIT can't work.  For those cases,
> gdbarch_addressable_memory_unit_size should be used instead.

Thanks for the review and the explanation, Simon.

I just pushed this patch to master.

-- 
Joel


More information about the Gdb-patches mailing list