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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [common/] [signals.c] - Diff between revs 227 and 816

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

Rev 227 Rev 816
/* Target signal translation functions for GDB.
/* Target signal translation functions for GDB.
   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
   2000, 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010
   2000, 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010
   Free Software Foundation, Inc.
   Free Software Foundation, Inc.
   Contributed by Cygnus Support.
   Contributed by Cygnus Support.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   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/>.  */
 
 
#ifdef GDBSERVER
#ifdef GDBSERVER
#include "server.h"
#include "server.h"
#else
#else
#include "defs.h"
#include "defs.h"
#include "gdb_string.h"
#include "gdb_string.h"
#endif
#endif
 
 
#ifdef HAVE_SIGNAL_H
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#include <signal.h>
#endif
#endif
 
 
#include "gdb_signals.h"
#include "gdb_signals.h"
 
 
struct gdbarch;
struct gdbarch;
 
 
/* Always use __SIGRTMIN if it's available.  SIGRTMIN is the lowest
/* Always use __SIGRTMIN if it's available.  SIGRTMIN is the lowest
   _available_ realtime signal, not the lowest supported; glibc takes
   _available_ realtime signal, not the lowest supported; glibc takes
   several for its own use.  */
   several for its own use.  */
 
 
#ifndef REALTIME_LO
#ifndef REALTIME_LO
# if defined(__SIGRTMIN)
# if defined(__SIGRTMIN)
#  define REALTIME_LO __SIGRTMIN
#  define REALTIME_LO __SIGRTMIN
#  define REALTIME_HI (__SIGRTMAX + 1)
#  define REALTIME_HI (__SIGRTMAX + 1)
# elif defined(SIGRTMIN)
# elif defined(SIGRTMIN)
#  define REALTIME_LO SIGRTMIN
#  define REALTIME_LO SIGRTMIN
#  define REALTIME_HI (SIGRTMAX + 1)
#  define REALTIME_HI (SIGRTMAX + 1)
# endif
# endif
#endif
#endif
 
 
/* This table must match in order and size the signals in enum target_signal
/* This table must match in order and size the signals in enum target_signal
   in src/include/gdb/signals.h.  */
   in src/include/gdb/signals.h.  */
