From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47930 invoked by alias); 13 Jun 2016 15:07:18 -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 47027 invoked by uid 89); 13 Jun 2016 15:07:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=parents 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, 13 Jun 2016 15:07:07 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (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 4D338D4001; Mon, 13 Jun 2016 15:07:06 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5DF75e5007658; Mon, 13 Jun 2016 11:07:05 -0400 Subject: Re: [PATCH 05/12] Handle reinsert breakpoints for vforked child To: Yao Qi , gdb-patches@sourceware.org References: <1464859846-15619-1-git-send-email-yao.qi@linaro.org> <1464859846-15619-6-git-send-email-yao.qi@linaro.org> From: Pedro Alves Message-ID: Date: Mon, 13 Jun 2016 15:07:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <1464859846-15619-6-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-06/txt/msg00235.txt.bz2 On 06/02/2016 10:30 AM, Yao Qi wrote: > When a thread is doing step-over with reinsert breakpoint, and the > instruction executed is a syscall doing vfork, both parent and child > share the memory, so the reinsert breakpoint in the space is visible > to both of them. Also, removing the reinsert breakpoints from the > child will effectively remove them from the parent. We should > carefully manipulate reinsert breakpoints for both processes. > > What we are doing here is that > > - uninsert reinsert breakpoints from the parent before cloning the > breakpoint list. We use "uninsert" instead of "remove", because > we need to "reinsert" them back after vfork is done. In fact, > "uninsert" removes them from both child and parent process space. > - reinsert breakpoints in parent process are still copied to child's > breakpoint list, > - remove them from child's breakpoint list as what we did for fork, > at this point, reinsert breakpoints are removed from the child and > the parent, but they are still tracked by the parent's breakpoint > list, > - once vfork is done, "reinsert" them back to the parent, > > gdb/gdbserver: > > 2016-05-26 Yao Qi > > * linux-low.c (handle_extended_wait): Call > uninsert_reinsert_breakpoints for the parent process. Remove > reinsert breakpoints from the child process. Reinsert them to > the parent process when vfork is done. > * mem-break.c (uninsert_reinsert_breakpoints): New function. > (reinsert_reinsert_breakpoints): New function. > * mem-break.h (uninsert_reinsert_breakpoints): Declare > (reinsert_reinsert_breakpoints): Declare. > > gdb/testsuite: > > 2016-05-26 Yao Qi > > * gdb.base/step-over-fork-1.exp: Extend the test for vfork. OK. Thanks, Pedro Alves