Remove gdbarch_bits_big_endian
authorTom Tromey <tromey@adacore.com>
Mon, 25 Nov 2019 19:31:02 +0000 (12:31 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 4 Dec 2019 16:31:18 +0000 (09:31 -0700)
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

13 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/dwarf2loc.c
gdb/dwarf2read.c
gdb/eval.c
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/gdbtypes.h
gdb/target-descriptions.c
gdb/valarith.c
gdb/value.c
gdb/value.h

index af3962160e5ec9403d4c01b9ab4a0a681c9c0f6b..e09a5887d14c505dd2f1e2d39face297dee993a1 100644 (file)
@@ -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
index 7959a5f06e2237da8d6cfaa1e2dc2c333bd2f89c..3289a8e5c8eef918370afe44298808210f9b864e 100644 (file)
@@ -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;
 
index 0b22745074ad45559a47a30588270ea83182c276..976d453d3ca2283fe2f75084544050dd42a94dac 100644 (file)
@@ -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);
 
index 40d93c9b0e482aa32bface30a75515bab6b9541a..e009b523ccc831ca315f13a5ec4a44f8b8946242 100644 (file)
@@ -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
index 72f5109a7c424739059e4ebba279c1ad32548e6c..87874420dc8643f422b78a7adac9039c89198a9a 100644 (file)
@@ -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;
index fa6be50730b4aac73a73754f769453456927ba1e..59c97da9853e4ac3eb7b5d98e6341a90863c50ad 100644 (file)
@@ -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)
 {
index 01b5aef8f80323bf8b73c0cb458279f90a24cce3..78e05ecdcb93b8ae8dc843d27618f82cb0adde59 100644 (file)
@@ -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);
index 62f68dc8add682233d4f0dbd17e9437c3dc2fde6..331eb392781eb759d38303897947e7a950b3c8dc 100755 (executable)
@@ -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.
index f6879e85a9bb09d763d518a03b7f1bd005136422..e399f5f5bc373ad95867d6e3c5a3e7f6bf9b6f21 100644 (file)
@@ -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;
 
index f83c2f963adb6635027424a51e3aa471e49b768f..29b80ddd79905e4d7689a92f75e9d6bbbe67c89a 100644 (file)
@@ -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);
index 4920cfc18a606bce21ddea4890b1845bc55c4022..887acc86751078ad3f5944b2b6119d414edccd29 100644 (file)
@@ -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;
 }
index 2e2117bf31c37509c69ec562947520bd40ce7378..781808016cde43778c4446b1ae4f0ff02f17b20d 100644 (file)
@@ -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);
index 96c9c216e93ca0c42c353fb402a33986de440bb7..08162474211d2e72e356eb1d14a224ca196776af 100644 (file)
@@ -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);
This page took 0.04457 seconds and 4 git commands to generate.