1 /* Target signal translation functions for GDB.
2 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003, 2006, 2007, 2008, 2009
4 Free Software Foundation, Inc.
5 Contributed by Cygnus Support.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
27 #include "gdb_string.h"
36 /* Always use __SIGRTMIN if it's available. SIGRTMIN is the lowest
37 _available_ realtime signal, not the lowest supported; glibc takes
38 several for its own use. */
41 # if defined(__SIGRTMIN)
42 # define REALTIME_LO __SIGRTMIN
43 # define REALTIME_HI (__SIGRTMAX + 1)
44 # elif defined(SIGRTMIN)
45 # define REALTIME_LO SIGRTMIN
46 # define REALTIME_HI (SIGRTMAX + 1)
50 /* This table must match in order and size the signals in enum target_signal
51 in src/include/gdb/signals.h. */
60 {"SIGINT", "Interrupt"},
62 {"SIGILL", "Illegal instruction"},
63 {"SIGTRAP", "Trace/breakpoint trap"},
64 {"SIGABRT", "Aborted"},
65 {"SIGEMT", "Emulation trap"},
66 {"SIGFPE", "Arithmetic exception"},
67 {"SIGKILL", "Killed"},
68 {"SIGBUS", "Bus error"},
69 {"SIGSEGV", "Segmentation fault"},
70 {"SIGSYS", "Bad system call"},
71 {"SIGPIPE", "Broken pipe"},
72 {"SIGALRM", "Alarm clock"},
73 {"SIGTERM", "Terminated"},
74 {"SIGURG", "Urgent I/O condition"},
75 {"SIGSTOP", "Stopped (signal)"},
76 {"SIGTSTP", "Stopped (user)"},
77 {"SIGCONT", "Continued"},
78 {"SIGCHLD", "Child status changed"},
79 {"SIGTTIN", "Stopped (tty input)"},
80 {"SIGTTOU", "Stopped (tty output)"},
81 {"SIGIO", "I/O possible"},
82 {"SIGXCPU", "CPU time limit exceeded"},
83 {"SIGXFSZ", "File size limit exceeded"},
84 {"SIGVTALRM", "Virtual timer expired"},
85 {"SIGPROF", "Profiling timer expired"},
86 {"SIGWINCH", "Window size changed"},
87 {"SIGLOST", "Resource lost"},
88 {"SIGUSR1", "User defined signal 1"},
89 {"SIGUSR2", "User defined signal 2"},
90 {"SIGPWR", "Power fail/restart"},
91 {"SIGPOLL", "Pollable event occurred"},
92 {"SIGWIND", "SIGWIND"},
93 {"SIGPHONE", "SIGPHONE"},
94 {"SIGWAITING", "Process's LWPs are blocked"},
95 {"SIGLWP", "Signal LWP"},
96 {"SIGDANGER", "Swap space dangerously low"},
97 {"SIGGRANT", "Monitor mode granted"},
98 {"SIGRETRACT", "Need to relinquish monitor mode"},
99 {"SIGMSG", "Monitor mode data available"},
100 {"SIGSOUND", "Sound completed"},
101 {"SIGSAK", "Secure attention"},
102 {"SIGPRIO", "SIGPRIO"},
103 {"SIG33", "Real-time event 33"},
104 {"SIG34", "Real-time event 34"},
105 {"SIG35", "Real-time event 35"},
106 {"SIG36", "Real-time event 36"},
107 {"SIG37", "Real-time event 37"},
108 {"SIG38", "Real-time event 38"},
109 {"SIG39", "Real-time event 39"},
110 {"SIG40", "Real-time event 40"},
111 {"SIG41", "Real-time event 41"},
112 {"SIG42", "Real-time event 42"},
113 {"SIG43", "Real-time event 43"},
114 {"SIG44", "Real-time event 44"},
115 {"SIG45", "Real-time event 45"},
116 {"SIG46", "Real-time event 46"},
117 {"SIG47", "Real-time event 47"},
118 {"SIG48", "Real-time event 48"},
119 {"SIG49", "Real-time event 49"},
120 {"SIG50", "Real-time event 50"},
121 {"SIG51", "Real-time event 51"},
122 {"SIG52", "Real-time event 52"},
123 {"SIG53", "Real-time event 53"},
124 {"SIG54", "Real-time event 54"},
125 {"SIG55", "Real-time event 55"},
126 {"SIG56", "Real-time event 56"},
127 {"SIG57", "Real-time event 57"},
128 {"SIG58", "Real-time event 58"},
129 {"SIG59", "Real-time event 59"},
130 {"SIG60", "Real-time event 60"},
131 {"SIG61", "Real-time event 61"},
132 {"SIG62", "Real-time event 62"},
133 {"SIG63", "Real-time event 63"},
134 {"SIGCANCEL", "LWP internal signal"},
135 {"SIG32", "Real-time event 32"},
136 {"SIG64", "Real-time event 64"},
137 {"SIG65", "Real-time event 65"},
138 {"SIG66", "Real-time event 66"},
139 {"SIG67", "Real-time event 67"},
140 {"SIG68", "Real-time event 68"},
141 {"SIG69", "Real-time event 69"},
142 {"SIG70", "Real-time event 70"},
143 {"SIG71", "Real-time event 71"},
144 {"SIG72", "Real-time event 72"},
145 {"SIG73", "Real-time event 73"},
146 {"SIG74", "Real-time event 74"},
147 {"SIG75", "Real-time event 75"},
148 {"SIG76", "Real-time event 76"},
149 {"SIG77", "Real-time event 77"},
150 {"SIG78", "Real-time event 78"},
151 {"SIG79", "Real-time event 79"},
152 {"SIG80", "Real-time event 80"},
153 {"SIG81", "Real-time event 81"},
154 {"SIG82", "Real-time event 82"},
155 {"SIG83", "Real-time event 83"},
156 {"SIG84", "Real-time event 84"},
157 {"SIG85", "Real-time event 85"},
158 {"SIG86", "Real-time event 86"},
159 {"SIG87", "Real-time event 87"},
160 {"SIG88", "Real-time event 88"},
161 {"SIG89", "Real-time event 89"},
162 {"SIG90", "Real-time event 90"},
163 {"SIG91", "Real-time event 91"},
164 {"SIG92", "Real-time event 92"},
165 {"SIG93", "Real-time event 93"},
166 {"SIG94", "Real-time event 94"},
167 {"SIG95", "Real-time event 95"},
168 {"SIG96", "Real-time event 96"},
169 {"SIG97", "Real-time event 97"},
170 {"SIG98", "Real-time event 98"},
171 {"SIG99", "Real-time event 99"},
172 {"SIG100", "Real-time event 100"},
173 {"SIG101", "Real-time event 101"},
174 {"SIG102", "Real-time event 102"},
175 {"SIG103", "Real-time event 103"},
176 {"SIG104", "Real-time event 104"},
177 {"SIG105", "Real-time event 105"},
178 {"SIG106", "Real-time event 106"},
179 {"SIG107", "Real-time event 107"},
180 {"SIG108", "Real-time event 108"},
181 {"SIG109", "Real-time event 109"},
182 {"SIG110", "Real-time event 110"},
183 {"SIG111", "Real-time event 111"},
184 {"SIG112", "Real-time event 112"},
185 {"SIG113", "Real-time event 113"},
186 {"SIG114", "Real-time event 114"},
187 {"SIG115", "Real-time event 115"},
188 {"SIG116", "Real-time event 116"},
189 {"SIG117", "Real-time event 117"},
190 {"SIG118", "Real-time event 118"},
191 {"SIG119", "Real-time event 119"},
192 {"SIG120", "Real-time event 120"},
193 {"SIG121", "Real-time event 121"},
194 {"SIG122", "Real-time event 122"},
195 {"SIG123", "Real-time event 123"},
196 {"SIG124", "Real-time event 124"},
197 {"SIG125", "Real-time event 125"},
198 {"SIG126", "Real-time event 126"},
199 {"SIG127", "Real-time event 127"},
201 {"SIGINFO", "Information request"},
203 {NULL
, "Unknown signal"},
204 {NULL
, "Internal error: printing TARGET_SIGNAL_DEFAULT"},
206 /* Mach exceptions */
207 {"EXC_BAD_ACCESS", "Could not access memory"},
208 {"EXC_BAD_INSTRUCTION", "Illegal instruction/operand"},
209 {"EXC_ARITHMETIC", "Arithmetic exception"},
210 {"EXC_EMULATION", "Emulation instruction"},
211 {"EXC_SOFTWARE", "Software generated exception"},
212 {"EXC_BREAKPOINT", "Breakpoint"},
214 /* Last entry, used to check whether the table is the right size. */
215 {NULL
, "TARGET_SIGNAL_MAGIC"}
221 /* Return the string for a signal. */
223 target_signal_to_string (enum target_signal sig
)
225 if ((int) sig
>= TARGET_SIGNAL_FIRST
&& (int) sig
<= TARGET_SIGNAL_LAST
)
226 return signals
[sig
].string
;
228 return signals
[TARGET_SIGNAL_UNKNOWN
].string
;
231 /* Return the name for a signal. */
233 target_signal_to_name (enum target_signal sig
)
235 if ((int) sig
>= TARGET_SIGNAL_FIRST
&& (int) sig
<= TARGET_SIGNAL_LAST
236 && signals
[sig
].name
!= NULL
)
237 return signals
[sig
].name
;
239 /* I think the code which prints this will always print it along
240 with the string, so no need to be verbose (very old comment). */
244 /* Given a name, return its signal. */
246 target_signal_from_name (const char *name
)
248 enum target_signal sig
;
250 /* It's possible we also should allow "SIGCLD" as well as "SIGCHLD"
251 for TARGET_SIGNAL_SIGCHLD. SIGIOT, on the other hand, is more
252 questionable; seems like by now people should call it SIGABRT
255 /* This ugly cast brought to you by the native VAX compiler. */
256 for (sig
= TARGET_SIGNAL_HUP
;
257 sig
< TARGET_SIGNAL_LAST
;
258 sig
= (enum target_signal
) ((int) sig
+ 1))
259 if (signals
[sig
].name
!= NULL
260 && strcmp (name
, signals
[sig
].name
) == 0)
262 return TARGET_SIGNAL_UNKNOWN
;
265 /* The following functions are to help certain targets deal
266 with the signal/waitstatus stuff. They could just as well be in
267 a file called native-utils.c or unixwaitstatus-utils.c or whatever. */
269 /* Convert host signal to our signals. */
271 target_signal_from_host (int hostsig
)
273 /* A switch statement would make sense but would require special kludges
274 to deal with the cases where more than one signal has the same number. */
277 return TARGET_SIGNAL_0
;
280 if (hostsig
== SIGHUP
)
281 return TARGET_SIGNAL_HUP
;
284 if (hostsig
== SIGINT
)
285 return TARGET_SIGNAL_INT
;
287 #if defined (SIGQUIT)
288 if (hostsig
== SIGQUIT
)
289 return TARGET_SIGNAL_QUIT
;
292 if (hostsig
== SIGILL
)
293 return TARGET_SIGNAL_ILL
;
295 #if defined (SIGTRAP)
296 if (hostsig
== SIGTRAP
)
297 return TARGET_SIGNAL_TRAP
;
299 #if defined (SIGABRT)
300 if (hostsig
== SIGABRT
)
301 return TARGET_SIGNAL_ABRT
;
304 if (hostsig
== SIGEMT
)
305 return TARGET_SIGNAL_EMT
;
308 if (hostsig
== SIGFPE
)
309 return TARGET_SIGNAL_FPE
;
311 #if defined (SIGKILL)
312 if (hostsig
== SIGKILL
)
313 return TARGET_SIGNAL_KILL
;
316 if (hostsig
== SIGBUS
)
317 return TARGET_SIGNAL_BUS
;
319 #if defined (SIGSEGV)
320 if (hostsig
== SIGSEGV
)
321 return TARGET_SIGNAL_SEGV
;
324 if (hostsig
== SIGSYS
)
325 return TARGET_SIGNAL_SYS
;
327 #if defined (SIGPIPE)
328 if (hostsig
== SIGPIPE
)
329 return TARGET_SIGNAL_PIPE
;
331 #if defined (SIGALRM)
332 if (hostsig
== SIGALRM
)
333 return TARGET_SIGNAL_ALRM
;
335 #if defined (SIGTERM)
336 if (hostsig
== SIGTERM
)
337 return TARGET_SIGNAL_TERM
;
339 #if defined (SIGUSR1)
340 if (hostsig
== SIGUSR1
)
341 return TARGET_SIGNAL_USR1
;
343 #if defined (SIGUSR2)
344 if (hostsig
== SIGUSR2
)
345 return TARGET_SIGNAL_USR2
;
348 if (hostsig
== SIGCLD
)
349 return TARGET_SIGNAL_CHLD
;
351 #if defined (SIGCHLD)
352 if (hostsig
== SIGCHLD
)
353 return TARGET_SIGNAL_CHLD
;
356 if (hostsig
== SIGPWR
)
357 return TARGET_SIGNAL_PWR
;
359 #if defined (SIGWINCH)
360 if (hostsig
== SIGWINCH
)
361 return TARGET_SIGNAL_WINCH
;
364 if (hostsig
== SIGURG
)
365 return TARGET_SIGNAL_URG
;
368 if (hostsig
== SIGIO
)
369 return TARGET_SIGNAL_IO
;
371 #if defined (SIGPOLL)
372 if (hostsig
== SIGPOLL
)
373 return TARGET_SIGNAL_POLL
;
375 #if defined (SIGSTOP)
376 if (hostsig
== SIGSTOP
)
377 return TARGET_SIGNAL_STOP
;
379 #if defined (SIGTSTP)
380 if (hostsig
== SIGTSTP
)
381 return TARGET_SIGNAL_TSTP
;
383 #if defined (SIGCONT)
384 if (hostsig
== SIGCONT
)
385 return TARGET_SIGNAL_CONT
;
387 #if defined (SIGTTIN)
388 if (hostsig
== SIGTTIN
)
389 return TARGET_SIGNAL_TTIN
;
391 #if defined (SIGTTOU)
392 if (hostsig
== SIGTTOU
)
393 return TARGET_SIGNAL_TTOU
;
395 #if defined (SIGVTALRM)
396 if (hostsig
== SIGVTALRM
)
397 return TARGET_SIGNAL_VTALRM
;
399 #if defined (SIGPROF)
400 if (hostsig
== SIGPROF
)
401 return TARGET_SIGNAL_PROF
;
403 #if defined (SIGXCPU)
404 if (hostsig
== SIGXCPU
)
405 return TARGET_SIGNAL_XCPU
;
407 #if defined (SIGXFSZ)
408 if (hostsig
== SIGXFSZ
)
409 return TARGET_SIGNAL_XFSZ
;
411 #if defined (SIGWIND)
412 if (hostsig
== SIGWIND
)
413 return TARGET_SIGNAL_WIND
;
415 #if defined (SIGPHONE)
416 if (hostsig
== SIGPHONE
)
417 return TARGET_SIGNAL_PHONE
;
419 #if defined (SIGLOST)
420 if (hostsig
== SIGLOST
)
421 return TARGET_SIGNAL_LOST
;
423 #if defined (SIGWAITING)
424 if (hostsig
== SIGWAITING
)
425 return TARGET_SIGNAL_WAITING
;
427 #if defined (SIGCANCEL)
428 if (hostsig
== SIGCANCEL
)
429 return TARGET_SIGNAL_CANCEL
;
432 if (hostsig
== SIGLWP
)
433 return TARGET_SIGNAL_LWP
;
435 #if defined (SIGDANGER)
436 if (hostsig
== SIGDANGER
)
437 return TARGET_SIGNAL_DANGER
;
439 #if defined (SIGGRANT)
440 if (hostsig
== SIGGRANT
)
441 return TARGET_SIGNAL_GRANT
;
443 #if defined (SIGRETRACT)
444 if (hostsig
== SIGRETRACT
)
445 return TARGET_SIGNAL_RETRACT
;
448 if (hostsig
== SIGMSG
)
449 return TARGET_SIGNAL_MSG
;
451 #if defined (SIGSOUND)
452 if (hostsig
== SIGSOUND
)
453 return TARGET_SIGNAL_SOUND
;
456 if (hostsig
== SIGSAK
)
457 return TARGET_SIGNAL_SAK
;
459 #if defined (SIGPRIO)
460 if (hostsig
== SIGPRIO
)
461 return TARGET_SIGNAL_PRIO
;
464 /* Mach exceptions. Assumes that the values for EXC_ are positive! */
465 #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
466 if (hostsig
== _NSIG
+ EXC_BAD_ACCESS
)
467 return TARGET_EXC_BAD_ACCESS
;
469 #if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
470 if (hostsig
== _NSIG
+ EXC_BAD_INSTRUCTION
)
471 return TARGET_EXC_BAD_INSTRUCTION
;
473 #if defined (EXC_ARITHMETIC) && defined (_NSIG)
474 if (hostsig
== _NSIG
+ EXC_ARITHMETIC
)
475 return TARGET_EXC_ARITHMETIC
;
477 #if defined (EXC_EMULATION) && defined (_NSIG)
478 if (hostsig
== _NSIG
+ EXC_EMULATION
)
479 return TARGET_EXC_EMULATION
;
481 #if defined (EXC_SOFTWARE) && defined (_NSIG)
482 if (hostsig
== _NSIG
+ EXC_SOFTWARE
)
483 return TARGET_EXC_SOFTWARE
;
485 #if defined (EXC_BREAKPOINT) && defined (_NSIG)
486 if (hostsig
== _NSIG
+ EXC_BREAKPOINT
)
487 return TARGET_EXC_BREAKPOINT
;
490 #if defined (SIGINFO)
491 if (hostsig
== SIGINFO
)
492 return TARGET_SIGNAL_INFO
;
495 #if defined (REALTIME_LO)
496 if (hostsig
>= REALTIME_LO
&& hostsig
< REALTIME_HI
)
498 /* This block of TARGET_SIGNAL_REALTIME value is in order. */
499 if (33 <= hostsig
&& hostsig
<= 63)
500 return (enum target_signal
)
501 (hostsig
- 33 + (int) TARGET_SIGNAL_REALTIME_33
);
502 else if (hostsig
== 32)
503 return TARGET_SIGNAL_REALTIME_32
;
504 else if (64 <= hostsig
&& hostsig
<= 127)
505 return (enum target_signal
)
506 (hostsig
- 64 + (int) TARGET_SIGNAL_REALTIME_64
);
508 error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal");
512 return TARGET_SIGNAL_UNKNOWN
;
515 /* Convert a OURSIG (an enum target_signal) to the form used by the
516 target operating system (refered to as the ``host'') or zero if the
517 equivalent host signal is not available. Set/clear OURSIG_OK
521 do_target_signal_to_host (enum target_signal oursig
,
525 /* Silence the 'not used' warning, for targets that
526 do not support signals. */
532 case TARGET_SIGNAL_0
:
536 case TARGET_SIGNAL_HUP
:
540 case TARGET_SIGNAL_INT
:
543 #if defined (SIGQUIT)
544 case TARGET_SIGNAL_QUIT
:
548 case TARGET_SIGNAL_ILL
:
551 #if defined (SIGTRAP)
552 case TARGET_SIGNAL_TRAP
:
555 #if defined (SIGABRT)
556 case TARGET_SIGNAL_ABRT
:
560 case TARGET_SIGNAL_EMT
:
564 case TARGET_SIGNAL_FPE
:
567 #if defined (SIGKILL)
568 case TARGET_SIGNAL_KILL
:
572 case TARGET_SIGNAL_BUS
:
575 #if defined (SIGSEGV)
576 case TARGET_SIGNAL_SEGV
:
580 case TARGET_SIGNAL_SYS
:
583 #if defined (SIGPIPE)
584 case TARGET_SIGNAL_PIPE
:
587 #if defined (SIGALRM)
588 case TARGET_SIGNAL_ALRM
:
591 #if defined (SIGTERM)
592 case TARGET_SIGNAL_TERM
:
595 #if defined (SIGUSR1)
596 case TARGET_SIGNAL_USR1
:
599 #if defined (SIGUSR2)
600 case TARGET_SIGNAL_USR2
:
603 #if defined (SIGCHLD) || defined (SIGCLD)
604 case TARGET_SIGNAL_CHLD
:
605 #if defined (SIGCHLD)
610 #endif /* SIGCLD or SIGCHLD */
612 case TARGET_SIGNAL_PWR
:
615 #if defined (SIGWINCH)
616 case TARGET_SIGNAL_WINCH
:
620 case TARGET_SIGNAL_URG
:
624 case TARGET_SIGNAL_IO
:
627 #if defined (SIGPOLL)
628 case TARGET_SIGNAL_POLL
:
631 #if defined (SIGSTOP)
632 case TARGET_SIGNAL_STOP
:
635 #if defined (SIGTSTP)
636 case TARGET_SIGNAL_TSTP
:
639 #if defined (SIGCONT)
640 case TARGET_SIGNAL_CONT
:
643 #if defined (SIGTTIN)
644 case TARGET_SIGNAL_TTIN
:
647 #if defined (SIGTTOU)
648 case TARGET_SIGNAL_TTOU
:
651 #if defined (SIGVTALRM)
652 case TARGET_SIGNAL_VTALRM
:
655 #if defined (SIGPROF)
656 case TARGET_SIGNAL_PROF
:
659 #if defined (SIGXCPU)
660 case TARGET_SIGNAL_XCPU
:
663 #if defined (SIGXFSZ)
664 case TARGET_SIGNAL_XFSZ
:
667 #if defined (SIGWIND)
668 case TARGET_SIGNAL_WIND
:
671 #if defined (SIGPHONE)
672 case TARGET_SIGNAL_PHONE
:
675 #if defined (SIGLOST)
676 case TARGET_SIGNAL_LOST
:
679 #if defined (SIGWAITING)
680 case TARGET_SIGNAL_WAITING
:
683 #if defined (SIGCANCEL)
684 case TARGET_SIGNAL_CANCEL
:
688 case TARGET_SIGNAL_LWP
:
691 #if defined (SIGDANGER)
692 case TARGET_SIGNAL_DANGER
:
695 #if defined (SIGGRANT)
696 case TARGET_SIGNAL_GRANT
:
699 #if defined (SIGRETRACT)
700 case TARGET_SIGNAL_RETRACT
:
704 case TARGET_SIGNAL_MSG
:
707 #if defined (SIGSOUND)
708 case TARGET_SIGNAL_SOUND
:
712 case TARGET_SIGNAL_SAK
:
715 #if defined (SIGPRIO)
716 case TARGET_SIGNAL_PRIO
:
720 /* Mach exceptions. Assumes that the values for EXC_ are positive! */
721 #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
722 case TARGET_EXC_BAD_ACCESS
:
723 return _NSIG
+ EXC_BAD_ACCESS
;
725 #if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
726 case TARGET_EXC_BAD_INSTRUCTION
:
727 return _NSIG
+ EXC_BAD_INSTRUCTION
;
729 #if defined (EXC_ARITHMETIC) && defined (_NSIG)
730 case TARGET_EXC_ARITHMETIC
:
731 return _NSIG
+ EXC_ARITHMETIC
;
733 #if defined (EXC_EMULATION) && defined (_NSIG)
734 case TARGET_EXC_EMULATION
:
735 return _NSIG
+ EXC_EMULATION
;
737 #if defined (EXC_SOFTWARE) && defined (_NSIG)
738 case TARGET_EXC_SOFTWARE
:
739 return _NSIG
+ EXC_SOFTWARE
;
741 #if defined (EXC_BREAKPOINT) && defined (_NSIG)
742 case TARGET_EXC_BREAKPOINT
:
743 return _NSIG
+ EXC_BREAKPOINT
;
746 #if defined (SIGINFO)
747 case TARGET_SIGNAL_INFO
:
752 #if defined (REALTIME_LO)
755 if (oursig
>= TARGET_SIGNAL_REALTIME_33
756 && oursig
<= TARGET_SIGNAL_REALTIME_63
)
758 /* This block of signals is continuous, and
759 TARGET_SIGNAL_REALTIME_33 is 33 by definition. */
760 retsig
= (int) oursig
- (int) TARGET_SIGNAL_REALTIME_33
+ 33;
762 else if (oursig
== TARGET_SIGNAL_REALTIME_32
)
764 /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
765 TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */
768 else if (oursig
>= TARGET_SIGNAL_REALTIME_64
769 && oursig
<= TARGET_SIGNAL_REALTIME_127
)
771 /* This block of signals is continuous, and
772 TARGET_SIGNAL_REALTIME_64 is 64 by definition. */
773 retsig
= (int) oursig
- (int) TARGET_SIGNAL_REALTIME_64
+ 64;
776 if (retsig
>= REALTIME_LO
&& retsig
< REALTIME_HI
)
786 target_signal_to_host_p (enum target_signal oursig
)
789 do_target_signal_to_host (oursig
, &oursig_ok
);
794 target_signal_to_host (enum target_signal oursig
)
797 int targ_signo
= do_target_signal_to_host (oursig
, &oursig_ok
);
800 /* The user might be trying to do "signal SIGSAK" where this system
801 doesn't have SIGSAK. */
802 warning ("Signal %s does not exist on this system.\n",
803 target_signal_to_name (oursig
));
810 /* In some circumstances we allow a command to specify a numeric
811 signal. The idea is to keep these circumstances limited so that
812 users (and scripts) develop portable habits. For comparison,
813 POSIX.2 `kill' requires that 1,2,3,6,9,14, and 15 work (and using a
814 numeric signal at all is obsolescent. We are slightly more
815 lenient and allow 1-15 which should match host signal numbers on
816 most systems. Use of symbolic signal names is strongly encouraged. */
819 target_signal_from_command (int num
)
821 if (num
>= 1 && num
<= 15)
822 return (enum target_signal
) num
;
823 error ("Only signals 1-15 are valid as numeric signals.\n\
824 Use \"info signals\" for a list of symbolic signals.");
828 extern initialize_file_ftype _initialize_signals
; /* -Wmissing-prototype */
831 _initialize_signals (void)
833 if (strcmp (signals
[TARGET_SIGNAL_LAST
].string
, "TARGET_SIGNAL_MAGIC") != 0)
834 internal_error (__FILE__
, __LINE__
, "failed internal consistency check");
839 default_target_signal_to_host (struct gdbarch
*gdbarch
, enum target_signal ts
)
841 return target_signal_to_host (ts
);
845 default_target_signal_from_host (struct gdbarch
*gdbarch
, int signo
)
847 return target_signal_from_host (signo
);