public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Add constructor to fork_catchpoint
Date: Fri,  6 May 2022 18:10:46 +0000 (GMT)	[thread overview]
Message-ID: <20220506181046.E4ECE3857344@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ec798154804ede0a7a3a9bcd3d8d08cd0499897b

commit ec798154804ede0a7a3a9bcd3d8d08cd0499897b
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Apr 30 12:52:51 2022 -0600

    Add constructor to fork_catchpoint
    
    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 @@
 
 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 = null_ptid;
 };
 
 /* Implement the "insert" method for fork catchpoints.  */
@@ -180,11 +185,9 @@ create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch,
 				    bool temp, const char *cond_string,
 				    bool is_vfork)
 {
-  std::unique_ptr<fork_catchpoint> c (new fork_catchpoint ());
+  std::unique_ptr<fork_catchpoint> c (new fork_catchpoint (is_vfork));
 
   init_catchpoint (c.get (), gdbarch, temp, cond_string);
-  c->is_vfork = is_vfork;
-  c->forked_inferior_pid = null_ptid;
 
   install_breakpoint (0, std::move (c), 1);
 }


                 reply	other threads:[~2022-05-06 18:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220506181046.E4ECE3857344@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).