From patchwork Tue Jul 30 19:02:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33861 Received: (qmail 27624 invoked by alias); 30 Jul 2019 19:02:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 27457 invoked by uid 89); 30 Jul 2019 19:02:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 30 Jul 2019 19:02:52 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4C2C111626B; Tue, 30 Jul 2019 15:02:51 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id HJxs4mB0esDw; Tue, 30 Jul 2019 15:02:51 -0400 (EDT) Received: from murgatroyd.Home (97-122-178-82.hlrn.qwest.net [97.122.178.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id E907B11663F; Tue, 30 Jul 2019 15:02:50 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Change breakpoint::filter to be a unique_xmalloc_ptr Date: Tue, 30 Jul 2019 13:02:48 -0600 Message-Id: <20190730190248.20709-1-tromey@adacore.com> MIME-Version: 1.0 This changes breakpoint::filter to be a unique_xmalloc_ptr, removing an explicit xfree, as well as a use of a "release" method. gdb/ChangeLog 2019-07-30 Tom Tromey * breakpoint.c (init_breakpoint_sal): Update. (breakpoint): Update. * breakpoint.h (struct breakpoint) : Now a unique_xmalloc_ptr. --- gdb/ChangeLog | 7 +++++++ gdb/breakpoint.c | 5 ++--- gdb/breakpoint.h | 5 ++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index e0c9aa460f1..7a1e7824f21 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -8850,7 +8850,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, b->location = std::move (location); else b->location = new_address_location (b->loc->address, NULL, 0); - b->filter = filter.release (); + b->filter = std::move (filter); } static void @@ -12124,7 +12124,6 @@ breakpoint::~breakpoint () { xfree (this->cond_string); xfree (this->extra_string); - xfree (this->filter); } static struct bp_location * @@ -13701,7 +13700,7 @@ decode_location_default (struct breakpoint *b, decode_line_full (location, DECODE_LINE_FUNFIRSTLINE, search_pspace, NULL, 0, &canonical, multiple_symbols_all, - b->filter); + b->filter.get ()); /* We should get 0 or 1 resulting SALs. */ gdb_assert (canonical.lsals.size () < 2); diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index a825be72228..69a043c7676 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -734,9 +734,8 @@ struct breakpoint event_location_up location; /* The filter that should be passed to decode_line_full when - re-setting this breakpoint. This may be NULL, but otherwise is - allocated with xmalloc. */ - char *filter = NULL; + re-setting this breakpoint. This may be NULL. */ + gdb::unique_xmalloc_ptr filter; /* For a ranged breakpoint, the location we used to find the end of the range. */