From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id E4ECE3857344; Fri, 6 May 2022 18:10:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4ECE3857344 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Add constructor to fork_catchpoint X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: fb9e63701335b7383622e3da5825dd4aa45b788e X-Git-Newrev: ec798154804ede0a7a3a9bcd3d8d08cd0499897b Message-Id: <20220506181046.E4ECE3857344@sourceware.org> Date: Fri, 6 May 2022 18:10:46 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2022 18:10:47 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dec798154804e= de0a7a3a9bcd3d8d08cd0499897b commit ec798154804ede0a7a3a9bcd3d8d08cd0499897b Author: Tom Tromey Date: Sat Apr 30 12:52:51 2022 -0600 Add constructor to fork_catchpoint =20 This adds a constructor to fork_catchpoint and simplifies the caller. Diff: --- gdb/break-catch-fork.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gdb/break-catch-fork.c b/gdb/break-catch-fork.c index e8d613f062d..3ad4bafcf1c 100644 --- a/gdb/break-catch-fork.c +++ b/gdb/break-catch-fork.c @@ -34,6 +34,11 @@ =20 struct fork_catchpoint : public breakpoint { + explicit fork_catchpoint (bool is_vfork_) + : is_vfork (is_vfork_) + { + } + int insert_location (struct bp_location *) override; int remove_location (struct bp_location *, enum remove_bp_reason reason) override; @@ -52,7 +57,7 @@ struct fork_catchpoint : public breakpoint /* Process id of a child process whose forking triggered this catchpoint. This field is only valid immediately after this catchpoint has triggered. */ - ptid_t forked_inferior_pid; + ptid_t forked_inferior_pid =3D null_ptid; }; =20 /* Implement the "insert" method for fork catchpoints. */ @@ -180,11 +185,9 @@ create_fork_vfork_event_catchpoint (struct gdbarch *gd= barch, bool temp, const char *cond_string, bool is_vfork) { - std::unique_ptr c (new fork_catchpoint ()); + std::unique_ptr c (new fork_catchpoint (is_vfork)); =20 init_catchpoint (c.get (), gdbarch, temp, cond_string); - c->is_vfork =3D is_vfork; - c->forked_inferior_pid =3D null_ptid; =20 install_breakpoint (0, std::move (c), 1); }