Updated copyright notices for most files.
[deliverable/binutils-gdb.git] / sim / common / run.c
index 2c98df87caae4264dbf0ab3c20833ba2a591e636..f2b6fb041bca6ba39dd0893456218d5283060495 100644 (file)
@@ -1,25 +1,27 @@
 /* run front end support for all the simulators.
-   Copyright (C) 1992, 93-96, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+   2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 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 this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Steve Chamberlain sac@cygnus.com,
    and others at Cygnus.  */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include "cconfig.h"
 #include "tconfig.h"
+#endif
 
 #include <signal.h>
 #include <stdio.h>
@@ -43,11 +45,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "libiberty.h"
 #include "bfd.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
 #include "ansidecl.h"
-
-#include "../libiberty/alloca-conf.h"
+#include "run-sim.h"
 
 static void usage PARAMS ((void));
 extern int optind;
@@ -60,8 +61,8 @@ static char *myname;
 extern int getopt ();
 
 #ifdef NEED_UI_LOOP_HOOK
-/* Gdb foolery. This is only needed for gdb using a gui. */
-int (*ui_loop_hook) PARAMS ((int signo));
+/* Gdb foolery. This is only needed for gdb using a gui.  */
+int (*deprecated_ui_loop_hook) PARAMS ((int signo));
 #endif
 
 static SIM_DESC sd;
@@ -109,18 +110,18 @@ main (ac, av)
 
   /* FIXME: This is currently being migrated into sim_open.
      Simulators that use functions such as sim_size() still require
-     this. */
+     this.  */
   default_callback.init (&default_callback);
   sim_set_callbacks (&default_callback);
 
+#ifdef SIM_TARGET_SWITCHES
+  ac = sim_target_parse_command_line (ac, av);
+#endif
+
   /* FIXME: This is currently being rewritten to have each simulator
      do all argv processing.  */
 
-#ifdef SIM_H8300 /* FIXME: quick hack */
-  while ((i = getopt (ac, av, "a:c:m:op:s:htv")) != EOF) 
-#else
-  while ((i = getopt (ac, av, "a:c:m:op:s:tv")) != EOF) 
-#endif
+  while ((i = getopt (ac, av, "a:c:m:op:s:tv")) != EOF)
     switch (i)
       {
       case 'a':
@@ -150,10 +151,10 @@ main (ac, av)
 #ifdef SIM_HAVE_ENVIRONMENT
       case 'o':
        /* Operating enironment where any signals are delivered to the
-           target. */
+           target.  */
        operating_p = 1;
        break;
-#endif SIM_HAVE_ENVIRONMENT
+#endif
 #ifdef SIM_HAVE_PROFILE
       case 'p':
        sim_set_profile (atoi (optarg));
@@ -173,11 +174,6 @@ main (ac, av)
        /* sim_set_verbose (1); */
        break;
        /* FIXME: Quick hack, to be replaced by more general facility.  */
-#ifdef SIM_H8300
-      case 'h':
-       set_h8300h (1);
-       break;
-#endif
       default:
        usage ();
       }
@@ -196,9 +192,9 @@ main (ac, av)
     }
 
   abfd = bfd_openr (name, 0);
-  if (!abfd) 
+  if (!abfd)
     {
-      fprintf (stderr, "%s: can't open %s: %s\n", 
+      fprintf (stderr, "%s: can't open %s: %s\n",
               myname, name, bfd_errmsg (bfd_get_error ()));
       exit (1);
     }
@@ -225,7 +221,7 @@ main (ac, av)
 #endif
 
   /* Ensure that any run-time initialisation that needs to be
-     performed by the simulator can occur. */
+     performed by the simulator can occur.  */
   sd = sim_open (SIM_OPEN_STANDALONE, &default_callback, abfd, sim_argv);
   if (sd == 0)
     exit (1);
@@ -239,7 +235,7 @@ main (ac, av)
 #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. */
+     sim_stop_reason() can be used to determine any stop reason.  */
   if (trace)
     sim_set_trace ();
   sigrc = 0;
@@ -282,30 +278,24 @@ main (ac, av)
      the signal that the simulator received; we want to return that to
      indicate failure.  */
 
-#ifdef SIM_H8300 /* FIXME: Ugh.  grep for SLEEP in compile.c  */
-  if (sigrc == SIGILL)
-    abort ();
-  sigrc = 0;
-#else
   /* Why did we stop? */
   switch (reason)
     {
     case sim_signalled:
     case sim_stopped:
       if (sigrc != 0)
-        fprintf (stderr, "program stopped with signal %d.\n", sigrc);
+       fprintf (stderr, "program stopped with signal %d.\n", sigrc);
       break;
 
     case sim_exited:
       break;
 
     case sim_running:
-    case sim_polling: /* these indicate a serious problem */
+    case sim_polling: /* These indicate a serious problem.  */
       abort ();
       break;
 
     }
-#endif
 
   return sigrc;
 }
@@ -318,9 +308,6 @@ usage ()
   fprintf (stderr, "-a args         Pass `args' to simulator.\n");
 #ifdef SIM_HAVE_SIMCACHE
   fprintf (stderr, "-c size         Set simulator cache size to `size'.\n");
-#endif
-#ifdef SIM_H8300
-  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
@@ -336,5 +323,9 @@ usage ()
   fprintf (stderr, "\n");
   fprintf (stderr, "program args    Arguments to pass to simulated program.\n");
   fprintf (stderr, "                Note: Very few simulators support this.\n");
+#ifdef SIM_TARGET_SWITCHES
+  fprintf (stderr, "\nTarget specific options:\n");
+  sim_target_display_usage ();
+#endif
   exit (1);
 }
This page took 0.02557 seconds and 4 git commands to generate.