aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-nat.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-02-23 10:56:41 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2021-02-23 10:56:41 -0500
commit897608ed56a73739aa675011c2104565b68fc8bb (patch)
treed5eca83f8efc9c78e423f062c79411677148c148 /gdb/linux-nat.c
parentf16ccf47d8795ea050810d0381ce4ad6de09bfb7 (diff)
downloadbinutils-897608ed56a73739aa675011c2104565b68fc8bb.zip
binutils-897608ed56a73739aa675011c2104565b68fc8bb.tar.gz
binutils-897608ed56a73739aa675011c2104565b68fc8bb.tar.bz2
gdb: linux-nat: make linux_nat_filter_event return void
I noticed that linux_nat_filter_event returns a value, but its caller doesn't use it. This has been since 9c02b52532ac ("linux-nat.c: better starvation avoidance, handle non-stop mode too"). Before that commit, the return value was used to tell the caller whether to continue processing that event or not. But since then, the model is that we pull all events from the kernel and linux_nat_filter_event just saves the status to the lwp_info structure if it thinks it's relevant. And the caller, linux_nat_wait_1, selects a status at random amongst the threads with a pending status. So essentially, the return value of linux_nat_filter_event does not have a reason to be anymore. Change it so it returns void. gdb/ChangeLog: * linux-nat.c (linux_nat_filter_event): Return void. Change-Id: I35662868910f5122772ed92a512adfbf4da12d87
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r--gdb/linux-nat.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 42dcd77..ccfd3c1 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -2822,9 +2822,10 @@ resumed_callback (struct lwp_info *lp)
}
/* Check if we should go on and pass this event to common code.
- Return the affected lwp if we should, or NULL otherwise. */
-static struct lwp_info *
+ If so, save the status to the lwp_info structure associated to LWPID. */
+
+static void
linux_nat_filter_event (int lwpid, int status)
{
struct lwp_info *lp;
@@ -2862,7 +2863,7 @@ linux_nat_filter_event (int lwpid, int status)
linux_nat_debug_printf ("saving LWP %ld status %s in stopped_pids list",
(long) lwpid, status_to_str (status));
add_to_pid_list (&stopped_pids, lwpid, status);
- return NULL;
+ return;
}
/* Make sure we don't report an event for the exit of an LWP not in
@@ -2870,7 +2871,7 @@ linux_nat_filter_event (int lwpid, int status)
if we detach from a program we originally forked and then it
exits. */
if (!WIFSTOPPED (status) && !lp)
- return NULL;
+ return;
/* This LWP is stopped now. (And if dead, this prevents it from
ever being continued.) */
@@ -2894,7 +2895,7 @@ linux_nat_filter_event (int lwpid, int status)
on. */
status = W_STOPCODE (SIGTRAP);
if (linux_handle_syscall_trap (lp, 0))
- return NULL;
+ return;
}
else
{
@@ -2910,7 +2911,7 @@ linux_nat_filter_event (int lwpid, int status)
linux_nat_debug_printf ("Handling extended status 0x%06x", status);
if (linux_handle_extended_wait (lp, status))
- return NULL;
+ return;
}
/* Check if the thread has exited. */
@@ -2926,7 +2927,7 @@ linux_nat_filter_event (int lwpid, int status)
was not the end of the debugged application and should be
ignored. */
exit_lwp (lp);
- return NULL;
+ return;
}
/* Note that even if the leader was ptrace-stopped, it can still
@@ -2942,7 +2943,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);
- return lp;
+ return;
}
/* Make sure we don't report a SIGSTOP that we sent ourselves in
@@ -2968,7 +2969,7 @@ linux_nat_filter_event (int lwpid, int status)
linux_resume_one_lwp (lp, lp->step, GDB_SIGNAL_0);
gdb_assert (lp->resumed);
- return NULL;
+ return;
}
}
@@ -2990,7 +2991,7 @@ linux_nat_filter_event (int lwpid, int status)
gdb_assert (lp->resumed);
/* Discard the event. */
- return NULL;
+ return;
}
/* Don't report signals that GDB isn't interested in, such as
@@ -3039,7 +3040,7 @@ linux_nat_filter_event (int lwpid, int status)
target_pid_to_str (lp->ptid).c_str (),
(signo != GDB_SIGNAL_0
? strsignal (gdb_signal_to_host (signo)) : "0"));
- return NULL;
+ return;
}
}
@@ -3047,7 +3048,6 @@ linux_nat_filter_event (int lwpid, int status)
gdb_assert (lp);
lp->status = status;
save_stop_reason (lp);
- return lp;
}
/* Detect zombie thread group leaders, and "exit" them. We can't reap