From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12974 invoked by alias); 15 Dec 2014 13:11:40 -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 12957 invoked by uid 89); 15 Dec 2014 13:11:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 15 Dec 2014 13:11:38 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBFDBX7t021944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Dec 2014 08:11:34 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBFDBVEN030178; Mon, 15 Dec 2014 08:11:32 -0500 Message-ID: <548EDE03.7090005@redhat.com> Date: Mon, 15 Dec 2014 13:11:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Joel Brobecker CC: gdb-patches@sourceware.org Subject: Re: RFC: skip_inline_frames failed assertion resuming from breakpoint on LynxOS References: <20141120051109.GR5774@adacore.com> <20141120051223.GA23720@adacore.com> <546DBA9F.9060600@redhat.com> <20141120171137.GT5774@adacore.com> <546F173A.3070204@redhat.com> <20141213154638.GK5457@adacore.com> In-Reply-To: <20141213154638.GK5457@adacore.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-12/txt/msg00384.txt.bz2 On 12/13/2014 03:46 PM, Joel Brobecker wrote: > Hi Pedro, > >> The main issue is that we're trying to move the thread past a >> breakpoint. Barring displaced stepping support, to move the >> thread past the breakpoint, we have to remove the breakpoint from >> the target temporarily. But then we _cannot_ resume other threads >> but the one that is stopped at the breakpoint, because then those >> other threads could fly by the removed breakpoint and miss it. > > Attached is a patch that does just that, tested on ppc-lynx5 and > ppc-lynx178. I waited a while before posting it here, because > I wanted to put it in observation for a while first... > > gdb/gdbserver/ChangeLog: > > * lynx-low.c (lynx_resume): Use PTRACE_SINGLESTEP_ONE if N == 1. > Remove FIXME comment about assumption about N. > > OK to commit? Sure, OK. > > Note that parallel to that, I came across another issue, which I am > going to call a limitation for now: consider the case where we have > 2 threads, A and B, and we are tring to next/step some code in thread > A. While doing so, thread B receives a signal, and therefore reports > it to GDB. GDB sees that this signal is configured as > nostop/noprint/pass, so presumably, you would think that we'd resume > the inferior passing that signal to thread B. However, how do you do > that while at the same time stepping thread A? GDB nowadays sends a single vCont packet that both steps thread A, continues thread B with a signal and continues all other threads with no signal (previously in some cases it'd just lose control of the inferior, or deliver the signal to the wrong thread). Something like: vCont;s:A;C SIG:B;c See the switch_back_to_stepped_thread calls within: if (random_signal) { at the tail end of handle_signal_stop, and remote.c:append_pending_thread_resumptions. There are tests in the testsuite that result in packets just like that. > > IIRC, what happens currently in this case is that GDB keeps trying > to resume/step thread A, and the kernel keeps telling GDB "no, > thread B just received a signal", and so GDB and the kernel go > into that infinite loop where nothing advances. I'm not quite sure > why we keep getting the signal for thread B, if it's a new signal > each time, or if it's about the signal not being passed back (the > program I saw this in is fairly large and complicated). > > In any case, I don't see how we could improve this situation > without settting sss-like breakpoints... Something I'm not really > eager to do, at least for now, since "set scheduler-locking step" > seems to work around the issue. Couldn't you iterate over the threads, and use PTRACE_STEP_ONE for the stepped threads, and PTRACE_CONT_ONE for the others, instead of PTRACE_CONT ? For the case above, lynx_resume would end up issuing: PTRACE_STEP_ONE, thread A, sig 0 PTRACE_CONT_ONE, thread B, sig SIG PTRACE_CONT_ONE, thread C, sig 0 PTRACE_CONT_ONE, thread D, sig 0 ... Otherwise, yeah, sounds like handling the step request with breakpoints instead might be the solution. Thanks, Pedro Alves