From: Paul Floyd Date: Mon, 29 Nov 2021 21:44:17 +0000 (+0100) Subject: Bug 446251 TARGET_SIGNAL_THR added to enum target_signal X-Git-Tag: VALGRIND_3_19_0~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=521e4690091e36ac8e1fbf388f8e30615a50f0d0;p=thirdparty%2Fvalgrind.git Bug 446251 TARGET_SIGNAL_THR added to enum target_signal gdb considers FreeBSD SIGTHR to be the evuivalent if SIGLWP not a signal in its own right. Remove the extra enum entry (which fixes errors in converting signals from number to string) and map TARGET_SIGNAL_LWP to SIGTHR. --- diff --git a/coregrind/m_gdbserver/gdb/signals.h b/coregrind/m_gdbserver/gdb/signals.h index 4857475fa3..81f373ae78 100644 --- a/coregrind/m_gdbserver/gdb/signals.h +++ b/coregrind/m_gdbserver/gdb/signals.h @@ -137,9 +137,6 @@ enum target_signal /* Used internally by Solaris threads. See signal(5) on Solaris. */ TARGET_SIGNAL_CANCEL = 76, - /* Similar to the above, but for FreeBSD */ - TARGET_SIGNAL_THR = 77, - /* Yes, this pains me, too. But LynxOS didn't have SIG32, and now GNU/Linux does, and we can't disturb the numbering, since it's part of the remote protocol. Note that in some GDB's @@ -235,6 +232,8 @@ enum target_signal /* If you are adding a new signal, add it just above this comment. */ + + /* Last and unused enum value, for sizing arrays, etc. */ TARGET_SIGNAL_LAST }; diff --git a/coregrind/m_gdbserver/signals.c b/coregrind/m_gdbserver/signals.c index 9aee90fcba..fc4cdf2178 100644 --- a/coregrind/m_gdbserver/signals.c +++ b/coregrind/m_gdbserver/signals.c @@ -78,7 +78,7 @@ static struct { {"SIGWIND", "SIGWIND"}, {"SIGPHONE", "SIGPHONE"}, {"SIGWAITING", "Process's LWPs are blocked"}, - {"SIGLWP", "Signal LWP"}, + {"SIGLWP", "Signal LWP"}, /* FreeBSD SIGTHR */ {"SIGDANGER", "Swap space dangerously low"}, {"SIGGRANT", "Monitor mode granted"}, {"SIGRETRACT", "Need to relinquish monitor mode"}, @@ -404,10 +404,6 @@ enum target_signal target_signal_from_host (int hostsig) if (hostsig == VKI_SIGCANCEL) return TARGET_SIGNAL_CANCEL; #endif -#if defined(VKI_SIGTHR) - if (hostsig == VKI_SIGTHR) - return TARGET_SIGNAL_THR; -#endif #if defined (VKI_SIGLWP) if (hostsig == VKI_SIGLWP) return TARGET_SIGNAL_LWP; @@ -475,6 +471,10 @@ enum target_signal target_signal_from_host (int hostsig) if (hostsig == VKI_SIGLIBRT) return TARGET_SIGNAL_LIBRT; #endif +#if defined(VKI_SIGTHR) + if (hostsig == VKI_SIGTHR) + return TARGET_SIGNAL_LWP; +#endif #if defined (VKI_SIGRTMIN) if (hostsig >= VKI_SIGRTMIN && hostsig < VKI_SIGRTMAX) { @@ -661,10 +661,6 @@ int do_target_signal_to_host (enum target_signal oursig, case TARGET_SIGNAL_CANCEL: return VKI_SIGCANCEL; #endif -#if defined (VKI_SIGTHR) - case TARGET_SIGNAL_THR: - return VKI_SIGTHR; -#endif #if defined (VKI_SIGLWP) case TARGET_SIGNAL_LWP: return VKI_SIGLWP; @@ -732,6 +728,10 @@ int do_target_signal_to_host (enum target_signal oursig, case TARGET_SIGNAL_LIBRT: return SIGLIBRT; #endif +#if defined (VKI_SIGTHR) + case TARGET_SIGNAL_LWP: + return VKI_SIGTHR; +#endif default: #if defined (VKI_SIGRTMIN)