From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12071 invoked by alias); 16 May 2013 12:24:56 -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 12048 invoked by uid 89); 16 May 2013 12:24:53 -0000 X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO autolearn=ham version=3.3.1 Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 16 May 2013 12:24:52 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 5AFF32E8C2; Thu, 16 May 2013 08:24:50 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ViFVgNbFfAbo; Thu, 16 May 2013 08:24:50 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id E4A722E801; Thu, 16 May 2013 08:24:49 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id C1A7FC2566; Thu, 16 May 2013 16:24:43 +0400 (RET) Date: Thu, 16 May 2013 12:24:00 -0000 From: Joel Brobecker To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [RFA] gdbserver/lynx178: spurious SIG61 signal when resuming inferior. Message-ID: <20130516122443.GA4017@adacore.com> References: <1368441986-14478-1-git-send-email-brobecker@adacore.com> <5190CCF9.3020004@redhat.com> <20130513132802.GA32222@adacore.com> <5190F869.3090408@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5190F869.3090408@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013-05/txt/msg00608.txt.bz2 > Old lynx-nat.c did: > > http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/Attic/lynx-nat.c?rev=1.23&content-type=text/x-cvsweb-markup&cvsroot=src > > /* If pid == -1, then we want to step/continue all threads, else > we only want to step/continue a single thread. */ > if (pid == -1) > { > pid = PIDGET (inferior_ptid); > func = step ? PTRACE_SINGLESTEP : PTRACE_CONT; > } > else > func = step ? PTRACE_SINGLESTEP_ONE : PTRACE_CONT_ONE; > > > I'd like to believe that just doing that in gdbserver too > would fix the scheduler-locking example. :-) I just tried that, and I am not sure yet how well this is going to work. It'll at least require a change in the "wait" routine which resumes the execution after a "new-thread" event, because do not want to resume the execution using the thread's ptid, because we'd switch to a PTRACE_CONT_ONE request. I tried to see if I could make it work quickly, but got inconclusive results (process hanging), so I am leaving that for another day :-). > For the SIG61 issue, I wonder whether for PTRACE_CONT, > it's "continue main pid process" that we should always use > instead of "last reported thread id" (and that's what the old > lynx-nat.c did too). Did you try that? Yes, I did that a while ago. Looking at the man page for PTRACE_CONT: This request is always directed to an individual thread specified by pid, while all the threads in the traced process are also to be resumed. The man page also says a bit earlier: Per-thread, but effective on the entire process. Based on the above, I think that using the currently "active" thread (the thread that caused the process to stop) helps avoid having the debugger influence the program's behavior by influencing its scheduling. Nevertheless, I tried that again today, and that is not sufficient to prevent the SIG61 signal from being raised. So I think that the patch as I proposed it still makes sense. I know you pre-approved it, but I want to make sure that I answered all your questions properly before going ahead with the commit. > Sorry to be picky. IMO, it's good to have all these > experimentation results archived, for when somebody proposes > removing/changing the "make sure to resume last reported" code > at some point... Not at all, I think this makes sense. -- Joel