From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 286F63858C5F; Thu, 2 Feb 2023 15:08:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 286F63858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675350517; bh=OLnSkq9hKYLxBtzdVDAKFxF5F/tW0EAnpoi+sOHjiJQ=; h=From:To:Subject:Date:From; b=STmJgl+v339SgBTU/lRM4nuTRWRTE29717/31LQX8uVtuZHE6zxuYrWSusxFT12iL UpISQhe1Be286BmR035ddzBnwJF9rgM/P/ghttb8aro+p3ocCuOVuUZacGKQAeDPvU raR4lABURJ+wrq6jAv2EH9nDFFrBdLIvwF+xvun8= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: make install_breakpoint return a non-owning reference X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: 1a8505cb53faa1c191d09ba221f9b0ec383ccfde X-Git-Newrev: b82d4ec99e3347b62a16cf5456628a37a128a99b Message-Id: <20230202150837.286F63858C5F@sourceware.org> Date: Thu, 2 Feb 2023 15:08:37 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db82d4ec99e33= 47b62a16cf5456628a37a128a99b commit b82d4ec99e3347b62a16cf5456628a37a128a99b Author: Pedro Alves Date: Fri Sep 23 11:48:11 2022 -0400 gdb: make install_breakpoint return a non-owning reference =20 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. =20 Co-Authored-By: Simon Marchi Change-Id: I2e8106a784021ff276ce251e24708cbdccc2d479 Approved-By: Andrew Burgess Diff: --- 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 00cc2ab401c..e25c5889ec4 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -7956,7 +7956,7 @@ catchpoint::catchpoint (struct gdbarch *gdbarch, bool= temp, pspace =3D current_program_space; } =20 -void +breakpoint * install_breakpoint (int internal, std::unique_ptr &&arg, int u= pdate_gll) { breakpoint *b =3D add_to_breakpoint_chain (std::move (arg)); @@ -7969,6 +7969,8 @@ install_breakpoint (int internal, std::unique_ptr &&arg, int update_ =20 if (update_gll) update_global_location_list (UGLL_MAY_INSERT); + + return b; } =20 static int diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 399bd037977..352e8468537 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1484,10 +1484,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. =20 -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); =20 /* Returns the breakpoint ops appropriate for use with with LOCSPEC and according to IS_TRACEPOINT. Use this to ensure, for example,