/* *INDENT-OFF* */
/* *INDENT-OFF* */
static const struct {
static const struct {
  const char *name;
  const char *name;
  const char *string;
  const char *string;
  } signals [] =
  } signals [] =
{
{
  {"0", "Signal 0"},
  {"0", "Signal 0"},
  {"SIGHUP", "Hangup"},
  {"SIGHUP", "Hangup"},
  {"SIGINT", "Interrupt"},
  {"SIGINT", "Interrupt"},
  {"SIGQUIT", "Quit"},
  {"SIGQUIT", "Quit"},
  {"SIGILL", "Illegal instruction"},
  {"SIGILL", "Illegal instruction"},
  {"SIGTRAP", "Trace/breakpoint trap"},
  {"SIGTRAP", "Trace/breakpoint trap"},
  {"SIGABRT", "Aborted"},
  {"SIGABRT", "Aborted"},
  {"SIGEMT", "Emulation trap"},
  {"SIGEMT", "Emulation trap"},
  {"SIGFPE", "Arithmetic exception"},
  {"SIGFPE", "Arithmetic exception"},
  {"SIGKILL", "Killed"},
  {"SIGKILL", "Killed"},
  {"SIGBUS", "Bus error"},
  {"SIGBUS", "Bus error"},
  {"SIGSEGV", "Segmentation fault"},
  {"SIGSEGV", "Segmentation fault"},
  {"SIGSYS", "Bad system call"},
  {"SIGSYS", "Bad system call"},
  {"SIGPIPE", "Broken pipe"},
  {"SIGPIPE", "Broken pipe"},
  {"SIGALRM", "Alarm clock"},
  {"SIGALRM", "Alarm clock"},
  {"SIGTERM", "Terminated"},
  {"SIGTERM", "Terminated"},
  {"SIGURG", "Urgent I/O condition"},
  {"SIGURG", "Urgent I/O condition"},
  {"SIGSTOP", "Stopped (signal)"},
  {"SIGSTOP", "Stopped (signal)"},
  {"SIGTSTP", "Stopped (user)"},
  {"SIGTSTP", "Stopped (user)"},
  {"SIGCONT", "Continued"},
  {"SIGCONT", "Continued"},
  {"SIGCHLD", "Child status changed"},
  {"SIGCHLD", "Child status changed"},
  {"SIGTTIN", "Stopped (tty input)"},
  {"SIGTTIN", "Stopped (tty input)"},
  {"SIGTTOU", "Stopped (tty output)"},
  {"SIGTTOU", "Stopped (tty output)"},
  {"SIGIO", "I/O possible"},
  {"SIGIO", "I/O possible"},
  {"SIGXCPU", "CPU time limit exceeded"},
  {"SIGXCPU", "CPU time limit exceeded"},
  {"SIGXFSZ", "File size limit exceeded"},
  {"SIGXFSZ", "File size limit exceeded"},
  {"SIGVTALRM", "Virtual timer expired"},
  {"SIGVTALRM", "Virtual timer expired"},
  {"SIGPROF", "Profiling timer expired"},
  {"SIGPROF", "Profiling timer expired"},
  {"SIGWINCH", "Window size changed"},
  {"SIGWINCH", "Window size changed"},
  {"SIGLOST", "Resource lost"},
  {"SIGLOST", "Resource lost"},
  {"SIGUSR1", "User defined signal 1"},
  {"SIGUSR1", "User defined signal 1"},
  {"SIGUSR2", "User defined signal 2"},
  {"SIGUSR2", "User defined signal 2"},
  {"SIGPWR", "Power fail/restart"},
  {"SIGPWR", "Power fail/restart"},
  {"SIGPOLL", "Pollable event occurred"},
  {"SIGPOLL", "Pollable event occurred"},
  {"SIGWIND", "SIGWIND"},
  {"SIGWIND", "SIGWIND"},
  {"SIGPHONE", "SIGPHONE"},
  {"SIGPHONE", "SIGPHONE"},
  {"SIGWAITING", "Process's LWPs are blocked"},
  {"SIGWAITING", "Process's LWPs are blocked"},
  {"SIGLWP", "Signal LWP"},
  {"SIGLWP", "Signal LWP"},
  {"SIGDANGER", "Swap space dangerously low"},
  {"SIGDANGER", "Swap space dangerously low"},
  {"SIGGRANT", "Monitor mode granted"},
  {"SIGGRANT", "Monitor mode granted"},
  {"SIGRETRACT", "Need to relinquish monitor mode"},
  {"SIGRETRACT", "Need to relinquish monitor mode"},
  {"SIGMSG", "Monitor mode data available"},
  {"SIGMSG", "Monitor mode data available"},
  {"SIGSOUND", "Sound completed"},
  {"SIGSOUND", "Sound completed"},
  {"SIGSAK", "Secure attention"},
  {"SIGSAK", "Secure attention"},
  {"SIGPRIO", "SIGPRIO"},
  {"SIGPRIO", "SIGPRIO"},
  {"SIG33", "Real-time event 33"},
  {"SIG33", "Real-time event 33"},
  {"SIG34", "Real-time event 34"},
  {"SIG34", "Real-time event 34"},
  {"SIG35", "Real-time event 35"},
  {"SIG35", "Real-time event 35"},
  {"SIG36", "Real-time event 36"},
  {"SIG36", "Real-time event 36"},
  {"SIG37", "Real-time event 37"},
  {"SIG37", "Real-time event 37"},
  {"SIG38", "Real-time event 38"},
  {"SIG38", "Real-time event 38"},
  {"SIG39", "Real-time event 39"},
  {"SIG39", "Real-time event 39"},
  {"SIG40", "Real-time event 40"},
  {"SIG40", "Real-time event 40"},
  {"SIG41", "Real-time event 41"},
  {"SIG41", "Real-time event 41"},
  {"SIG42", "Real-time event 42"},
  {"SIG42", "Real-time event 42"},
  {"SIG43", "Real-time event 43"},
  {"SIG43", "Real-time event 43"},
  {"SIG44", "Real-time event 44"},
  {"SIG44", "Real-time event 44"},
  {"SIG45", "Real-time event 45"},
  {"SIG45", "Real-time event 45"},
  {"SIG46", "Real-time event 46"},
  {"SIG46", "Real-time event 46"},
  {"SIG47", "Real-time event 47"},
  {"SIG47", "Real-time event 47"},
  {"SIG48", "Real-time event 48"},
  {"SIG48", "Real-time event 48"},
  {"SIG49", "Real-time event 49"},
  {"SIG49", "Real-time event 49"},
  {"SIG50", "Real-time event 50"},
  {"SIG50", "Real-time event 50"},
  {"SIG51", "Real-time event 51"},
  {"SIG51", "Real-time event 51"},
  {"SIG52", "Real-time event 52"},
  {"SIG52", "Real-time event 52"},
  {"SIG53", "Real-time event 53"},
  {"SIG53", "Real-time event 53"},
  {"SIG54", "Real-time event 54"},
  {"SIG54", "Real-time event 54"},
  {"SIG55", "Real-time event 55"},
  {"SIG55", "Real-time event 55"},
  {"SIG56", "Real-time event 56"},
  {"SIG56", "Real-time event 56"},
  {"SIG57", "Real-time event 57"},
  {"SIG57", "Real-time event 57"},
  {"SIG58", "Real-time event 58"},
  {"SIG58", "Real-time event 58"},
  {"SIG59", "Real-time event 59"},
  {"SIG59", "Real-time event 59"},
  {"SIG60", "Real-time event 60"},
  {"SIG60", "Real-time event 60"},
  {"SIG61", "Real-time event 61"},
  {"SIG61", "Real-time event 61"},
  {"SIG62", "Real-time event 62"},
  {"SIG62", "Real-time event 62"},
  {"SIG63", "Real-time event 63"},
  {"SIG63", "Real-time event 63"},
  {"SIGCANCEL", "LWP internal signal"},
  {"SIGCANCEL", "LWP internal signal"},
  {"SIG32", "Real-time event 32"},
  {"SIG32", "Real-time event 32"},
  {"SIG64", "Real-time event 64"},
  {"SIG64", "Real-time event 64"},
  {"SIG65", "Real-time event 65"},
  {"SIG65", "Real-time event 65"},
  {"SIG66", "Real-time event 66"},
  {"SIG66", "Real-time event 66"},
  {"SIG67", "Real-time event 67"},
  {"SIG67", "Real-time event 67"},
  {"SIG68", "Real-time event 68"},
  {"SIG68", "Real-time event 68"},
  {"SIG69", "Real-time event 69"},
  {"SIG69", "Real-time event 69"},
  {"SIG70", "Real-time event 70"},
  {"SIG70", "Real-time event 70"},
  {"SIG71", "Real-time event 71"},
  {"SIG71", "Real-time event 71"},
  {"SIG72", "Real-time event 72"},
  {"SIG72", "Real-time event 72"},
  {"SIG73", "Real-time event 73"},
  {"SIG73", "Real-time event 73"},
  {"SIG74", "Real-time event 74"},
  {"SIG74", "Real-time event 74"},
  {"SIG75", "Real-time event 75"},
  {"SIG75", "Real-time event 75"},
  {"SIG76", "Real-time event 76"},
  {"SIG76", "Real-time event 76"},
  {"SIG77", "Real-time event 77"},
  {"SIG77", "Real-time event 77"},
  {"SIG78", "Real-time event 78"},
  {"SIG78", "Real-time event 78"},
  {"SIG79", "Real-time event 79"},
  {"SIG79", "Real-time event 79"},
  {"SIG80", "Real-time event 80"},
  {"SIG80", "Real-time event 80"},
  {"SIG81", "Real-time event 81"},
  {"SIG81", "Real-time event 81"},
  {"SIG82", "Real-time event 82"},
  {"SIG82", "Real-time event 82"},
  {"SIG83", "Real-time event 83"},
  {"SIG83", "Real-time event 83"},
  {"SIG84", "Real-time event 84"},
  {"SIG84", "Real-time event 84"},
  {"SIG85", "Real-time event 85"},
  {"SIG85", "Real-time event 85"},
  {"SIG86", "Real-time event 86"},
  {"SIG86", "Real-time event 86"},
  {"SIG87", "Real-time event 87"},
  {"SIG87", "Real-time event 87"},
  {"SIG88", "Real-time event 88"},
  {"SIG88", "Real-time event 88"},
  {"SIG89", "Real-time event 89"},
  {"SIG89", "Real-time event 89"},
  {"SIG90", "Real-time event 90"},
  {"SIG90", "Real-time event 90"},
  {"SIG91", "Real-time event 91"},
  {"SIG91", "Real-time event 91"},
  {"SIG92", "Real-time event 92"},
  {"SIG92", "Real-time event 92"},
  {"SIG93", "Real-time event 93"},
  {"SIG93", "Real-time event 93"},
  {"SIG94", "Real-time event 94"},
  {"SIG94", "Real-time event 94"},
  {"SIG95", "Real-time event 95"},
  {"SIG95", "Real-time event 95"},
  {"SIG96", "Real-time event 96"},
  {"SIG96", "Real-time event 96"},
  {"SIG97", "Real-time event 97"},
  {"SIG97", "Real-time event 97"},
  {"SIG98", "Real-time event 98"},
  {"SIG98", "Real-time event 98"},
  {"SIG99", "Real-time event 99"},
  {"SIG99", "Real-time event 99"},
  {"SIG100", "Real-time event 100"},
  {"SIG100", "Real-time event 100"},
  {"SIG101", "Real-time event 101"},
  {"SIG101", "Real-time event 101"},
  {"SIG102", "Real-time event 102"},
  {"SIG102", "Real-time event 102"},
  {"SIG103", "Real-time event 103"},
  {"SIG103", "Real-time event 103"},
  {"SIG104", "Real-time event 104"},
  {"SIG104", "Real-time event 104"},
  {"SIG105", "Real-time event 105"},
  {"SIG105", "Real-time event 105"},
  {"SIG106", "Real-time event 106"},
  {"SIG106", "Real-time event 106"},
  {"SIG107", "Real-time event 107"},
  {"SIG107", "Real-time event 107"},
  {"SIG108", "Real-time event 108"},
  {"SIG108", "Real-time event 108"},
  {"SIG109", "Real-time event 109"},
  {"SIG109", "Real-time event 109"},
  {"SIG110", "Real-time event 110"},
  {"SIG110", "Real-time event 110"},
  {"SIG111", "Real-time event 111"},
  {"SIG111", "Real-time event 111"},
  {"SIG112", "Real-time event 112"},
  {"SIG112", "Real-time event 112"},
  {"SIG113", "Real-time event 113"},
  {"SIG113", "Real-time event 113"},
  {"SIG114", "Real-time event 114"},
  {"SIG114", "Real-time event 114"},
  {"SIG115", "Real-time event 115"},
  {"SIG115", "Real-time event 115"},
  {"SIG116", "Real-time event 116"},
  {"SIG116", "Real-time event 116"},
  {"SIG117", "Real-time event 117"},
  {"SIG117", "Real-time event 117"},
  {"SIG118", "Real-time event 118"},
  {"SIG118", "Real-time event 118"},
  {"SIG119", "Real-time event 119"},
  {"SIG119", "Real-time event 119"},
  {"SIG120", "Real-time event 120"},
  {"SIG120", "Real-time event 120"},
  {"SIG121", "Real-time event 121"},
  {"SIG121", "Real-time event 121"},
  {"SIG122", "Real-time event 122"},
  {"SIG122", "Real-time event 122"},
  {"SIG123", "Real-time event 123"},
  {"SIG123", "Real-time event 123"},
  {"SIG124", "Real-time event 124"},
  {"SIG124", "Real-time event 124"},
  {"SIG125", "Real-time event 125"},
  {"SIG125", "Real-time event 125"},
  {"SIG126", "Real-time event 126"},
  {"SIG126", "Real-time event 126"},
  {"SIG127", "Real-time event 127"},
  {"SIG127", "Real-time event 127"},
 
 
  {"SIGINFO", "Information request"},
  {"SIGINFO", "Information request"},
 
 
  {NULL, "Unknown signal"},
  {NULL, "Unknown signal"},
  {NULL, "Internal error: printing TARGET_SIGNAL_DEFAULT"},
  {NULL, "Internal error: printing TARGET_SIGNAL_DEFAULT"},
 
 
  /* Mach exceptions */
  /* Mach exceptions */
  {"EXC_BAD_ACCESS", "Could not access memory"},
  {"EXC_BAD_ACCESS", "Could not access memory"},
  {"EXC_BAD_INSTRUCTION", "Illegal instruction/operand"},
  {"EXC_BAD_INSTRUCTION", "Illegal instruction/operand"},
  {"EXC_ARITHMETIC", "Arithmetic exception"},
  {"EXC_ARITHMETIC", "Arithmetic exception"},
  {"EXC_EMULATION", "Emulation instruction"},
  {"EXC_EMULATION", "Emulation instruction"},
  {"EXC_SOFTWARE", "Software generated exception"},
  {"EXC_SOFTWARE", "Software generated exception"},
  {"EXC_BREAKPOINT", "Breakpoint"},
  {"EXC_BREAKPOINT", "Breakpoint"},
 
 
  /* Last entry, used to check whether the table is the right size.  */
  /* Last entry, used to check whether the table is the right size.  */
  {NULL, "TARGET_SIGNAL_MAGIC"}
  {NULL, "TARGET_SIGNAL_MAGIC"}
};
};
/* *INDENT-ON* */
/* *INDENT-ON* */
 
 
 
 
 
 
/* Return the string for a signal.  */
/* Return the string for a signal.  */
const char *
const char *
target_signal_to_string (enum target_signal sig)
target_signal_to_string (enum target_signal sig)
{
{
  if ((int) sig >= TARGET_SIGNAL_FIRST && (int) sig <= TARGET_SIGNAL_LAST)
  if ((int) sig >= TARGET_SIGNAL_FIRST && (int) sig <= TARGET_SIGNAL_LAST)
    return signals[sig].string;
    return signals[sig].string;
  else
  else
    return signals[TARGET_SIGNAL_UNKNOWN].string;
    return signals[TARGET_SIGNAL_UNKNOWN].string;
}
}
 
 
/* Return the name for a signal.  */
/* Return the name for a signal.  */
const char *
const char *
target_signal_to_name (enum target_signal sig)
target_signal_to_name (enum target_signal sig)
{
{
  if ((int) sig >= TARGET_SIGNAL_FIRST && (int) sig <= TARGET_SIGNAL_LAST
  if ((int) sig >= TARGET_SIGNAL_FIRST && (int) sig <= TARGET_SIGNAL_LAST
      && signals[sig].name != NULL)
      && signals[sig].name != NULL)
    return signals[sig].name;
    return signals[sig].name;
  else
  else
    /* I think the code which prints this will always print it along
    /* I think the code which prints this will always print it along
       with the string, so no need to be verbose (very old comment).  */
       with the string, so no need to be verbose (very old comment).  */
    return "?";
    return "?";
}
}
 
 
/* Given a name, return its signal.  */
/* Given a name, return its signal.  */
enum target_signal
enum target_signal
target_signal_from_name (const char *name)
target_signal_from_name (const char *name)
{
{
  enum target_signal sig;
  enum target_signal sig;
 
 
  /* It's possible we also should allow "SIGCLD" as well as "SIGCHLD"
  /* It's possible we also should allow "SIGCLD" as well as "SIGCHLD"
     for TARGET_SIGNAL_SIGCHLD.  SIGIOT, on the other hand, is more
     for TARGET_SIGNAL_SIGCHLD.  SIGIOT, on the other hand, is more
     questionable; seems like by now people should call it SIGABRT
     questionable; seems like by now people should call it SIGABRT
     instead.  */
     instead.  */
 
 
  /* This ugly cast brought to you by the native VAX compiler.  */
  /* This ugly cast brought to you by the native VAX compiler.  */
  for (sig = TARGET_SIGNAL_HUP;
  for (sig = TARGET_SIGNAL_HUP;
       sig < TARGET_SIGNAL_LAST;
       sig < TARGET_SIGNAL_LAST;
       sig = (enum target_signal) ((int) sig + 1))
       sig = (enum target_signal) ((int) sig + 1))
    if (signals[sig].name != NULL
    if (signals[sig].name != NULL
        && strcmp (name, signals[sig].name) == 0)
        && strcmp (name, signals[sig].name) == 0)
      return sig;
      return sig;
  return TARGET_SIGNAL_UNKNOWN;
  return TARGET_SIGNAL_UNKNOWN;
}
}


