* arch-utils.c (initialize_current_architecture): Test byte_order

against BFD_ENDIAN_UNKNOWN.
(gdbarch_info_init): Initialize byte_order to BFD_ENDIAN_UNKNOWN.
* gdbarch.sh: Update comments on default value of byte_order.
(verify_gdbarch, gdbarch_update_p): Test byte_order against
BFD_ENDIAN_UNKNOWN.
* gdbarch.h, gdbarch.c: Re-generate.
This commit is contained in:
Andrew Cagney 2001-12-29 19:25:58 +00:00
parent 815ecd3476
commit 428721aaa3
5 changed files with 28 additions and 19 deletions

View File

@ -1,3 +1,13 @@
2001-12-30 Andrew Cagney <ac131313@redhat.com>
* arch-utils.c (initialize_current_architecture): Test byte_order
against BFD_ENDIAN_UNKNOWN.
(gdbarch_info_init): Initialize byte_order to BFD_ENDIAN_UNKNOWN.
* gdbarch.sh: Update comments on default value of byte_order.
(verify_gdbarch, gdbarch_update_p): Test byte_order against
BFD_ENDIAN_UNKNOWN.
* gdbarch.h, gdbarch.c: Re-generate.
2001-12-27 Michael Snyder <msnyder@redhat.com> 2001-12-27 Michael Snyder <msnyder@redhat.com>
* i386-linux-nat.c: Include i386-tdep.h. * i386-linux-nat.c: Include i386-tdep.h.

View File

