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.
This commit is contained in:
Andrew Cagney
1997-08-27 07:45:50 +00:00
parent 2f88c3244e
commit 750b794296
4 changed files with 36 additions and 10 deletions

View File

@ -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

View File

@ -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));

View File

@ -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)
if (!target_byte_order_auto)
{
switch (TARGET_BYTE_ORDER)
{
case BIG_ENDIAN:
strcat (arg_buf, " -E big");
else
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.");

View File

@ -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