/* The following functions are to help certain targets deal
/* The following functions are to help certain targets deal
   with the signal/waitstatus stuff.  They could just as well be in
   with the signal/waitstatus stuff.  They could just as well be in
   a file called native-utils.c or unixwaitstatus-utils.c or whatever.  */
   a file called native-utils.c or unixwaitstatus-utils.c or whatever.  */
 
 
/* Convert host signal to our signals.  */
/* Convert host signal to our signals.  */
enum target_signal
enum target_signal
target_signal_from_host (int hostsig)
target_signal_from_host (int hostsig)
{
{
  /* A switch statement would make sense but would require special kludges
  /* A switch statement would make sense but would require special kludges
     to deal with the cases where more than one signal has the same number.  */
     to deal with the cases where more than one signal has the same number.  */
 
 
  if (hostsig == 0)
  if (hostsig == 0)
    return TARGET_SIGNAL_0;
    return TARGET_SIGNAL_0;
 
 
#if defined (SIGHUP)
#if defined (SIGHUP)
  if (hostsig == SIGHUP)
  if (hostsig == SIGHUP)
    return TARGET_SIGNAL_HUP;
    return TARGET_SIGNAL_HUP;
#endif
#endif
#if defined (SIGINT)
#if defined (SIGINT)
  if (hostsig == SIGINT)
  if (hostsig == SIGINT)
    return TARGET_SIGNAL_INT;
    return TARGET_SIGNAL_INT;
#endif
#endif
#if defined (SIGQUIT)
#if defined (SIGQUIT)
  if (hostsig == SIGQUIT)
  if (hostsig == SIGQUIT)
    return TARGET_SIGNAL_QUIT;
    return TARGET_SIGNAL_QUIT;
#endif
#endif
#if defined (SIGILL)
#if defined (SIGILL)
  if (hostsig == SIGILL)
  if (hostsig == SIGILL)
    return TARGET_SIGNAL_ILL;
    return TARGET_SIGNAL_ILL;
#endif
#endif
#if defined (SIGTRAP)
#if defined (SIGTRAP)
  if (hostsig == SIGTRAP)
  if (hostsig == SIGTRAP)
    return TARGET_SIGNAL_TRAP;
    return TARGET_SIGNAL_TRAP;
#endif
#endif
#if defined (SIGABRT)
#if defined (SIGABRT)
  if (hostsig == SIGABRT)
  if (hostsig == SIGABRT)
    return TARGET_SIGNAL_ABRT;
    return TARGET_SIGNAL_ABRT;
#endif
#endif
#if defined (SIGEMT)
#if defined (SIGEMT)
  if (hostsig == SIGEMT)
  if (hostsig == SIGEMT)
    return TARGET_SIGNAL_EMT;
    return TARGET_SIGNAL_EMT;
#endif
#endif
#if defined (SIGFPE)
#if defined (SIGFPE)
  if (hostsig == SIGFPE)
  if (hostsig == SIGFPE)
    return TARGET_SIGNAL_FPE;
    return TARGET_SIGNAL_FPE;
#endif
#endif
#if defined (SIGKILL)
#if defined (SIGKILL)
  if (hostsig == SIGKILL)
  if (hostsig == SIGKILL)
    return TARGET_SIGNAL_KILL;
    return TARGET_SIGNAL_KILL;
#endif
#endif
#if defined (SIGBUS)
#if defined (SIGBUS)
  if (hostsig == SIGBUS)
  if (hostsig == SIGBUS)
    return TARGET_SIGNAL_BUS;
    return TARGET_SIGNAL_BUS;
#endif
#endif
#if defined (SIGSEGV)
#if defined (SIGSEGV)
  if (hostsig == SIGSEGV)
  if (hostsig == SIGSEGV)
    return TARGET_SIGNAL_SEGV;
    return TARGET_SIGNAL_SEGV;
#endif
#endif
#if defined (SIGSYS)
#if defined (SIGSYS)
  if (hostsig == SIGSYS)
  if (hostsig == SIGSYS)
    return TARGET_SIGNAL_SYS;
    return TARGET_SIGNAL_SYS;
#endif
#endif
#if defined (SIGPIPE)
#if defined (SIGPIPE)
  if (hostsig == SIGPIPE)
  if (hostsig == SIGPIPE)
    return TARGET_SIGNAL_PIPE;
    return TARGET_SIGNAL_PIPE;
#endif
#endif
#if defined (SIGALRM)
#if defined (SIGALRM)
  if (hostsig == SIGALRM)
  if (hostsig == SIGALRM)
    return TARGET_SIGNAL_ALRM;
    return TARGET_SIGNAL_ALRM;
#endif
#endif
#if defined (SIGTERM)
#if defined (SIGTERM)
  if (hostsig == SIGTERM)
  if (hostsig == SIGTERM)
    return TARGET_SIGNAL_TERM;
    return TARGET_SIGNAL_TERM;
#endif
#endif
#if defined (SIGUSR1)
#if defined (SIGUSR1)
  if (hostsig == SIGUSR1)
  if (hostsig == SIGUSR1)
    return TARGET_SIGNAL_USR1;
    return TARGET_SIGNAL_USR1;
#endif
#endif
#if defined (SIGUSR2)
#if defined (SIGUSR2)
  if (hostsig == SIGUSR2)
  if (hostsig == SIGUSR2)
    return TARGET_SIGNAL_USR2;
    return TARGET_SIGNAL_USR2;
#endif
#endif
#if defined (SIGCLD)
#if defined (SIGCLD)
  if (hostsig == SIGCLD)
  if (hostsig == SIGCLD)
    return TARGET_SIGNAL_CHLD;
    return TARGET_SIGNAL_CHLD;
#endif
#endif
#if defined (SIGCHLD)
#if defined (SIGCHLD)
  if (hostsig == SIGCHLD)
  if (hostsig == SIGCHLD)
    return TARGET_SIGNAL_CHLD;
    return TARGET_SIGNAL_CHLD;
#endif
#endif
#if defined (SIGPWR)
#if defined (SIGPWR)
  if (hostsig == SIGPWR)
  if (hostsig == SIGPWR)
    return TARGET_SIGNAL_PWR;
    return TARGET_SIGNAL_PWR;
#endif
#endif
#if defined (SIGWINCH)
#if defined (SIGWINCH)
  if (hostsig == SIGWINCH)
  if (hostsig == SIGWINCH)
    return TARGET_SIGNAL_WINCH;
    return TARGET_SIGNAL_WINCH;
#endif
#endif
#if defined (SIGURG)
#if defined (SIGURG)
  if (hostsig == SIGURG)
  if (hostsig == SIGURG)
    return TARGET_SIGNAL_URG;
    return TARGET_SIGNAL_URG;
#endif
#endif
#if defined (SIGIO)
#if defined (SIGIO)
  if (hostsig == SIGIO)
  if (hostsig == SIGIO)
    return TARGET_SIGNAL_IO;
    return TARGET_SIGNAL_IO;
#endif
#endif
#if defined (SIGPOLL)
#if defined (SIGPOLL)
  if (hostsig == SIGPOLL)
  if (hostsig == SIGPOLL)
    return TARGET_SIGNAL_POLL;
    return TARGET_SIGNAL_POLL;
#endif
#endif
#if defined (SIGSTOP)
#if defined (SIGSTOP)
  if (hostsig == SIGSTOP)
  if (hostsig == SIGSTOP)
    return TARGET_SIGNAL_STOP;
    return TARGET_SIGNAL_STOP;
#endif
#endif
#if defined (SIGTSTP)
#if defined (SIGTSTP)
  if (hostsig == SIGTSTP)
  if (hostsig == SIGTSTP)
    return TARGET_SIGNAL_TSTP;
    return TARGET_SIGNAL_TSTP;
#endif
#endif
#if defined (SIGCONT)
#if defined (SIGCONT)
  if (hostsig == SIGCONT)
  if (hostsig == SIGCONT)
    return TARGET_SIGNAL_CONT;
    return TARGET_SIGNAL_CONT;
#endif
#endif
#if defined (SIGTTIN)
#if defined (SIGTTIN)
  if (hostsig == SIGTTIN)
  if (hostsig == SIGTTIN)
    return TARGET_SIGNAL_TTIN;
    return TARGET_SIGNAL_TTIN;
#endif
#endif
#if defined (SIGTTOU)
#if defined (SIGTTOU)
  if (hostsig == SIGTTOU)
  if (hostsig == SIGTTOU)
    return TARGET_SIGNAL_TTOU;
    return TARGET_SIGNAL_TTOU;
#endif
#endif
#if defined (SIGVTALRM)
#if defined (SIGVTALRM)
  if (hostsig == SIGVTALRM)
  if (hostsig == SIGVTALRM)
    return TARGET_SIGNAL_VTALRM;
    return TARGET_SIGNAL_VTALRM;
#endif
#endif
#if defined (SIGPROF)
#if defined (SIGPROF)
  if (hostsig == SIGPROF)
  if (hostsig == SIGPROF)
    return TARGET_SIGNAL_PROF;
    return TARGET_SIGNAL_PROF;
#endif
#endif
#if defined (SIGXCPU)
#if defined (SIGXCPU)
  if (hostsig == SIGXCPU)
  if (hostsig == SIGXCPU)
    return TARGET_SIGNAL_XCPU;
    return TARGET_SIGNAL_XCPU;
#endif
#endif
#if defined (SIGXFSZ)
#if defined (SIGXFSZ)
  if (hostsig == SIGXFSZ)
  if (hostsig == SIGXFSZ)
    return TARGET_SIGNAL_XFSZ;
    return TARGET_SIGNAL_XFSZ;
#endif
#endif
#if defined (SIGWIND)
#if defined (SIGWIND)
  if (hostsig == SIGWIND)
  if (hostsig == SIGWIND)
    return TARGET_SIGNAL_WIND;
    return TARGET_SIGNAL_WIND;
#endif
#endif
#if defined (SIGPHONE)
#if defined (SIGPHONE)
  if (hostsig == SIGPHONE)
  if (hostsig == SIGPHONE)
    return TARGET_SIGNAL_PHONE;
    return TARGET_SIGNAL_PHONE;
#endif
#endif
#if defined (SIGLOST)
#if defined (SIGLOST)
  if (hostsig == SIGLOST)
  if (hostsig == SIGLOST)
    return TARGET_SIGNAL_LOST;
    return TARGET_SIGNAL_LOST;
#endif
#endif
#if defined (SIGWAITING)
#if defined (SIGWAITING)
  if (hostsig == SIGWAITING)
  if (hostsig == SIGWAITING)
    return TARGET_SIGNAL_WAITING;
    return TARGET_SIGNAL_WAITING;
#endif
#endif
#if defined (SIGCANCEL)
#if defined (SIGCANCEL)
  if (hostsig == SIGCANCEL)
  if (hostsig == SIGCANCEL)
    return TARGET_SIGNAL_CANCEL;
    return TARGET_SIGNAL_CANCEL;
#endif
#endif
#if defined (SIGLWP)
#if defined (SIGLWP)
  if (hostsig == SIGLWP)
  if (hostsig == SIGLWP)
    return TARGET_SIGNAL_LWP;
    return TARGET_SIGNAL_LWP;
#endif
#endif
#if defined (SIGDANGER)
#if defined (SIGDANGER)
  if (hostsig == SIGDANGER)
  if (hostsig == SIGDANGER)
    return TARGET_SIGNAL_DANGER;
    return TARGET_SIGNAL_DANGER;
#endif
#endif
#if defined (SIGGRANT)
#if defined (SIGGRANT)
  if (hostsig == SIGGRANT)
  if (hostsig == SIGGRANT)
    return TARGET_SIGNAL_GRANT;
    return TARGET_SIGNAL_GRANT;
#endif
#endif
#if defined (SIGRETRACT)
#if defined (SIGRETRACT)
  if (hostsig == SIGRETRACT)
  if (hostsig == SIGRETRACT)
    return TARGET_SIGNAL_RETRACT;
    return TARGET_SIGNAL_RETRACT;
#endif
#endif
#if defined (SIGMSG)
#if defined (SIGMSG)
  if (hostsig == SIGMSG)
  if (hostsig == SIGMSG)
    return TARGET_SIGNAL_MSG;
    return TARGET_SIGNAL_MSG;
#endif
#endif
#if defined (SIGSOUND)
#if defined (SIGSOUND)
  if (hostsig == SIGSOUND)
  if (hostsig == SIGSOUND)
    return TARGET_SIGNAL_SOUND;
    return TARGET_SIGNAL_SOUND;
#endif
#endif
#if defined (SIGSAK)
#if defined (SIGSAK)
  if (hostsig == SIGSAK)
  if (hostsig == SIGSAK)
    return TARGET_SIGNAL_SAK;
    return TARGET_SIGNAL_SAK;
#endif
#endif
#if defined (SIGPRIO)
#if defined (SIGPRIO)
  if (hostsig == SIGPRIO)
  if (hostsig == SIGPRIO)
    return TARGET_SIGNAL_PRIO;
    return TARGET_SIGNAL_PRIO;
#endif
#endif
 
 
  /* Mach exceptions.  Assumes that the values for EXC_ are positive! */
  /* Mach exceptions.  Assumes that the values for EXC_ are positive! */
#if defined (EXC_BAD_ACCESS) && defined (_NSIG)
#if defined (EXC_BAD_ACCESS) && defined (_NSIG)
  if (hostsig == _NSIG + EXC_BAD_ACCESS)
  if (hostsig == _NSIG + EXC_BAD_ACCESS)
    return TARGET_EXC_BAD_ACCESS;
    return TARGET_EXC_BAD_ACCESS;
#endif
#endif
#if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
#if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
  if (hostsig == _NSIG + EXC_BAD_INSTRUCTION)
  if (hostsig == _NSIG + EXC_BAD_INSTRUCTION)
    return TARGET_EXC_BAD_INSTRUCTION;
    return TARGET_EXC_BAD_INSTRUCTION;
#endif
#endif
#if defined (EXC_ARITHMETIC) && defined (_NSIG)
#if defined (EXC_ARITHMETIC) && defined (_NSIG)
  if (hostsig == _NSIG + EXC_ARITHMETIC)
  if (hostsig == _NSIG + EXC_ARITHMETIC)
    return TARGET_EXC_ARITHMETIC;
    return TARGET_EXC_ARITHMETIC;
#endif
#endif
#if defined (EXC_EMULATION) && defined (_NSIG)
#if defined (EXC_EMULATION) && defined (_NSIG)
  if (hostsig == _NSIG + EXC_EMULATION)
  if (hostsig == _NSIG + EXC_EMULATION)
    return TARGET_EXC_EMULATION;
    return TARGET_EXC_EMULATION;
#endif
#endif
#if defined (EXC_SOFTWARE) && defined (_NSIG)
#if defined (EXC_SOFTWARE) && defined (_NSIG)
  if (hostsig == _NSIG + EXC_SOFTWARE)
  if (hostsig == _NSIG + EXC_SOFTWARE)
    return TARGET_EXC_SOFTWARE;
    return TARGET_EXC_SOFTWARE;
#endif
#endif
#if defined (EXC_BREAKPOINT) && defined (_NSIG)
#if defined (EXC_BREAKPOINT) && defined (_NSIG)
  if (hostsig == _NSIG + EXC_BREAKPOINT)
  if (hostsig == _NSIG + EXC_BREAKPOINT)
    return TARGET_EXC_BREAKPOINT;
    return TARGET_EXC_BREAKPOINT;
#endif
#endif
 
 
#if defined (SIGINFO)
#if defined (SIGINFO)
  if (hostsig == SIGINFO)
  if (hostsig == SIGINFO)
    return TARGET_SIGNAL_INFO;
    return TARGET_SIGNAL_INFO;
#endif
#endif
 
 
#if defined (REALTIME_LO)
#if defined (REALTIME_LO)
  if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
  if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
    {
    {
      /* This block of TARGET_SIGNAL_REALTIME value is in order.  */
      /* This block of TARGET_SIGNAL_REALTIME value is in order.  */
      if (33 <= hostsig && hostsig <= 63)
      if (33 <= hostsig && hostsig <= 63)
        return (enum target_signal)
        return (enum target_signal)
          (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33);
          (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33);
      else if (hostsig == 32)
      else if (hostsig == 32)
        return TARGET_SIGNAL_REALTIME_32;
        return TARGET_SIGNAL_REALTIME_32;
      else if (64 <= hostsig && hostsig <= 127)
      else if (64 <= hostsig && hostsig <= 127)
        return (enum target_signal)
        return (enum target_signal)
          (hostsig - 64 + (int) TARGET_SIGNAL_REALTIME_64);
          (hostsig - 64 + (int) TARGET_SIGNAL_REALTIME_64);
      else
      else
        error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal");
        error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal");
    }
    }
#endif
#endif
 
 
  return TARGET_SIGNAL_UNKNOWN;
  return TARGET_SIGNAL_UNKNOWN;
}
}
 
 
/* Convert a OURSIG (an enum target_signal) to the form used by the
/* Convert a OURSIG (an enum target_signal) to the form used by the
   target operating system (refered to as the ``host'') or zero if the
   target operating system (refered to as the ``host'') or zero if the
   equivalent host signal is not available.  Set/clear OURSIG_OK
   equivalent host signal is not available.  Set/clear OURSIG_OK
   accordingly. */
   accordingly. */
 
 
