mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 10:03:47 +08:00
Remove gdbarch_bits_big_endian
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
This commit is contained in:
parent
7ab4a236ce
commit
d5a22e77b5
@ -1,3 +1,20 @@
|
||||
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
|
||||
|
@ -2257,7 +2257,7 @@ decode_constrained_packed_array (struct value *arr)
|
||||
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
|
||||
@ -2499,7 +2499,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
|
||||
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);
|
||||
@ -2645,7 +2645,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
|
||||
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;
|
||||
@ -2694,7 +2694,7 @@ value_assign_to_component (struct value *container, struct value *component,
|
||||
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;
|
||||
|
||||
|
@ -1577,8 +1577,7 @@ rw_pieced_value (struct value *v, struct value *from)
|
||||
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)
|
||||
{
|
||||
@ -2817,7 +2816,7 @@ access_memory (struct gdbarch *arch, struct agent_expr *expr, ULONGEST nbits)
|
||||
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. */
|
||||
@ -2867,7 +2866,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
|
||||
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);
|
||||
|
||||
|
@ -15127,7 +15127,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
|
||||
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
|
||||
|
@ -1547,7 +1547,7 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||
{
|
||||
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;
|
||||
|
@ -172,7 +172,6 @@ struct gdbarch
|
||||
|
||||
*/
|
||||
|
||||
int bits_big_endian;
|
||||
int short_bit;
|
||||
int int_bit;
|
||||
int long_bit;
|
||||
@ -389,7 +388,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
|
||||
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;
|
||||
@ -528,7 +526,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
|
||||
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 */
|
||||
@ -816,9 +813,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
|
||||
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));
|
||||
@ -1564,23 +1558,6 @@ gdbarch_target_desc (struct gdbarch *gdbarch)
|
||||
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)
|
||||
{
|
||||
|
@ -146,12 +146,6 @@ extern const struct target_desc * gdbarch_target_desc (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);
|
||||
|
@ -347,10 +347,6 @@ i;enum gdb_osabi;osabi;;;GDB_OSABI_UNKNOWN
|
||||
#
|
||||
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.
|
||||
|
@ -552,10 +552,9 @@ union type_owner
|
||||
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;
|
||||
|
||||
|
@ -224,7 +224,7 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
|
||||
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);
|
||||
|
@ -1723,7 +1723,7 @@ value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
|
||||
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;
|
||||
}
|
||||
|
@ -273,8 +273,8 @@ struct value
|
||||
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,
|
||||
@ -3135,7 +3135,7 @@ unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
|
||||
|
||||
/* 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);
|
||||
@ -3311,7 +3311,7 @@ modify_field (struct type *type, gdb_byte *addr,
|
||||
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);
|
||||
|
@ -146,8 +146,8 @@ extern LONGEST value_bitsize (const struct value *);
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user