From what I can tell, set_gdbarch_bits_big_endian has never been used.
That is, all architectures since its introduction have simply used the
default, which is simply check the architecture's byte-endianness.
Because this interferes with the scalar_storage_order code, this patch
removes this gdbarch setting entirely. In some places,
type_byte_order is used rather than the plain gdbarch.
gdb/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* ada-lang.c (decode_constrained_packed_array)
(ada_value_assign, value_assign_to_component): Update.
* dwarf2loc.c (rw_pieced_value, access_memory)
(dwarf2_compile_expr_to_ax): Update.
* dwarf2read.c (dwarf2_add_field): Update.
* eval.c (evaluate_subexp_standard): Update.
* gdbarch.c, gdbarch.h: Rebuild.
* gdbarch.sh (bits_big_endian): Remove.
* gdbtypes.h (union field_location): Update comment.
* target-descriptions.c (make_gdb_type): Update.
* valarith.c (value_bit_index): Update.
* value.c (struct value) <bitpos>: Update comment.
(unpack_bits_as_long, modify_field): Update.
* value.h (value_bitpos): Update comment.
Change-Id: I379b5e0c408ec8742f7a6c6b721108e73ed1b018
+2019-12-04 Tom Tromey <tromey@adacore.com>
+
+ * ada-lang.c (decode_constrained_packed_array)
+ (ada_value_assign, value_assign_to_component): Update.
+ * dwarf2loc.c (rw_pieced_value, access_memory)
+ (dwarf2_compile_expr_to_ax): Update.
+ * dwarf2read.c (dwarf2_add_field): Update.
+ * eval.c (evaluate_subexp_standard): Update.
+ * gdbarch.c, gdbarch.h: Rebuild.
+ * gdbarch.sh (bits_big_endian): Remove.
+ * gdbtypes.h (union field_location): Update comment.
+ * target-descriptions.c (make_gdb_type): Update.
+ * valarith.c (value_bit_index): Update.
+ * value.c (struct value) <bitpos>: Update comment.
+ (unpack_bits_as_long, modify_field): Update.
+ * value.h (value_bitpos): Update comment.
+
2019-12-04 Tom Tromey <tromey@adacore.com>
* gdbtypes.c (type_byte_order): Move earlier. Assert for unknown
return NULL;
}
- if (gdbarch_bits_big_endian (get_type_arch (value_type (arr)))
+ if (type_byte_order (value_type (arr)) == BFD_ENDIAN_BIG
&& ada_is_modular_type (value_type (arr)))
{
/* This is a (right-justified) modular type representing a packed
const gdb_byte *src; /* First byte containing data to unpack */
gdb_byte *unpacked;
const int is_scalar = is_scalar_type (type);
- const int is_big_endian = gdbarch_bits_big_endian (get_type_arch (type));
+ const int is_big_endian = type_byte_order (type) == BFD_ENDIAN_BIG;
gdb::byte_vector staging;
type = ada_check_typedef (type);
if (from_size == 0)
from_size = TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT;
- const int is_big_endian = gdbarch_bits_big_endian (get_type_arch (type));
+ const int is_big_endian = type_byte_order (type) == BFD_ENDIAN_BIG;
ULONGEST from_offset = 0;
if (is_big_endian && is_scalar_type (value_type (fromval)))
from_offset = from_size - bits;
else
bits = value_bitsize (component);
- if (gdbarch_bits_big_endian (get_type_arch (value_type (container))))
+ if (type_byte_order (value_type (container)) == BFD_ENDIAN_BIG)
{
int src_offset;
struct piece_closure *c
= (struct piece_closure *) value_computed_closure (v);
gdb::byte_vector buffer;
- int bits_big_endian
- = gdbarch_bits_big_endian (get_type_arch (value_type (v)));
+ bool bits_big_endian = type_byte_order (value_type (v)) == BFD_ENDIAN_BIG;
if (from != NULL)
{
if (8 * nbytes == nbits)
return;
- if (gdbarch_bits_big_endian (arch))
+ if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
{
/* On a bits-big-endian machine, we want the high-order
NBITS. */
enum bfd_endian byte_order = gdbarch_byte_order (arch);
ULONGEST bits_collected = 0;
unsigned int addr_size_bits = 8 * addr_size;
- int bits_big_endian = gdbarch_bits_big_endian (arch);
+ bool bits_big_endian = byte_order == BFD_ENDIAN_BIG;
std::vector<int> offsets (op_end - op_ptr, -1);
attr = dwarf2_attr (die, DW_AT_bit_offset, cu);
if (attr != nullptr)
{
- if (gdbarch_bits_big_endian (gdbarch))
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
{
/* For big endian bits, the DW_AT_bit_offset gives the
additional bit offset from the MSB of the containing
{
int bit_index = (unsigned) range_low % TARGET_CHAR_BIT;
- if (gdbarch_bits_big_endian (exp->gdbarch))
+ if (gdbarch_byte_order (exp->gdbarch) == BFD_ENDIAN_BIG)
bit_index = TARGET_CHAR_BIT - 1 - bit_index;
valaddr[(unsigned) range_low / TARGET_CHAR_BIT]
|= 1 << bit_index;
*/
- int bits_big_endian;
int short_bit;
int int_bit;
int long_bit;
gdbarch->target_desc = info->target_desc;
/* Force the explicit initialization of these. */
- gdbarch->bits_big_endian = (gdbarch->byte_order == BFD_ENDIAN_BIG);
gdbarch->short_bit = 2*TARGET_CHAR_BIT;
gdbarch->int_bit = 4*TARGET_CHAR_BIT;
gdbarch->long_bit = 4*TARGET_CHAR_BIT;
if (gdbarch->bfd_arch_info == NULL)
log.puts ("\n\tbfd_arch_info");
/* Check those that need to be defined for the given multi-arch level. */
- /* Skip verify of bits_big_endian, invalid_p == 0 */
/* Skip verify of short_bit, invalid_p == 0 */
/* Skip verify of int_bit, invalid_p == 0 */
/* Skip verify of long_bit, invalid_p == 0 */
fprintf_unfiltered (file,
"gdbarch_dump: bfd_arch_info = %s\n",
gdbarch_bfd_arch_info (gdbarch)->printable_name);
- fprintf_unfiltered (file,
- "gdbarch_dump: bits_big_endian = %s\n",
- plongest (gdbarch->bits_big_endian));
fprintf_unfiltered (file,
"gdbarch_dump: breakpoint_from_pc = <%s>\n",
host_address_to_string (gdbarch->breakpoint_from_pc));
return gdbarch->target_desc;
}
-int
-gdbarch_bits_big_endian (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- /* Skip verify of bits_big_endian, invalid_p == 0 */
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_bits_big_endian called\n");
- return gdbarch->bits_big_endian;
-}
-
-void
-set_gdbarch_bits_big_endian (struct gdbarch *gdbarch,
- int bits_big_endian)
-{
- gdbarch->bits_big_endian = bits_big_endian;
-}
-
int
gdbarch_short_bit (struct gdbarch *gdbarch)
{
/* The following are initialized by the target dependent code. */
-/* The bit byte-order has to do just with numbering of bits in debugging symbols
- and such. Conceptually, it's quite separate from byte/word byte order. */
-
-extern int gdbarch_bits_big_endian (struct gdbarch *gdbarch);
-extern void set_gdbarch_bits_big_endian (struct gdbarch *gdbarch, int bits_big_endian);
-
/* Number of bits in a short or unsigned short for the target machine. */
extern int gdbarch_short_bit (struct gdbarch *gdbarch);
#
i;const struct target_desc *;target_desc;;;;;;;host_address_to_string (gdbarch->target_desc)
-# The bit byte-order has to do just with numbering of bits in debugging symbols
-# and such. Conceptually, it's quite separate from byte/word byte order.
-v;int;bits_big_endian;;;1;(gdbarch->byte_order == BFD_ENDIAN_BIG);;0
-
# Number of bits in a short or unsigned short for the target machine.
v;int;short_bit;;;8 * sizeof (short);2*TARGET_CHAR_BIT;;0
# Number of bits in an int or unsigned int for the target machine.
union field_location
{
/* * Position of this field, counting in bits from start of
- containing structure. For gdbarch_bits_big_endian=1
- targets, it is the bit offset to the MSB. For
- gdbarch_bits_big_endian=0 targets, it is the bit offset to
- the LSB. */
+ containing structure. For big-endian targets, it is the bit
+ offset to the MSB. For little-endian targets, it is the bit
+ offset to the LSB. */
LONGEST bitpos;
the total size of the structure. */
bitsize = f.end - f.start + 1;
total_size = e->size * TARGET_CHAR_BIT;
- if (gdbarch_bits_big_endian (m_gdbarch))
+ if (gdbarch_byte_order (m_gdbarch) == BFD_ENDIAN_BIG)
SET_FIELD_BITPOS (fld[0], total_size - f.start - bitsize);
else
SET_FIELD_BITPOS (fld[0], f.start);
word = extract_unsigned_integer (valaddr + (rel_index / TARGET_CHAR_BIT), 1,
type_byte_order (type));
rel_index %= TARGET_CHAR_BIT;
- if (gdbarch_bits_big_endian (gdbarch))
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
rel_index = TARGET_CHAR_BIT - 1 - rel_index;
return (word >> rel_index) & 1;
}
LONGEST bitsize = 0;
/* Only used for bitfields; position of start of field. For
- gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For
- gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */
+ little-endian targets, it is the position of the LSB. For
+ big-endian targets, it is the position of the MSB. */
LONGEST bitpos = 0;
/* The number of references to this value. When a value is created,
/* Extract bits. See comment above. */
- if (gdbarch_bits_big_endian (get_type_arch (field_type)))
+ if (byte_order == BFD_ENDIAN_BIG)
lsbcount = (bytes_read * 8 - bitpos % 8 - bitsize);
else
lsbcount = (bitpos % 8);
oword = extract_unsigned_integer (addr, bytesize, byte_order);
/* Shifting for bit field depends on endianness of the target machine. */
- if (gdbarch_bits_big_endian (get_type_arch (type)))
+ if (byte_order == BFD_ENDIAN_BIG)
bitpos = bytesize * 8 - bitpos - bitsize;
oword &= ~(mask << bitpos);
extern void set_value_bitsize (struct value *, LONGEST bit);
/* Only used for bitfields; position of start of field. For
- gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For
- gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */
+ little-endian targets, it is the position of the LSB. For
+ big-endian targets, it is the position of the MSB. */
extern LONGEST value_bitpos (const struct value *);
extern void set_value_bitpos (struct value *, LONGEST bit);