gdb: change store_waitstatus to return a target_waitstatus by value

store_waitstatus is basically a translation function between a status
integer and an equivalent target_waitstatus object.  It would make sense
for it to take the integer as a parameter and return the
target_waitstatus by value.  Do that, and rename to
host_status_to_waitstatus.  Users can then do:

  ws = host_status_to_waitstatus (status)

which does the right thing, given the move constructor of
target_waitstatus.

Change-Id: I7a07d59d3dc19d3ed66929642f82f44f3e85d61b
This commit is contained in:
Simon Marchi
2021-12-01 13:09:56 -05:00
committed by Simon Marchi
parent 857dfb92de
commit 7509b82979
8 changed files with 20 additions and 19 deletions

View File

@@ -2159,7 +2159,7 @@ wait_lwp (struct lwp_info *lp)
process is gone. Store the status to report to the
core. Store it in lp->waitstatus, because lp->status
would be ambiguous (W_EXITCODE(0,0) == 0). */
store_waitstatus (&lp->waitstatus, status);
lp->waitstatus = host_status_to_waitstatus (status);
return 0;
}
@@ -2932,7 +2932,7 @@ linux_nat_filter_event (int lwpid, int status)
/* Store the pending event in the waitstatus, because
W_EXITCODE(0,0) == 0. */
store_waitstatus (&lp->waitstatus, status);
lp->waitstatus = host_status_to_waitstatus (status);
return;
}
@@ -3306,7 +3306,7 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
lp->waitstatus.set_ignore ();
}
else
store_waitstatus (ourstatus, status);
*ourstatus = host_status_to_waitstatus (status);
linux_nat_debug_printf ("exit");