diff options
author | Andrew Cagney <cagney@redhat.com> | 1997-08-27 07:45:50 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 1997-08-27 07:45:50 +0000 |
commit | 750b7942964c37db092d613eef64eff6dd5de7f3 (patch) | |
tree | 2707565d7b2e535137d6c441d2d2eecbf1cedf7b /gdb/remote-sim.c | |
parent | 2f88c3244e1f5caabec33e020425fe4710a95fc7 (diff) | |
download | gdb-750b7942964c37db092d613eef64eff6dd5de7f3.zip gdb-750b7942964c37db092d613eef64eff6dd5de7f3.tar.gz 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.
Diffstat (limited to 'gdb/remote-sim.c')
-rw-r--r-- | gdb/remote-sim.c | 31 |
1 files changed, 23 insertions, 8 deletions
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."); |