aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-08-27 07:45:50 +0000
committerAndrew Cagney <cagney@redhat.com>1997-08-27 07:45:50 +0000
commit750b7942964c37db092d613eef64eff6dd5de7f3 (patch)
tree2707565d7b2e535137d6c441d2d2eecbf1cedf7b
parent2f88c3244e1f5caabec33e020425fe4710a95fc7 (diff)
downloadfsf-binutils-gdb-750b7942964c37db092d613eef64eff6dd5de7f3.zip
fsf-binutils-gdb-750b7942964c37db092d613eef64eff6dd5de7f3.tar.gz
fsf-binutils-gdb-750b7942964c37db092d613eef64eff6dd5de7f3.tar.bz2
Only pass endianess to simulator when explicitly set by user with set
endian. Prepend endian argument so that it can be overriden with target sim -ARGS.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/defs.h4
-rw-r--r--gdb/remote-sim.c31
-rw-r--r--gdb/top.c2
4 files changed, 36 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 90f70e7..5f1aa84 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+Tue Aug 26 17:13:43 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * remote-sim.c (gdbsim_open): Only pass endianness to sim_open
+ when set explicitly. Prepend endianness arg so that it can be
+ overridden.
+
+ * defs.h, top.c (target_byte_order_auto): Make global when
+ byteorder is selectable.
+
Tue Aug 26 15:19:56 1997 Andrew Cagney <cagney@b1.cygnus.com>
* remote-sim.c (gdbsim_create_inferior): Pass exec_bfd into
diff --git a/gdb/defs.h b/gdb/defs.h
index 65558e0..94725a9 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -758,6 +758,8 @@ extern void free ();
#undef TARGET_BYTE_ORDER
#define TARGET_BYTE_ORDER target_byte_order
extern int target_byte_order;
+/* Nonzero when target_byte_order auto-detected */
+extern int target_byte_order_auto;
#endif
extern void set_endian_from_file PARAMS ((bfd *));
@@ -1004,7 +1006,7 @@ struct target_waitstatus;
struct cmd_list_element;
#endif
-extern void (*init_ui_hook) PARAMS ((void));
+extern void (*init_ui_hook) PARAMS ((char *argv0));
extern void (*command_loop_hook) PARAMS ((void));
extern void (*fputs_unfiltered_hook) PARAMS ((const char *linebuffer,
FILE *stream));
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 023eca0..71a73d3 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -506,16 +506,31 @@ gdbsim_open (args, from_tty)
len = 7 + 1 + (args ? strlen (args) : 0) + 50;
arg_buf = (char *) alloca (len);
- sprintf (arg_buf, "gdbsim%s%s",
- args ? " " : "", args ? args : "");
+ 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). */
#ifdef TARGET_BYTE_ORDER_SELECTABLE
- /* Since GDB always closes the target and updates byte-order when
- opening a new file, TARGET_BYTE_ORDER is normally correct. */
- if (TARGET_BYTE_ORDER == BIG_ENDIAN)
- strcat (arg_buf, " -E big");
- else
- strcat (arg_buf, " -E little");
+ if (!target_byte_order_auto)
+ {
+ switch (TARGET_BYTE_ORDER)
+ {
+ case BIG_ENDIAN:
+ strcat (arg_buf, " -E big");
+ break;
+ case LITTLE_ENDIAN:
+ strcat (arg_buf, " -E little");
+ break;
+ default:
+ fatal ("Value of TARGET_BYTE_ORDER unknown");
+ }
+ }
#endif
+ /* finally, any explicit args */
+ if (args)
+ {
+ strcat (arg_buf, " "); /* 1 */
+ strcat (arg_buf, args);
+ }
argv = buildargv (arg_buf);
if (argv == NULL)
error ("Insufficient memory available to allocate simulator arg list.");
diff --git a/gdb/top.c b/gdb/top.c
index dfa8f3d..1c85374 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -3126,7 +3126,7 @@ dont_repeat_command (ignored, from_tty)
#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
#endif
int target_byte_order = TARGET_BYTE_ORDER_DEFAULT;
-static int target_byte_order_auto = 1;
+int target_byte_order_auto = 1;
#else
static int target_byte_order_auto = 0;
#endif