+ return 0;
+}
+
+static int
+fbsd_insert_fork_catchpoint (struct target_ops *self, int pid)
+{
+ return 0;
+}
+
+static int
+fbsd_remove_fork_catchpoint (struct target_ops *self, int pid)
+{
+ return 0;
+}
+
+static int
+fbsd_insert_vfork_catchpoint (struct target_ops *self, int pid)
+{
+ return 0;
+}
+
+static int
+fbsd_remove_vfork_catchpoint (struct target_ops *self, int pid)
+{
+ return 0;
+}
+
+/* Enable fork tracing for a specific process.
+
+ To catch fork events, PT_FOLLOW_FORK is set on every traced process
+ to enable stops on returns from fork or vfork. Note that both the
+ parent and child will always stop, even if system call stops are
+ not enabled. */
+
+static void
+fbsd_enable_follow_fork (pid_t pid)
+{
+ if (ptrace (PT_FOLLOW_FORK, pid, (PTRACE_TYPE_ARG3)0, 1) == -1)
+ perror_with_name (("ptrace"));
+}
+
+/* Implement the "to_post_startup_inferior" target_ops method. */
+
+static void
+fbsd_post_startup_inferior (struct target_ops *self, ptid_t pid)
+{
+ fbsd_enable_follow_fork (ptid_get_pid (pid));
+}
+
+/* Implement the "to_post_attach" target_ops method. */
+
+static void
+fbsd_post_attach (struct target_ops *self, int pid)
+{
+ fbsd_enable_follow_fork (pid);
+}
+#endif
+
+#ifdef PL_FLAG_EXEC
+/* If the FreeBSD kernel supports PL_FLAG_EXEC, then traced processes
+ will always stop after exec. */
+
+static int
+fbsd_insert_exec_catchpoint (struct target_ops *self, int pid)
+{
+ return 0;
+}
+
+static int
+fbsd_remove_exec_catchpoint (struct target_ops *self, int pid)
+{
+ return 0;
+}
+#endif
+#endif
+
+void
+fbsd_nat_add_target (struct target_ops *t)
+{
+ t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
+ t->to_find_memory_regions = fbsd_find_memory_regions;
+#ifdef PT_LWPINFO
+ super_wait = t->to_wait;
+ t->to_wait = fbsd_wait;
+#ifdef TDP_RFPPWAIT
+ t->to_follow_fork = fbsd_follow_fork;
+ t->to_insert_fork_catchpoint = fbsd_insert_fork_catchpoint;
+ t->to_remove_fork_catchpoint = fbsd_remove_fork_catchpoint;
+ t->to_insert_vfork_catchpoint = fbsd_insert_vfork_catchpoint;
+ t->to_remove_vfork_catchpoint = fbsd_remove_vfork_catchpoint;
+ t->to_post_startup_inferior = fbsd_post_startup_inferior;
+ t->to_post_attach = fbsd_post_attach;
+#endif
+#ifdef PL_FLAG_EXEC
+ t->to_insert_exec_catchpoint = fbsd_insert_exec_catchpoint;
+ t->to_remove_exec_catchpoint = fbsd_remove_exec_catchpoint;
+#endif
+#endif
+ add_target (t);