Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: lgustavo@codesourcery.com
Cc: "'gdb-patches@sourceware.org'" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Share ptrace options discovery/linux native code between GDB and gdbserver
Date: Wed, 14 Aug 2013 18:30:00 -0000	[thread overview]
Message-ID: <520BCCBD.6070007@redhat.com> (raw)
In-Reply-To: <5201162A.8080204@codesourcery.com>

On 08/06/2013 04:28 PM, Luis Machado wrote:

>>> >> +/* Signals to block to make that sigsuspend work.  */
>>> >> +static sigset_t blocked_mask;
>> >
>> > This isn't right.  On linux-nat.c, this is a global because
>> > it holds the LinuxThreads signals too, initialized by
>> > lin_thread_get_thread_signals.  Now the block_child_signals
>> > in linux-nat.c will no longer block the right signals, as
>> > linux-nat.c:blocked_mask still exists, and that is the
>> > one that gets the LinuxThreads signals added, not this
>> > one, but it's this one that block_child_signals operates
>> > on ...
>> >
>> > On gdbserver, the my_waitpid wrapper does:
>> >
>> >    if (flags & __WALL)
>> >      {
>> >        sigset_t block_mask, org_mask, wake_mask;
>> >        ^^^^^^^^^^^^^^^^^^^
>> >
>> > It's a local, for a reason.  It's because ...
>> >
>> >        int wnohang;
>> >
>> >        wnohang = (flags & WNOHANG) != 0;
>> >        flags &= ~(__WALL | __WCLONE);
>> >        flags |= WNOHANG;
>> >
>> >        /* Block all signals while here.  This avoids knowing about
>> >           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> > 	 LinuxThread's signals.  */
>> >           ^^^^^^^^^^^^^^^^^^^^^^^^^
>> >        sigfillset (&block_mask);
>> >        ^^^^^^^^^^^^^^^^^^^^^^^^^
>> >
>> > ... we block all signals.  The comment alludes exactly to
>> > the avoiding of GDBserver doing things differently, and
>> > avoiding the need for the block_mask global.
>> >
>> >        sigprocmask (SIG_BLOCK, &block_mask, &org_mask);
>> >
>> >
> Ok. But what about its use on 
> common/linux-ptrace.c:linux_check_ptrace_features. Why does GDB check 
> for features differently? Or is this shared mask not needed there at all 
> and thus we don't need to call block_child_signals and 
> restore_child_signals_mask at all?
> 
> I'll send an updated patch once i fully understand the details on 
> signal-blocking.

Okay, I've sent a patch (along with the rationale) for this at:

 http://sourceware.org/ml/gdb-patches/2013-08/msg00385.html

Let me know what you think.  I believe that should simplify
your patch.

-- 
Pedro Alves


      reply	other threads:[~2013-08-14 18:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-24 21:01 Luis Machado
2013-07-30 18:58 ` Pedro Alves
2013-07-30 19:20   ` Tom Tromey
2013-08-06 15:28   ` Luis Machado
2013-08-14 18:30     ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=520BCCBD.6070007@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox