1 /* Target signal translation functions for GDB.
2 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002 Free Software Foundation, Inc.
4 Contributed by Cygnus Support.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
28 #include "gdb_string.h"
33 /* Always use __SIGRTMIN if it's available. SIGRTMIN is the lowest
34 _available_ realtime signal, not the lowest supported; glibc takes
35 several for its own use. */
38 # if defined(__SIGRTMIN)
39 # define REALTIME_LO __SIGRTMIN
40 # define REALTIME_HI __SIGRTMAX
41 # elif defined(SIGRTMIN)
42 # define REALTIME_LO SIGRTMIN
43 # define REALTIME_HI SIGRTMAX
47 /* This table must match in order and size the signals in enum target_signal
57 {"SIGINT", "Interrupt"},
59 {"SIGILL", "Illegal instruction"},
60 {"SIGTRAP", "Trace/breakpoint trap"},
61 {"SIGABRT", "Aborted"},
62 {"SIGEMT", "Emulation trap"},
63 {"SIGFPE", "Arithmetic exception"},
64 {"SIGKILL", "Killed"},
65 {"SIGBUS", "Bus error"},
66 {"SIGSEGV", "Segmentation fault"},
67 {"SIGSYS", "Bad system call"},
68 {"SIGPIPE", "Broken pipe"},
69 {"SIGALRM", "Alarm clock"},
70 {"SIGTERM", "Terminated"},
71 {"SIGURG", "Urgent I/O condition"},
72 {"SIGSTOP", "Stopped (signal)"},
73 {"SIGTSTP", "Stopped (user)"},
74 {"SIGCONT", "Continued"},
75 {"SIGCHLD", "Child status changed"},
76 {"SIGTTIN", "Stopped (tty input)"},
77 {"SIGTTOU", "Stopped (tty output)"},
78 {"SIGIO", "I/O possible"},
79 {"SIGXCPU", "CPU time limit exceeded"},
80 {"SIGXFSZ", "File size limit exceeded"},
81 {"SIGVTALRM", "Virtual timer expired"},
82 {"SIGPROF", "Profiling timer expired"},
83 {"SIGWINCH", "Window size changed"},
84 {"SIGLOST", "Resource lost"},
85 {"SIGUSR1", "User defined signal 1"},
86 {"SIGUSR2", "User defined signal 2"},
87 {"SIGPWR", "Power fail/restart"},
88 {"SIGPOLL", "Pollable event occurred"},
89 {"SIGWIND", "SIGWIND"},
90 {"SIGPHONE", "SIGPHONE"},
91 {"SIGWAITING", "Process's LWPs are blocked"},
92 {"SIGLWP", "Signal LWP"},
93 {"SIGDANGER", "Swap space dangerously low"},
94 {"SIGGRANT", "Monitor mode granted"},
95 {"SIGRETRACT", "Need to relinquish monitor mode"},
96 {"SIGMSG", "Monitor mode data available"},
97 {"SIGSOUND", "Sound completed"},
98 {"SIGSAK", "Secure attention"},
99 {"SIGPRIO", "SIGPRIO"},
100 {"SIG33", "Real-time event 33"},
101 {"SIG34", "Real-time event 34"},
102 {"SIG35", "Real-time event 35"},
103 {"SIG36", "Real-time event 36"},
104 {"SIG37", "Real-time event 37"},
105 {"SIG38", "Real-time event 38"},
106 {"SIG39", "Real-time event 39"},
107 {"SIG40", "Real-time event 40"},
108 {"SIG41", "Real-time event 41"},
109 {"SIG42", "Real-time event 42"},
110 {"SIG43", "Real-time event 43"},
111 {"SIG44", "Real-time event 44"},
112 {"SIG45", "Real-time event 45"},
113 {"SIG46", "Real-time event 46"},
114 {"SIG47", "Real-time event 47"},
115 {"SIG48", "Real-time event 48"},
116 {"SIG49", "Real-time event 49"},
117 {"SIG50", "Real-time event 50"},
118 {"SIG51", "Real-time event 51"},
119 {"SIG52", "Real-time event 52"},
120 {"SIG53", "Real-time event 53"},
121 {"SIG54", "Real-time event 54"},
122 {"SIG55", "Real-time event 55"},
123 {"SIG56", "Real-time event 56"},
124 {"SIG57", "Real-time event 57"},
125 {"SIG58", "Real-time event 58"},
126 {"SIG59", "Real-time event 59"},
127 {"SIG60", "Real-time event 60"},
128 {"SIG61", "Real-time event 61"},
129 {"SIG62", "Real-time event 62"},
130 {"SIG63", "Real-time event 63"},
131 {"SIGCANCEL", "LWP internal signal"},
132 {"SIG32", "Real-time event 32"},
133 {"SIG64", "Real-time event 64"},
134 {"SIG65", "Real-time event 65"},
135 {"SIG66", "Real-time event 66"},
136 {"SIG67", "Real-time event 67"},
137 {"SIG68", "Real-time event 68"},
138 {"SIG69", "Real-time event 69"},
139 {"SIG70", "Real-time event 70"},
140 {"SIG71", "Real-time event 71"},
141 {"SIG72", "Real-time event 72"},
142 {"SIG73", "Real-time event 73"},
143 {"SIG74", "Real-time event 74"},
144 {"SIG75", "Real-time event 75"},
145 {"SIG76", "Real-time event 76"},
146 {"SIG77", "Real-time event 77"},
147 {"SIG78", "Real-time event 78"},
148 {"SIG79", "Real-time event 79"},
149 {"SIG80", "Real-time event 80"},
150 {"SIG81", "Real-time event 81"},
151 {"SIG82", "Real-time event 82"},
152 {"SIG83", "Real-time event 83"},
153 {"SIG84", "Real-time event 84"},
154 {"SIG85", "Real-time event 85"},
155 {"SIG86", "Real-time event 86"},
156 {"SIG87", "Real-time event 87"},
157 {"SIG88", "Real-time event 88"},
158 {"SIG89", "Real-time event 89"},
159 {"SIG90", "Real-time event 90"},
160 {"SIG91", "Real-time event 91"},
161 {"SIG92", "Real-time event 92"},
162 {"SIG93", "Real-time event 93"},
163 {"SIG94", "Real-time event 94"},
164 {"SIG95", "Real-time event 95"},
165 {"SIG96", "Real-time event 96"},
166 {"SIG97", "Real-time event 97"},
167 {"SIG98", "Real-time event 98"},
168 {"SIG99", "Real-time event 99"},
169 {"SIG100", "Real-time event 100"},
170 {"SIG101", "Real-time event 101"},
171 {"SIG102", "Real-time event 102"},
172 {"SIG103", "Real-time event 103"},
173 {"SIG104", "Real-time event 104"},
174 {"SIG105", "Real-time event 105"},
175 {"SIG106", "Real-time event 106"},
176 {"SIG107", "Real-time event 107"},
177 {"SIG108", "Real-time event 108"},
178 {"SIG109", "Real-time event 109"},
179 {"SIG110", "Real-time event 110"},
180 {"SIG111", "Real-time event 111"},
181 {"SIG112", "Real-time event 112"},
182 {"SIG113", "Real-time event 113"},
183 {"SIG114", "Real-time event 114"},
184 {"SIG115", "Real-time event 115"},
185 {"SIG116", "Real-time event 116"},
186 {"SIG117", "Real-time event 117"},
187 {"SIG118", "Real-time event 118"},
188 {"SIG119", "Real-time event 119"},
189 {"SIG120", "Real-time event 120"},
190 {"SIG121", "Real-time event 121"},
191 {"SIG122", "Real-time event 122"},
192 {"SIG123", "Real-time event 123"},
193 {"SIG124", "Real-time event 124"},
194 {"SIG125", "Real-time event 125"},
195 {"SIG126", "Real-time event 126"},
196 {"SIG127", "Real-time event 127"},
198 {"SIGINFO", "Information request"},
200 {NULL
, "Unknown signal"},
201 {NULL
, "Internal error: printing TARGET_SIGNAL_DEFAULT"},
203 /* Mach exceptions */
204 {"EXC_BAD_ACCESS", "Could not access memory"},
205 {"EXC_BAD_INSTRUCTION", "Illegal instruction/operand"},
206 {"EXC_ARITHMETIC", "Arithmetic exception"},
207 {"EXC_EMULATION", "Emulation instruction"},
208 {"EXC_SOFTWARE", "Software generated exception"},
209 {"EXC_BREAKPOINT", "Breakpoint"},
211 /* Last entry, used to check whether the table is the right size. */
212 {NULL
, "TARGET_SIGNAL_MAGIC"}
218 /* Return the string for a signal. */
220 target_signal_to_string (enum target_signal sig
)
222 if ((sig
>= TARGET_SIGNAL_FIRST
) && (sig
<= TARGET_SIGNAL_LAST
))
223 return signals
[sig
].string
;
225 return signals
[TARGET_SIGNAL_UNKNOWN
].string
;
228 /* Return the name for a signal. */
230 target_signal_to_name (enum target_signal sig
)
232 if ((sig
>= TARGET_SIGNAL_FIRST
) && (sig
<= TARGET_SIGNAL_LAST
)
233 && signals
[sig
].name
!= NULL
)
234 return signals
[sig
].name
;
236 /* I think the code which prints this will always print it along
237 with the string, so no need to be verbose (very old comment). */
241 /* Given a name, return its signal. */
243 target_signal_from_name (char *name
)
245 enum target_signal sig
;
247 /* It's possible we also should allow "SIGCLD" as well as "SIGCHLD"
248 for TARGET_SIGNAL_SIGCHLD. SIGIOT, on the other hand, is more
249 questionable; seems like by now people should call it SIGABRT
252 /* This ugly cast brought to you by the native VAX compiler. */
253 for (sig
= TARGET_SIGNAL_HUP
;
254 sig
< TARGET_SIGNAL_LAST
;
255 sig
= (enum target_signal
) ((int) sig
+ 1))
256 if (signals
[sig
].name
!= NULL
257 && strcmp (name
, signals
[sig
].name
) == 0)
259 return TARGET_SIGNAL_UNKNOWN
;
262 /* The following functions are to help certain targets deal
263 with the signal/waitstatus stuff. They could just as well be in
264 a file called native-utils.c or unixwaitstatus-utils.c or whatever. */
266 /* Convert host signal to our signals. */
268 target_signal_from_host (int hostsig
)
270 /* A switch statement would make sense but would require special kludges
271 to deal with the cases where more than one signal has the same number. */
274 return TARGET_SIGNAL_0
;
277 if (hostsig
== SIGHUP
)
278 return TARGET_SIGNAL_HUP
;
281 if (hostsig
== SIGINT
)
282 return TARGET_SIGNAL_INT
;
284 #if defined (SIGQUIT)
285 if (hostsig
== SIGQUIT
)
286 return TARGET_SIGNAL_QUIT
;
289 if (hostsig
== SIGILL
)
290 return TARGET_SIGNAL_ILL
;
292 #if defined (SIGTRAP)
293 if (hostsig
== SIGTRAP
)
294 return TARGET_SIGNAL_TRAP
;
296 #if defined (SIGABRT)
297 if (hostsig
== SIGABRT
)
298 return TARGET_SIGNAL_ABRT
;
301 if (hostsig
== SIGEMT
)
302 return TARGET_SIGNAL_EMT
;
305 if (hostsig
== SIGFPE
)
306 return TARGET_SIGNAL_FPE
;
308 #if defined (SIGKILL)
309 if (hostsig
== SIGKILL
)
310 return TARGET_SIGNAL_KILL
;
313 if (hostsig
== SIGBUS
)
314 return TARGET_SIGNAL_BUS
;
316 #if defined (SIGSEGV)
317 if (hostsig
== SIGSEGV
)
318 return TARGET_SIGNAL_SEGV
;
321 if (hostsig
== SIGSYS
)
322 return TARGET_SIGNAL_SYS
;
324 #if defined (SIGPIPE)
325 if (hostsig
== SIGPIPE
)
326 return TARGET_SIGNAL_PIPE
;
328 #if defined (SIGALRM)
329 if (hostsig
== SIGALRM
)
330 return TARGET_SIGNAL_ALRM
;
332 #if defined (SIGTERM)
333 if (hostsig
== SIGTERM
)
334 return TARGET_SIGNAL_TERM
;
336 #if defined (SIGUSR1)
337 if (hostsig
== SIGUSR1
)
338 return TARGET_SIGNAL_USR1
;
340 #if defined (SIGUSR2)
341 if (hostsig
== SIGUSR2
)
342 return TARGET_SIGNAL_USR2
;
345 if (hostsig
== SIGCLD
)
346 return TARGET_SIGNAL_CHLD
;
348 #if defined (SIGCHLD)
349 if (hostsig
== SIGCHLD
)
350 return TARGET_SIGNAL_CHLD
;
353 if (hostsig
== SIGPWR
)
354 return TARGET_SIGNAL_PWR
;
356 #if defined (SIGWINCH)
357 if (hostsig
== SIGWINCH
)
358 return TARGET_SIGNAL_WINCH
;
361 if (hostsig
== SIGURG
)
362 return TARGET_SIGNAL_URG
;
365 if (hostsig
== SIGIO
)
366 return TARGET_SIGNAL_IO
;
368 #if defined (SIGPOLL)
369 if (hostsig
== SIGPOLL
)
370 return TARGET_SIGNAL_POLL
;
372 #if defined (SIGSTOP)
373 if (hostsig
== SIGSTOP
)
374 return TARGET_SIGNAL_STOP
;
376 #if defined (SIGTSTP)
377 if (hostsig
== SIGTSTP
)
378 return TARGET_SIGNAL_TSTP
;
380 #if defined (SIGCONT)
381 if (hostsig
== SIGCONT
)
382 return TARGET_SIGNAL_CONT
;
384 #if defined (SIGTTIN)
385 if (hostsig
== SIGTTIN
)
386 return TARGET_SIGNAL_TTIN
;
388 #if defined (SIGTTOU)
389 if (hostsig
== SIGTTOU
)
390 return TARGET_SIGNAL_TTOU
;
392 #if defined (SIGVTALRM)
393 if (hostsig
== SIGVTALRM
)
394 return TARGET_SIGNAL_VTALRM
;
396 #if defined (SIGPROF)
397 if (hostsig
== SIGPROF
)
398 return TARGET_SIGNAL_PROF
;
400 #if defined (SIGXCPU)
401 if (hostsig
== SIGXCPU
)
402 return TARGET_SIGNAL_XCPU
;
404 #if defined (SIGXFSZ)
405 if (hostsig
== SIGXFSZ
)
406 return TARGET_SIGNAL_XFSZ
;
408 #if defined (SIGWIND)
409 if (hostsig
== SIGWIND
)
410 return TARGET_SIGNAL_WIND
;
412 #if defined (SIGPHONE)
413 if (hostsig
== SIGPHONE
)
414 return TARGET_SIGNAL_PHONE
;
416 #if defined (SIGLOST)
417 if (hostsig
== SIGLOST
)
418 return TARGET_SIGNAL_LOST
;
420 #if defined (SIGWAITING)
421 if (hostsig
== SIGWAITING
)
422 return TARGET_SIGNAL_WAITING
;
424 #if defined (SIGCANCEL)
425 if (hostsig
== SIGCANCEL
)
426 return TARGET_SIGNAL_CANCEL
;
429 if (hostsig
== SIGLWP
)
430 return TARGET_SIGNAL_LWP
;
432 #if defined (SIGDANGER)
433 if (hostsig
== SIGDANGER
)
434 return TARGET_SIGNAL_DANGER
;
436 #if defined (SIGGRANT)
437 if (hostsig
== SIGGRANT
)
438 return TARGET_SIGNAL_GRANT
;
440 #if defined (SIGRETRACT)
441 if (hostsig
== SIGRETRACT
)
442 return TARGET_SIGNAL_RETRACT
;
445 if (hostsig
== SIGMSG
)
446 return TARGET_SIGNAL_MSG
;
448 #if defined (SIGSOUND)
449 if (hostsig
== SIGSOUND
)
450 return TARGET_SIGNAL_SOUND
;
453 if (hostsig
== SIGSAK
)
454 return TARGET_SIGNAL_SAK
;
456 #if defined (SIGPRIO)
457 if (hostsig
== SIGPRIO
)
458 return TARGET_SIGNAL_PRIO
;
461 /* Mach exceptions. Assumes that the values for EXC_ are positive! */
462 #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
463 if (hostsig
== _NSIG
+ EXC_BAD_ACCESS
)
464 return TARGET_EXC_BAD_ACCESS
;
466 #if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
467 if (hostsig
== _NSIG
+ EXC_BAD_INSTRUCTION
)
468 return TARGET_EXC_BAD_INSTRUCTION
;
470 #if defined (EXC_ARITHMETIC) && defined (_NSIG)
471 if (hostsig
== _NSIG
+ EXC_ARITHMETIC
)
472 return TARGET_EXC_ARITHMETIC
;
474 #if defined (EXC_EMULATION) && defined (_NSIG)
475 if (hostsig
== _NSIG
+ EXC_EMULATION
)
476 return TARGET_EXC_EMULATION
;
478 #if defined (EXC_SOFTWARE) && defined (_NSIG)
479 if (hostsig
== _NSIG
+ EXC_SOFTWARE
)
480 return TARGET_EXC_SOFTWARE
;
482 #if defined (EXC_BREAKPOINT) && defined (_NSIG)
483 if (hostsig
== _NSIG
+ EXC_BREAKPOINT
)
484 return TARGET_EXC_BREAKPOINT
;
487 #if defined (SIGINFO)
488 if (hostsig
== SIGINFO
)
489 return TARGET_SIGNAL_INFO
;
492 #if defined (REALTIME_LO)
493 if (hostsig
>= REALTIME_LO
&& hostsig
< REALTIME_HI
)
495 /* This block of TARGET_SIGNAL_REALTIME value is in order. */
496 if (33 <= hostsig
&& hostsig
<= 63)
497 return (enum target_signal
)
498 (hostsig
- 33 + (int) TARGET_SIGNAL_REALTIME_33
);
499 else if (hostsig
== 32)
500 return TARGET_SIGNAL_REALTIME_32
;
501 else if (64 <= hostsig
&& hostsig
<= 127)
502 return (enum target_signal
)
503 (hostsig
- 64 + (int) TARGET_SIGNAL_REALTIME_64
);
505 error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal");
509 return TARGET_SIGNAL_UNKNOWN
;
512 /* Convert a OURSIG (an enum target_signal) to the form used by the
513 target operating system (refered to as the ``host'') or zero if the
514 equivalent host signal is not available. Set/clear OURSIG_OK
518 do_target_signal_to_host (enum target_signal oursig
,
526 case TARGET_SIGNAL_0
:
530 case TARGET_SIGNAL_HUP
:
534 case TARGET_SIGNAL_INT
:
537 #if defined (SIGQUIT)
538 case TARGET_SIGNAL_QUIT
:
542 case TARGET_SIGNAL_ILL
:
545 #if defined (SIGTRAP)
546 case TARGET_SIGNAL_TRAP
:
549 #if defined (SIGABRT)
550 case TARGET_SIGNAL_ABRT
:
554 case TARGET_SIGNAL_EMT
:
558 case TARGET_SIGNAL_FPE
:
561 #if defined (SIGKILL)
562 case TARGET_SIGNAL_KILL
:
566 case TARGET_SIGNAL_BUS
:
569 #if defined (SIGSEGV)
570 case TARGET_SIGNAL_SEGV
:
574 case TARGET_SIGNAL_SYS
:
577 #if defined (SIGPIPE)
578 case TARGET_SIGNAL_PIPE
:
581 #if defined (SIGALRM)
582 case TARGET_SIGNAL_ALRM
:
585 #if defined (SIGTERM)
586 case TARGET_SIGNAL_TERM
:
589 #if defined (SIGUSR1)
590 case TARGET_SIGNAL_USR1
:
593 #if defined (SIGUSR2)
594 case TARGET_SIGNAL_USR2
:
597 #if defined (SIGCHLD) || defined (SIGCLD)
598 case TARGET_SIGNAL_CHLD
:
599 #if defined (SIGCHLD)
604 #endif /* SIGCLD or SIGCHLD */
606 case TARGET_SIGNAL_PWR
:
609 #if defined (SIGWINCH)
610 case TARGET_SIGNAL_WINCH
:
614 case TARGET_SIGNAL_URG
:
618 case TARGET_SIGNAL_IO
:
621 #if defined (SIGPOLL)
622 case TARGET_SIGNAL_POLL
:
625 #if defined (SIGSTOP)
626 case TARGET_SIGNAL_STOP
:
629 #if defined (SIGTSTP)
630 case TARGET_SIGNAL_TSTP
:
633 #if defined (SIGCONT)
634 case TARGET_SIGNAL_CONT
:
637 #if defined (SIGTTIN)
638 case TARGET_SIGNAL_TTIN
:
641 #if defined (SIGTTOU)
642 case TARGET_SIGNAL_TTOU
:
645 #if defined (SIGVTALRM)
646 case TARGET_SIGNAL_VTALRM
:
649 #if defined (SIGPROF)
650 case TARGET_SIGNAL_PROF
:
653 #if defined (SIGXCPU)
654 case TARGET_SIGNAL_XCPU
:
657 #if defined (SIGXFSZ)
658 case TARGET_SIGNAL_XFSZ
:
661 #if defined (SIGWIND)
662 case TARGET_SIGNAL_WIND
:
665 #if defined (SIGPHONE)
666 case TARGET_SIGNAL_PHONE
:
669 #if defined (SIGLOST)
670 case TARGET_SIGNAL_LOST
:
673 #if defined (SIGWAITING)
674 case TARGET_SIGNAL_WAITING
:
677 #if defined (SIGCANCEL)
678 case TARGET_SIGNAL_CANCEL
:
682 case TARGET_SIGNAL_LWP
:
685 #if defined (SIGDANGER)
686 case TARGET_SIGNAL_DANGER
:
689 #if defined (SIGGRANT)
690 case TARGET_SIGNAL_GRANT
:
693 #if defined (SIGRETRACT)
694 case TARGET_SIGNAL_RETRACT
:
698 case TARGET_SIGNAL_MSG
:
701 #if defined (SIGSOUND)
702 case TARGET_SIGNAL_SOUND
:
706 case TARGET_SIGNAL_SAK
:
709 #if defined (SIGPRIO)
710 case TARGET_SIGNAL_PRIO
:
714 /* Mach exceptions. Assumes that the values for EXC_ are positive! */
715 #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
716 case TARGET_EXC_BAD_ACCESS
:
717 return _NSIG
+ EXC_BAD_ACCESS
;
719 #if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
720 case TARGET_EXC_BAD_INSTRUCTION
:
721 return _NSIG
+ EXC_BAD_INSTRUCTION
;
723 #if defined (EXC_ARITHMETIC) && defined (_NSIG)
724 case TARGET_EXC_ARITHMETIC
:
725 return _NSIG
+ EXC_ARITHMETIC
;
727 #if defined (EXC_EMULATION) && defined (_NSIG)
728 case TARGET_EXC_EMULATION
:
729 return _NSIG
+ EXC_EMULATION
;
731 #if defined (EXC_SOFTWARE) && defined (_NSIG)
732 case TARGET_EXC_SOFTWARE
:
733 return _NSIG
+ EXC_SOFTWARE
;
735 #if defined (EXC_BREAKPOINT) && defined (_NSIG)
736 case TARGET_EXC_BREAKPOINT
:
737 return _NSIG
+ EXC_BREAKPOINT
;
740 #if defined (SIGINFO)
741 case TARGET_SIGNAL_INFO
:
746 #if defined (REALTIME_LO)
749 if (oursig
>= TARGET_SIGNAL_REALTIME_33
750 && oursig
<= TARGET_SIGNAL_REALTIME_63
)
752 /* This block of signals is continuous, and
753 TARGET_SIGNAL_REALTIME_33 is 33 by definition. */
754 retsig
= (int) oursig
- (int) TARGET_SIGNAL_REALTIME_33
+ 33;
756 else if (oursig
== TARGET_SIGNAL_REALTIME_32
)
758 /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
759 TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */
762 else if (oursig
>= TARGET_SIGNAL_REALTIME_64
763 && oursig
<= TARGET_SIGNAL_REALTIME_127
)
765 /* This block of signals is continuous, and
766 TARGET_SIGNAL_REALTIME_64 is 64 by definition. */
767 retsig
= (int) oursig
- (int) TARGET_SIGNAL_REALTIME_64
+ 64;
770 if (retsig
>= REALTIME_LO
&& retsig
< REALTIME_HI
)
780 target_signal_to_host_p (enum target_signal oursig
)
783 do_target_signal_to_host (oursig
, &oursig_ok
);
788 target_signal_to_host (enum target_signal oursig
)
791 int targ_signo
= do_target_signal_to_host (oursig
, &oursig_ok
);
794 /* The user might be trying to do "signal SIGSAK" where this system
795 doesn't have SIGSAK. */
796 warning ("Signal %s does not exist on this system.\n",
797 target_signal_to_name (oursig
));
804 /* In some circumstances we allow a command to specify a numeric
805 signal. The idea is to keep these circumstances limited so that
806 users (and scripts) develop portable habits. For comparison,
807 POSIX.2 `kill' requires that 1,2,3,6,9,14, and 15 work (and using a
808 numeric signal at all is obsolescent. We are slightly more
809 lenient and allow 1-15 which should match host signal numbers on
810 most systems. Use of symbolic signal names is strongly encouraged. */
813 target_signal_from_command (int num
)
815 if (num
>= 1 && num
<= 15)
816 return (enum target_signal
) num
;
817 error ("Only signals 1-15 are valid as numeric signals.\n\
818 Use \"info signals\" for a list of symbolic signals.");
822 extern initialize_file_ftype _initialize_signals
; /* -Wmissing-prototype */
825 _initialize_signals (void)
827 if (strcmp (signals
[TARGET_SIGNAL_LAST
].string
, "TARGET_SIGNAL_MAGIC") != 0)
828 internal_error (__FILE__
, __LINE__
, "failed internal consistency check");