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

Simon Marchi simark@simark.ca
Mon Nov 30 15:42:28 GMT 2020


On 2020-11-29 10:45 a.m., Joel Brobecker wrote:
> 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.

Simon


More information about the Gdb-patches mailing list