]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/obsd-nat.c
gdb, gdbserver: make target_waitstatus safe
[thirdparty/binutils-gdb.git] / gdb / obsd-nat.c
index 890ec5ed67013971e2eb38a289b01d4e9818e291..c70820d60d022b2fdec94cab010de7920d23d116 100644 (file)
@@ -90,7 +90,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
                       target_wait_flags options)
 {
   ptid_t wptid = inf_ptrace_target::wait (ptid, ourstatus, options);
-  if (ourstatus->kind == TARGET_WAITKIND_STOPPED)
+  if (ourstatus->kind () == TARGET_WAITKIND_STOPPED)
     {
       ptrace_state_t pe;
 
@@ -103,8 +103,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
       switch (pe.pe_report_event)
        {
        case PTRACE_FORK:
-         ourstatus->kind = TARGET_WAITKIND_FORKED;
-         ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
+         ourstatus->set_forked (ptid_t (pe.pe_other_pid));
 
          /* Make sure the other end of the fork is stopped too.  */
          pid_t fpid = waitpid (pe.pe_other_pid, nullptr, 0);
@@ -119,11 +118,11 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
          gdb_assert (pe.pe_other_pid == pid);
          if (find_inferior_pid (this, fpid) != nullptr)
            {
-             ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
+             ourstatus->set_forked (ptid_t (pe.pe_other_pid));
              wptid = ptid_t (fpid, pe.pe_tid, 0);
            }
 
-         obsd_enable_proc_events (ourstatus->value.related_pid.pid ());
+         obsd_enable_proc_events (ourstatus->child_ptid ().pid ());
          break;
        }