This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC][PATCH] Big-endian hosts: Fix "set architecture cris"

The all-architectures-1.exp test case currently yields 66 FAILs on s390x,
because the "set architecture" command fails each time when attempting to
switch to "cris", "crisv32", or "cris:common_v10_v32".  Actually, the
command would succeed if the endianness had been set to "little" before.
Instead, the test case sets the endianness to "auto", which results in
"big" on s390x.

So on x86_64:

  (gdb) set endian auto
  The target endianness is set automatically (currently little endian)
  (gdb) set architecture cris
  warning: A handler for the OS ABI "AIX" is not built into this configuration
  of GDB.  Attempting to continue with the default cris settings.

  The target architecture is assumed to be cris

But on s390x:

  (gdb) set endian auto
  The target endianness is set automatically (currently big endian)
  (gdb) set architecture cris
  Architecture `cris' not recognized.

See also the test results for s390x and ppc64be:

Indeed, cris_gdbarch_init in cris-tdep.c returns a failure unless the
user-specified endianness is "little".  Other architectures usually ignore
the user-specified endianness and return a valid gdbarch anyhow, even if
they can not really cope with the given endianness.

This patch removes the check in cris-tdep.c and forces little-endian byte
order instead.


	* cris-tdep.c (cris_gdbarch_init): Remove check for
	info.byte_order and force it to BFD_ENDIAN_LITTLE.
 gdb/cris-tdep.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index c2ce338..aefd44a 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -4022,31 +4022,14 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* No matching architecture was found.  Create a new one.  */
   tdep = XNEW (struct gdbarch_tdep);
+  info.byte_order = BFD_ENDIAN_LITTLE;
   gdbarch = gdbarch_alloc (&info, tdep);
   tdep->cris_version = usr_cmd_cris_version;
   tdep->cris_mode = usr_cmd_cris_mode;
   tdep->cris_dwarf2_cfi = usr_cmd_cris_dwarf2_cfi;
-  /* INIT shall ensure that the INFO.BYTE_ORDER is non-zero.  */
-  switch (info.byte_order)
-    {
-      /* Ok.  */
-      break;
-    case BFD_ENDIAN_BIG:
-      /* Cris is always little endian, but the user could have forced
-	 big endian with "set endian".  */
-      return 0;
-    default:
-      internal_error (__FILE__, __LINE__,
-		      _("cris_gdbarch_init: unknown byte order in info"));
-    }
   set_gdbarch_return_value (gdbarch, cris_return_value);
   set_gdbarch_sp_regnum (gdbarch, 14);
   /* Length of ordinary registers used in push_word and a few other

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]