From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23401 invoked by alias); 1 Jul 2016 13:02:48 -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 23376 invoked by uid 89); 1 Jul 2016 13:02:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=dies, HTo:D*FreeBSD.org, paper 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; Fri, 01 Jul 2016 13:02:42 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0B67CF629; Fri, 1 Jul 2016 13:02:40 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u61D2d2h000441; Fri, 1 Jul 2016 09:02:40 -0400 Subject: Re: [PATCH 0/2] Fix x86 debug registers on FreeBSD with threads To: John Baldwin , gdb-patches@sourceware.org References: <20160628225507.80772-1-jhb@FreeBSD.org> From: Pedro Alves Message-ID: <5d3788cc-400b-3efa-4a88-dc3a072ce706@redhat.com> Date: Fri, 01 Jul 2016 13:02:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160628225507.80772-1-jhb@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-07/txt/msg00008.txt.bz2 On 06/28/2016 11:55 PM, John Baldwin wrote: > The pan-BSD x86 debug register support code was only setting the > debug registers on the current LWP identified by inferior_ptid. > This fixes the code to set the debug registers on all of the LWPs > belonging to the current inferior on each change. Looks good to me. Spotted a missing space in: ALL_NON_EXITED_THREADS(thread) > > One question I have is that the amd64 x86 debug register code was > invoking x86_cleanup_dregs in the mourn_inferior target op, but > the x86 linux native code calls this in the post_startup_inferior > target op instead. Any ideas as to why they are different? Not sure. Probably history, or maybe to be sure to paper over potential problems from the "inferior exit/dies/detached" end missing clearing the reg state. OTOH, I think target_post_startup_inferior isn't called for attach. Note that mourn_inferior isn't called in some cases. Some targets call it from within their to_detach and to_kill target methods, but that's not guaranteed. I think that linux-nat.c doesn't call it from its to_detach, but OTOH, when you get there, watchpoints had better have been removed from the target already. But maybe there's a problem as follow-fork time, not sure. Note that the linux native code also calls x86_forget_process directly through linux_nat_forget_process. > > John Baldwin (2): > Consolidate x86 debug register code for BSD native targets. > Set debug registers on all threads belonging to the current inferior. Thanks, Pedro Alves