From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6906 invoked by alias); 10 Apr 2017 01:33:52 -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 6863 invoked by uid 89); 10 Apr 2017 01:33:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=HTo:U*tom, H*u:1.2.4, H*UA:1.2.4 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Apr 2017 01:33:45 +0000 Received: by simark.ca (Postfix, from userid 33) id 7C2451E18C; Sun, 9 Apr 2017 21:33:44 -0400 (EDT) To: Tom Tromey Subject: Re: [RFA 01/14] Introduce event_location_up X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 10 Apr 2017 01:33:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: <20170408201208.2672-2-tom@tromey.com> References: <20170408201208.2672-1-tom@tromey.com> <20170408201208.2672-2-tom@tromey.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.4 X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00218.txt.bz2 On 2017-04-08 16:11, Tom Tromey wrote: > This removes make_cleanup_delete_event_location and instead changes > the various location functions to return an event_location_up, a new > unique_ptr typedef. Thanks for doing this, the patch looks good to me. Two suggestions below. > This is largely straightforward, but be sure to examine the > init_breakpoint_sal change. I believe the code I deleted there is > dead, because "location != NULL" can never be true in that branch; but > you should double-check. It looks correct. > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index 3925ec6..f3834d5 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -3472,7 +3472,7 @@ create_overlay_event_breakpoint (void) > &internal_breakpoint_ops); > initialize_explicit_location (&explicit_loc); > explicit_loc.function_name = ASTRDUP (func_name); > - b->location = new_explicit_location (&explicit_loc); > + b->location = new_explicit_location (&explicit_loc).release (); Since the breakpoint structure is new'ed and delete'd, you can also change breakpoint's location field to be an event_location_up, instead of doing a (bunch of) release. I think you could do the same with the location field in linespec_result as well, since that structure is only allocated statically (and therefore its defaults ctor/dtor are called). > @@ -15278,7 +15241,7 @@ static void > strace_command (char *arg, int from_tty) > { > struct breakpoint_ops *ops; > - struct event_location *location; > + event_location_up location; > struct cleanup *back_to; > > /* Decide if we are dealing with a static tracepoint marker (`-m'), > @@ -15294,9 +15257,9 @@ strace_command (char *arg, int from_tty) > location = string_to_event_location (&arg, current_language); > } > > - back_to = make_cleanup_delete_event_location (location); > + You can delete the extra line here. Thanks, Simon