From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7291 invoked by alias); 14 Aug 2013 18:30:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 7280 invoked by uid 89); 14 Aug 2013 18:30:37 -0000 X-Spam-SWARE-Status: No, score=-8.7 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 14 Aug 2013 18:30:36 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7EIUTHm032745 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 14 Aug 2013 14:30:32 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r7EIULH4008504; Wed, 14 Aug 2013 14:30:25 -0400 Message-ID: <520BCCBD.6070007@redhat.com> Date: Wed, 14 Aug 2013 18:30:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: lgustavo@codesourcery.com CC: "'gdb-patches@sourceware.org'" Subject: Re: [PATCH] Share ptrace options discovery/linux native code between GDB and gdbserver References: <51F04092.2070008@codesourcery.com> <51F80CDB.3050106@redhat.com> <5201162A.8080204@codesourcery.com> In-Reply-To: <5201162A.8080204@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-08/txt/msg00386.txt.bz2 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