mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 12:23:31 +08:00
Refactor ptrace extended event status.
This commit implements functions for identifying and extracting extended ptrace event information from a Linux wait status. These are just convenience functions intended to hide the ">> 16" used to extract the event from the wait status word, replacing the hard-coded shift with a more descriptive function call. This is preparatory work for implementation of follow-fork and detach-on-fork for extended-remote linux targets. gdb/ChangeLog: * linux-nat.c (linux_handle_extended_wait): Call linux_ptrace_get_extended_event. (wait_lwp): Call linux_is_extended_waitstatus. (linux_nat_filter_event): Call linux_ptrace_get_extended_event and linux_is_extended_waitstatus. * nat/linux-ptrace.c (linux_test_for_tracefork): Call linux_ptrace_get_extended_event. (linux_ptrace_get_extended_event): New function. (linux_is_extended_waitstatus): New function. * nat/linux-ptrace.h (linux_ptrace_get_extended_event) (linux_is_extended_waitstatus): New declarations. gdb/gdbserver/ChangeLog: * linux-low.c (handle_extended_wait): Call linux_ptrace_get_extended_event. (get_stop_pc, get_detach_signal, linux_low_filter_event): Call linux_is_extended_waitstatus. ---
This commit is contained in:
@ -416,7 +416,7 @@ linux_test_for_tracefork (int child_pid)
|
||||
|
||||
/* Check if we received a fork event notification. */
|
||||
if (ret == child_pid && WIFSTOPPED (status)
|
||||
&& status >> 16 == PTRACE_EVENT_FORK)
|
||||
&& linux_ptrace_get_extended_event (status) == PTRACE_EVENT_FORK)
|
||||
{
|
||||
/* We did receive a fork event notification. Make sure its PID
|
||||
is reported. */
|
||||
@ -550,3 +550,19 @@ linux_ptrace_set_additional_flags (int flags)
|
||||
{
|
||||
additional_flags = flags;
|
||||
}
|
||||
|
||||
/* Extract extended ptrace event from wait status. */
|
||||
|
||||
int
|
||||
linux_ptrace_get_extended_event (int wstat)
|
||||
{
|
||||
return (wstat >> 16);
|
||||
}
|
||||
|
||||
/* Determine whether wait status denotes an extended event. */
|
||||
|
||||
int
|
||||
linux_is_extended_waitstatus (int wstat)
|
||||
{
|
||||
return (linux_ptrace_get_extended_event (wstat) != 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user