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] - Blame information for rev 1783

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
/* Simulator signal support
2
   Copyright (C) 1997 Free Software Foundation, Inc.
3
   Contributed by Cygnus Support
4
 
5
This file is part of the GNU Simulators.
6
 
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2, or (at your option)
10
any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License along
18
with this program; if not, write to the Free Software Foundation, Inc.,
19
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
 
21
#include <signal.h>
22
#include "sim-main.h"
23
 
24
/* Convert SIM_SIGFOO to SIGFOO.
25
   What to do when the host doesn't have SIGFOO is handled on a case by case
26
   basis.  Generally, in the case of passing a value back to gdb, we want gdb
27
   to not think the process has died (so it can be debugged at the point of
28
   failure).  */
29
 
30
#ifdef _MSC_VER
31
#ifndef SIGTRAP
32
#define SIGTRAP 5
33
#endif
34
#ifndef SIGBUS
35
#define SIGBUS 10
36
#endif
37
#ifndef SIGQUIT
38
#define SIGQUIT 3
39
#endif
40
#endif
41
 
42
int
43
sim_signal_to_host (SIM_DESC sd, SIM_SIGNAL sig)
44
{
45
  switch (sig)
46
    {
47
    case SIM_SIGINT :
48
      return SIGINT;
49
 
50
    case SIM_SIGABRT :
51
      return SIGABRT;
52
 
53
    case SIM_SIGILL :
54
#ifdef SIGILL
55
      return SIGILL;
56
#else
57
      return SIGSEGV;
58
#endif
59
 
60
    case SIM_SIGTRAP :
61
      return SIGTRAP;
62
 
63
    case SIM_SIGBUS :
64
#ifdef SIGBUS
65
      return SIGBUS;
66
#else
67
      return SIGSEGV;
68
#endif
69
 
70
    case SIM_SIGSEGV :
71
      return SIGSEGV;
72
 
73
    case SIM_SIGXCPU :
74
#ifdef SIGXCPU
75
      return SIGXCPU;
76
#endif
77
      break;
78
 
79
    case SIM_SIGFPE:
80
#ifdef SIGXCPU
81
      return SIGFPE;
82
#endif
83
      break;
84
 
85
    case SIM_SIGNONE:
86
      return 0;
87
      break;
88
    }
89
 
90
  sim_io_eprintf (sd, "sim_signal_to_host: unknown signal: %d\n", sig);
91
#ifdef SIGHUP
92
  return SIGHUP;  /* FIXME: Suggestions?  */
93
#else
94
  return 1;
95
#endif
96
}

powered by: WebSVN 2.1.0

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