@ -762,7 +762,7 @@ initialize_current_architecture (void)
/* take several guesses at a byte order. */ /* take several guesses at a byte order. */
/* NB: can't use TARGET_BYTE_ORDER_DEFAULT as its definition is /* NB: can't use TARGET_BYTE_ORDER_DEFAULT as its definition is
forced above. */ forced above. */
if (info.byte_order == 0 if (info.byte_order == BFD_ENDIAN_UNKNOWN
&& default_bfd_vec != NULL) && default_bfd_vec != NULL)
{ {
/* Extract BFD's default vector's byte order. */ /* Extract BFD's default vector's byte order. */
@ -778,7 +778,7 @@ initialize_current_architecture (void)
break; break;
} }
} }
if (info.byte_order == 0) if (info.byte_order == BFD_ENDIAN_UNKNOWN)
{ {
/* look for ``*el-*'' in the target name. */ /* look for ``*el-*'' in the target name. */
const char *chp; const char *chp;
@ -788,7 +788,7 @@ initialize_current_architecture (void)
&& strncmp (chp - 2, "el", 2) == 0) && strncmp (chp - 2, "el", 2) == 0)
info.byte_order = BFD_ENDIAN_LITTLE; info.byte_order = BFD_ENDIAN_LITTLE;
} }
if (info.byte_order == 0) if (info.byte_order == BFD_ENDIAN_UNKNOWN)
{ {
/* Wire it to big-endian!!! */ /* Wire it to big-endian!!! */
info.byte_order = BIG_ENDIAN; info.byte_order = BIG_ENDIAN;
@ -842,6 +842,7 @@ void
gdbarch_info_init (struct gdbarch_info *info) gdbarch_info_init (struct gdbarch_info *info)
{ {
memset (info, 0, sizeof (struct gdbarch_info)); memset (info, 0, sizeof (struct gdbarch_info));
info->byte_order = BFD_ENDIAN_UNKNOWN;
} }
/* */ /* */

View File

@ -548,7 +548,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
log = mem_fileopen (); log = mem_fileopen ();
cleanups = make_cleanup_ui_file_delete (log); cleanups = make_cleanup_ui_file_delete (log);
/* fundamental */ /* fundamental */
if (gdbarch->byte_order == 0) if (gdbarch->byte_order == BFD_ENDIAN_UNKNOWN)
fprintf_unfiltered (log, "\n\tbyte-order"); fprintf_unfiltered (log, "\n\tbyte-order");
if (gdbarch->bfd_arch_info == NULL) if (gdbarch->bfd_arch_info == NULL)
fprintf_unfiltered (log, "\n\tbfd_arch_info"); fprintf_unfiltered (log, "\n\tbfd_arch_info");
@ -4749,17 +4749,17 @@ gdbarch_update_p (struct gdbarch_info info)
info.bfd_arch_info = TARGET_ARCHITECTURE; info.bfd_arch_info = TARGET_ARCHITECTURE;
/* ``(gdb) set byte-order ...'' */ /* ``(gdb) set byte-order ...'' */
if (info.byte_order == 0 if (info.byte_order == BFD_ENDIAN_UNKNOWN
&& !TARGET_BYTE_ORDER_AUTO) && !TARGET_BYTE_ORDER_AUTO)
info.byte_order = TARGET_BYTE_ORDER; info.byte_order = TARGET_BYTE_ORDER;
/* From the INFO struct. */ /* From the INFO struct. */
if (info.byte_order == 0 if (info.byte_order == BFD_ENDIAN_UNKNOWN
&& info.abfd != NULL) && info.abfd != NULL)
info.byte_order = (bfd_big_endian (info.abfd) ? BIG_ENDIAN info.byte_order = (bfd_big_endian (info.abfd) ? BIG_ENDIAN
: bfd_little_endian (info.abfd) ? BFD_ENDIAN_LITTLE : bfd_little_endian (info.abfd) ? BFD_ENDIAN_LITTLE
: 0); : BFD_ENDIAN_UNKNOWN);
/* From the current target. */ /* From the current target. */
if (info.byte_order == 0) if (info.byte_order == BFD_ENDIAN_UNKNOWN)
info.byte_order = TARGET_BYTE_ORDER; info.byte_order = TARGET_BYTE_ORDER;
/* Must have found some sort of architecture. */ /* Must have found some sort of architecture. */

View File

@ -2263,8 +2263,7 @@ extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
The INIT function parameter INFO shall, as far as possible, be The INIT function parameter INFO shall, as far as possible, be
pre-initialized with information obtained from INFO.ABFD or pre-initialized with information obtained from INFO.ABFD or
previously selected architecture (if similar). INIT shall ensure previously selected architecture (if similar).
that the INFO.BYTE_ORDER is non-zero.
The INIT function shall return any of: NULL - indicating that it The INIT function shall return any of: NULL - indicating that it
doesn't recognize the selected architecture; an existing ``struct doesn't recognize the selected architecture; an existing ``struct
@ -2288,7 +2287,7 @@ struct gdbarch_info
/* Use default: NULL (ZERO). */ /* Use default: NULL (ZERO). */
const struct bfd_arch_info *bfd_arch_info; const struct bfd_arch_info *bfd_arch_info;
/* Use default: 0 (ZERO). */ /* Use default: BFD_ENDIAN_UNKNOWN (NB: is not ZERO). */
int byte_order; int byte_order;
/* Use default: NULL (ZERO). */ /* Use default: NULL (ZERO). */

View File

@ -913,8 +913,7 @@ extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
The INIT function parameter INFO shall, as far as possible, be The INIT function parameter INFO shall, as far as possible, be
pre-initialized with information obtained from INFO.ABFD or pre-initialized with information obtained from INFO.ABFD or
previously selected architecture (if similar). INIT shall ensure previously selected architecture (if similar).
that the INFO.BYTE_ORDER is non-zero.
The INIT function shall return any of: NULL - indicating that it The INIT function shall return any of: NULL - indicating that it
doesn't recognize the selected architecture; an existing \`\`struct doesn't recognize the selected architecture; an existing \`\`struct
@ -938,7 +937,7 @@ struct gdbarch_info
/* Use default: NULL (ZERO). */ /* Use default: NULL (ZERO). */
const struct bfd_arch_info *bfd_arch_info; const struct bfd_arch_info *bfd_arch_info;
/* Use default: 0 (ZERO). */ /* Use default: BFD_ENDIAN_UNKNOWN (NB: is not ZERO). */
int byte_order; int byte_order;
/* Use default: NULL (ZERO). */ /* Use default: NULL (ZERO). */
@ -1429,7 +1428,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
log = mem_fileopen (); log = mem_fileopen ();
cleanups = make_cleanup_ui_file_delete (log); cleanups = make_cleanup_ui_file_delete (log);
/* fundamental */ /* fundamental */
if (gdbarch->byte_order == 0) if (gdbarch->byte_order == BFD_ENDIAN_UNKNOWN)
fprintf_unfiltered (log, "\n\tbyte-order"); fprintf_unfiltered (log, "\n\tbyte-order");
if (gdbarch->bfd_arch_info == NULL) if (gdbarch->bfd_arch_info == NULL)
fprintf_unfiltered (log, "\n\tbfd_arch_info"); fprintf_unfiltered (log, "\n\tbfd_arch_info");
@ -2058,17 +2057,17 @@ gdbarch_update_p (struct gdbarch_info info)
info.bfd_arch_info = TARGET_ARCHITECTURE; info.bfd_arch_info = TARGET_ARCHITECTURE;
/* \`\`(gdb) set byte-order ...'' */ /* \`\`(gdb) set byte-order ...'' */
if (info.byte_order == 0 if (info.byte_order == BFD_ENDIAN_UNKNOWN
&& !TARGET_BYTE_ORDER_AUTO) && !TARGET_BYTE_ORDER_AUTO)
info.byte_order = TARGET_BYTE_ORDER; info.byte_order = TARGET_BYTE_ORDER;
/* From the INFO struct. */ /* From the INFO struct. */
if (info.byte_order == 0 if (info.byte_order == BFD_ENDIAN_UNKNOWN
&& info.abfd != NULL) && info.abfd != NULL)
info.byte_order = (bfd_big_endian (info.abfd) ? BIG_ENDIAN info.byte_order = (bfd_big_endian (info.abfd) ? BIG_ENDIAN
: bfd_little_endian (info.abfd) ? BFD_ENDIAN_LITTLE : bfd_little_endian (info.abfd) ? BFD_ENDIAN_LITTLE
: 0); : BFD_ENDIAN_UNKNOWN);
/* From the current target. */ /* From the current target. */
if (info.byte_order == 0) if (info.byte_order == BFD_ENDIAN_UNKNOWN)
info.byte_order = TARGET_BYTE_ORDER; info.byte_order = TARGET_BYTE_ORDER;
/* Must have found some sort of architecture. */ /* Must have found some sort of architecture. */