OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gdb/] [gdb-6.8/] [gdb-6.8.openrisc-2.1/] [sim/] [common/] [sim-signal.c] - Diff between revs 24 and 33

Only display areas with differences | Details | Blame | View Log

Rev 24 Rev 33
/* Simulator signal support
/* Simulator signal support
   Copyright (C) 1997, 2007, 2008 Free Software Foundation, Inc.
   Copyright (C) 1997, 2007, 2008 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 3 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
(at your option) 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
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
#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 SIGFPE
#ifdef SIGFPE
      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
}
}
 
 
enum target_signal
enum target_signal
sim_signal_to_target (SIM_DESC sd, SIM_SIGNAL sig)
sim_signal_to_target (SIM_DESC sd, SIM_SIGNAL sig)
{
{
  switch (sig)
  switch (sig)
    {
    {
    case SIM_SIGINT :
    case SIM_SIGINT :
      return TARGET_SIGNAL_INT;
      return TARGET_SIGNAL_INT;
 
 
    case SIM_SIGABRT :
    case SIM_SIGABRT :
      return TARGET_SIGNAL_ABRT;
      return TARGET_SIGNAL_ABRT;
 
 
    case SIM_SIGILL :
    case SIM_SIGILL :
      return TARGET_SIGNAL_ILL;
      return TARGET_SIGNAL_ILL;
 
 
    case SIM_SIGTRAP :
    case SIM_SIGTRAP :
      return TARGET_SIGNAL_TRAP;
      return TARGET_SIGNAL_TRAP;
 
 
    case SIM_SIGBUS :
    case SIM_SIGBUS :
      return TARGET_SIGNAL_BUS;
      return TARGET_SIGNAL_BUS;
 
 
    case SIM_SIGSEGV :
    case SIM_SIGSEGV :
      return TARGET_SIGNAL_SEGV;
      return TARGET_SIGNAL_SEGV;
 
 
    case SIM_SIGXCPU :
    case SIM_SIGXCPU :
      return TARGET_SIGNAL_XCPU;
      return TARGET_SIGNAL_XCPU;
 
 
    case SIM_SIGFPE:
    case SIM_SIGFPE:
      return TARGET_SIGNAL_FPE;
      return TARGET_SIGNAL_FPE;
      break;
      break;
 
 
    case SIM_SIGNONE:
    case SIM_SIGNONE:
      return TARGET_SIGNAL_0;
      return TARGET_SIGNAL_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);
  return TARGET_SIGNAL_HUP;
  return TARGET_SIGNAL_HUP;
}
}
 
 

powered by: WebSVN 2.1.0

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