static int
static int
do_target_signal_to_host (enum target_signal oursig,
do_target_signal_to_host (enum target_signal oursig,
                          int *oursig_ok)
                          int *oursig_ok)
{
{
  int retsig;
  int retsig;
  /* Silence the 'not used' warning, for targets that
  /* Silence the 'not used' warning, for targets that
     do not support signals.  */
     do not support signals.  */
  (void) retsig;
  (void) retsig;
 
 
  *oursig_ok = 1;
  *oursig_ok = 1;
  switch (oursig)
  switch (oursig)
    {
    {
    case TARGET_SIGNAL_0:
    case TARGET_SIGNAL_0:
      return 0;
      return 0;
 
 
#if defined (SIGHUP)
#if defined (SIGHUP)
    case TARGET_SIGNAL_HUP:
    case TARGET_SIGNAL_HUP:
      return SIGHUP;
      return SIGHUP;
#endif
#endif
#if defined (SIGINT)
#if defined (SIGINT)
    case TARGET_SIGNAL_INT:
    case TARGET_SIGNAL_INT:
      return SIGINT;
      return SIGINT;
#endif
#endif
#if defined (SIGQUIT)
#if defined (SIGQUIT)
    case TARGET_SIGNAL_QUIT:
    case TARGET_SIGNAL_QUIT:
      return SIGQUIT;
      return SIGQUIT;
#endif
#endif
#if defined (SIGILL)
#if defined (SIGILL)
    case TARGET_SIGNAL_ILL:
    case TARGET_SIGNAL_ILL:
      return SIGILL;
      return SIGILL;
#endif
#endif
#if defined (SIGTRAP)
#if defined (SIGTRAP)
    case TARGET_SIGNAL_TRAP:
    case TARGET_SIGNAL_TRAP:
      return SIGTRAP;
      return SIGTRAP;
#endif
#endif
#if defined (SIGABRT)
#if defined (SIGABRT)
    case TARGET_SIGNAL_ABRT:
    case TARGET_SIGNAL_ABRT:
      return SIGABRT;
      return SIGABRT;
#endif
#endif
#if defined (SIGEMT)
#if defined (SIGEMT)
    case TARGET_SIGNAL_EMT:
    case TARGET_SIGNAL_EMT:
      return SIGEMT;
      return SIGEMT;
#endif
#endif
#if defined (SIGFPE)
#if defined (SIGFPE)
    case TARGET_SIGNAL_FPE:
    case TARGET_SIGNAL_FPE:
      return SIGFPE;
      return SIGFPE;
#endif
#endif
#if defined (SIGKILL)
#if defined (SIGKILL)
    case TARGET_SIGNAL_KILL:
    case TARGET_SIGNAL_KILL:
      return SIGKILL;
      return SIGKILL;
#endif
#endif
#if defined (SIGBUS)
#if defined (SIGBUS)
    case TARGET_SIGNAL_BUS:
    case TARGET_SIGNAL_BUS:
      return SIGBUS;
      return SIGBUS;
#endif
#endif
#if defined (SIGSEGV)
#if defined (SIGSEGV)
    case TARGET_SIGNAL_SEGV:
    case TARGET_SIGNAL_SEGV:
      return SIGSEGV;
      return SIGSEGV;
#endif
#endif
#if defined (SIGSYS)
#if defined (SIGSYS)
    case TARGET_SIGNAL_SYS:
    case TARGET_SIGNAL_SYS:
      return SIGSYS;
      return SIGSYS;
#endif
#endif
#if defined (SIGPIPE)
#if defined (SIGPIPE)
    case TARGET_SIGNAL_PIPE:
    case TARGET_SIGNAL_PIPE:
      return SIGPIPE;
      return SIGPIPE;
#endif
#endif
#if defined (SIGALRM)
#if defined (SIGALRM)
    case TARGET_SIGNAL_ALRM:
    case TARGET_SIGNAL_ALRM:
      return SIGALRM;
      return SIGALRM;
#endif
#endif
#if defined (SIGTERM)
#if defined (SIGTERM)
    case TARGET_SIGNAL_TERM:
    case TARGET_SIGNAL_TERM:
      return SIGTERM;
      return SIGTERM;
#endif
#endif
#if defined (SIGUSR1)
#if defined (SIGUSR1)
    case TARGET_SIGNAL_USR1:
    case TARGET_SIGNAL_USR1:
      return SIGUSR1;
      return SIGUSR1;
#endif
#endif
#if defined (SIGUSR2)
#if defined (SIGUSR2)
    case TARGET_SIGNAL_USR2:
    case TARGET_SIGNAL_USR2:
      return SIGUSR2;
      return SIGUSR2;
#endif
#endif
#if defined (SIGCHLD) || defined (SIGCLD)
#if defined (SIGCHLD) || defined (SIGCLD)
    case TARGET_SIGNAL_CHLD:
    case TARGET_SIGNAL_CHLD:
#if defined (SIGCHLD)
#if defined (SIGCHLD)
      return SIGCHLD;
      return SIGCHLD;
#else
#else
      return SIGCLD;
      return SIGCLD;
#endif
#endif
#endif /* SIGCLD or SIGCHLD */
#endif /* SIGCLD or SIGCHLD */
#if defined (SIGPWR)
#if defined (SIGPWR)
    case TARGET_SIGNAL_PWR:
    case TARGET_SIGNAL_PWR:
      return SIGPWR;
      return SIGPWR;
#endif
#endif
#if defined (SIGWINCH)
#if defined (SIGWINCH)
    case TARGET_SIGNAL_WINCH:
    case TARGET_SIGNAL_WINCH:
      return SIGWINCH;
      return SIGWINCH;
#endif
#endif
#if defined (SIGURG)
#if defined (SIGURG)
    case TARGET_SIGNAL_URG:
    case TARGET_SIGNAL_URG:
      return SIGURG;
      return SIGURG;
#endif
#endif
#if defined (SIGIO)
#if defined (SIGIO)
    case TARGET_SIGNAL_IO:
    case TARGET_SIGNAL_IO:
      return SIGIO;
      return SIGIO;
#endif
#endif
#if defined (SIGPOLL)
#if defined (SIGPOLL)
    case TARGET_SIGNAL_POLL:
    case TARGET_SIGNAL_POLL:
      return SIGPOLL;
      return SIGPOLL;
#endif
#endif
#if defined (SIGSTOP)
#if defined (SIGSTOP)
    case TARGET_SIGNAL_STOP:
    case TARGET_SIGNAL_STOP:
      return SIGSTOP;
      return SIGSTOP;
#endif
#endif
#if defined (SIGTSTP)
#if defined (SIGTSTP)
    case TARGET_SIGNAL_TSTP:
    case TARGET_SIGNAL_TSTP:
      return SIGTSTP;
      return SIGTSTP;
#endif
#endif
#if defined (SIGCONT)
#if defined (SIGCONT)
    case TARGET_SIGNAL_CONT:
    case TARGET_SIGNAL_CONT:
      return SIGCONT;
      return SIGCONT;
#endif
#endif
#if defined (SIGTTIN)
#if defined (SIGTTIN)
    case TARGET_SIGNAL_TTIN:
    case TARGET_SIGNAL_TTIN:
      return SIGTTIN;
      return SIGTTIN;
#endif
#endif
#if defined (SIGTTOU)
#if defined (SIGTTOU)
    case TARGET_SIGNAL_TTOU:
    case TARGET_SIGNAL_TTOU:
      return SIGTTOU;
      return SIGTTOU;
#endif
#endif
#if defined (SIGVTALRM)
#if defined (SIGVTALRM)
    case TARGET_SIGNAL_VTALRM:
    case TARGET_SIGNAL_VTALRM:
      return SIGVTALRM;
      return SIGVTALRM;
#endif
#endif
#if defined (SIGPROF)
#if defined (SIGPROF)
    case TARGET_SIGNAL_PROF:
    case TARGET_SIGNAL_PROF:
      return SIGPROF;
      return SIGPROF;
#endif
#endif
#if defined (SIGXCPU)
#if defined (SIGXCPU)
    case TARGET_SIGNAL_XCPU:
    case TARGET_SIGNAL_XCPU:
      return SIGXCPU;
      return SIGXCPU;
#endif
#endif
#if defined (SIGXFSZ)
#if defined (SIGXFSZ)
    case TARGET_SIGNAL_XFSZ:
    case TARGET_SIGNAL_XFSZ:
      return SIGXFSZ;
      return SIGXFSZ;
#endif
#endif
#if defined (SIGWIND)
#if defined (SIGWIND)
    case TARGET_SIGNAL_WIND:
    case TARGET_SIGNAL_WIND:
      return SIGWIND;
      return SIGWIND;
#endif
#endif
#if defined (SIGPHONE)
#if defined (SIGPHONE)
    case TARGET_SIGNAL_PHONE:
    case TARGET_SIGNAL_PHONE:
      return SIGPHONE;
      return SIGPHONE;
#endif
#endif
#if defined (SIGLOST)
#if defined (SIGLOST)
    case TARGET_SIGNAL_LOST:
    case TARGET_SIGNAL_LOST:
      return SIGLOST;
      return SIGLOST;
#endif
#endif
#if defined (SIGWAITING)
#if defined (SIGWAITING)
    case TARGET_SIGNAL_WAITING:
    case TARGET_SIGNAL_WAITING:
      return SIGWAITING;
      return SIGWAITING;
#endif
#endif
#if defined (SIGCANCEL)
#if defined (SIGCANCEL)
    case TARGET_SIGNAL_CANCEL:
    case TARGET_SIGNAL_CANCEL:
      return SIGCANCEL;
      return SIGCANCEL;
#endif
#endif
#if defined (SIGLWP)
#if defined (SIGLWP)
    case TARGET_SIGNAL_LWP:
    case TARGET_SIGNAL_LWP:
      return SIGLWP;
      return SIGLWP;
#endif
#endif
#if defined (SIGDANGER)
#if defined (SIGDANGER)
    case TARGET_SIGNAL_DANGER:
    case TARGET_SIGNAL_DANGER:
      return SIGDANGER;
      return SIGDANGER;
#endif
#endif
#if defined (SIGGRANT)
#if defined (SIGGRANT)
    case TARGET_SIGNAL_GRANT:
    case TARGET_SIGNAL_GRANT:
      return SIGGRANT;
      return SIGGRANT;
#endif
#endif
#if defined (SIGRETRACT)
#if defined (SIGRETRACT)
    case TARGET_SIGNAL_RETRACT:
    case TARGET_SIGNAL_RETRACT:
      return SIGRETRACT;
      return SIGRETRACT;
#endif
#endif
#if defined (SIGMSG)
#if defined (SIGMSG)
    case TARGET_SIGNAL_MSG:
    case TARGET_SIGNAL_MSG:
      return SIGMSG;
      return SIGMSG;
#endif
#endif
#if defined (SIGSOUND)
#if defined (SIGSOUND)
    case TARGET_SIGNAL_SOUND:
    case TARGET_SIGNAL_SOUND:
      return SIGSOUND;
      return SIGSOUND;
#endif
#endif
#if defined (SIGSAK)
#if defined (SIGSAK)
    case TARGET_SIGNAL_SAK:
    case TARGET_SIGNAL_SAK:
      return SIGSAK;
      return SIGSAK;
#endif
#endif
#if defined (SIGPRIO)
#if defined (SIGPRIO)
    case TARGET_SIGNAL_PRIO:
    case TARGET_SIGNAL_PRIO:
      return SIGPRIO;
      return SIGPRIO;
#endif
#endif
 
 
      /* Mach exceptions.  Assumes that the values for EXC_ are positive! */
      /* Mach exceptions.  Assumes that the values for EXC_ are positive! */
#if defined (EXC_BAD_ACCESS) && defined (_NSIG)
#if defined (EXC_BAD_ACCESS) && defined (_NSIG)
    case TARGET_EXC_BAD_ACCESS:
    case TARGET_EXC_BAD_ACCESS:
      return _NSIG + EXC_BAD_ACCESS;
      return _NSIG + EXC_BAD_ACCESS;
#endif
#endif
#if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
#if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
    case TARGET_EXC_BAD_INSTRUCTION:
    case TARGET_EXC_BAD_INSTRUCTION:
      return _NSIG + EXC_BAD_INSTRUCTION;
      return _NSIG + EXC_BAD_INSTRUCTION;
#endif
#endif
#if defined (EXC_ARITHMETIC) && defined (_NSIG)
#if defined (EXC_ARITHMETIC) && defined (_NSIG)
    case TARGET_EXC_ARITHMETIC:
    case TARGET_EXC_ARITHMETIC:
      return _NSIG + EXC_ARITHMETIC;
      return _NSIG + EXC_ARITHMETIC;
#endif
#endif
#if defined (EXC_EMULATION) && defined (_NSIG)
#if defined (EXC_EMULATION) && defined (_NSIG)
    case TARGET_EXC_EMULATION:
    case TARGET_EXC_EMULATION:
      return _NSIG + EXC_EMULATION;
      return _NSIG + EXC_EMULATION;
#endif
#endif
#if defined (EXC_SOFTWARE) && defined (_NSIG)
#if defined (EXC_SOFTWARE) && defined (_NSIG)
    case TARGET_EXC_SOFTWARE:
    case TARGET_EXC_SOFTWARE:
      return _NSIG + EXC_SOFTWARE;
      return _NSIG + EXC_SOFTWARE;
#endif
#endif
#if defined (EXC_BREAKPOINT) && defined (_NSIG)
#if defined (EXC_BREAKPOINT) && defined (_NSIG)
    case TARGET_EXC_BREAKPOINT:
    case TARGET_EXC_BREAKPOINT:
      return _NSIG + EXC_BREAKPOINT;
      return _NSIG + EXC_BREAKPOINT;
#endif
#endif
 
 
#if defined (SIGINFO)
#if defined (SIGINFO)
    case TARGET_SIGNAL_INFO:
    case TARGET_SIGNAL_INFO:
      return SIGINFO;
      return SIGINFO;
#endif
#endif
 
 
    default:
    default:
#if defined (REALTIME_LO)
#if defined (REALTIME_LO)
      retsig = 0;
      retsig = 0;
 
 
      if (oursig >= TARGET_SIGNAL_REALTIME_33
      if (oursig >= TARGET_SIGNAL_REALTIME_33
          && oursig <= TARGET_SIGNAL_REALTIME_63)
          && oursig <= TARGET_SIGNAL_REALTIME_63)
        {
        {
          /* This block of signals is continuous, and
          /* This block of signals is continuous, and
             TARGET_SIGNAL_REALTIME_33 is 33 by definition.  */
             TARGET_SIGNAL_REALTIME_33 is 33 by definition.  */
          retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33;
          retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33;
        }
        }
      else if (oursig == TARGET_SIGNAL_REALTIME_32)
      else if (oursig == TARGET_SIGNAL_REALTIME_32)
        {
        {
          /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
          /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
             TARGET_SIGNAL_REALTIME_33.  It is 32 by definition.  */
             TARGET_SIGNAL_REALTIME_33.  It is 32 by definition.  */
          retsig = 32;
          retsig = 32;
        }
        }
      else if (oursig >= TARGET_SIGNAL_REALTIME_64
      else if (oursig >= TARGET_SIGNAL_REALTIME_64
          && oursig <= TARGET_SIGNAL_REALTIME_127)
          && oursig <= TARGET_SIGNAL_REALTIME_127)
        {
        {
          /* This block of signals is continuous, and
          /* This block of signals is continuous, and
             TARGET_SIGNAL_REALTIME_64 is 64 by definition.  */
             TARGET_SIGNAL_REALTIME_64 is 64 by definition.  */
          retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64;
          retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64;
        }
        }
 
 
      if (retsig >= REALTIME_LO && retsig < REALTIME_HI)
      if (retsig >= REALTIME_LO && retsig < REALTIME_HI)
        return retsig;
        return retsig;
#endif
#endif
 
 
      *oursig_ok = 0;
      *oursig_ok = 0;
      return 0;
      return 0;
    }
    }
}
}
 
 
int
int
target_signal_to_host_p (enum target_signal oursig)
target_signal_to_host_p (enum target_signal oursig)
{
{
  int oursig_ok;
  int oursig_ok;
  do_target_signal_to_host (oursig, &oursig_ok);
  do_target_signal_to_host (oursig, &oursig_ok);
  return oursig_ok;
  return oursig_ok;
}
}
 
 
int
int
target_signal_to_host (enum target_signal oursig)
target_signal_to_host (enum target_signal oursig)
{
{
  int oursig_ok;
  int oursig_ok;
  int targ_signo = do_target_signal_to_host (oursig, &oursig_ok);
  int targ_signo = do_target_signal_to_host (oursig, &oursig_ok);
  if (!oursig_ok)
  if (!oursig_ok)
    {
    {
      /* The user might be trying to do "signal SIGSAK" where this system
      /* The user might be trying to do "signal SIGSAK" where this system
         doesn't have SIGSAK.  */
         doesn't have SIGSAK.  */
      warning ("Signal %s does not exist on this system.\n",
      warning ("Signal %s does not exist on this system.\n",
               target_signal_to_name (oursig));
               target_signal_to_name (oursig));
      return 0;
      return 0;
    }
    }
  else
  else
    return targ_signo;
    return targ_signo;
}
}
 
 
#ifndef GDBSERVER
#ifndef GDBSERVER
 
 
/* In some circumstances we allow a command to specify a numeric
/* In some circumstances we allow a command to specify a numeric
   signal.  The idea is to keep these circumstances limited so that
   signal.  The idea is to keep these circumstances limited so that
   users (and scripts) develop portable habits.  For comparison,
   users (and scripts) develop portable habits.  For comparison,
   POSIX.2 `kill' requires that 1,2,3,6,9,14, and 15 work (and using a
   POSIX.2 `kill' requires that 1,2,3,6,9,14, and 15 work (and using a
   numeric signal at all is obsolescent.  We are slightly more
   numeric signal at all is obsolescent.  We are slightly more
   lenient and allow 1-15 which should match host signal numbers on
   lenient and allow 1-15 which should match host signal numbers on
   most systems.  Use of symbolic signal names is strongly encouraged.  */
   most systems.  Use of symbolic signal names is strongly encouraged.  */
 
 
