diff -urpN src/gdb/ada-lang.c dev/gdb/ada-lang.c --- src/gdb/ada-lang.c 2008-01-09 11:01:28.000000000 +0100 +++ dev/gdb/ada-lang.c 2008-01-11 18:43:46.000000000 +0100 @@ -1875,7 +1875,8 @@ decode_packed_array (struct value *arr) return NULL; } - if (BITS_BIG_ENDIAN && ada_is_modular_type (value_type (arr))) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG + && ada_is_modular_type (value_type (arr))) { /* This is a (right-justified) modular type representing a packed array with no wrapper. In order to interpret the value through @@ -1998,7 +1999,7 @@ ada_value_primitive_packed_val (struct v int len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8; /* Transmit bytes from least to most significant; delta is the direction the indices move. */ - int delta = BITS_BIG_ENDIAN ? -1 : 1; + int delta = (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) ? -1 : 1; type = ada_check_typedef (type); @@ -2047,7 +2048,7 @@ ada_value_primitive_packed_val (struct v memset (unpacked, 0, TYPE_LENGTH (type)); return v; } - else if (BITS_BIG_ENDIAN) + else if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { src = len - 1; if (has_negatives (type) @@ -2141,7 +2142,7 @@ move_bits (gdb_byte *target, int targ_of targ_offset %= HOST_CHAR_BIT; source += src_offset / HOST_CHAR_BIT; src_offset %= HOST_CHAR_BIT; - if (BITS_BIG_ENDIAN) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { accum = (unsigned char) *source; source += 1; @@ -2229,7 +2230,7 @@ ada_value_assign (struct value *toval, s fromval = value_cast (type, fromval); read_memory (to_addr, buffer, len); - if (BITS_BIG_ENDIAN) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) move_bits (buffer, value_bitpos (toval), value_contents (fromval), TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT - @@ -2276,7 +2277,7 @@ value_assign_to_component (struct value else bits = value_bitsize (component); - if (BITS_BIG_ENDIAN) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) move_bits (value_contents_writeable (container) + offset_in_container, value_bitpos (container) + bit_offset_in_container, value_contents (val), diff -urpN src/gdb/defs.h dev/gdb/defs.h --- src/gdb/defs.h 2008-01-11 13:28:02.000000000 +0100 +++ dev/gdb/defs.h 2008-01-11 18:45:26.000000000 +0100 @@ -1043,14 +1043,6 @@ enum { MAX_REGISTER_SIZE = 16 }; #define HOST_CHAR_BIT TARGET_CHAR_BIT #endif -/* 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. */ - -#if !defined (BITS_BIG_ENDIAN) -#define BITS_BIG_ENDIAN (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) -#endif - /* In findvar.c. */ extern LONGEST extract_signed_integer (const gdb_byte *, int); diff -urpN src/gdb/dwarf2read.c dev/gdb/dwarf2read.c --- src/gdb/dwarf2read.c 2008-01-11 14:32:31.000000000 +0100 +++ dev/gdb/dwarf2read.c 2008-01-11 18:41:27.000000000 +0100 @@ -3502,7 +3502,7 @@ dwarf2_add_field (struct field_info *fip attr = dwarf2_attr (die, DW_AT_bit_offset, cu); if (attr) { - if (BITS_BIG_ENDIAN) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { /* For big endian bits, the DW_AT_bit_offset gives the additional bit offset from the MSB of the containing diff -urpN src/gdb/eval.c dev/gdb/eval.c --- src/gdb/eval.c 2008-01-08 11:22:24.000000000 +0100 +++ dev/gdb/eval.c 2008-01-11 18:40:32.000000000 +0100 @@ -686,7 +686,7 @@ evaluate_subexp_standard (struct type *e for (; range_low <= range_high; range_low++) { int bit_index = (unsigned) range_low % TARGET_CHAR_BIT; - if (BITS_BIG_ENDIAN) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) bit_index = TARGET_CHAR_BIT - 1 - bit_index; valaddr[(unsigned) range_low / TARGET_CHAR_BIT] |= 1 << bit_index; diff -urpN src/gdb/gdbtypes.h dev/gdb/gdbtypes.h --- src/gdb/gdbtypes.h 2008-01-01 23:53:10.000000000 +0100 +++ dev/gdb/gdbtypes.h 2008-01-11 18:39:29.000000000 +0100 @@ -403,8 +403,8 @@ struct main_type { /* Position of this field, counting in bits from start of containing structure. - For BITS_BIG_ENDIAN=1 targets, it is the bit offset to the MSB. - For BITS_BIG_ENDIAN=0 targets, it is the bit offset to the LSB. + For Big Endian targets, it is the bit offset to the MSB. + For Little Endian targets, it is the bit offset to the LSB. For a range bound or enum value, this is the value itself. */ int bitpos; diff -urpN src/gdb/valarith.c dev/gdb/valarith.c --- src/gdb/valarith.c 2008-01-08 11:22:24.000000000 +0100 +++ dev/gdb/valarith.c 2008-01-11 18:38:31.000000000 +0100 @@ -230,7 +230,8 @@ value_subscript (struct value *array, st offset = index / TARGET_CHAR_BIT; byte = *((char *) value_contents (array) + offset); bit_index = index % TARGET_CHAR_BIT; - byte >>= (BITS_BIG_ENDIAN ? TARGET_CHAR_BIT - 1 - bit_index : bit_index); + byte >>= (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG ? + TARGET_CHAR_BIT - 1 - bit_index : bit_index); v = value_from_longest (LA_BOOL_TYPE, byte & 1); set_value_bitpos (v, bit_index); set_value_bitsize (v, 1); @@ -1573,7 +1574,7 @@ value_bit_index (struct type *type, cons word = unpack_long (builtin_type_unsigned_char, valaddr + (rel_index / TARGET_CHAR_BIT)); rel_index %= TARGET_CHAR_BIT; - if (BITS_BIG_ENDIAN) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) rel_index = TARGET_CHAR_BIT - 1 - rel_index; return (word >> rel_index) & 1; } diff -urpN src/gdb/valops.c dev/gdb/valops.c --- src/gdb/valops.c 2008-01-08 11:22:24.000000000 +0100 +++ dev/gdb/valops.c 2008-01-11 18:36:58.000000000 +0100 @@ -2743,7 +2743,7 @@ value_slice (struct value *array, int lo else if (element > 0) { int j = i % TARGET_CHAR_BIT; - if (BITS_BIG_ENDIAN) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) j = TARGET_CHAR_BIT - 1 - j; value_contents_raw (slice)[i / TARGET_CHAR_BIT] |= (1 << j); } diff -urpN src/gdb/value.c dev/gdb/value.c --- src/gdb/value.c 2008-01-08 11:22:24.000000000 +0100 +++ dev/gdb/value.c 2008-01-11 18:36:10.000000000 +0100 @@ -72,8 +72,8 @@ struct value int bitsize; /* Only used for bitfields; position of start of field. For - BITS_BIG_ENDIAN=0 targets, it is the position of the LSB. For - 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. */ int bitpos; /* Frame register value is relative to. This will be described in @@ -1481,7 +1481,7 @@ unpack_field_as_long (struct type *type, /* Extract bits. See comment above. */ - if (BITS_BIG_ENDIAN) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) lsbcount = (sizeof val * 8 - bitpos % 8 - bitsize); else lsbcount = (bitpos % 8); @@ -1537,7 +1537,7 @@ modify_field (gdb_byte *addr, LONGEST fi oword = extract_unsigned_integer (addr, sizeof oword); /* Shifting for bit field depends on endianness of the target machine. */ - if (BITS_BIG_ENDIAN) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) bitpos = sizeof (oword) * 8 - bitpos - bitsize; oword &= ~(mask << bitpos); diff -urpN src/gdb/value.h dev/gdb/value.h --- src/gdb/value.h 2008-01-08 11:22:24.000000000 +0100 +++ dev/gdb/value.h 2008-01-11 18:34:08.000000000 +0100 @@ -62,8 +62,8 @@ extern int value_bitsize (struct value * extern void set_value_bitsize (struct value *, int bit); /* Only used for bitfields; position of start of field. For - BITS_BIG_ENDIAN=0 targets, it is the position of the LSB. For - 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 int value_bitpos (struct value *); extern void set_value_bitpos (struct value *, int bit);