OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [VER_5_3/] [gdb-5.3/] [sim/] [common/] [sim-signal.c] - Diff between revs 1182 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 1182 Rev 1765
/* Simulator signal support
/* Simulator signal support
   Copyright (C) 1997 Free Software Foundation, Inc.
   Copyright (C) 1997 Free Software Foundation, Inc.
   Contributed by Cygnus Support
   Contributed by Cygnus Support
 
 
This file is part of the GNU Simulators.
This file is part of the GNU Simulators.
 
 
This program is free software; you can redistribute it and/or modify
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
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
any later version.
 
 
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
GNU General Public License for more details.
 
 
You should have received a copy of the GNU General Public License along
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.,
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 
#include <signal.h>
#include <signal.h>
#include "sim-main.h"
#include "sim-main.h"
 
 
/* Convert SIM_SIGFOO to SIGFOO.
/* Convert SIM_SIGFOO to SIGFOO.
   What to do when the host doesn't have SIGFOO is handled on a case by case
   What to do when the host doesn't have SIGFOO is handled on a case by case
   basis.  Generally, in the case of passing a value back to gdb, we want gdb
   basis.  Generally, in the case of passing a value back to gdb, we want gdb
   to not think the process has died (so it can be debugged at the point of
   to not think the process has died (so it can be debugged at the point of
   failure).  */
   failure).  */
 
 
#ifdef _MSC_VER
#ifdef _MSC_VER
#ifndef SIGTRAP
#ifndef SIGTRAP
#define SIGTRAP 5
#define SIGTRAP 5
#endif
#endif
#ifndef SIGBUS
#ifndef SIGBUS
#define SIGBUS 10
#define SIGBUS 10
#endif
#endif
#ifndef SIGQUIT
#ifndef SIGQUIT
#define SIGQUIT 3
#define SIGQUIT 3
#endif
#endif
#endif
#endif
 
 
int
int
sim_signal_to_host (SIM_DESC sd, SIM_SIGNAL sig)
sim_signal_to_host (SIM_DESC sd, SIM_SIGNAL sig)
{
{
  switch (sig)
  switch (sig)
    {
    {
    case SIM_SIGINT :
    case SIM_SIGINT :
      return SIGINT;
      return SIGINT;
 
 
    case SIM_SIGABRT :
    case SIM_SIGABRT :
      return SIGABRT;
      return SIGABRT;
 
 
    case SIM_SIGILL :
    case SIM_SIGILL :
#ifdef SIGILL
#ifdef SIGILL
      return SIGILL;
      return SIGILL;
#else
#else
      return SIGSEGV;
      return SIGSEGV;
#endif
#endif
 
 
    case SIM_SIGTRAP :
    case SIM_SIGTRAP :
      return SIGTRAP;
      return SIGTRAP;
 
 
    case SIM_SIGBUS :
    case SIM_SIGBUS :
#ifdef SIGBUS
#ifdef SIGBUS
      return SIGBUS;
      return SIGBUS;
#else
#else
      return SIGSEGV;
      return SIGSEGV;
#endif
#endif
 
 
    case SIM_SIGSEGV :
    case SIM_SIGSEGV :
      return SIGSEGV;
      return SIGSEGV;
 
 
    case SIM_SIGXCPU :
    case SIM_SIGXCPU :
#ifdef SIGXCPU
#ifdef SIGXCPU
      return SIGXCPU;
      return SIGXCPU;
#endif
#endif
      break;
      break;
 
 
    case SIM_SIGFPE:
    case SIM_SIGFPE:
#ifdef SIGXCPU
#ifdef SIGXCPU
      return SIGFPE;
      return SIGFPE;
#endif
#endif
      break;
      break;
 
 
    case SIM_SIGNONE:
    case SIM_SIGNONE:
      return 0;
      return 0;
      break;
      break;
    }
    }
 
 
  sim_io_eprintf (sd, "sim_signal_to_host: unknown signal: %d\n", sig);
  sim_io_eprintf (sd, "sim_signal_to_host: unknown signal: %d\n", sig);
#ifdef SIGHUP
#ifdef SIGHUP
  return SIGHUP;  /* FIXME: Suggestions?  */
  return SIGHUP;  /* FIXME: Suggestions?  */
#else
#else
  return 1;
  return 1;
#endif
#endif
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.