diff options
author | Tom Tromey <tom@tromey.com> | 2022-04-30 12:52:51 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-05-06 12:03:34 -0600 |
commit | ec798154804ede0a7a3a9bcd3d8d08cd0499897b (patch) | |
tree | d1e74bc89f5adf99b9f953a248490f9f28222944 /gdb | |
parent | fb9e63701335b7383622e3da5825dd4aa45b788e (diff) | |
download | gdb-ec798154804ede0a7a3a9bcd3d8d08cd0499897b.zip gdb-ec798154804ede0a7a3a9bcd3d8d08cd0499897b.tar.gz gdb-ec798154804ede0a7a3a9bcd3d8d08cd0499897b.tar.bz2 |
Add constructor to fork_catchpoint
This adds a constructor to fork_catchpoint and simplifies the caller.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/break-catch-fork.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gdb/break-catch-fork.c b/gdb/break-catch-fork.c index e8d613f..3ad4baf 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); } |