When SIM_HAVE_ENVIRONMENT: use sim_set_trace() to enable tracing
authorAndrew Cagney <cagney@redhat.com>
Tue, 22 Feb 2000 08:52:21 +0000 (08:52 +0000)
committerAndrew Cagney <cagney@redhat.com>
Tue, 22 Feb 2000 08:52:21 +0000 (08:52 +0000)
instead of sim_trace() to run the program; include support for ``-o''
option (operating environment); when a signal occurs, only continue
execution when operating environment mode.
Update d10v.

include/ChangeLog
include/remote-sim.h
sim/common/ChangeLog
sim/common/run.c
sim/d10v/ChangeLog
sim/d10v/Makefile.in
sim/d10v/interp.c
sim/testsuite/d10v-elf/ChangeLog
sim/testsuite/d10v-elf/Makefile.in

index f377d21f0cd3842196621aeb62f6f06d120b534b..bd9ba9a545b542713502630c328e42e842b7527d 100644 (file)
@@ -1,3 +1,8 @@
+Tue Feb 22 15:19:54 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * remote-sim.h (sim_trace): Document return values.
+       (sim_set_trace): Declare.  Deprecate.
+
 2000-02-21  Alan Modra  <alan@spri.levels.unisa.edu.au>
 
        * dis-asm.h (struct disassemble_info): Change `length' param of
index a8eb9238280b5d49ce8fb7930a99cf1a9e76dd99..b32f93fddcad88d4ddcbb2e6077a525183bd11ed 100644 (file)
@@ -308,15 +308,27 @@ void sim_set_callbacks PARAMS ((struct host_callback_struct *));
 void sim_size PARAMS ((int i));
 
 
-/* Run a simulation with tracing enabled.
+/* Single-step simulator with tracing enabled.
    THIS PROCEDURE IS DEPRECIATED.
+   THIS PROCEDURE IS EVEN MORE DEPRECATED THAN SIM_SET_TRACE
    GDB and NRUN do not use this interface.
-   This procedure does not take a SIM_DESC argument as it is
-   used before sim_open. */
+   This procedure returns: ``0'' indicating that the simulator should
+   be continued using sim_trace() calls; ``1'' indicating that the
+   simulation has finished. */
 
 int sim_trace PARAMS ((SIM_DESC sd));
 
 
+/* Enable tracing.
+   THIS PROCEDURE IS DEPRECIATED.
+   GDB and NRUN do not use this interface.
+   This procedure returns: ``0'' indicating that the simulator should
+   be continued using sim_trace() calls; ``1'' indicating that the
+   simulation has finished. */
+
+void sim_set_trace PARAMS ((void));
+
+
 /* Configure the size of the profile buffer.
    THIS PROCEDURE IS DEPRECIATED.
    GDB and NRUN do not use this interface.
index 9aeba034293134e3a06cced9d494c7882f3fddd6..1273e8353d4f5ca94e4149421afb55a657f941de 100644 (file)
@@ -1,3 +1,12 @@
+Tue Feb 22 16:45:09 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * run.c (main): When SIM_HAVE_ENVIRONMENT enable tracing with
+       sim_set_trace and run simulator using sim_resume.
+       (main): Add option ``-o'' - operating environment.  Only continue
+       after a signal when operating environment.
+       (main): Always set REASON and SIGRC using sim_stop_reason.
+       (sim_trace): Delete extern declaration.
+
 2000-02-08  Nick Clifton  <nickc@cygnus.com>
 
        * callback.c: Fix compile time warning messages.
index 1a4e96908f11686d361c6888374454d4a714fcc4..d23b5a0152e4d1f621be7d44a21ecb4655012605 100644 (file)
@@ -57,9 +57,6 @@ extern host_callback default_callback;
 
 static char *myname;
 
-/* NOTE: sim_size() and sim_trace() are going away */
-extern int sim_trace PARAMS ((SIM_DESC sd));
-
 extern int getopt ();
 
 #ifdef NEED_UI_LOOP_HOOK
@@ -89,6 +86,9 @@ main (ac, av)
   int i;
   int verbose = 0;
   int trace = 0;
+#ifdef SIM_HAVE_ENVIRONMENT
+  int operating_p = 0;
+#endif
   char *name;
   static char *no_args[4];
   char **sim_argv = &no_args[0];
@@ -117,9 +117,9 @@ main (ac, av)
      do all argv processing.  */
 
 #ifdef SIM_H8300 /* FIXME: quick hack */
-  while ((i = getopt (ac, av, "a:c:m:p:s:htv")) != EOF) 
+  while ((i = getopt (ac, av, "a:c:m:op:s:htv")) != EOF) 
 #else
-  while ((i = getopt (ac, av, "a:c:m:p:s:tv")) != EOF) 
+  while ((i = getopt (ac, av, "a:c:m:op:s:tv")) != EOF) 
 #endif
     switch (i)
       {
@@ -147,6 +147,13 @@ main (ac, av)
        /* FIXME: Rename to sim_set_mem_size.  */
        sim_size (atoi (optarg));
        break;
+#ifdef SIM_HAVE_ENVIRONMENT
+      case 'o':
+       /* Operating enironment where any signals are delivered to the
+           target. */
+       operating_p = 1;
+       break;
+#endif SIM_HAVE_ENVIRONMENT
 #ifdef SIM_HAVE_PROFILE
       case 'p':
        sim_set_profile (atoi (optarg));
@@ -157,8 +164,6 @@ main (ac, av)
 #endif
       case 't':
        trace = 1;
-       /* FIXME: need to allow specification of what to trace.  */
-       /* sim_set_trace (1); */
        break;
       case 'v':
        /* Things that are printed with -v are the kinds of things that
@@ -231,6 +236,21 @@ main (ac, av)
   if (sim_create_inferior (sd, abfd, prog_args, NULL) == SIM_RC_FAIL)
     exit (1);
 
+#ifdef SIM_HAVE_ENVIRONMENT
+  /* NOTE: An old simulator supporting the operating environment MUST
+     provide sim_set_trace() and not sim_trace(). That way
+     sim_stop_reason() can be used to determine any stop reason. */
+  if (trace)
+    sim_set_trace ();
+  do
+    {
+      prev_sigint = signal (SIGINT, cntrl_c);
+      sim_resume (sd, 0, sigrc);
+      signal (SIGINT, prev_sigint);
+      sim_stop_reason (sd, &reason, &sigrc);
+    }
+  while (operating_p && reason == sim_stopped && sigrc != SIGINT);
+#else
   if (trace)
     {
       int done = 0;
@@ -240,18 +260,16 @@ main (ac, av)
          done = sim_trace (sd);
        }
       signal (SIGINT, prev_sigint);
+      sim_stop_reason (sd, &reason, &sigrc);
     }
   else
     {
-      do
-       {
-         prev_sigint = signal (SIGINT, cntrl_c);
-         sim_resume (sd, 0, sigrc);
-         signal (SIGINT, prev_sigint);
-         sim_stop_reason (sd, &reason, &sigrc);
-       }
-      while (reason == sim_stopped && sigrc != SIGINT);
+      prev_sigint = signal (SIGINT, cntrl_c);
+      sim_resume (sd, 0, sigrc);
+      signal (SIGINT, prev_sigint);
+      sim_stop_reason (sd, &reason, &sigrc);
     }
+#endif
 
   if (verbose)
     sim_info (sd, 0);
@@ -303,6 +321,9 @@ usage ()
   fprintf (stderr, "-h              Executable is for h8/300h or h8/300s.\n");
 #endif
   fprintf (stderr, "-m size         Set memory size of simulator, in bytes.\n");
+#ifdef SIM_HAVE_ENVIRONMENT
+  fprintf (stderr, "-o              Select operating (kernel) environment.\n");
+#endif
 #ifdef SIM_HAVE_PROFILE
   fprintf (stderr, "-p freq         Set profiling frequency.\n");
   fprintf (stderr, "-s size         Set profiling size.\n");
index a497981325279b81c23289d39385efa1b63f501c..232716636a14f88e0dcd26296fd7c390cc9cf6eb 100644 (file)
@@ -1,3 +1,8 @@
+Tue Feb 22 18:24:56 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * Makefile.in (SIM_EXTRA_CFLAGS): Define SIM_HAVE_ENVIRONMENT.
+       * interp.c (sim_set_trace): Replace sim_trace.  Enable tracing.
+
 Mon Jan  3 02:06:07 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * interp.c (lookup_hash): Stop the update of the PC when there was
index 602ffff0c99becc3530a65bbe0689a55244d4494..8ed219f013830d4530144a902950db248199c5c0 100644 (file)
@@ -20,7 +20,7 @@
 
 SIM_OBJS = interp.o table.o simops.o endian.o sim-load.o
 SIM_EXTRA_CLEAN = clean-extra
-SIM_EXTRA_CFLAGS = -DNEED_UI_LOOP_HOOK
+SIM_EXTRA_CFLAGS = -DNEED_UI_LOOP_HOOK -DSIM_HAVE_ENVIRONMENT
 
 INCLUDE = d10v_sim.h $(srcroot)/include/callback.h targ-vals.h endian.c
 
index 80898ab44efd3cabc06fa951d5ecb6b3b4f03f68..91ebee56ce99ed93cddd8b950d339299a686697c 100644 (file)
@@ -1072,20 +1072,12 @@ sim_resume (sd, step, siggnal)
     State.exception = SIGTRAP;
 }
 
-int
-sim_trace (sd)
-     SIM_DESC sd;
+void
+sim_set_trace (void)
 {
-  enum sim_stop reason;
-  static int sigrc = 0;
 #ifdef DEBUG
   d10v_debug = DEBUG;
 #endif
-  /* NOTE: SIGRC starts with zero and is then, always the value
-     returned by the last sim_stop_reason() call. */
-  sim_resume (sd, 0, sigrc);
-  sim_stop_reason (sd, &reason, &sigrc);
-  return (reason != sim_stopped || sigrc != SIGINT);
 }
 
 void
index 1d73e29f4adcbae0b6627e3aa124696908b2ad20..a7cf211ce367cdbc98540e7d7ece0faef25f3e0c 100644 (file)
@@ -1,3 +1,7 @@
+Tue Feb 22 17:36:34 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * Makefile.in: Force d10v into operating mode.
+
 Mon Jan  3 00:17:28 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * t-ae-ld-d.s, t-ae-ld-i.s, t-ae-ld-id.s, t-ae-ld-im.s ,
index 079f95d4c5496dc5794dc6282e77bbc4c3333281..40e96464eb5ca855b070dad8b3958645e646c348 100644 (file)
@@ -106,6 +106,9 @@ RUN_FOR_TARGET = `\
     echo $(target_alias)-run ; \
   fi`
 
+# Force d10v into operating mode.
+RUNFLAGS_FOR_TARGET=-o
+
 
 check: sanity $(TESTS)
 sanity:
This page took 0.041989 seconds and 4 git commands to generate.