enum target_signal
enum target_signal
target_signal_from_command (int num)
target_signal_from_command (int num)
{
{
  if (num >= 1 && num <= 15)
  if (num >= 1 && num <= 15)
    return (enum target_signal) num;
    return (enum target_signal) num;
  error ("Only signals 1-15 are valid as numeric signals.\n\
  error ("Only signals 1-15 are valid as numeric signals.\n\
Use \"info signals\" for a list of symbolic signals.");
Use \"info signals\" for a list of symbolic signals.");
}
}
 
 
extern initialize_file_ftype _initialize_signals; /* -Wmissing-prototype */
extern initialize_file_ftype _initialize_signals; /* -Wmissing-prototype */
 
 
void
void
_initialize_signals (void)
_initialize_signals (void)
{
{
  if (strcmp (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC") != 0)
  if (strcmp (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC") != 0)
    internal_error (__FILE__, __LINE__, "failed internal consistency check");
    internal_error (__FILE__, __LINE__, "failed internal consistency check");
}
}
 
 
int
int
default_target_signal_to_host (struct gdbarch *gdbarch, enum target_signal ts)
default_target_signal_to_host (struct gdbarch *gdbarch, enum target_signal ts)
{
{
  return target_signal_to_host (ts);
  return target_signal_to_host (ts);
}
}
 
 
enum target_signal
enum target_signal
default_target_signal_from_host (struct gdbarch *gdbarch, int signo)
default_target_signal_from_host (struct gdbarch *gdbarch, int signo)
{
{
  return target_signal_from_host (signo);
  return target_signal_from_host (signo);
}
}
 
 
#endif /* ! GDBSERVER */
#endif /* ! GDBSERVER */
 
 

powered by: WebSVN 2.1.0

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