Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Ignore the last EXIT_THREAD_DEBUG_EVENT on Windows
Date: Sat, 22 Aug 2026 08:47:34 +0300	[thread overview]
Message-ID: <86h5kmzoy1.fsf@gnu.org> (raw)
In-Reply-To: <87o6evpcbm.fsf@tromey.com> (message from Tom Tromey on Fri, 21 Aug 2026 12:18:05 -0600)

> From: Tom Tromey <tromey@adacore.com>
> Cc: Tom Tromey <tromey@adacore.com>,  gdb-patches@sourceware.org
> Date: Fri, 21 Aug 2026 12:18:05 -0600
> 
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
> 
> Eli> How can we know that a given thread is a "final" one, when Windows is
> Eli> known to start its own threads for the program being debugged?
> 
> We track when threads are created and destroyed, and only apply this
> behavior when there is a single thread remaining.

Is there no possibility whatsoever that another thread will be created
while we handle the termination of what we consider to be "the last
thread"?  Even though GDB supports scheduler-locking and non-stop mode
on Windows?

Also, doesn't EXIT_PROCESS_DEBUG_EVENT provide to us data about the
process (like its exit code) that EXIT_THREAD_DEBUG_EVENT does not?

> Eli> Are you sure there are no such threads left running after all the
> Eli> threads known to GDB exit, and cause this issue?
> 
> Yes, extracted from the log in the bug, here are all the thread and
> process events:
> 
> [windows events] get_windows_debug_event: kernel event for pid=1604 tid=0x89c code=CREATE_PROCESS_DEBUG_EVENT
>   [windows events] get_windows_debug_event: kernel event for pid=1604 tid=0xc20 code=CREATE_THREAD_DEBUG_EVENT
>   [windows events] get_windows_debug_event: kernel event for pid=1604 tid=0xc20 code=EXIT_THREAD_DEBUG_EVENT
>   [windows events] get_windows_debug_event: kernel event for pid=1604 tid=0x89c code=EXIT_THREAD_DEBUG_EVENT

Did you succeed in capturing EXIT_THREAD_DEBUG_EVENT after receiving
EXIT_PROCESS_DEBUG_EVENT this way?

> >> 1. It only happened under load, I was never able to reproduce it by
> >> running a single test case.
> 
> Eli> What do you mean by "load" in this case? what kind of load?
> 
> If I run one test case in isolation, it never fails.  However if I run
> the whole test suite, which defaults to running as many tests as there
> are CPUs, I do see some failures.  Frequently -- but not always -- the
> same tests fail.

Then this could be a problem due to effect of previous/other tests,
which run before or in parallel with this test.  In which case I'm not
sure we should install this change.  As you say, the OS should handle
this issue for us, and the OS always knows better which thread is the
last one.  I worry that we could introduce a possibility of
regressions if we install this workaround for a problem for which we
have only insufficient understanding.

  reply	other threads:[~2026-08-22  5:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 16:18 Tom Tromey
2026-08-21 17:53 ` Eli Zaretskii
2026-08-21 18:18   ` Tom Tromey
2026-08-22  5:47     ` Eli Zaretskii [this message]
2026-08-27 15:27       ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86h5kmzoy1.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox