+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
#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 *));
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));
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.");
#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