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, 2010
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/>. */
26 #include "gdb_string.h"
33 #include "gdb_signals.h"
37 /* Always use __SIGRTMIN if it's available. SIGRTMIN is the lowest
38 _available_ realtime signal, not the lowest supported; glibc takes
39 several for its own use. */
42 # if defined(__SIGRTMIN)
43 # define REALTIME_LO __SIGRTMIN
44 # define REALTIME_HI (__SIGRTMAX + 1)
45 # elif defined(SIGRTMIN)
46 # define REALTIME_LO SIGRTMIN
47 # define REALTIME_HI (SIGRTMAX + 1)
51 /* This table must match in order and size the signals in enum target_signal
52 in src/include/gdb/signals.h. */
61 {"SIGINT", "Interrupt"},
63 {"SIGILL", "Illegal instruction"},
64 {"SIGTRAP", "Trace/breakpoint trap"},
65 {"SIGABRT", "Aborted"},
66 {"SIGEMT", "Emulation trap"},
67 {"SIGFPE", "Arithmetic exception"},
68 {"SIGKILL", "Killed"},
69 {"SIGBUS", "Bus error"},
70 {"SIGSEGV", "Segmentation fault"},
71 {"SIGSYS", "Bad system call"},
72 {"SIGPIPE", "Broken pipe"},
73 {"SIGALRM", "Alarm clock"},
74 {"SIGTERM", "Terminated"},
75 {"SIGURG", "Urgent I/O condition"},
76 {"SIGSTOP", "Stopped (signal)"},
77 {"SIGTSTP", "Stopped (user)"},
78 {"SIGCONT", "Continued"},
79 {"SIGCHLD", "Child status changed"},
80 {"SIGTTIN", "Stopped (tty input)"},
81 {"SIGTTOU", "Stopped (tty output)"},
82 {"SIGIO", "I/O possible"},
83 {"SIGXCPU", "CPU time limit exceeded"},
84 {"SIGXFSZ", "File size limit exceeded"},
85 {"SIGVTALRM", "Virtual timer expired"},
86 {"SIGPROF", "Profiling timer expired"},
87 {"SIGWINCH", "Window size changed"},
88 {"SIGLOST", "Resource lost"},
89 {"SIGUSR1", "User defined signal 1"},
90 {"SIGUSR2", "User defined signal 2"},
91 {"SIGPWR", "Power fail/restart"},
92 {"SIGPOLL", "Pollable event occurred"},
93 {"SIGWIND", "SIGWIND"},
94 {"SIGPHONE", "SIGPHONE"},
95 {"SIGWAITING", "Process's LWPs are blocked"},
96 {"SIGLWP", "Signal LWP"},
97 {"SIGDANGER", "Swap space dangerously low"},
98 {"SIGGRANT", "Monitor mode granted"},
99 {"SIGRETRACT", "Need to relinquish monitor mode"},
100 {"SIGMSG", "Monitor mode data available"},
101 {"SIGSOUND", "Sound completed"},
102 {"SIGSAK", "Secure attention"},
103 {"SIGPRIO", "SIGPRIO"},
104 {"SIG33", "Real-time event 33"},
105 {"SIG34", "Real-time event 34"},
106 {"SIG35", "Real-time event 35"},
107 {"SIG36", "Real-time event 36"},
108 {"SIG37", "Real-time event 37"},
109 {"SIG38", "Real-time event 38"},
110 {"SIG39", "Real-time event 39"},
111 {"SIG40", "Real-time event 40"},
112 {"SIG41", "Real-time event 41"},
113 {"SIG42", "Real-time event 42"},
114 {"SIG43", "Real-time event 43"},
115 {"SIG44", "Real-time event 44"},
116 {"SIG45", "Real-time event 45"},
117 {"SIG46", "Real-time event 46"},
118 {"SIG47", "Real-time event 47"},
119 {"SIG48", "Real-time event 48"},
120 {"SIG49", "Real-time event 49"},
121 {"SIG50", "Real-time event 50"},
122 {"SIG51", "Real-time event 51"},
123 {"SIG52", "Real-time event 52"},
124 {"SIG53", "Real-time event 53"},
125 {"SIG54", "Real-time event 54"},
126 {"SIG55", "Real-time event 55"},
127 {"SIG56", "Real-time event 56"},
128 {"SIG57", "Real-time event 57"},
129 {"SIG58", "Real-time event 58"},
130 {"SIG59", "Real-time event 59"},
131 {"SIG60", "Real-time event 60"},
132 {"SIG61", "Real-time event 61"},
133 {"SIG62", "Real-time event 62"},
134 {"SIG63", "Real-time event 63"},
135 {"SIGCANCEL", "LWP internal signal"},
136 {"SIG32", "Real-time event 32"},
137 {"SIG64", "Real-time event 64"},
138 {"SIG65", "Real-time event 65"},
139 {"SIG66", "Real-time event 66"},
140 {"SIG67", "Real-time event 67"},
141 {"SIG68", "Real-time event 68"},
142 {"SIG69", "Real-time event 69"},
143 {"SIG70", "Real-time event 70"},
144 {"SIG71", "Real-time event 71"},
145 {"SIG72", "Real-time event 72"},
146 {"SIG73", "Real-time event 73"},
147 {"SIG74", "Real-time event 74"},
148 {"SIG75", "Real-time event 75"},
149 {"SIG76", "Real-time event 76"},
150 {"SIG77", "Real-time event 77"},
151 {"SIG78", "Real-time event 78"},
152 {"SIG79", "Real-time event 79"},
153 {"SIG80", "Real-time event 80"},
154 {"SIG81", "Real-time event 81"},
155 {"SIG82", "Real-time event 82"},
156 {"SIG83", "Real-time event 83"},
157 {"SIG84", "Real-time event 84"},
158 {"SIG85", "Real-time event 85"},
159 {"SIG86", "Real-time event 86"},
160 {"SIG87", "Real-time event 87"},
161 {"SIG88", "Real-time event 88"},
162 {"SIG89", "Real-time event 89"},
163 {"SIG90", "Real-time event 90"},
164 {"SIG91", "Real-time event 91"},
165 {"SIG92", "Real-time event 92"},
166 {"SIG93", "Real-time event 93"},
167 {"SIG94", "Real-time event 94"},
168 {"SIG95", "Real-time event 95"},
169 {"SIG96", "Real-time event 96"},
170 {"SIG97", "Real-time event 97"},
171 {"SIG98", "Real-time event 98"},
172 {"SIG99", "Real-time event 99"},
173 {"SIG100", "Real-time event 100"},
174 {"SIG101", "Real-time event 101"},
175 {"SIG102", "Real-time event 102"},
176 {"SIG103", "Real-time event 103"},
177 {"SIG104", "Real-time event 104"},
178 {"SIG105", "Real-time event 105"},
179 {"SIG106", "Real-time event 106"},
180 {"SIG107", "Real-time event 107"},
181 {"SIG108", "Real-time event 108"},
182 {"SIG109", "Real-time event 109"},
183 {"SIG110", "Real-time event 110"},
184 {"SIG111", "Real-time event 111"},
185 {"SIG112", "Real-time event 112"},
186 {"SIG113", "Real-time event 113"},
187 {"SIG114", "Real-time event 114"},
188 {"SIG115", "Real-time event 115"},
189 {"SIG116", "Real-time event 116"},
190 {"SIG117", "Real-time event 117"},
191 {"SIG118", "Real-time event 118"},
192 {"SIG119", "Real-time event 119"},
193 {"SIG120", "Real-time event 120"},
194 {"SIG121", "Real-time event 121"},
195 {"SIG122", "Real-time event 122"},
196 {"SIG123", "Real-time event 123"},
197 {"SIG124", "Real-time event 124"},
198 {"SIG125", "Real-time event 125"},
199 {"SIG126", "Real-time event 126"},
200 {"SIG127", "Real-time event 127"},
202 {"SIGINFO", "Information request"},
204 {NULL, "Unknown signal"},
205 {NULL, "Internal error: printing TARGET_SIGNAL_DEFAULT"},
207 /* Mach exceptions */
208 {"EXC_BAD_ACCESS", "Could not access memory"},
209 {"EXC_BAD_INSTRUCTION", "Illegal instruction/operand"},
210 {"EXC_ARITHMETIC", "Arithmetic exception"},
211 {"EXC_EMULATION", "Emulation instruction"},
212 {"EXC_SOFTWARE", "Software generated exception"},
213 {"EXC_BREAKPOINT", "Breakpoint"},
215 /* Last entry, used to check whether the table is the right size. */
216 {NULL, "TARGET_SIGNAL_MAGIC"}
222 /* Return the string for a signal. */
224 target_signal_to_string (enum target_signal sig)
226 if ((int) sig >= TARGET_SIGNAL_FIRST && (int) sig <= TARGET_SIGNAL_LAST)
227 return signals[sig].string;
229 return signals[TARGET_SIGNAL_UNKNOWN].string;
232 /* Return the name for a signal. */
234 target_signal_to_name (enum target_signal sig)
236 if ((int) sig >= TARGET_SIGNAL_FIRST && (int) sig <= TARGET_SIGNAL_LAST
237 && signals[sig].name != NULL)
238 return signals[sig].name;
240 /* I think the code which prints this will always print it along
241 with the string, so no need to be verbose (very old comment). */
245 /* Given a name, return its signal. */
247 target_signal_from_name (const char *name)
249 enum target_signal sig;
251 /* It's possible we also should allow "SIGCLD" as well as "SIGCHLD"
252 for TARGET_SIGNAL_SIGCHLD. SIGIOT, on the other hand, is more
253 questionable; seems like by now people should call it SIGABRT
256 /* This ugly cast brought to you by the native VAX compiler. */
257 for (sig = TARGET_SIGNAL_HUP;
258 sig < TARGET_SIGNAL_LAST;
259 sig = (enum target_signal) ((int) sig + 1))
260 if (signals[sig].name != NULL
261 && strcmp (name, signals[sig].name) == 0)
263 return TARGET_SIGNAL_UNKNOWN;
266 /* The following functions are to help certain targets deal
267 with the signal/waitstatus stuff. They could just as well be in
268 a file called native-utils.c or unixwaitstatus-utils.c or whatever. */
270 /* Convert host signal to our signals. */
272 target_signal_from_host (int hostsig)
274 /* A switch statement would make sense but would require special kludges
275 to deal with the cases where more than one signal has the same number. */
278 return TARGET_SIGNAL_0;
281 if (hostsig == SIGHUP)
282 return TARGET_SIGNAL_HUP;
285 if (hostsig == SIGINT)
286 return TARGET_SIGNAL_INT;
288 #if defined (SIGQUIT)
289 if (hostsig == SIGQUIT)
290 return TARGET_SIGNAL_QUIT;
293 if (hostsig == SIGILL)
294 return TARGET_SIGNAL_ILL;
296 #if defined (SIGTRAP)
297 if (hostsig == SIGTRAP)
298 return TARGET_SIGNAL_TRAP;
300 #if defined (SIGABRT)
301 if (hostsig == SIGABRT)
302 return TARGET_SIGNAL_ABRT;
305 if (hostsig == SIGEMT)
306 return TARGET_SIGNAL_EMT;
309 if (hostsig == SIGFPE)
310 return TARGET_SIGNAL_FPE;
312 #if defined (SIGKILL)
313 if (hostsig == SIGKILL)
314 return TARGET_SIGNAL_KILL;
317 if (hostsig == SIGBUS)
318 return TARGET_SIGNAL_BUS;
320 #if defined (SIGSEGV)
321 if (hostsig == SIGSEGV)
322 return TARGET_SIGNAL_SEGV;
325 if (hostsig == SIGSYS)
326 return TARGET_SIGNAL_SYS;
328 #if defined (SIGPIPE)
329 if (hostsig == SIGPIPE)
330 return TARGET_SIGNAL_PIPE;
332 #if defined (SIGALRM)
333 if (hostsig == SIGALRM)
334 return TARGET_SIGNAL_ALRM;
336 #if defined (SIGTERM)
337 if (hostsig == SIGTERM)
338 return TARGET_SIGNAL_TERM;
340 #if defined (SIGUSR1)
341 if (hostsig == SIGUSR1)
342 return TARGET_SIGNAL_USR1;
344 #if defined (SIGUSR2)
345 if (hostsig == SIGUSR2)
346 return TARGET_SIGNAL_USR2;
349 if (hostsig == SIGCLD)
350 return TARGET_SIGNAL_CHLD;
352 #if defined (SIGCHLD)
353 if (hostsig == SIGCHLD)
354 return TARGET_SIGNAL_CHLD;
357 if (hostsig == SIGPWR)
358 return TARGET_SIGNAL_PWR;
360 #if defined (SIGWINCH)
361 if (hostsig == SIGWINCH)
362 return TARGET_SIGNAL_WINCH;
365 if (hostsig == SIGURG)
366 return TARGET_SIGNAL_URG;
369 if (hostsig == SIGIO)
370 return TARGET_SIGNAL_IO;
372 #if defined (SIGPOLL)
373 if (hostsig == SIGPOLL)
374 return TARGET_SIGNAL_POLL;
376 #if defined (SIGSTOP)
377 if (hostsig == SIGSTOP)
378 return TARGET_SIGNAL_STOP;
380 #if defined (SIGTSTP)
381 if (hostsig == SIGTSTP)
382 return TARGET_SIGNAL_TSTP;
384 #if defined (SIGCONT)
385 if (hostsig == SIGCONT)
386 return TARGET_SIGNAL_CONT;
388 #if defined (SIGTTIN)
389 if (hostsig == SIGTTIN)
390 return TARGET_SIGNAL_TTIN;
392 #if defined (SIGTTOU)
393 if (hostsig == SIGTTOU)
394 return TARGET_SIGNAL_TTOU;
396 #if defined (SIGVTALRM)
397 if (hostsig == SIGVTALRM)
398 return TARGET_SIGNAL_VTALRM;
400 #if defined (SIGPROF)
401 if (hostsig == SIGPROF)
402 return TARGET_SIGNAL_PROF;
404 #if defined (SIGXCPU)
405 if (hostsig == SIGXCPU)
406 return TARGET_SIGNAL_XCPU;
408 #if defined (SIGXFSZ)
409 if (hostsig == SIGXFSZ)
410 return TARGET_SIGNAL_XFSZ;
412 #if defined (SIGWIND)
413 if (hostsig == SIGWIND)
414 return TARGET_SIGNAL_WIND;
416 #if defined (SIGPHONE)
417 if (hostsig == SIGPHONE)
418 return TARGET_SIGNAL_PHONE;
420 #if defined (SIGLOST)
421 if (hostsig == SIGLOST)
422 return TARGET_SIGNAL_LOST;
424 #if defined (SIGWAITING)
425 if (hostsig == SIGWAITING)
426 return TARGET_SIGNAL_WAITING;
428 #if defined (SIGCANCEL)
429 if (hostsig == SIGCANCEL)
430 return TARGET_SIGNAL_CANCEL;
433 if (hostsig == SIGLWP)
434 return TARGET_SIGNAL_LWP;
436 #if defined (SIGDANGER)
437 if (hostsig == SIGDANGER)
438 return TARGET_SIGNAL_DANGER;
440 #if defined (SIGGRANT)
441 if (hostsig == SIGGRANT)
442 return TARGET_SIGNAL_GRANT;
444 #if defined (SIGRETRACT)
445 if (hostsig == SIGRETRACT)
446 return TARGET_SIGNAL_RETRACT;
449 if (hostsig == SIGMSG)
450 return TARGET_SIGNAL_MSG;
452 #if defined (SIGSOUND)
453 if (hostsig == SIGSOUND)
454 return TARGET_SIGNAL_SOUND;
457 if (hostsig == SIGSAK)
458 return TARGET_SIGNAL_SAK;
460 #if defined (SIGPRIO)
461 if (hostsig == SIGPRIO)
462 return TARGET_SIGNAL_PRIO;
465 /* Mach exceptions. Assumes that the values for EXC_ are positive! */
466 #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
467 if (hostsig == _NSIG + EXC_BAD_ACCESS)
468 return TARGET_EXC_BAD_ACCESS;
470 #if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
471 if (hostsig == _NSIG + EXC_BAD_INSTRUCTION)
472 return TARGET_EXC_BAD_INSTRUCTION;
474 #if defined (EXC_ARITHMETIC) && defined (_NSIG)
475 if (hostsig == _NSIG + EXC_ARITHMETIC)
476 return TARGET_EXC_ARITHMETIC;
478 #if defined (EXC_EMULATION) && defined (_NSIG)
479 if (hostsig == _NSIG + EXC_EMULATION)
480 return TARGET_EXC_EMULATION;
482 #if defined (EXC_SOFTWARE) && defined (_NSIG)
483 if (hostsig == _NSIG + EXC_SOFTWARE)
484 return TARGET_EXC_SOFTWARE;
486 #if defined (EXC_BREAKPOINT) && defined (_NSIG)
487 if (hostsig == _NSIG + EXC_BREAKPOINT)
488 return TARGET_EXC_BREAKPOINT;
491 #if defined (SIGINFO)
492 if (hostsig == SIGINFO)
493 return TARGET_SIGNAL_INFO;
496 #if defined (REALTIME_LO)
497 if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
499 /* This block of TARGET_SIGNAL_REALTIME value is in order. */
500 if (33 <= hostsig && hostsig <= 63)
501 return (enum target_signal)
502 (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33);
503 else if (hostsig == 32)
504 return TARGET_SIGNAL_REALTIME_32;
505 else if (64 <= hostsig && hostsig <= 127)
506 return (enum target_signal)
507 (hostsig - 64 + (int) TARGET_SIGNAL_REALTIME_64);
509 error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal");
513 return TARGET_SIGNAL_UNKNOWN;
516 /* Convert a OURSIG (an enum target_signal) to the form used by the
517 target operating system (refered to as the ``host'') or zero if the
518 equivalent host signal is not available. Set/clear OURSIG_OK
522 do_target_signal_to_host (enum target_signal oursig,
526 /* Silence the 'not used' warning, for targets that
527 do not support signals. */
533 case TARGET_SIGNAL_0:
537 case TARGET_SIGNAL_HUP:
541 case TARGET_SIGNAL_INT:
544 #if defined (SIGQUIT)
545 case TARGET_SIGNAL_QUIT:
549 case TARGET_SIGNAL_ILL:
552 #if defined (SIGTRAP)
553 case TARGET_SIGNAL_TRAP:
556 #if defined (SIGABRT)
557 case TARGET_SIGNAL_ABRT:
561 case TARGET_SIGNAL_EMT:
565 case TARGET_SIGNAL_FPE:
568 #if defined (SIGKILL)
569 case TARGET_SIGNAL_KILL:
573 case TARGET_SIGNAL_BUS:
576 #if defined (SIGSEGV)
577 case TARGET_SIGNAL_SEGV:
581 case TARGET_SIGNAL_SYS:
584 #if defined (SIGPIPE)
585 case TARGET_SIGNAL_PIPE:
588 #if defined (SIGALRM)
589 case TARGET_SIGNAL_ALRM:
592 #if defined (SIGTERM)
593 case TARGET_SIGNAL_TERM:
596 #if defined (SIGUSR1)
597 case TARGET_SIGNAL_USR1:
600 #if defined (SIGUSR2)
601 case TARGET_SIGNAL_USR2:
604 #if defined (SIGCHLD) || defined (SIGCLD)
605 case TARGET_SIGNAL_CHLD:
606 #if defined (SIGCHLD)
611 #endif /* SIGCLD or SIGCHLD */
613 case TARGET_SIGNAL_PWR:
616 #if defined (SIGWINCH)
617 case TARGET_SIGNAL_WINCH:
621 case TARGET_SIGNAL_URG:
625 case TARGET_SIGNAL_IO:
628 #if defined (SIGPOLL)
629 case TARGET_SIGNAL_POLL:
632 #if defined (SIGSTOP)
633 case TARGET_SIGNAL_STOP:
636 #if defined (SIGTSTP)
637 case TARGET_SIGNAL_TSTP:
640 #if defined (SIGCONT)
641 case TARGET_SIGNAL_CONT:
644 #if defined (SIGTTIN)
645 case TARGET_SIGNAL_TTIN:
648 #if defined (SIGTTOU)
649 case TARGET_SIGNAL_TTOU:
652 #if defined (SIGVTALRM)
653 case TARGET_SIGNAL_VTALRM:
656 #if defined (SIGPROF)
657 case TARGET_SIGNAL_PROF:
660 #if defined (SIGXCPU)
661 case TARGET_SIGNAL_XCPU:
664 #if defined (SIGXFSZ)
665 case TARGET_SIGNAL_XFSZ:
668 #if defined (SIGWIND)
669 case TARGET_SIGNAL_WIND:
672 #if defined (SIGPHONE)
673 case TARGET_SIGNAL_PHONE:
676 #if defined (SIGLOST)
677 case TARGET_SIGNAL_LOST:
680 #if defined (SIGWAITING)
681 case TARGET_SIGNAL_WAITING:
684 #if defined (SIGCANCEL)
685 case TARGET_SIGNAL_CANCEL:
689 case TARGET_SIGNAL_LWP:
692 #if defined (SIGDANGER)
693 case TARGET_SIGNAL_DANGER:
696 #if defined (SIGGRANT)
697 case TARGET_SIGNAL_GRANT:
700 #if defined (SIGRETRACT)
701 case TARGET_SIGNAL_RETRACT:
705 case TARGET_SIGNAL_MSG:
708 #if defined (SIGSOUND)
709 case TARGET_SIGNAL_SOUND:
713 case TARGET_SIGNAL_SAK:
716 #if defined (SIGPRIO)
717 case TARGET_SIGNAL_PRIO:
721 /* Mach exceptions. Assumes that the values for EXC_ are positive! */
722 #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
723 case TARGET_EXC_BAD_ACCESS:
724 return _NSIG + EXC_BAD_ACCESS;
726 #if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
727 case TARGET_EXC_BAD_INSTRUCTION:
728 return _NSIG + EXC_BAD_INSTRUCTION;
730 #if defined (EXC_ARITHMETIC) && defined (_NSIG)
731 case TARGET_EXC_ARITHMETIC:
732 return _NSIG + EXC_ARITHMETIC;
734 #if defined (EXC_EMULATION) && defined (_NSIG)
735 case TARGET_EXC_EMULATION:
736 return _NSIG + EXC_EMULATION;
738 #if defined (EXC_SOFTWARE) && defined (_NSIG)
739 case TARGET_EXC_SOFTWARE:
740 return _NSIG + EXC_SOFTWARE;
742 #if defined (EXC_BREAKPOINT) && defined (_NSIG)
743 case TARGET_EXC_BREAKPOINT:
744 return _NSIG + EXC_BREAKPOINT;
747 #if defined (SIGINFO)
748 case TARGET_SIGNAL_INFO:
753 #if defined (REALTIME_LO)
756 if (oursig >= TARGET_SIGNAL_REALTIME_33
757 && oursig <= TARGET_SIGNAL_REALTIME_63)
759 /* This block of signals is continuous, and
760 TARGET_SIGNAL_REALTIME_33 is 33 by definition. */
761 retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33;
763 else if (oursig == TARGET_SIGNAL_REALTIME_32)
765 /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
766 TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */
769 else if (oursig >= TARGET_SIGNAL_REALTIME_64
770 && oursig <= TARGET_SIGNAL_REALTIME_127)
772 /* This block of signals is continuous, and
773 TARGET_SIGNAL_REALTIME_64 is 64 by definition. */
774 retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64;
777 if (retsig >= REALTIME_LO && retsig < REALTIME_HI)
787 target_signal_to_host_p (enum target_signal oursig)
790 do_target_signal_to_host (oursig, &oursig_ok);
795 target_signal_to_host (enum target_signal oursig)
798 int targ_signo = do_target_signal_to_host (oursig, &oursig_ok);
801 /* The user might be trying to do "signal SIGSAK" where this system
802 doesn't have SIGSAK. */
803 warning ("Signal %s does not exist on this system.\n",
804 target_signal_to_name (oursig));
813 /* In some circumstances we allow a command to specify a numeric
814 signal. The idea is to keep these circumstances limited so that
815 users (and scripts) develop portable habits. For comparison,
816 POSIX.2 `kill' requires that 1,2,3,6,9,14, and 15 work (and using a
817 numeric signal at all is obsolescent. We are slightly more
818 lenient and allow 1-15 which should match host signal numbers on
819 most systems. Use of symbolic signal names is strongly encouraged. */
822 target_signal_from_command (int num)
824 if (num >= 1 && num <= 15)
825 return (enum target_signal) num;
826 error ("Only signals 1-15 are valid as numeric signals.\n\
827 Use \"info signals\" for a list of symbolic signals.");
830 extern initialize_file_ftype _initialize_signals; /* -Wmissing-prototype */
833 _initialize_signals (void)
835 if (strcmp (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC") != 0)
836 internal_error (__FILE__, __LINE__, "failed internal consistency check");
840 default_target_signal_to_host (struct gdbarch *gdbarch, enum target_signal ts)
842 return target_signal_to_host (ts);
846 default_target_signal_from_host (struct gdbarch *gdbarch, int signo)
848 return target_signal_from_host (signo);
851 #endif /* ! GDBSERVER */