Add constructor to signal_catchpoint
authorTom Tromey <tom@tromey.com>
Sat, 30 Apr 2022 20:20:53 +0000 (14:20 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 6 May 2022 18:03:34 +0000 (12:03 -0600)
This adds a constructor to signal_catchpoint and simplifies the
caller.

gdb/break-catch-sig.c

index c42b0fd1c0114a58b8b7a495600821025e6bb21e..1c29a057d60240a551e5837a8f6d5815df54dcc5 100644 (file)
 
 struct signal_catchpoint : public breakpoint
 {
+  signal_catchpoint (std::vector<gdb_signal> &&sigs, bool catch_all_)
+    : signals_to_be_caught (std::move (sigs)),
+      catch_all (catch_all_)
+  {
+  }
+
   int insert_location (struct bp_location *) override;
   int remove_location (struct bp_location *,
                       enum remove_bp_reason reason) override;
@@ -316,10 +322,9 @@ create_signal_catchpoint (int tempflag, std::vector<gdb_signal> &&filter,
 {
   struct gdbarch *gdbarch = get_current_arch ();
 
-  std::unique_ptr<signal_catchpoint> c (new signal_catchpoint ());
+  std::unique_ptr<signal_catchpoint> c
+    (new signal_catchpoint (std::move (filter), catch_all));
   init_catchpoint (c.get (), gdbarch, tempflag, nullptr);
-  c->signals_to_be_caught = std::move (filter);
-  c->catch_all = catch_all;
 
   install_breakpoint (0, std::move (c), 1);
 }