1 /* Target signal translation functions for GDB.
2 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2011 Free Software Foundation, Inc.
4 Contributed by Cygnus Support.
6 This file is part of GDB.
7 It has been modified to integrate it in valgrind
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 2 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, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA. */
26 #if defined(VGO_darwin)
27 // ???? darwin signal.h defines SIGPOLL conditionnally ????
33 enum target_signal
target_signal_from_name (const char *name
);
34 enum target_signal
target_signal_from_command (int num
);
36 /* This table must match in order and size the signals in enum target_signal
46 {"SIGINT", "Interrupt"},
48 {"SIGILL", "Illegal instruction"},
49 {"SIGTRAP", "Trace/breakpoint trap"},
50 {"SIGABRT", "Aborted"},
51 {"SIGEMT", "Emulation trap"},
52 {"SIGFPE", "Arithmetic exception"},
53 {"SIGKILL", "Killed"},
54 {"SIGBUS", "Bus error"},
55 {"SIGSEGV", "Segmentation fault"},
56 {"SIGSYS", "Bad system call"},
57 {"SIGPIPE", "Broken pipe"},
58 {"SIGALRM", "Alarm clock"},
59 {"SIGTERM", "Terminated"},
60 {"SIGURG", "Urgent I/O condition"},
61 {"SIGSTOP", "Stopped (signal)"},
62 {"SIGTSTP", "Stopped (user)"},
63 {"SIGCONT", "Continued"},
64 {"SIGCHLD", "Child status changed"},
65 {"SIGTTIN", "Stopped (tty input)"},
66 {"SIGTTOU", "Stopped (tty output)"},
67 {"SIGIO", "I/O possible"},
68 {"SIGXCPU", "CPU time limit exceeded"},
69 {"SIGXFSZ", "File size limit exceeded"},
70 {"SIGVTALRM", "Virtual timer expired"},
71 {"SIGPROF", "Profiling timer expired"},
72 {"SIGWINCH", "Window size changed"},
73 {"SIGLOST", "Resource lost"},
74 {"SIGUSR1", "User defined signal 1"},
75 {"SIGUSR2", "User defined signal 2"},
76 {"SIGPWR", "Power fail/restart"},
77 {"SIGPOLL", "Pollable event occurred"},
78 {"SIGWIND", "SIGWIND"},
79 {"SIGPHONE", "SIGPHONE"},
80 {"SIGWAITING", "Process's LWPs are blocked"},
81 {"SIGLWP", "Signal LWP"},
82 {"SIGDANGER", "Swap space dangerously low"},
83 {"SIGGRANT", "Monitor mode granted"},
84 {"SIGRETRACT", "Need to relinquish monitor mode"},
85 {"SIGMSG", "Monitor mode data available"},
86 {"SIGSOUND", "Sound completed"},
87 {"SIGSAK", "Secure attention"},
88 {"SIGPRIO", "SIGPRIO"},
89 {"SIG33", "Real-time event 33"},
90 {"SIG34", "Real-time event 34"},
91 {"SIG35", "Real-time event 35"},
92 {"SIG36", "Real-time event 36"},
93 {"SIG37", "Real-time event 37"},
94 {"SIG38", "Real-time event 38"},
95 {"SIG39", "Real-time event 39"},
96 {"SIG40", "Real-time event 40"},
97 {"SIG41", "Real-time event 41"},
98 {"SIG42", "Real-time event 42"},
99 {"SIG43", "Real-time event 43"},
100 {"SIG44", "Real-time event 44"},
101 {"SIG45", "Real-time event 45"},
102 {"SIG46", "Real-time event 46"},
103 {"SIG47", "Real-time event 47"},
104 {"SIG48", "Real-time event 48"},
105 {"SIG49", "Real-time event 49"},
106 {"SIG50", "Real-time event 50"},
107 {"SIG51", "Real-time event 51"},
108 {"SIG52", "Real-time event 52"},
109 {"SIG53", "Real-time event 53"},
110 {"SIG54", "Real-time event 54"},
111 {"SIG55", "Real-time event 55"},
112 {"SIG56", "Real-time event 56"},
113 {"SIG57", "Real-time event 57"},
114 {"SIG58", "Real-time event 58"},
115 {"SIG59", "Real-time event 59"},
116 {"SIG60", "Real-time event 60"},
117 {"SIG61", "Real-time event 61"},
118 {"SIG62", "Real-time event 62"},
119 {"SIG63", "Real-time event 63"},
120 {"SIGCANCEL", "LWP internal signal"},
121 {"SIG32", "Real-time event 32"},
122 {"SIG64", "Real-time event 64"},
123 {"SIG65", "Real-time event 65"},
124 {"SIG66", "Real-time event 66"},
125 {"SIG67", "Real-time event 67"},
126 {"SIG68", "Real-time event 68"},
127 {"SIG69", "Real-time event 69"},
128 {"SIG70", "Real-time event 70"},
129 {"SIG71", "Real-time event 71"},
130 {"SIG72", "Real-time event 72"},
131 {"SIG73", "Real-time event 73"},
132 {"SIG74", "Real-time event 74"},
133 {"SIG75", "Real-time event 75"},
134 {"SIG76", "Real-time event 76"},
135 {"SIG77", "Real-time event 77"},
136 {"SIG78", "Real-time event 78"},
137 {"SIG79", "Real-time event 79"},
138 {"SIG80", "Real-time event 80"},
139 {"SIG81", "Real-time event 81"},
140 {"SIG82", "Real-time event 82"},
141 {"SIG83", "Real-time event 83"},
142 {"SIG84", "Real-time event 84"},
143 {"SIG85", "Real-time event 85"},
144 {"SIG86", "Real-time event 86"},
145 {"SIG87", "Real-time event 87"},
146 {"SIG88", "Real-time event 88"},
147 {"SIG89", "Real-time event 89"},
148 {"SIG90", "Real-time event 90"},
149 {"SIG91", "Real-time event 91"},
150 {"SIG92", "Real-time event 92"},
151 {"SIG93", "Real-time event 93"},
152 {"SIG94", "Real-time event 94"},
153 {"SIG95", "Real-time event 95"},
154 {"SIG96", "Real-time event 96"},
155 {"SIG97", "Real-time event 97"},
156 {"SIG98", "Real-time event 98"},
157 {"SIG99", "Real-time event 99"},
158 {"SIG100", "Real-time event 100"},
159 {"SIG101", "Real-time event 101"},
160 {"SIG102", "Real-time event 102"},
161 {"SIG103", "Real-time event 103"},
162 {"SIG104", "Real-time event 104"},
163 {"SIG105", "Real-time event 105"},
164 {"SIG106", "Real-time event 106"},
165 {"SIG107", "Real-time event 107"},
166 {"SIG108", "Real-time event 108"},
167 {"SIG109", "Real-time event 109"},
168 {"SIG110", "Real-time event 110"},
169 {"SIG111", "Real-time event 111"},
170 {"SIG112", "Real-time event 112"},
171 {"SIG113", "Real-time event 113"},
172 {"SIG114", "Real-time event 114"},
173 {"SIG115", "Real-time event 115"},
174 {"SIG116", "Real-time event 116"},
175 {"SIG117", "Real-time event 117"},
176 {"SIG118", "Real-time event 118"},
177 {"SIG119", "Real-time event 119"},
178 {"SIG120", "Real-time event 120"},
179 {"SIG121", "Real-time event 121"},
180 {"SIG122", "Real-time event 122"},
181 {"SIG123", "Real-time event 123"},
182 {"SIG124", "Real-time event 124"},
183 {"SIG125", "Real-time event 125"},
184 {"SIG126", "Real-time event 126"},
185 {"SIG127", "Real-time event 127"},
187 {"SIGINFO", "Information request"},
189 {NULL
, "Unknown signal"},
190 {NULL
, "Internal error: printing TARGET_SIGNAL_DEFAULT"},
192 /* Mach exceptions */
193 {"EXC_BAD_ACCESS", "Could not access memory"},
194 {"EXC_BAD_INSTRUCTION", "Illegal instruction/operand"},
195 {"EXC_ARITHMETIC", "Arithmetic exception"},
196 {"EXC_EMULATION", "Emulation instruction"},
197 {"EXC_SOFTWARE", "Software generated exception"},
198 {"EXC_BREAKPOINT", "Breakpoint"},
200 /* Last entry, used to check whether the table is the right size. */
201 {NULL
, "TARGET_SIGNAL_MAGIC"}
207 /* Return the name for a signal. */
208 const char *target_signal_to_name (enum target_signal sig
)
210 if ((sig
>= TARGET_SIGNAL_FIRST
) && (sig
<= TARGET_SIGNAL_LAST
)
211 && signals
[sig
].name
!= NULL
)
212 return signals
[sig
].name
;
214 /* I think the code which prints this will always print it along
215 with the string, so no need to be verbose (very old comment). */
219 /* Given a name, return its signal. */
220 enum target_signal
target_signal_from_name (const char *name
)
222 enum target_signal sig
;
224 /* It's possible we also should allow "SIGCLD" as well as "SIGCHLD"
225 for TARGET_SIGNAL_SIGCHLD. SIGIOT, on the other hand, is more
226 questionable; seems like by now people should call it SIGABRT
229 /* This ugly cast brought to you by the native VAX compiler. */
230 for (sig
= TARGET_SIGNAL_HUP
;
231 sig
< TARGET_SIGNAL_LAST
;
232 sig
= (enum target_signal
) ((int) sig
+ 1))
233 if (signals
[sig
].name
!= NULL
234 && strcmp (name
, signals
[sig
].name
) == 0)
236 return TARGET_SIGNAL_UNKNOWN
;
240 /* The following functions are to help certain targets deal
241 with the signal/waitstatus stuff. They could just as well be in
242 a file called native-utils.c or unixwaitstatus-utils.c or whatever. */
244 /* Convert host signal to our signals. */
245 enum target_signal
target_signal_from_host (int hostsig
)
247 /* A switch statement would make sense but would require special kludges
248 to deal with the cases where more than one signal has the same number. */
251 return TARGET_SIGNAL_0
;
253 #if defined (VKI_SIGHUP)
254 if (hostsig
== VKI_SIGHUP
)
255 return TARGET_SIGNAL_HUP
;
257 #if defined (VKI_SIGINT)
258 if (hostsig
== VKI_SIGINT
)
259 return TARGET_SIGNAL_INT
;
261 #if defined (VKI_SIGQUIT)
262 if (hostsig
== VKI_SIGQUIT
)
263 return TARGET_SIGNAL_QUIT
;
265 #if defined (VKI_SIGILL)
266 if (hostsig
== VKI_SIGILL
)
267 return TARGET_SIGNAL_ILL
;
269 #if defined (VKI_SIGTRAP)
270 if (hostsig
== VKI_SIGTRAP
)
271 return TARGET_SIGNAL_TRAP
;
273 #if defined (VKI_SIGABRT)
274 if (hostsig
== VKI_SIGABRT
)
275 return TARGET_SIGNAL_ABRT
;
277 #if defined (VKI_SIGEMT)
278 if (hostsig
== VKI_SIGEMT
)
279 return TARGET_SIGNAL_EMT
;
281 #if defined (VKI_SIGFPE)
282 if (hostsig
== VKI_SIGFPE
)
283 return TARGET_SIGNAL_FPE
;
285 #if defined (VKI_SIGKILL)
286 if (hostsig
== VKI_SIGKILL
)
287 return TARGET_SIGNAL_KILL
;
289 #if defined (VKI_SIGBUS)
290 if (hostsig
== VKI_SIGBUS
)
291 return TARGET_SIGNAL_BUS
;
293 #if defined (VKI_SIGSEGV)
294 if (hostsig
== VKI_SIGSEGV
)
295 return TARGET_SIGNAL_SEGV
;
297 #if defined (VKI_SIGSYS)
298 if (hostsig
== VKI_SIGSYS
)
299 return TARGET_SIGNAL_SYS
;
301 #if defined (VKI_SIGPIPE)
302 if (hostsig
== VKI_SIGPIPE
)
303 return TARGET_SIGNAL_PIPE
;
305 #if defined (VKI_SIGALRM)
306 if (hostsig
== VKI_SIGALRM
)
307 return TARGET_SIGNAL_ALRM
;
309 #if defined (VKI_SIGTERM)
310 if (hostsig
== VKI_SIGTERM
)
311 return TARGET_SIGNAL_TERM
;
313 #if defined (VKI_SIGUSR1)
314 if (hostsig
== VKI_SIGUSR1
)
315 return TARGET_SIGNAL_USR1
;
317 #if defined (VKI_SIGUSR2)
318 if (hostsig
== VKI_SIGUSR2
)
319 return TARGET_SIGNAL_USR2
;
321 #if defined (VKI_SIGCLD)
322 if (hostsig
== VKI_SIGCLD
)
323 return TARGET_SIGNAL_CHLD
;
325 #if defined (VKI_SIGCHLD)
326 if (hostsig
== VKI_SIGCHLD
)
327 return TARGET_SIGNAL_CHLD
;
329 #if defined (VKI_SIGPWR)
330 if (hostsig
== VKI_SIGPWR
)
331 return TARGET_SIGNAL_PWR
;
333 #if defined (VKI_SIGWINCH)
334 if (hostsig
== VKI_SIGWINCH
)
335 return TARGET_SIGNAL_WINCH
;
337 #if defined (VKI_SIGURG)
338 if (hostsig
== VKI_SIGURG
)
339 return TARGET_SIGNAL_URG
;
341 #if defined (VKI_SIGIO)
342 if (hostsig
== VKI_SIGIO
)
343 return TARGET_SIGNAL_IO
;
345 #if defined (VKI_SIGPOLL)
346 if (hostsig
== VKI_SIGPOLL
)
347 return TARGET_SIGNAL_POLL
;
349 #if defined (VKI_SIGSTOP)
350 if (hostsig
== VKI_SIGSTOP
)
351 return TARGET_SIGNAL_STOP
;
353 #if defined (VKI_SIGTSTP)
354 if (hostsig
== VKI_SIGTSTP
)
355 return TARGET_SIGNAL_TSTP
;
357 #if defined (VKI_SIGCONT)
358 if (hostsig
== VKI_SIGCONT
)
359 return TARGET_SIGNAL_CONT
;
361 #if defined (VKI_SIGTTIN)
362 if (hostsig
== VKI_SIGTTIN
)
363 return TARGET_SIGNAL_TTIN
;
365 #if defined (VKI_SIGTTOU)
366 if (hostsig
== VKI_SIGTTOU
)
367 return TARGET_SIGNAL_TTOU
;
369 #if defined (VKI_SIGVTALRM)
370 if (hostsig
== VKI_SIGVTALRM
)
371 return TARGET_SIGNAL_VTALRM
;
373 #if defined (VKI_SIGPROF)
374 if (hostsig
== VKI_SIGPROF
)
375 return TARGET_SIGNAL_PROF
;
377 #if defined (VKI_SIGXCPU)
378 if (hostsig
== VKI_SIGXCPU
)
379 return TARGET_SIGNAL_XCPU
;
381 #if defined (VKI_SIGXFSZ)
382 if (hostsig
== VKI_SIGXFSZ
)
383 return TARGET_SIGNAL_XFSZ
;
385 #if defined (VKI_SIGWIND)
386 if (hostsig
== VKI_SIGWIND
)
387 return TARGET_SIGNAL_WIND
;
389 #if defined (VKI_SIGPHONE)
390 if (hostsig
== VKI_SIGPHONE
)
391 return TARGET_SIGNAL_PHONE
;
393 #if defined (VKI_SIGLOST)
394 if (hostsig
== VKI_SIGLOST
)
395 return TARGET_SIGNAL_LOST
;
397 #if defined (VKI_SIGWAITING)
398 if (hostsig
== VKI_SIGWAITING
)
399 return TARGET_SIGNAL_WAITING
;
401 #if defined (VKI_SIGCANCEL)
402 if (hostsig
== VKI_SIGCANCEL
)
403 return TARGET_SIGNAL_CANCEL
;
405 #if defined (VKI_SIGLWP)
406 if (hostsig
== VKI_SIGLWP
)
407 return TARGET_SIGNAL_LWP
;
409 #if defined (VKI_SIGDANGER)
410 if (hostsig
== VKI_SIGDANGER
)
411 return TARGET_SIGNAL_DANGER
;
413 #if defined (VKI_SIGGRANT)
414 if (hostsig
== VKI_SIGGRANT
)
415 return TARGET_SIGNAL_GRANT
;
417 #if defined (VKI_SIGRETRACT)
418 if (hostsig
== VKI_SIGRETRACT
)
419 return TARGET_SIGNAL_RETRACT
;
421 #if defined (VKI_SIGMSG)
422 if (hostsig
== VKI_SIGMSG
)
423 return TARGET_SIGNAL_MSG
;
425 #if defined (VKI_SIGSOUND)
426 if (hostsig
== VKI_SIGSOUND
)
427 return TARGET_SIGNAL_SOUND
;
429 #if defined (VKI_SIGSAK)
430 if (hostsig
== VKI_SIGSAK
)
431 return TARGET_SIGNAL_SAK
;
433 #if defined (VKI_SIGPRIO)
434 if (hostsig
== VKI_SIGPRIO
)
435 return TARGET_SIGNAL_PRIO
;
438 /* Mach exceptions. Assumes that the values for EXC_ are positive! */
439 #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
440 if (hostsig
== _NSIG
+ EXC_BAD_ACCESS
)
441 return TARGET_EXC_BAD_ACCESS
;
443 #if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
444 if (hostsig
== _NSIG
+ EXC_BAD_INSTRUCTION
)
445 return TARGET_EXC_BAD_INSTRUCTION
;
447 #if defined (EXC_ARITHMETIC) && defined (_NSIG)
448 if (hostsig
== _NSIG
+ EXC_ARITHMETIC
)
449 return TARGET_EXC_ARITHMETIC
;
451 #if defined (EXC_EMULATION) && defined (_NSIG)
452 if (hostsig
== _NSIG
+ EXC_EMULATION
)
453 return TARGET_EXC_EMULATION
;
455 #if defined (EXC_SOFTWARE) && defined (_NSIG)
456 if (hostsig
== _NSIG
+ EXC_SOFTWARE
)
457 return TARGET_EXC_SOFTWARE
;
459 #if defined (EXC_BREAKPOINT) && defined (_NSIG)
460 if (hostsig
== _NSIG
+ EXC_BREAKPOINT
)
461 return TARGET_EXC_BREAKPOINT
;
464 #if defined (VKI_SIGINFO)
465 if (hostsig
== VKI_SIGINFO
)
466 return TARGET_SIGNAL_INFO
;
469 #if defined (VKI_SIGRTMIN)
470 if (hostsig
>= VKI_SIGRTMIN
&& hostsig
< VKI_SIGRTMAX
) {
471 /* This block of TARGET_SIGNAL_REALTIME value is in order. */
472 if (33 <= hostsig
&& hostsig
<= 63)
473 return (enum target_signal
)
474 (hostsig
- 33 + (int) TARGET_SIGNAL_REALTIME_33
);
475 else if (hostsig
== 32)
476 return TARGET_SIGNAL_REALTIME_32
;
477 else if (64 <= hostsig
&& hostsig
<= 127)
478 return (enum target_signal
)
479 (hostsig
- 64 + (int) TARGET_SIGNAL_REALTIME_64
);
483 error ("Valgrind GDBSERVER bug: (target_signal_from_host):"
484 " unrecognized vki signal %d\n", hostsig
);
485 return TARGET_SIGNAL_UNKNOWN
;
488 /* Convert a OURSIG (an enum target_signal) to the form used by the
489 target operating system (refered to as the ``host'') or zero if the
490 equivalent host signal is not available. Set/clear OURSIG_OK
494 int do_target_signal_to_host (enum target_signal oursig
,
499 case TARGET_SIGNAL_0
:
502 #if defined (VKI_SIGHUP)
503 case TARGET_SIGNAL_HUP
:
506 #if defined (VKI_SIGINT)
507 case TARGET_SIGNAL_INT
:
510 #if defined (VKI_SIGQUIT)
511 case TARGET_SIGNAL_QUIT
:
514 #if defined (VKI_SIGILL)
515 case TARGET_SIGNAL_ILL
:
518 #if defined (VKI_SIGTRAP)
519 case TARGET_SIGNAL_TRAP
:
522 #if defined (VKI_SIGABRT)
523 case TARGET_SIGNAL_ABRT
:
526 #if defined (VKI_SIGEMT)
527 case TARGET_SIGNAL_EMT
:
530 #if defined (VKI_SIGFPE)
531 case TARGET_SIGNAL_FPE
:
534 #if defined (VKI_SIGKILL)
535 case TARGET_SIGNAL_KILL
:
538 #if defined (VKI_SIGBUS)
539 case TARGET_SIGNAL_BUS
:
542 #if defined (VKI_SIGSEGV)
543 case TARGET_SIGNAL_SEGV
:
546 #if defined (VKI_SIGSYS)
547 case TARGET_SIGNAL_SYS
:
550 #if defined (VKI_SIGPIPE)
551 case TARGET_SIGNAL_PIPE
:
554 #if defined (VKI_SIGALRM)
555 case TARGET_SIGNAL_ALRM
:
558 #if defined (VKI_SIGTERM)
559 case TARGET_SIGNAL_TERM
:
562 #if defined (VKI_SIGUSR1)
563 case TARGET_SIGNAL_USR1
:
566 #if defined (VKI_SIGUSR2)
567 case TARGET_SIGNAL_USR2
:
570 #if defined (VKI_SIGCHLD) || defined (VKI_SIGCLD)
571 case TARGET_SIGNAL_CHLD
:
572 #if defined (VKI_SIGCHLD)
577 #endif /* SIGCLD or SIGCHLD */
578 #if defined (VKI_SIGPWR)
579 case TARGET_SIGNAL_PWR
:
582 #if defined (VKI_SIGWINCH)
583 case TARGET_SIGNAL_WINCH
:
586 #if defined (VKI_SIGURG)
587 case TARGET_SIGNAL_URG
:
590 #if defined (VKI_SIGIO)
591 case TARGET_SIGNAL_IO
:
594 #if defined (VKI_SIGPOLL)
595 case TARGET_SIGNAL_POLL
:
598 #if defined (VKI_SIGSTOP)
599 case TARGET_SIGNAL_STOP
:
602 #if defined (VKI_SIGTSTP)
603 case TARGET_SIGNAL_TSTP
:
606 #if defined (VKI_SIGCONT)
607 case TARGET_SIGNAL_CONT
:
610 #if defined (VKI_SIGTTIN)
611 case TARGET_SIGNAL_TTIN
:
614 #if defined (VKI_SIGTTOU)
615 case TARGET_SIGNAL_TTOU
:
618 #if defined (VKI_SIGVTALRM)
619 case TARGET_SIGNAL_VTALRM
:
620 return VKI_SIGVTALRM
;
622 #if defined (VKI_SIGPROF)
623 case TARGET_SIGNAL_PROF
:
626 #if defined (VKI_SIGXCPU)
627 case TARGET_SIGNAL_XCPU
:
630 #if defined (VKI_SIGXFSZ)
631 case TARGET_SIGNAL_XFSZ
:
634 #if defined (VKI_SIGWIND)
635 case TARGET_SIGNAL_WIND
:
638 #if defined (VKI_SIGPHONE)
639 case TARGET_SIGNAL_PHONE
:
642 #if defined (VKI_SIGLOST)
643 case TARGET_SIGNAL_LOST
:
646 #if defined (VKI_SIGWAITING)
647 case TARGET_SIGNAL_WAITING
:
648 return VKI_SIGWAITING
;
650 #if defined (VKI_SIGCANCEL)
651 case TARGET_SIGNAL_CANCEL
:
652 return VKI_SIGCANCEL
;
654 #if defined (VKI_SIGLWP)
655 case TARGET_SIGNAL_LWP
:
658 #if defined (VKI_SIGDANGER)
659 case TARGET_SIGNAL_DANGER
:
660 return VKI_SIGDANGER
;
662 #if defined (VKI_SIGGRANT)
663 case TARGET_SIGNAL_GRANT
:
666 #if defined (VKI_SIGRETRACT)
667 case TARGET_SIGNAL_RETRACT
:
668 return VKI_SIGRETRACT
;
670 #if defined (VKI_SIGMSG)
671 case TARGET_SIGNAL_MSG
:
674 #if defined (VKI_SIGSOUND)
675 case TARGET_SIGNAL_SOUND
:
678 #if defined (VKI_SIGSAK)
679 case TARGET_SIGNAL_SAK
:
682 #if defined (VKI_SIGPRIO)
683 case TARGET_SIGNAL_PRIO
:
687 /* Mach exceptions. Assumes that the values for EXC_ are positive! */
688 #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
689 case TARGET_EXC_BAD_ACCESS
:
690 return _NSIG
+ EXC_BAD_ACCESS
;
692 #if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
693 case TARGET_EXC_BAD_INSTRUCTION
:
694 return _NSIG
+ EXC_BAD_INSTRUCTION
;
696 #if defined (EXC_ARITHMETIC) && defined (_NSIG)
697 case TARGET_EXC_ARITHMETIC
:
698 return _NSIG
+ EXC_ARITHMETIC
;
700 #if defined (EXC_EMULATION) && defined (_NSIG)
701 case TARGET_EXC_EMULATION
:
702 return _NSIG
+ EXC_EMULATION
;
704 #if defined (EXC_SOFTWARE) && defined (_NSIG)
705 case TARGET_EXC_SOFTWARE
:
706 return _NSIG
+ EXC_SOFTWARE
;
708 #if defined (EXC_BREAKPOINT) && defined (_NSIG)
709 case TARGET_EXC_BREAKPOINT
:
710 return _NSIG
+ EXC_BREAKPOINT
;
713 #if defined (VKI_SIGINFO)
714 case TARGET_SIGNAL_INFO
:
719 #if defined (VKI_SIGRTMIN)
723 if (oursig
>= TARGET_SIGNAL_REALTIME_33
724 && oursig
<= TARGET_SIGNAL_REALTIME_63
) {
725 /* This block of signals is continuous, and
726 TARGET_SIGNAL_REALTIME_33 is 33 by definition. */
727 retsig
= (int) oursig
- (int) TARGET_SIGNAL_REALTIME_33
+ 33;
728 } else if (oursig
== TARGET_SIGNAL_REALTIME_32
) {
729 /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
730 TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */
732 } else if (oursig
>= TARGET_SIGNAL_REALTIME_64
733 && oursig
<= TARGET_SIGNAL_REALTIME_127
) {
734 /* This block of signals is continuous, and
735 TARGET_SIGNAL_REALTIME_64 is 64 by definition. */
736 retsig
= (int) oursig
- (int) TARGET_SIGNAL_REALTIME_64
+ 64;
739 if (retsig
>= VKI_SIGRTMIN
&& retsig
< VKI_SIGRTMAX
)
743 error ("Valgrind GDBSERVER bug: (do_target_signal_to_host):"
744 " unrecognized target signal %d\n", oursig
);
750 int target_signal_to_host_p (enum target_signal oursig
)
753 do_target_signal_to_host (oursig
, &oursig_ok
);
757 int target_signal_to_host (enum target_signal oursig
)
760 int targ_signo
= do_target_signal_to_host (oursig
, &oursig_ok
);
762 /* The user might be trying to do "signal SIGSAK" where this system
763 doesn't have SIGSAK. */
764 warning ("Signal %s does not exist on this system.\n",
765 target_signal_to_name (oursig
));
772 /* In some circumstances we allow a command to specify a numeric
773 signal. The idea is to keep these circumstances limited so that
774 users (and scripts) develop portable habits. For comparison,
775 POSIX.2 `kill' requires that 1,2,3,6,9,14, and 15 work (and using a
776 numeric signal at all is obsolescent. We are slightly more
777 lenient and allow 1-15 which should match host signal numbers on
778 most systems. Use of symbolic signal names is strongly encouraged. */
780 enum target_signal
target_signal_from_command (int num
)
782 if (num
>= 1 && num
<= 15)
783 return (enum target_signal
) num
;
784 error ("Only signals 1-15 are valid as numeric signals.\n\
785 Use \"info signals\" for a list of symbolic signals.\n");