From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id C90D6383FD68 for ; Tue, 6 Dec 2022 16:46:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C90D6383FD68 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670345175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=W3gCjg/wDbnG/3sw9fr8zj0tSpEs80gHz6rztFc6p8k=; b=dWuHOkF/ElycY0fKSj7gQ3ESP4knkSj//WWlCueRYej0U5dVhFH2Ivyiv/01MleALIk7gy bLpUOLXj1XNdtCIYcuHFYBQi6C+wZoYUKtPDqhAgbbELWVHkJiY3xVLbMhiWG4Xyj35cNe H4+elMpBaDVLIoZmC9QFLQgAF71RLIY= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-650-wSpyavfANAawQoyQ2PNYwQ-1; Tue, 06 Dec 2022 11:46:14 -0500 X-MC-Unique: wSpyavfANAawQoyQ2PNYwQ-1 Received: by mail-wr1-f72.google.com with SMTP id x1-20020adfbb41000000b002426b33b618so1529847wrg.7 for ; Tue, 06 Dec 2022 08:46:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=W3gCjg/wDbnG/3sw9fr8zj0tSpEs80gHz6rztFc6p8k=; b=C3vByc6SppKOAnbvSxgqqR1v5N2URbn/v9NFVqs9RgWrbYf6RpSl4V+GzMIuySaG9M z28WuY4U4Q0iivtOIU1tEqzHUFWCPtfLz39vtMajs/Ag1duQl1uQvTvL9trfpBukL5gD YW25pKAjIaiy+Eyz/9TExy+zY+EZFBYW6ZIO80k+aEWD9aASAienYP+8Wj7yU0eMLzvR BFzvfmyi71Cfzfv5Kbn+vFY11wLQQr7VWhiQzQ2B7Mme0e7/6vZO6gTvuSUDpwzNAJ8o ZIVtIklcDVqDCNpjjNL9FkCzrkID1TvxljzKT/By6l2ptV0aNXGfXJlQ5pronmIBvUMi lyhw== X-Gm-Message-State: ANoB5pnpM2i0q3hRSrlvhfXfaUbLSvQiW0f27fMrDxDJ4fR8ucWPEkco QuOVNpGJIDa2oSM+wHmKw9pgQ1st4xmhR2ZNeMcq+do+pgD9x6aEzRpVaQmAlqt6lcqQUH6HITG c1WozFEF6wv43CSRvQLFdTNrn9EAf58S3Ra30klG42go1NrXxSP3RjL2oZDkIraYKFauYax80QA == X-Received: by 2002:a05:6000:5c2:b0:242:2601:719d with SMTP id bh2-20020a05600005c200b002422601719dmr19068351wrb.366.1670345173082; Tue, 06 Dec 2022 08:46:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf4LpPvipvVnzT9l4ndx46AtYU3sY5BXvQEfqSbi+A0UFdy4RstegZ3CPRfWpMRoNXzHUA5L9w== X-Received: by 2002:a05:6000:5c2:b0:242:2601:719d with SMTP id bh2-20020a05600005c200b002422601719dmr19068333wrb.366.1670345172822; Tue, 06 Dec 2022 08:46:12 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id m12-20020a7bca4c000000b003d1e763ba46sm3025279wml.10.2022.12.06.08.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 08:46:12 -0800 (PST) From: Andrew Burgess To: Simon Marchi via Gdb-patches , gdb-patches@sourceware.org Cc: Pedro Alves , Simon Marchi Subject: Re: [PATCH 02/12] gdb: make install_breakpoint return a non-owning reference In-Reply-To: <20221206135729.3937767-3-simon.marchi@efficios.com> References: <20221206135729.3937767-1-simon.marchi@efficios.com> <20221206135729.3937767-3-simon.marchi@efficios.com> Date: Tue, 06 Dec 2022 16:46:11 +0000 Message-ID: <87v8mo32gc.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Simon Marchi via Gdb-patches writes: > From: Pedro Alves > > A following patch will want to install a breakpoint and then keep a > non-owning reference to it. Make install_breakpoint return a non-owning > reference, to make that easy. LGTM. Thanks, Andrew > > Co-Authored-By: Simon Marchi > Change-Id: I2e8106a784021ff276ce251e24708cbdccc2d479 > --- > gdb/breakpoint.c | 4 +++- > gdb/breakpoint.h | 8 +++++--- > 2 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index f0276a963c0..f974808b4b4 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -7954,7 +7954,7 @@ catchpoint::catchpoint (struct gdbarch *gdbarch, bool temp, > pspace = current_program_space; > } > > -void > +breakpoint * > install_breakpoint (int internal, std::unique_ptr &&arg, int update_gll) > { > breakpoint *b = add_to_breakpoint_chain (std::move (arg)); > @@ -7967,6 +7967,8 @@ install_breakpoint (int internal, std::unique_ptr &&arg, int update_ > > if (update_gll) > update_global_location_list (UGLL_MAY_INSERT); > + > + return b; > } > > static int > diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h > index f7633d29cbf..eafe694f367 100644 > --- a/gdb/breakpoint.h > +++ b/gdb/breakpoint.h > @@ -1479,10 +1479,12 @@ extern void > target and breakpoint_created observers of its existence. If > INTERNAL is non-zero, the breakpoint number will be allocated from > the internal breakpoint count. If UPDATE_GLL is non-zero, > - update_global_location_list will be called. */ > + update_global_location_list will be called. > > -extern void install_breakpoint (int internal, std::unique_ptr &&b, > - int update_gll); > + Takes ownership of B, and returns a non-owning reference to it. */ > + > +extern breakpoint *install_breakpoint > + (int internal, std::unique_ptr &&b, int update_gll); > > /* Returns the breakpoint ops appropriate for use with with LOCSPEC > and according to IS_TRACEPOINT. Use this to ensure, for example, > -- > 2.38.1