gdb/common/signals.c - gdb

Global variables defined

Functions defined

Macros defined

Source code

  1. /* Target signal translation functions for GDB.
  2.    Copyright (C) 1990-2015 Free Software Foundation, Inc.
  3.    Contributed by Cygnus Support.

  4.    This file is part of GDB.

  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 3 of the License, or
  8.    (at your option) any later version.

  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.

  13.    You should have received a copy of the GNU General Public License
  14.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  15. #include "common-defs.h"

  16. #ifdef HAVE_SIGNAL_H
  17. #include <signal.h>
  18. #endif

  19. #include "gdb_signals.h"

  20. struct gdbarch;

  21. /* Always use __SIGRTMIN if it's available.  SIGRTMIN is the lowest
  22.    _available_ realtime signal, not the lowest supported; glibc takes
  23.    several for its own use.  */

  24. #ifndef REALTIME_LO
  25. # if defined(__SIGRTMIN)
  26. #  define REALTIME_LO __SIGRTMIN
  27. #  define REALTIME_HI (__SIGRTMAX + 1)
  28. # elif defined(SIGRTMIN)
  29. #  define REALTIME_LO SIGRTMIN
  30. #  define REALTIME_HI (SIGRTMAX + 1)
  31. # endif
  32. #endif

  33. /* This table must match in order and size the signals in enum
  34.    gdb_signal.  */

  35. static const struct {
  36.   const char *symbol;
  37.   const char *name;
  38.   const char *string;
  39.   } signals [] =
  40. {
  41. #define SET(symbol, constant, name, string) { #symbol, name, string },
  42. #include "gdb/signals.def"
  43. #undef SET
  44. };

  45. const char *
  46. gdb_signal_to_symbol_string (enum gdb_signal sig)
  47. {
  48.   gdb_assert ((int) sig >= GDB_SIGNAL_FIRST && (int) sig <= GDB_SIGNAL_LAST);

  49.   return signals[sig].symbol;
  50. }

  51. /* Return the string for a signal.  */
  52. const char *
  53. gdb_signal_to_string (enum gdb_signal sig)
  54. {
  55.   if ((int) sig >= GDB_SIGNAL_FIRST && (int) sig <= GDB_SIGNAL_LAST)
  56.     return signals[sig].string;
  57.   else
  58.     return signals[GDB_SIGNAL_UNKNOWN].string;
  59. }

  60. /* Return the name for a signal.  */
  61. const char *
  62. gdb_signal_to_name (enum gdb_signal sig)
  63. {
  64.   if ((int) sig >= GDB_SIGNAL_FIRST && (int) sig <= GDB_SIGNAL_LAST
  65.       && signals[sig].name != NULL)
  66.     return signals[sig].name;
  67.   else
  68.     /* I think the code which prints this will always print it along
  69.        with the string, so no need to be verbose (very old comment).  */
  70.     return "?";
  71. }

  72. /* Given a name, return its signal.  */
  73. enum gdb_signal
  74. gdb_signal_from_name (const char *name)
  75. {
  76.   enum gdb_signal sig;

  77.   /* It's possible we also should allow "SIGCLD" as well as "SIGCHLD"
  78.      for GDB_SIGNAL_SIGCHLD.  SIGIOT, on the other hand, is more
  79.      questionable; seems like by now people should call it SIGABRT
  80.      instead.  */

  81.   /* This ugly cast brought to you by the native VAX compiler.  */
  82.   for (sig = GDB_SIGNAL_HUP;
  83.        sig < GDB_SIGNAL_LAST;
  84.        sig = (enum gdb_signal) ((int) sig + 1))
  85.     if (signals[sig].name != NULL
  86.         && strcmp (name, signals[sig].name) == 0)
  87.       return sig;
  88.   return GDB_SIGNAL_UNKNOWN;
  89. }

  90. /* The following functions are to help certain targets deal
  91.    with the signal/waitstatus stuff.  They could just as well be in
  92.    a file called native-utils.c or unixwaitstatus-utils.c or whatever.  */

  93. /* Convert host signal to our signals.  */
  94. enum gdb_signal
  95. gdb_signal_from_host (int hostsig)
  96. {
  97.   /* A switch statement would make sense but would require special
  98.      kludges to deal with the cases where more than one signal has the
  99.      same number.  Signals are ordered ANSI-standard signals first,
  100.      other signals second, with signals in each block ordered by their
  101.      numerical values on a typical POSIX platform.  */

  102.   if (hostsig == 0)
  103.     return GDB_SIGNAL_0;

  104.   /* SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM
  105.      are ANSI-standard signals and are always available.  */
  106.   if (hostsig == SIGINT)
  107.     return GDB_SIGNAL_INT;
  108.   if (hostsig == SIGILL)
  109.     return GDB_SIGNAL_ILL;
  110.   if (hostsig == SIGABRT)
  111.     return GDB_SIGNAL_ABRT;
  112.   if (hostsig == SIGFPE)
  113.     return GDB_SIGNAL_FPE;
  114.   if (hostsig == SIGSEGV)
  115.     return GDB_SIGNAL_SEGV;
  116.   if (hostsig == SIGTERM)
  117.     return GDB_SIGNAL_TERM;

  118.   /* All other signals need preprocessor conditionals.  */
  119. #if defined (SIGHUP)
  120.   if (hostsig == SIGHUP)
  121.     return GDB_SIGNAL_HUP;
  122. #endif
  123. #if defined (SIGQUIT)
  124.   if (hostsig == SIGQUIT)
  125.     return GDB_SIGNAL_QUIT;
  126. #endif
  127. #if defined (SIGTRAP)
  128.   if (hostsig == SIGTRAP)
  129.     return GDB_SIGNAL_TRAP;
  130. #endif
  131. #if defined (SIGEMT)
  132.   if (hostsig == SIGEMT)
  133.     return GDB_SIGNAL_EMT;
  134. #endif
  135. #if defined (SIGKILL)
  136.   if (hostsig == SIGKILL)
  137.     return GDB_SIGNAL_KILL;
  138. #endif
  139. #if defined (SIGBUS)
  140.   if (hostsig == SIGBUS)
  141.     return GDB_SIGNAL_BUS;
  142. #endif
  143. #if defined (SIGSYS)
  144.   if (hostsig == SIGSYS)
  145.     return GDB_SIGNAL_SYS;
  146. #endif
  147. #if defined (SIGPIPE)
  148.   if (hostsig == SIGPIPE)
  149.     return GDB_SIGNAL_PIPE;
  150. #endif
  151. #if defined (SIGALRM)
  152.   if (hostsig == SIGALRM)
  153.     return GDB_SIGNAL_ALRM;
  154. #endif
  155. #if defined (SIGUSR1)
  156.   if (hostsig == SIGUSR1)
  157.     return GDB_SIGNAL_USR1;
  158. #endif
  159. #if defined (SIGUSR2)
  160.   if (hostsig == SIGUSR2)
  161.     return GDB_SIGNAL_USR2;
  162. #endif
  163. #if defined (SIGCLD)
  164.   if (hostsig == SIGCLD)
  165.     return GDB_SIGNAL_CHLD;
  166. #endif
  167. #if defined (SIGCHLD)
  168.   if (hostsig == SIGCHLD)
  169.     return GDB_SIGNAL_CHLD;
  170. #endif
  171. #if defined (SIGPWR)
  172.   if (hostsig == SIGPWR)
  173.     return GDB_SIGNAL_PWR;
  174. #endif
  175. #if defined (SIGWINCH)
  176.   if (hostsig == SIGWINCH)
  177.     return GDB_SIGNAL_WINCH;
  178. #endif
  179. #if defined (SIGURG)
  180.   if (hostsig == SIGURG)
  181.     return GDB_SIGNAL_URG;
  182. #endif
  183. #if defined (SIGIO)
  184.   if (hostsig == SIGIO)
  185.     return GDB_SIGNAL_IO;
  186. #endif
  187. #if defined (SIGPOLL)
  188.   if (hostsig == SIGPOLL)
  189.     return GDB_SIGNAL_POLL;
  190. #endif
  191. #if defined (SIGSTOP)
  192.   if (hostsig == SIGSTOP)
  193.     return GDB_SIGNAL_STOP;
  194. #endif
  195. #if defined (SIGTSTP)
  196.   if (hostsig == SIGTSTP)
  197.     return GDB_SIGNAL_TSTP;
  198. #endif
  199. #if defined (SIGCONT)
  200.   if (hostsig == SIGCONT)
  201.     return GDB_SIGNAL_CONT;
  202. #endif
  203. #if defined (SIGTTIN)
  204.   if (hostsig == SIGTTIN)
  205.     return GDB_SIGNAL_TTIN;
  206. #endif
  207. #if defined (SIGTTOU)
  208.   if (hostsig == SIGTTOU)
  209.     return GDB_SIGNAL_TTOU;
  210. #endif
  211. #if defined (SIGVTALRM)
  212.   if (hostsig == SIGVTALRM)
  213.     return GDB_SIGNAL_VTALRM;
  214. #endif
  215. #if defined (SIGPROF)
  216.   if (hostsig == SIGPROF)
  217.     return GDB_SIGNAL_PROF;
  218. #endif
  219. #if defined (SIGXCPU)
  220.   if (hostsig == SIGXCPU)
  221.     return GDB_SIGNAL_XCPU;
  222. #endif
  223. #if defined (SIGXFSZ)
  224.   if (hostsig == SIGXFSZ)
  225.     return GDB_SIGNAL_XFSZ;
  226. #endif
  227. #if defined (SIGWIND)
  228.   if (hostsig == SIGWIND)
  229.     return GDB_SIGNAL_WIND;
  230. #endif
  231. #if defined (SIGPHONE)
  232.   if (hostsig == SIGPHONE)
  233.     return GDB_SIGNAL_PHONE;
  234. #endif
  235. #if defined (SIGLOST)
  236.   if (hostsig == SIGLOST)
  237.     return GDB_SIGNAL_LOST;
  238. #endif
  239. #if defined (SIGWAITING)
  240.   if (hostsig == SIGWAITING)
  241.     return GDB_SIGNAL_WAITING;
  242. #endif
  243. #if defined (SIGCANCEL)
  244.   if (hostsig == SIGCANCEL)
  245.     return GDB_SIGNAL_CANCEL;
  246. #endif
  247. #if defined (SIGLWP)
  248.   if (hostsig == SIGLWP)
  249.     return GDB_SIGNAL_LWP;
  250. #endif
  251. #if defined (SIGDANGER)
  252.   if (hostsig == SIGDANGER)
  253.     return GDB_SIGNAL_DANGER;
  254. #endif
  255. #if defined (SIGGRANT)
  256.   if (hostsig == SIGGRANT)
  257.     return GDB_SIGNAL_GRANT;
  258. #endif
  259. #if defined (SIGRETRACT)
  260.   if (hostsig == SIGRETRACT)
  261.     return GDB_SIGNAL_RETRACT;
  262. #endif
  263. #if defined (SIGMSG)
  264.   if (hostsig == SIGMSG)
  265.     return GDB_SIGNAL_MSG;
  266. #endif
  267. #if defined (SIGSOUND)
  268.   if (hostsig == SIGSOUND)
  269.     return GDB_SIGNAL_SOUND;
  270. #endif
  271. #if defined (SIGSAK)
  272.   if (hostsig == SIGSAK)
  273.     return GDB_SIGNAL_SAK;
  274. #endif
  275. #if defined (SIGPRIO)
  276.   if (hostsig == SIGPRIO)
  277.     return GDB_SIGNAL_PRIO;
  278. #endif

  279.   /* Mach exceptions.  Assumes that the values for EXC_ are positive! */
  280. #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
  281.   if (hostsig == _NSIG + EXC_BAD_ACCESS)
  282.     return GDB_EXC_BAD_ACCESS;
  283. #endif
  284. #if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
  285.   if (hostsig == _NSIG + EXC_BAD_INSTRUCTION)
  286.     return GDB_EXC_BAD_INSTRUCTION;
  287. #endif
  288. #if defined (EXC_ARITHMETIC) && defined (_NSIG)
  289.   if (hostsig == _NSIG + EXC_ARITHMETIC)
  290.     return GDB_EXC_ARITHMETIC;
  291. #endif
  292. #if defined (EXC_EMULATION) && defined (_NSIG)
  293.   if (hostsig == _NSIG + EXC_EMULATION)
  294.     return GDB_EXC_EMULATION;
  295. #endif
  296. #if defined (EXC_SOFTWARE) && defined (_NSIG)
  297.   if (hostsig == _NSIG + EXC_SOFTWARE)
  298.     return GDB_EXC_SOFTWARE;
  299. #endif
  300. #if defined (EXC_BREAKPOINT) && defined (_NSIG)
  301.   if (hostsig == _NSIG + EXC_BREAKPOINT)
  302.     return GDB_EXC_BREAKPOINT;
  303. #endif

  304. #if defined (SIGINFO)
  305.   if (hostsig == SIGINFO)
  306.     return GDB_SIGNAL_INFO;
  307. #endif

  308. #if defined (REALTIME_LO)
  309.   if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
  310.     {
  311.       /* This block of GDB_SIGNAL_REALTIME value is in order.  */
  312.       if (33 <= hostsig && hostsig <= 63)
  313.         return (enum gdb_signal)
  314.           (hostsig - 33 + (int) GDB_SIGNAL_REALTIME_33);
  315.       else if (hostsig == 32)
  316.         return GDB_SIGNAL_REALTIME_32;
  317.       else if (64 <= hostsig && hostsig <= 127)
  318.         return (enum gdb_signal)
  319.           (hostsig - 64 + (int) GDB_SIGNAL_REALTIME_64);
  320.       else
  321.         error (_("GDB bug: target.c (gdb_signal_from_host): "
  322.                "unrecognized real-time signal"));
  323.     }
  324. #endif

  325.   return GDB_SIGNAL_UNKNOWN;
  326. }

  327. /* Convert a OURSIG (an enum gdb_signal) to the form used by the
  328.    target operating system (refered to as the ``host'') or zero if the
  329.    equivalent host signal is not available.  Set/clear OURSIG_OK
  330.    accordingly. */

  331. static int
  332. do_gdb_signal_to_host (enum gdb_signal oursig,
  333.                           int *oursig_ok)
  334. {
  335.   int retsig;
  336.   /* Silence the 'not used' warning, for targets that
  337.      do not support signals.  */
  338.   (void) retsig;

  339.   /* Signals are ordered ANSI-standard signals first, other signals
  340.      second, with signals in each block ordered by their numerical
  341.      values on a typical POSIX platform.  */

  342.   *oursig_ok = 1;
  343.   switch (oursig)
  344.     {
  345.     case GDB_SIGNAL_0:
  346.       return 0;

  347.       /* SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM
  348.          are ANSI-standard signals and are always available.  */
  349.     case GDB_SIGNAL_INT:
  350.       return SIGINT;
  351.     case GDB_SIGNAL_ILL:
  352.       return SIGILL;
  353.     case GDB_SIGNAL_ABRT:
  354.       return SIGABRT;
  355.     case GDB_SIGNAL_FPE:
  356.       return SIGFPE;
  357.     case GDB_SIGNAL_SEGV:
  358.       return SIGSEGV;
  359.     case GDB_SIGNAL_TERM:
  360.       return SIGTERM;

  361.       /* All other signals need preprocessor conditionals.  */
  362. #if defined (SIGHUP)
  363.     case GDB_SIGNAL_HUP:
  364.       return SIGHUP;
  365. #endif
  366. #if defined (SIGQUIT)
  367.     case GDB_SIGNAL_QUIT:
  368.       return SIGQUIT;
  369. #endif
  370. #if defined (SIGTRAP)
  371.     case GDB_SIGNAL_TRAP:
  372.       return SIGTRAP;
  373. #endif
  374. #if defined (SIGEMT)
  375.     case GDB_SIGNAL_EMT:
  376.       return SIGEMT;
  377. #endif
  378. #if defined (SIGKILL)
  379.     case GDB_SIGNAL_KILL:
  380.       return SIGKILL;
  381. #endif
  382. #if defined (SIGBUS)
  383.     case GDB_SIGNAL_BUS:
  384.       return SIGBUS;
  385. #endif
  386. #if defined (SIGSYS)
  387.     case GDB_SIGNAL_SYS:
  388.       return SIGSYS;
  389. #endif
  390. #if defined (SIGPIPE)
  391.     case GDB_SIGNAL_PIPE:
  392.       return SIGPIPE;
  393. #endif
  394. #if defined (SIGALRM)
  395.     case GDB_SIGNAL_ALRM:
  396.       return SIGALRM;
  397. #endif
  398. #if defined (SIGUSR1)
  399.     case GDB_SIGNAL_USR1:
  400.       return SIGUSR1;
  401. #endif
  402. #if defined (SIGUSR2)
  403.     case GDB_SIGNAL_USR2:
  404.       return SIGUSR2;
  405. #endif
  406. #if defined (SIGCHLD) || defined (SIGCLD)
  407.     case GDB_SIGNAL_CHLD:
  408. #if defined (SIGCHLD)
  409.       return SIGCHLD;
  410. #else
  411.       return SIGCLD;
  412. #endif
  413. #endif /* SIGCLD or SIGCHLD */
  414. #if defined (SIGPWR)
  415.     case GDB_SIGNAL_PWR:
  416.       return SIGPWR;
  417. #endif
  418. #if defined (SIGWINCH)
  419.     case GDB_SIGNAL_WINCH:
  420.       return SIGWINCH;
  421. #endif
  422. #if defined (SIGURG)
  423.     case GDB_SIGNAL_URG:
  424.       return SIGURG;
  425. #endif
  426. #if defined (SIGIO)
  427.     case GDB_SIGNAL_IO:
  428.       return SIGIO;
  429. #endif
  430. #if defined (SIGPOLL)
  431.     case GDB_SIGNAL_POLL:
  432.       return SIGPOLL;
  433. #endif
  434. #if defined (SIGSTOP)
  435.     case GDB_SIGNAL_STOP:
  436.       return SIGSTOP;
  437. #endif
  438. #if defined (SIGTSTP)
  439.     case GDB_SIGNAL_TSTP:
  440.       return SIGTSTP;
  441. #endif
  442. #if defined (SIGCONT)
  443.     case GDB_SIGNAL_CONT:
  444.       return SIGCONT;
  445. #endif
  446. #if defined (SIGTTIN)
  447.     case GDB_SIGNAL_TTIN:
  448.       return SIGTTIN;
  449. #endif
  450. #if defined (SIGTTOU)
  451.     case GDB_SIGNAL_TTOU:
  452.       return SIGTTOU;
  453. #endif
  454. #if defined (SIGVTALRM)
  455.     case GDB_SIGNAL_VTALRM:
  456.       return SIGVTALRM;
  457. #endif
  458. #if defined (SIGPROF)
  459.     case GDB_SIGNAL_PROF:
  460.       return SIGPROF;
  461. #endif
  462. #if defined (SIGXCPU)
  463.     case GDB_SIGNAL_XCPU:
  464.       return SIGXCPU;
  465. #endif
  466. #if defined (SIGXFSZ)
  467.     case GDB_SIGNAL_XFSZ:
  468.       return SIGXFSZ;
  469. #endif
  470. #if defined (SIGWIND)
  471.     case GDB_SIGNAL_WIND:
  472.       return SIGWIND;
  473. #endif
  474. #if defined (SIGPHONE)
  475.     case GDB_SIGNAL_PHONE:
  476.       return SIGPHONE;
  477. #endif
  478. #if defined (SIGLOST)
  479.     case GDB_SIGNAL_LOST:
  480.       return SIGLOST;
  481. #endif
  482. #if defined (SIGWAITING)
  483.     case GDB_SIGNAL_WAITING:
  484.       return SIGWAITING;
  485. #endif
  486. #if defined (SIGCANCEL)
  487.     case GDB_SIGNAL_CANCEL:
  488.       return SIGCANCEL;
  489. #endif
  490. #if defined (SIGLWP)
  491.     case GDB_SIGNAL_LWP:
  492.       return SIGLWP;
  493. #endif
  494. #if defined (SIGDANGER)
  495.     case GDB_SIGNAL_DANGER:
  496.       return SIGDANGER;
  497. #endif
  498. #if defined (SIGGRANT)
  499.     case GDB_SIGNAL_GRANT:
  500.       return SIGGRANT;
  501. #endif
  502. #if defined (SIGRETRACT)
  503.     case GDB_SIGNAL_RETRACT:
  504.       return SIGRETRACT;
  505. #endif
  506. #if defined (SIGMSG)
  507.     case GDB_SIGNAL_MSG:
  508.       return SIGMSG;
  509. #endif
  510. #if defined (SIGSOUND)
  511.     case GDB_SIGNAL_SOUND:
  512.       return SIGSOUND;
  513. #endif
  514. #if defined (SIGSAK)
  515.     case GDB_SIGNAL_SAK:
  516.       return SIGSAK;
  517. #endif
  518. #if defined (SIGPRIO)
  519.     case GDB_SIGNAL_PRIO:
  520.       return SIGPRIO;
  521. #endif

  522.       /* Mach exceptions.  Assumes that the values for EXC_ are positive! */
  523. #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
  524.     case GDB_EXC_BAD_ACCESS:
  525.       return _NSIG + EXC_BAD_ACCESS;
  526. #endif
  527. #if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
  528.     case GDB_EXC_BAD_INSTRUCTION:
  529.       return _NSIG + EXC_BAD_INSTRUCTION;
  530. #endif
  531. #if defined (EXC_ARITHMETIC) && defined (_NSIG)
  532.     case GDB_EXC_ARITHMETIC:
  533.       return _NSIG + EXC_ARITHMETIC;
  534. #endif
  535. #if defined (EXC_EMULATION) && defined (_NSIG)
  536.     case GDB_EXC_EMULATION:
  537.       return _NSIG + EXC_EMULATION;
  538. #endif
  539. #if defined (EXC_SOFTWARE) && defined (_NSIG)
  540.     case GDB_EXC_SOFTWARE:
  541.       return _NSIG + EXC_SOFTWARE;
  542. #endif
  543. #if defined (EXC_BREAKPOINT) && defined (_NSIG)
  544.     case GDB_EXC_BREAKPOINT:
  545.       return _NSIG + EXC_BREAKPOINT;
  546. #endif

  547. #if defined (SIGINFO)
  548.     case GDB_SIGNAL_INFO:
  549.       return SIGINFO;
  550. #endif

  551.     default:
  552. #if defined (REALTIME_LO)
  553.       retsig = 0;

  554.       if (oursig >= GDB_SIGNAL_REALTIME_33
  555.           && oursig <= GDB_SIGNAL_REALTIME_63)
  556.         {
  557.           /* This block of signals is continuous, and
  558.              GDB_SIGNAL_REALTIME_33 is 33 by definition.  */
  559.           retsig = (int) oursig - (int) GDB_SIGNAL_REALTIME_33 + 33;
  560.         }
  561.       else if (oursig == GDB_SIGNAL_REALTIME_32)
  562.         {
  563.           /* GDB_SIGNAL_REALTIME_32 isn't contiguous with
  564.              GDB_SIGNAL_REALTIME_33.  It is 32 by definition.  */
  565.           retsig = 32;
  566.         }
  567.       else if (oursig >= GDB_SIGNAL_REALTIME_64
  568.           && oursig <= GDB_SIGNAL_REALTIME_127)
  569.         {
  570.           /* This block of signals is continuous, and
  571.              GDB_SIGNAL_REALTIME_64 is 64 by definition.  */
  572.           retsig = (int) oursig - (int) GDB_SIGNAL_REALTIME_64 + 64;
  573.         }

  574.       if (retsig >= REALTIME_LO && retsig < REALTIME_HI)
  575.         return retsig;
  576. #endif

  577.       *oursig_ok = 0;
  578.       return 0;
  579.     }
  580. }

  581. int
  582. gdb_signal_to_host_p (enum gdb_signal oursig)
  583. {
  584.   int oursig_ok;
  585.   do_gdb_signal_to_host (oursig, &oursig_ok);
  586.   return oursig_ok;
  587. }

  588. int
  589. gdb_signal_to_host (enum gdb_signal oursig)
  590. {
  591.   int oursig_ok;
  592.   int targ_signo = do_gdb_signal_to_host (oursig, &oursig_ok);
  593.   if (!oursig_ok)
  594.     {
  595.       /* The user might be trying to do "signal SIGSAK" where this system
  596.          doesn't have SIGSAK.  */
  597.       warning (_("Signal %s does not exist on this system."),
  598.                gdb_signal_to_name (oursig));
  599.       return 0;
  600.     }
  601.   else
  602.     return targ_signo;
  603. }