From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9350 invoked by alias); 31 Oct 2014 23:44:44 -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 9339 invoked by uid 89); 31 Oct 2014 23:44:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 31 Oct 2014 23:44:41 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1XkLrx-00036Y-V3 from Don_Breazeal@mentor.com ; Fri, 31 Oct 2014 16:44:37 -0700 Received: from [127.0.0.1] ([172.30.0.45]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 31 Oct 2014 16:44:37 -0700 Message-ID: <54541EE6.2090206@codesourcery.com> Date: Fri, 31 Oct 2014 23:44:00 -0000 From: "Breazeal, Don" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Pedro Alves , gdb-patches@sourceware.org Subject: Re: [PATCH 05/16 v2] GDBserver clone breakpoint list References: <1407434395-19089-1-git-send-email-donb@codesourcery.com> <1408580964-27916-6-git-send-email-donb@codesourcery.com> <543EB17E.8090404@redhat.com> In-Reply-To: <543EB17E.8090404@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00883.txt.bz2 On 10/15/2014 10:40 AM, Pedro Alves wrote: > On 08/21/2014 01:29 AM, Don Breazeal wrote: >> This patch implements gdbserver routines to clone the breakpoint lists of a >> process, duplicating them for another process. >> +#define APPEND_TO_LIST(listpp, itemp, tailp) \ >> + { \ >> + if (tailp == NULL) \ >> + *(listpp) = itemp; \ >> + else \ >> + tailp->next = itemp; \ >> + tailp = itemp; \ >> + } > > Please put ()'s around uses of the parameters. > Also, use 'do { ... } while (0)' instead of '{ ... }'. Done. >> +static void >> +clone_agent_expr (struct agent_expr **new_ax, struct agent_expr *src_ax) >> +{ > > Like memcpy, please make the src argument of these functions be > const. Done. > > Is there a reason this doesn't have the more natural prototype that > returns the new clone? No reason. I've made this change in the new version. > Here this could then be: > > new_bkpt = clone_one_breakpoint (bp); > APPEND_TO_LIST (new_list, new_bkpt, bkpt_tail); > APPEND_TO_LIST (new_raw_list, new_bkpt->raw, raw_bkpt_tail); > >> +/* Create a new breakpoint list NEW_BKPT_LIST that is a copy of SRC. */ >> + >> +void clone_all_breakpoints (struct breakpoint **new_bkpt_list, >> + struct raw_breakpoint **new_raw_bkpt_list, >> + struct breakpoint *src); And this change is made as well. > > It took me a second to realize that SRC is a list here rather than > a single breakpoint. Could you make that more explicit, like e.g.,: > > /* Create a new breakpoint list NEW_BKPT_LIST that is a copy of the > list that starts at SRC. */ I made this change, and also changed the name of SRC to SRC_LIST. Thanks for the review. I've posted an updated version of this patch here: https://sourceware.org/ml/gdb-patches/2014-10/msg00870.html. It's part of a new version of the whole patch series, updated to work with more recent changes. Thanks, --Don