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

gdb/break-catch-syscall.c

index bcdf0f117a5e9fb3ed65c9140ca1401b52d4c9b0..d25d7ba7c5e149458de19d157e79b87745841912 100644 (file)
 
 struct syscall_catchpoint : public breakpoint
 {
+  explicit syscall_catchpoint (std::vector<int> &&calls)
+    : syscalls_to_be_caught (std::move (calls))
+  {
+  }
+
   int insert_location (struct bp_location *) override;
   int remove_location (struct bp_location *,
                       enum remove_bp_reason reason) override;
@@ -347,9 +352,9 @@ create_syscall_event_catchpoint (int tempflag, std::vector<int> &&filter)
 {
   struct gdbarch *gdbarch = get_current_arch ();
 
-  std::unique_ptr<syscall_catchpoint> c (new syscall_catchpoint ());
+  std::unique_ptr<syscall_catchpoint> c
+    (new syscall_catchpoint (std::move (filter)));
   init_catchpoint (c.get (), gdbarch, tempflag, nullptr);
-  c->syscalls_to_be_caught = std::move (filter);
 
   install_breakpoint (0, std::move (c), 1);
 }