summaryrefslogtreecommitdiff
path: root/gdb/arch-utils.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-01-29 03:51:19 +0000
committerAndrew Cagney <cagney@redhat.com>2002-01-29 03:51:19 +0000
commitafe64c1a68ec5ba0921fd218d25257ae969b1cd2 (patch)
tree037db6f4d1cdfab0b982dbe798f56ce11c7a02eb /gdb/arch-utils.c
parent75bc7ddf1b1e98d946b1b3c260c56d2d8ebd251e (diff)
downloadbinutils-gdb-afe64c1a68ec5ba0921fd218d25257ae969b1cd2.tar.gz
* 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. Update doco.
Diffstat (limited to 'gdb/arch-utils.c')
-rw-r--r--gdb/arch-utils.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index ea95cdea384..e6cda543b6d 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -399,13 +399,14 @@ generic_register_virtual_size (int regnum)
/* 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;
+ 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";
@@ -725,9 +726,7 @@ initialize_current_architecture (void)
"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. */
+ /* Take several guesses at a byte order. */
if (info.byte_order == BFD_ENDIAN_UNKNOWN
&& default_bfd_vec != NULL)
{
@@ -769,7 +768,13 @@ initialize_current_architecture (void)
}
}
else
- initialize_non_multiarch ();
+ {
+ /* 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. */