Do not use internal definition of SIGRTMIN

Message ID 1446317977-24319-1-git-send-email-raj.khem@gmail.com
State New, archived
Headers

Commit Message

Khem Raj Oct. 31, 2015, 6:59 p.m. UTC
  Define W_STOPCODE if not defined already

__SIGRTMIN is internal to glibc and other libcs e.g. musl
may not provide them

2015-10-30  Khem Raj  <raj.khem@gmail.com>

        PR 13012
        * linux-nat.c (lin_thread_get_thread_signals): Use SIGRTMIN
        * instead of
        __SIGRTMIN.
        * nat/linux-nat.h(W_STOPCODE): Define W_STOPCODE if not already
        * defined.
---
 gdb/linux-nat.c     | 4 ++--
 gdb/nat/linux-nat.h | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
  

Comments

Andreas Schwab Oct. 31, 2015, 8:11 p.m. UTC | #1
Khem Raj <raj.khem@gmail.com> writes:

>         * linux-nat.c (lin_thread_get_thread_signals): Use SIGRTMIN
>         * instead of
>         __SIGRTMIN.

That's not the same.

> diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
> index 841ec39..12cf91b 100644
> --- a/gdb/linux-nat.c
> +++ b/gdb/linux-nat.c
> @@ -5227,10 +5227,10 @@ lin_thread_get_thread_signals (sigset_t *set)
>       fortunately they don't change!  */
>  
>    if (restart == 0)
> -    restart = __SIGRTMIN;
> +    restart = SIGRTMIN;
>  
>    if (cancel == 0)
> -    cancel = __SIGRTMIN + 1;
> +    cancel = SIGRTMIN + 1;

The point is to get the internal thread signals.

Andreas.
  
Khem Raj Oct. 31, 2015, 8:27 p.m. UTC | #2
On Sat, Oct 31, 2015 at 1:11 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Khem Raj <raj.khem@gmail.com> writes:
>
>>         * linux-nat.c (lin_thread_get_thread_signals): Use SIGRTMIN
>>         * instead of
>>         __SIGRTMIN.
>
> That's not the same.
>
>> diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
>> index 841ec39..12cf91b 100644
>> --- a/gdb/linux-nat.c
>> +++ b/gdb/linux-nat.c
>> @@ -5227,10 +5227,10 @@ lin_thread_get_thread_signals (sigset_t *set)
>>       fortunately they don't change!  */
>>
>>    if (restart == 0)
>> -    restart = __SIGRTMIN;
>> +    restart = SIGRTMIN;
>>
>>    if (cancel == 0)
>> -    cancel = __SIGRTMIN + 1;
>> +    cancel = SIGRTMIN + 1;
>
> The point is to get the internal thread signals.
>

OK then I will ifdef it with __GLIBC__ then

> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
  
Doug Evans Nov. 1, 2015, 1:12 a.m. UTC | #3
On Sat, Oct 31, 2015 at 11:59 AM, Khem Raj <raj.khem@gmail.com> wrote:
> Define W_STOPCODE if not defined already
>
> __SIGRTMIN is internal to glibc and other libcs e.g. musl
> may not provide them
>
> 2015-10-30  Khem Raj  <raj.khem@gmail.com>
>
>         PR 13012
>         * linux-nat.c (lin_thread_get_thread_signals): Use SIGRTMIN
>         * instead of
>         __SIGRTMIN.
>         * nat/linux-nat.h(W_STOPCODE): Define W_STOPCODE if not already
>         * defined.
> ---
>  gdb/linux-nat.c     | 4 ++--
>  gdb/nat/linux-nat.h | 4 ++++
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
> index 841ec39..12cf91b 100644
> --- a/gdb/linux-nat.c
> +++ b/gdb/linux-nat.c
> @@ -5227,10 +5227,10 @@ lin_thread_get_thread_signals (sigset_t *set)
>       fortunately they don't change!  */
>
>    if (restart == 0)
> -    restart = __SIGRTMIN;
> +    restart = SIGRTMIN;
>
>    if (cancel == 0)
> -    cancel = __SIGRTMIN + 1;
> +    cancel = SIGRTMIN + 1;
>
>    sigaddset (set, restart);
>    sigaddset (set, cancel);
> diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h
> index 70e6274..34c9feb 100644
> --- a/gdb/nat/linux-nat.h
> +++ b/gdb/nat/linux-nat.h
> @@ -30,6 +30,10 @@ struct arch_lwp_info;
>  #define __SIGRTMIN 32
>  #endif
>
> +#ifndef W_STOPCODE
> +#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
> +#endif
> +
>  /* Unlike other extended result codes, WSTOPSIG (status) on
>     PTRACE_O_TRACESYSGOOD syscall events doesn't return SIGTRAP, but
>     instead SIGTRAP with bit 7 set.  */
> --
> 2.6.2
>

Hi.

These patches look remarkably similar to mine that I recently checked in.
Porting gdb to musl?

2015-10-26  Doug Evans  <dje@google.com>

        * nat/linux-nat.h (__SIGRTMIN): Move here from gdbserver/linux-low.c.

2015-10-26  Doug Evans  <dje@google.com>

        * common/gdb_wait.h (W_STOPCODE): Define, moved here from
        gdbserver/linux-low.c.
        (WSETSTOP): Simplify.
  

Patch

diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 841ec39..12cf91b 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -5227,10 +5227,10 @@  lin_thread_get_thread_signals (sigset_t *set)
      fortunately they don't change!  */
 
   if (restart == 0)
-    restart = __SIGRTMIN;
+    restart = SIGRTMIN;
 
   if (cancel == 0)
-    cancel = __SIGRTMIN + 1;
+    cancel = SIGRTMIN + 1;
 
   sigaddset (set, restart);
   sigaddset (set, cancel);
diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h
index 70e6274..34c9feb 100644
--- a/gdb/nat/linux-nat.h
+++ b/gdb/nat/linux-nat.h
@@ -30,6 +30,10 @@  struct arch_lwp_info;
 #define __SIGRTMIN 32
 #endif
 
+#ifndef W_STOPCODE
+#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
+#endif
+
 /* Unlike other extended result codes, WSTOPSIG (status) on
    PTRACE_O_TRACESYSGOOD syscall events doesn't return SIGTRAP, but
    instead SIGTRAP with bit 7 set.  */