This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/rfc] Eliminate TARGET_BYTE_ORDER_DEFAULT
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 20 Jan 2002 15:27:03 -0500
- Subject: [patch/rfc] Eliminate TARGET_BYTE_ORDER_DEFAULT
Per discussion on TARGET_BYTE_ORDER_SELECTABLE. This patch removes
TARGET_BYTE_ORDER_DEFAULT.
I suspect the patch also fixes a bug in the non-multi-arch code (Daniel
J's prodding made me revisit it). Unlike the multi-arch case,
the non-multi-arch code wasn't updating target_byte_order with the
byte-order determined from BFD.
I'll leave this one for a few days.
Andrew
PS, the arm still comes up little endian:
ac131313@nettle$ ./gdb/gdb
GNU gdb 2002-01-20-cvs
(gdb) show endian
The target endianness is set automatically (currently little endian)
(gdb)
2002-01-20 Andrew Cagney <ac131313@redhat.com>
* arch-utils.c (TARGET_BYTE_ORDER_DEFAULT): Delete macro.
(target_byte_order): Initialize to BFD_ENDIAN_BIG.
(initialize_current_architecture): Update target_byte_order using
information from BFD.
* config/powerpc/tm-ppcle-eabi.h (TARGET_BYTE_ORDER_DEFAULT):
* config/mcore/tm-mcore.h (TARGET_BYTE_ORDER_DEFAULT):
* config/arm/tm-arm.h (TARGET_BYTE_ORDER_DEFAULT): Delete.
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.47
diff -p -r1.47 arch-utils.c
*** arch-utils.c 2002/01/20 19:26:48 1.47
--- arch-utils.c 2002/01/20 20:05:43
*************** generic_register_virtual_size (int regnu
*** 399,411 ****
/* Functions to manipulate the endianness of the target. */
- #ifndef TARGET_BYTE_ORDER_DEFAULT
- #define TARGET_BYTE_ORDER_DEFAULT BFD_ENDIAN_BIG /* arbitrary */
- #endif
/* ``target_byte_order'' is only used when non- multi-arch.
! Multi-arch targets obtain the current byte order using
! TARGET_BYTE_ORDER which is controlled by gdbarch.*. */
! int target_byte_order = TARGET_BYTE_ORDER_DEFAULT;
int target_byte_order_auto = 1;
static const char endian_big[] = "big";
--- 399,412 ----
/* Functions to manipulate the endianness of the target. */
/* ``target_byte_order'' is only used when non- multi-arch.
! Multi-arch targets obtain the current byte order using the
! TARGET_BYTE_ORDER gdbarch method.
!
! The choice of initial value is entirely arbitrary. During startup,
! the function initialize_current_architecture() updates this value
! based on default byte-order information extracted from BFD. */
! int target_byte_order = BFD_ENDIAN_BIG;
int target_byte_order_auto = 1;
static const char endian_big[] = "big";
*************** initialize_current_architecture (void)
*** 725,733 ****
"initialize_current_architecture: Arch not found");
}
! /* take several guesses at a byte order. */
! /* NB: can't use TARGET_BYTE_ORDER_DEFAULT as its definition is
! forced above. */
if (info.byte_order == BFD_ENDIAN_UNKNOWN
&& default_bfd_vec != NULL)
{
--- 726,732 ----
"initialize_current_architecture: Arch not found");
}
! /* Take several guesses at a byte order. */
if (info.byte_order == BFD_ENDIAN_UNKNOWN
&& default_bfd_vec != NULL)
{
*************** initialize_current_architecture (void)
*** 769,775 ****
}
}
else
! initialize_non_multiarch ();
/* Create the ``set architecture'' command appending ``auto'' to the
list of architectures. */
--- 768,780 ----
}
}
else
! {
! /* If the multi-arch logic comes up with a byte-order (from BFD)
! use it for the non-multi-arch case. */
! if (info.byte_order != BFD_ENDIAN_UNKNOWN)
! target_byte_order = info.byte_order;
! initialize_non_multiarch ();
! }
/* Create the ``set architecture'' command appending ``auto'' to the
list of architectures. */
Index: config/arm/tm-arm.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
retrieving revision 1.15
diff -p -r1.15 tm-arm.h
*** tm-arm.h 2002/01/20 19:26:48 1.15
--- tm-arm.h 2002/01/20 20:05:44
***************
*** 29,38 ****
struct type;
struct value;
- /* Target byte order on ARM defaults to selectable, and defaults to
- little endian. */
- #define TARGET_BYTE_ORDER_DEFAULT BFD_ENDIAN_LITTLE
-
/* IEEE format floating point. */
#define TARGET_DOUBLE_FORMAT (target_byte_order == BFD_ENDIAN_BIG \
? &floatformat_ieee_double_big \
--- 29,34 ----
Index: config/mcore/tm-mcore.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mcore/tm-mcore.h,v
retrieving revision 1.8
diff -p -r1.8 tm-mcore.h
*** tm-mcore.h 2002/01/20 19:26:49 1.8
--- tm-mcore.h 2002/01/20 20:05:44
***************
*** 20,28 ****
#include "regcache.h"
- /* The mcore is little endian (by default) */
- #define TARGET_BYTE_ORDER_DEFAULT BFD_ENDIAN_LITTLE
-
/* All registers are 32 bits */
#define REGISTER_SIZE 4
#define MAX_REGISTER_RAW_SIZE 4
--- 20,25 ----
Index: doc/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
retrieving revision 1.142
diff -p -r1.142 ChangeLog
*** ChangeLog 2002/01/20 19:26:50 1.142
--- ChangeLog 2002/01/20 20:05:51
***************
*** 1,6 ****
--- 1,11 ----
2002-01-20 Andrew Cagney <ac131313@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Delete
+ description of TARGET_BYTE_ORDER_DEFAULT.
+
+ 2002-01-20 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Delete
description of TARGET_BYTE_ORDER_SELECTABLE_P.
2002-01-20 Andrew Cagney <ac131313@redhat.com>
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.60
diff -p -r1.60 gdbint.texinfo
*** gdbint.texinfo 2002/01/20 19:26:50 1.60
--- gdbint.texinfo 2002/01/20 20:06:08
*************** where @var{valbuf} is the address of the
*** 3474,3485 ****
The default value of the ``symbol-reloading'' variable. (Never defined in
current sources.)
- @item TARGET_BYTE_ORDER_DEFAULT
- @findex TARGET_BYTE_ORDER_DEFAULT
- The ordering of bytes in the target. This must be either
- @code{BFD_ENDIAN_BIG} or @code{BFD_ENDIAN_LITTLE}. This macro replaces
- @code{TARGET_BYTE_ORDER} which is deprecated.
-
@item TARGET_CHAR_BIT
@findex TARGET_CHAR_BIT
Number of bits in a char; defaults to 8.
--- 3474,3479 ----