[patch] Can't connect to simulator that doesn't have bi-endian

Daniel Jacobowitz drow@false.org
Mon Feb 26 20:14:00 GMT 2007


On Tue, Feb 13, 2007 at 09:52:23AM +0900, Masaki Muranaka wrote:
> I think it should be:
> - if (target_byte_order_user)
> + if (target_byte_order_user != BFD_ENDIAN_UNKNOWN)
> 
> Others nice to me.

Thanks a lot, and sorry for taking so long to fix this.  I checked in
this version.

-- 
Daniel Jacobowitz
CodeSourcery

2007-02-26  Daniel Jacobowitz  <dan@codesourcery.com>

	* arch-utils.c (selected_byte_order): New.
	* arch-utils.h (selected_byte_order): New prototype.
	* remote-sim.c (gdbsim_open): Use selected_byte_order.

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.141
diff -u -p -r1.141 arch-utils.c
--- arch-utils.c	29 Jan 2007 17:31:05 -0000	1.141
+++ arch-utils.c	8 Feb 2007 15:00:24 -0000
@@ -280,6 +280,15 @@ static const char *endian_enum[] =
 };
 static const char *set_endian_string;
 
+enum bfd_endian
+selected_byte_order (void)
+{
+  if (target_byte_order_user != BFD_ENDIAN_UNKNOWN)
+    return TARGET_BYTE_ORDER;
+  else
+    return BFD_ENDIAN_UNKNOWN;
+}
+
 /* Called by ``show endian''.  */
 
 static void
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.84
diff -u -p -r1.84 arch-utils.h
--- arch-utils.h	29 Jan 2007 17:31:05 -0000	1.84
+++ arch-utils.h	8 Feb 2007 15:00:24 -0000
@@ -115,6 +115,10 @@ extern int generic_instruction_nullified
 
 extern int legacy_register_sim_regno (int regnum);
 
+/* Return the selected byte order, or BFD_ENDIAN_UNKNOWN if no byte
+   order was explicitly selected.  */
+extern enum bfd_endian selected_byte_order (void);
+
 /* Return the selected architecture's name, or NULL if no architecture
    was explicitly selected.  */
 extern const char *selected_architecture_name (void);
Index: remote-sim.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sim.c,v
retrieving revision 1.57
diff -u -p -r1.57 remote-sim.c
--- remote-sim.c	9 Jan 2007 17:58:56 -0000	1.57
+++ remote-sim.c	8 Feb 2007 15:00:24 -0000
@@ -504,9 +504,9 @@ gdbsim_open (char *args, int from_tty)
 	 + 50) /* slack */ ;
   arg_buf = (char *) alloca (len);
   strcpy (arg_buf, "gdbsim");	/* 7 */
-  /* Specify the byte order for the target when it is both selectable
-     and explicitly specified by the user (not auto detected). */
-  switch (TARGET_BYTE_ORDER)
+  /* Specify the byte order for the target when it is explicitly
+     specified by the user (not auto detected). */
+  switch (selected_byte_order ())
     {
     case BFD_ENDIAN_BIG:
       strcat (arg_buf, " -E big");



More information about the Gdb-patches mailing list