]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/mcore/interp.c
sim/mcore/interp.c: Include "unistd.h".
[thirdparty/binutils-gdb.git] / sim / mcore / interp.c
index 5a4ccc28811e599cdb261f4a3b16c44345e419cc..7e2be0d3ff51e94e94843ec711a718d45dbeb7fd 100644 (file)
@@ -1,6 +1,5 @@
 /* Simulator for Motorola's MCore processor
-   Copyright (C) 1999-2000, 2002-2003, 2007-2012 Free Software
-   Foundation, Inc.
+   Copyright (C) 1999-2015 Free Software Foundation, Inc.
    Contributed by Cygnus Solutions.
 
 This file is part of GDB, the GNU debugger.
@@ -18,11 +17,13 @@ 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, see <http://www.gnu.org/licenses/>.  */
 
+#include "config.h"
 #include <signal.h>
 #include "sysdep.h"
 #include <sys/times.h>
 #include <sys/param.h>
 #include <netinet/in.h>        /* for byte ordering macros */
+#include <unistd.h>
 #include "bfd.h"
 #include "gdb/callback.h"
 #include "libiberty.h"
@@ -472,12 +473,6 @@ set_initial_gprs ()
   cpu.gr[PARM4] = cpu.gr[0];
 }
 
-static void
-interrupt ()
-{
-  cpu.asregs.exception = SIGINT;
-}
-
 /* Functions so that trapped open/close don't interfere with the
    parent's functions.  We say that we can't close the descriptors
    that we didn't open.  exit() and cleanup() get in trouble here,
@@ -762,7 +757,6 @@ sim_resume (sd, step, siggnal)
   word ibuf;
   word pc;
   unsigned short inst;
-  void (* sigsave)();
   int memops;
   int bonus_cycles;
   int insts;
@@ -770,7 +764,6 @@ sim_resume (sd, step, siggnal)
   int cycs;
   word WLhash;
 
-  sigsave = signal (SIGINT, interrupt);
   cpu.asregs.exception = step ? SIGTRAP: 0;
   pc = cpu.asregs.pc;
 
@@ -1709,8 +1702,6 @@ sim_resume (sd, step, siggnal)
   cpu.asregs.cycles += insts;          /* and each takes a cycle */
   cpu.asregs.cycles += bonus_cycles;   /* and extra cycles for branches */
   cpu.asregs.cycles += memops * memcycles;     /* and memop cycle delays */
-  
-  signal (SIGINT, sigsave);
 }
 
 
@@ -1932,7 +1923,7 @@ sim_close (sd, quitting)
 SIM_RC
 sim_load (sd, prog, abfd, from_tty)
      SIM_DESC sd;
-     char * prog;
+     const char * prog;
      bfd * abfd;
      int from_tty;
 {
@@ -2140,7 +2131,7 @@ sim_kill (sd)
 void
 sim_do_command (sd, cmd)
      SIM_DESC sd;
-     char * cmd;
+     const char *cmd;
 {
   /* Nothing there yet; it's all an error.  */
   
@@ -2153,6 +2144,7 @@ sim_do_command (sd, cmd)
          if ((simargv[1] == NULL) || (simargv[2] == NULL))
            {
              fprintf (stderr, "Error: missing argument to watch cmd.\n");
+             freeargv (simargv);
              return;
            }
          
@@ -2197,6 +2189,8 @@ sim_do_command (sd, cmd)
          fprintf (stderr,"Error: \"%s\" is not a valid M.CORE simulator command.\n",
                   cmd);
        }
+
+      freeargv (simargv);
     }
   else
     {