From 6d8e15cbaff612c1fe4c4e878fcd2e6c2ccf1abe Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Tue, 21 Nov 1995 01:44:50 +0000 Subject: [PATCH] * run.c: Include "getopt.h". (verbose): Delete. (usage): Make static. (main): Call arm_sim_set_verbosity. Only load sections marked SEC_LOAD. * wrapper.c (mem_size, verbosity): New static global. (arm_sim_set_mem_size): Renamed from sim_size. Callers updated (arm_sim_set_profile{,_size}): Renamed from sim_foo. Callers updated. --- sim/arm/ChangeLog | 31 +++++++++++++++++++++++++++++++ sim/arm/run.c | 49 ++++++++++++++++++++++++++----------------------- 2 files changed, 57 insertions(+), 23 deletions(-) diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index 41f7032..4d18569 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,34 @@ +Mon Nov 20 17:40:38 1995 Doug Evans + + * run.c: Include "getopt.h". + (verbose): Delete. + (usage): Make static. + (main): Call arm_sim_set_verbosity. + Only load sections marked SEC_LOAD. + * wrapper.c (mem_size, verbosity): New static global. + (arm_sim_set_mem_size): Renamed from sim_size. + Callers updated + (arm_sim_set_profile{,_size}): Renamed from sim_foo. Callers updated. + +Fri Nov 17 19:35:11 1995 Doug Evans + + * armdefs.h (ARMul_State): New member `verbose'. + * armrdi.c (ARMul_ConsolePrint): Add missing va_end. + * run.c (verbose): Make global. + * wrapper.c (init): Set state->verbose. + (ARMul_ConsolePrint): Don't print anything if !verbose. + +Fri Oct 13 15:30:30 1995 Doug Evans + + * armos.c: #include dbg_rdi.h. + (ARMul_OSHandleSWI): Handle SWI_Breakpoint. + * armos.h (SWI_Breakpoint): Define. + * wrapper.c: #include armemu.h, dbg_rdi.h. + (rc): Delete. + (sim_resume): Use state->EndCondition to record stop state. + Call FLUSHPIPE before returning. + (sim_stop_reason): Determine reason from state->EndCondition. + Fri Oct 13 15:04:05 1995 steve chamberlain * wrapper.c (sim_set_callbacks): New. diff --git a/sim/arm/run.c b/sim/arm/run.c index 1d7bd46..556bafe 100644 --- a/sim/arm/run.c +++ b/sim/arm/run.c @@ -14,9 +14,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Steve Chamberlain sac@cygnus.com */ @@ -24,13 +23,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ #include #include #include "bfd.h" +#include "getopt.h" #include "remote-sim.h" -void usage(); -extern int optind; -extern char *optarg; +static void usage(); -int verbose = 0; int target_byte_order; int @@ -43,25 +40,27 @@ main (ac, av) asection *s; int i; int trace = 0; - char *name = ""; + int verbose = 0; + char *name; while ((i = getopt (ac, av, "m:p:s:tv")) != EOF) switch (i) { case 'm': - sim_size (atoi (optarg)); + arm_sim_set_mem_size (atoi (optarg)); break; - case 'p': - sim_set_profile (atoi (optarg)); + case 'p': /* FIXME: unused */ + arm_sim_set_profile (atoi (optarg)); break; - case 's': - sim_set_profile_size (atoi (optarg)); + case 's': /* FIXME: unused */ + arm_sim_set_profile_size (atoi (optarg)); break; case 't': trace = 1; break; case 'v': verbose = 1; + arm_sim_set_verbosity (1); break; default: usage(); @@ -78,21 +77,25 @@ main (ac, av) { printf ("run %s\n", name); } + abfd = bfd_openr (name, 0); if (abfd) { if (bfd_check_format (abfd, bfd_object)) { - for (s = abfd->sections; s; s = s->next) { - unsigned char *buffer = malloc (bfd_section_size (abfd, s)); - bfd_get_section_contents (abfd, - s, - buffer, - 0, - bfd_section_size (abfd, s)); - sim_write (s->vma, buffer, bfd_section_size (abfd, s)); + if (s->flags & SEC_LOAD) + { + unsigned char *buffer = malloc (bfd_section_size (abfd, s)); + bfd_get_section_contents (abfd, + s, + buffer, + 0, + bfd_section_size (abfd, s)); + sim_write (s->vma, buffer, bfd_section_size (abfd, s)); + free (buffer); + } } start_address = bfd_get_start_address (abfd); @@ -117,19 +120,19 @@ main (ac, av) /* Assume we left through the exit system call, in which case r0 has the exit code */ + /* FIXME: byte order dependent? */ { unsigned char b[4]; sim_fetch_register (0, b); return b[0]; } - } } return 1; } -void +static void usage() { fprintf (stderr, "usage: run [-tv] program\n"); -- 2.7.4