Change inferior thread list to be a thread map
[deliverable/binutils-gdb.git] / sim / ppc / main.c
index 091486b713c4de03397e9cf9c9b17b486a055f0b..667c02f2d43ab36b225f62a33e064d3a0141f922 100644 (file)
@@ -1,10 +1,10 @@
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
+    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
 
     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 of the License, or
+    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,
@@ -13,8 +13,7 @@
     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.
+    along with this program; if not, see <http://www.gnu.org/licenses/>.
  
     */
 
 #include "device.h" /* FIXME: psim should provide the interface */
 #include "events.h" /* FIXME: psim should provide the interface */
 
+#include "bfd.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
+
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
@@ -59,6 +62,12 @@ extern char **environ;
 static psim *simulation = NULL;
 
 
+void
+sim_io_poll_quit (void)
+{
+  /* nothing to do */
+}
+
 void
 sim_io_printf_filtered(const char *msg, ...)
 {
@@ -69,7 +78,7 @@ sim_io_printf_filtered(const char *msg, ...)
 }
 
 void
-error (char *msg, ...)
+error (const char *msg, ...)
 {
   va_list ap;
   va_start(ap, msg);
@@ -216,23 +225,33 @@ sim_io_flush_stdoutput(void)
   }
 }
 
+void
+sim_io_error (SIM_DESC sd, const char *msg, ...)
+{
+  va_list ap;
+  va_start(ap, msg);
+  vprintf(msg, ap);
+  printf("\n");
+  va_end(ap);
+
+  /* any final clean up */
+  if (ppc_trace[trace_print_info] && simulation != NULL)
+    psim_print_info (simulation, ppc_trace[trace_print_info]);
+
+  exit (1);
+}
+
 
 void *
 zalloc(long size)
 {
   void *memory = malloc(size);
   if (memory == NULL)
-    error("zmalloc failed\n");
+    error("zalloc failed\n");
   memset(memory, 0, size);
   return memory;
 }
 
-void
-zfree(void *chunk)
-{
-  free(chunk);
-}
-
 /* When a CNTRL-C occures, queue an event to shut down the simulation */
 
 static RETSIGTYPE
@@ -251,13 +270,13 @@ main(int argc, char **argv)
   device *root = psim_tree();
 
   /* parse the arguments */
-  argv = psim_options(root, argv + 1);
+  argv = psim_options (root, argv + 1, SIM_OPEN_STANDALONE);
   if (argv[0] == NULL) {
     if (ppc_trace[trace_opts]) {
       print_options ();
       return 0;
     } else {
-      psim_usage(0);
+      psim_usage (0, 0, SIM_OPEN_STANDALONE);
     }
   }
   name_of_file = argv[0];
@@ -293,7 +312,7 @@ main(int argc, char **argv)
   status = psim_get_status(simulation);
   switch (status.reason) {
   case was_continuing:
-    error("psim: continuing while stoped!\n");
+    error("psim: continuing while stopped!\n");
     return 0;
   case was_trap:
     error("psim: no trap insn\n");
This page took 0.02537 seconds and 4 git commands to generate.