From: David Edelsohn Date: Thu, 17 Apr 1997 10:52:59 +0000 (+0000) Subject: * Makefile.in (SIM_OBJS): Add sim-load.o. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d77e69d4a314da4c5b0e63d6eecd083cd3c5d52;p=binutils-gdb.git * Makefile.in (SIM_OBJS): Add sim-load.o. * interp.c (target_byte_order): Delete. (sim_kind, myname, little_endian_p): New static locals. (init_pointers): Use little_endian_p instead of target_byte_order. (sim_resume): Likewise. (sim_open): Set sim_kind, myname. Set little_endian_p from -E arg. (sim_load): Return SIM_RC. New arg abfd. Call sim_load_file to load file into simulator. Set start address from bfd. (sim_create_inferior): Return SIM_RC. Delete arg start_address. --- diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog index f382b05a234..91bcaefef31 100644 --- a/sim/sh/ChangeLog +++ b/sim/sh/ChangeLog @@ -1,3 +1,20 @@ +Thu Apr 17 03:32:04 1997 Doug Evans + + * Makefile.in (SIM_OBJS): Add sim-load.o. + * interp.c (target_byte_order): Delete. + (sim_kind, myname, little_endian_p): New static locals. + (init_pointers): Use little_endian_p instead of target_byte_order. + (sim_resume): Likewise. + (sim_open): Set sim_kind, myname. Set little_endian_p from -E arg. + (sim_load): Return SIM_RC. New arg abfd. Call sim_load_file to + load file into simulator. Set start address from bfd. + (sim_create_inferior): Return SIM_RC. Delete arg start_address. + +Mon Apr 7 15:45:02 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + * config.in: Ditto. + Wed Apr 2 15:06:28 1997 Doug Evans * interp.c (sim_open): New arg `kind'. diff --git a/sim/sh/Makefile.in b/sim/sh/Makefile.in index dfa52aaad42..bedf8342687 100644 --- a/sim/sh/Makefile.in +++ b/sim/sh/Makefile.in @@ -1,5 +1,5 @@ # Makefile template for Configure for the SH sim library. -# Copyright (C) 1990, 1991, 1992, 1995, 1996 Free Software Foundation, Inc. +# Copyright (C) 1990, 91, 92, 95, 96, 1997 Free Software Foundation, Inc. # Written by Cygnus Support. # # This program is free software; you can redistribute it and/or modify @@ -16,10 +16,12 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -SIM_OBJS = interp.o table.o +## COMMON_PRE_CONFIG_FRAG + +SIM_OBJS = interp.o table.o sim-load.o SIM_EXTRA_LIBS = -lm -@COMMON_MAKEFILE_FRAG@ +## COMMON_POST_CONFIG_FRAG interp.o: interp.c code.c table.c diff --git a/sim/sh/interp.c b/sim/sh/interp.c index 09cb4967e0d..f50c76b9cae 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -73,7 +73,9 @@ #define PC pc #define C cycles -extern int target_byte_order; +static SIM_OPEN_KIND sim_kind; +static char *myname; +static int little_endian_p; int fail () @@ -819,7 +821,7 @@ set_static_little_endian (x) static void init_pointers () { - int little_endian = (target_byte_order == 1234); + int little_endian = little_endian_p; set_static_little_endian (little_endian); @@ -897,7 +899,7 @@ sim_resume (sd, step, siggnal) #if defined(__GO32__) || defined(WIN32) register int pollcount = 0; #endif - register int little_endian = target_byte_order == 1234; + register int little_endian = little_endian_p; int tick_start = get_now (); void (*prev) (); @@ -1170,14 +1172,23 @@ sim_set_profile_size (n) } SIM_DESC -sim_open (argv) +sim_open (kind,argv) + SIM_OPEN_KIND kind; char **argv; { - /* FIXME: Better argument checking is needed here. */ - if (argv[1] != NULL) + char **p; + + sim_kind = kind; + myname = argv[0]; + + for (p = argv + 1; *p != NULL; ++p) { - parse_and_set_memory_size (argv[1]); + if (strcmp (*p, "-E") == 0) + little_endian_p = strcmp (*++p, "big") != 0; + else if (isdigit (**p)) + parse_and_set_memory_size (*p); } + /* fudge our descriptor for now */ return (SIM_DESC) 1; } @@ -1203,24 +1214,33 @@ sim_close (sd, quitting) /* nothing to do */ } -int -sim_load (sd, prog, from_tty) +SIM_RC +sim_load (sd, prog, abfd, from_tty) SIM_DESC sd; char *prog; + bfd *abfd; int from_tty; { - /* Return nonzero so GDB will handle it. */ - return 1; + extern bfd *sim_load_file (); /* ??? Don't know where this should live. */ + bfd *prog_bfd; + + prog_bfd = sim_load_file (sd, myname, callback, prog, abfd, + sim_kind == SIM_OPEN_DEBUG); + if (prog_bfd == NULL) + return SIM_RC_FAIL; + saved_state.asregs.pc = bfd_get_start_address (prog_bfd); + if (abfd == NULL) + bfd_close (prog_bfd); + return SIM_RC_OK; } -void -sim_create_inferior (sd, start_address, argv, env) +SIM_RC +sim_create_inferior (sd, argv, env) SIM_DESC sd; - SIM_ADDR start_address; char **argv; char **env; { - saved_state.asregs.pc = start_address; + return SIM_RC_OK; } void @@ -1236,20 +1256,28 @@ sim_do_command (sd, cmd) char *cmd; { char *sms_cmd = "set-memory-size"; + int cmdsize; - if (strncmp (cmd, sms_cmd, strlen (sms_cmd)) == 0 - && strchr (" ", cmd[strlen(sms_cmd)])) - parse_and_set_memory_size (cmd + strlen(sms_cmd) + 1); + if (cmd == NULL || *cmd == '\0') + { + cmd = "help"; + } + cmdsize = strlen (sms_cmd); + if (strncmp (cmd, sms_cmd, cmdsize) == 0 && strchr (" \t", cmd[cmdsize]) != NULL) + { + parse_and_set_memory_size (cmd + cmdsize + 1); + } else if (strcmp (cmd, "help") == 0) { - callback->printf_filtered (callback, "List of SH simulator commands:\n\n"); - callback->printf_filtered (callback, "set-memory-size -- Set the number of address bits to use\n"); - callback->printf_filtered (callback, "\n"); + (callback->printf_filtered) (callback, "List of SH simulator commands:\n\n"); + (callback->printf_filtered) (callback, "set-memory-size -- Set the number of address bits to use\n"); + (callback->printf_filtered) (callback, "\n"); } else - fprintf (stderr, "Error: \"%s\" is not a valid SH simulator command.\n", - cmd); + { + (callback->printf_filtered) (callback, "Error: \"%s\" is not a valid SH simulator command.\n", cmd); + } } void