aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-nat.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2024-05-17 20:09:18 +0100
committerPedro Alves <pedro@palves.net>2024-05-17 20:21:48 +0100
commit41330f5d32d175de2b70eaed5031823c113b5961 (patch)
tree641f08cd772c9f9d3a0e67acb19219b041714376 /gdb/linux-nat.c
parent5223cde0d5f7a74c31ce75c3ffb1064d8eeeaf54 (diff)
downloadgdb-users/palves/windows-non-stop.zip
gdb-users/palves/windows-non-stop.tar.gz
gdb-users/palves/windows-non-stop.tar.bz2
Fix process-dies-after-detachusers/palves/windows-non-stop
- Need to flush pending kernel-side events - I realized that while we're detaching, we want to pass exceptions down to the inferior with DBG_EXCEPTION_NOT_HANDLED, instead of losing them. I ended up reusing a bit of code from the Linux target. Change-Id: Ifaa96b4a41bb83d868079af4d47633715c0e1940
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r--gdb/linux-nat.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 48ecd36..4564407 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1286,13 +1286,13 @@ detach_one_pid (int pid, int signo)
pid, strsignal (signo));
}
-/* Get pending signal of THREAD as a host signal number, for detaching
+/* Get pending signal of LP as a host signal number, for detaching
purposes. This is the signal the thread last stopped for, which we
need to deliver to the thread when detaching, otherwise, it'd be
suppressed/lost. */
static int
-get_detach_signal (struct lwp_info *lp)
+get_lwp_detach_signal (struct lwp_info *lp)
{
enum gdb_signal signo = GDB_SIGNAL_0;
@@ -1322,37 +1322,7 @@ get_detach_signal (struct lwp_info *lp)
else if (lp->status)
signo = gdb_signal_from_host (WSTOPSIG (lp->status));
else
- {
- thread_info *tp = linux_target->find_thread (lp->ptid);
-
- if (target_is_non_stop_p () && !tp->executing ())
- {
- if (tp->has_pending_waitstatus ())
- {
- /* If the thread has a pending event, and it was stopped with a
- signal, use that signal to resume it. If it has a pending
- event of another kind, it was not stopped with a signal, so
- resume it without a signal. */
- if (tp->pending_waitstatus ().kind () == TARGET_WAITKIND_STOPPED)
- signo = tp->pending_waitstatus ().sig ();
- else
- signo = GDB_SIGNAL_0;
- }
- else
- signo = tp->stop_signal ();
- }
- else if (!target_is_non_stop_p ())
- {
- ptid_t last_ptid;
- process_stratum_target *last_target;
-
- get_last_target_status (&last_target, &last_ptid, nullptr);
-
- if (last_target == linux_target
- && lp->ptid.lwp () == last_ptid.lwp ())
- signo = tp->stop_signal ();
- }
- }
+ signo = get_detach_signal (linux_target, lp->ptid);
if (signo == GDB_SIGNAL_0)
{