Re: [PATCH] [gdb/tdep] Don't call WaitForSingleObject with INFINITE arg

Pedro Alves
2025-06-06T13:14:25Z

On 2025-06-05 17:15, Pedro Alves wrote:
>> However, testsuite progress ground to a halt at
>> gdb.base/branch-to-self.exp. [ AFAICT, similar problems reported
>> here [1]. ]
> The testsuite fails to kill gdb all the time for me, it may well be
> the same. I'll give it a try after you've merged it.
>

I tested this now, and, unfortunately, it makes no difference for me.

With upstream from before your patch, and I do see a gdb.base/branch-to-self.exp hang.

However, after your patch, I still see the same hang.

If I attach another GDB to the hung GDB, I see several other GDB threads stopped in
WaitForMultipleObjects with an INFINITE argument, in Cygwin code, so I'm puzzled on
how changing that particular call made a difference for you. :-/ Wonder if it's just
a happy coincidence of affecting the scheduling.

I've long suspected that this is actually some deadlock bug in Cygwin somewhere around
closing stdin/stdout, and I still suspect so. But I can't discard it being a GDB bug.

I didn't use to have this issue maybe a year ago, then I stopped working on Windows for a
few months, and when I got back at it, I started seeing the issue. It's like some Cygwin
update, or Windows update caused the issue.

The hang is like other hangs I've observed before, it's around closing GDB to restart it
for more tests, and the patch at:

https://sourceware.org/pipermail/gdb-patches/2025-May/217949.html

still helps with it for me. With that one on top of yours, and with
gdb.base/branch-to-self.exp, I get:

WARNING: closing gdb failed with: child process exited abnormally

(the same as what I get without your patch) and the testcase moves on and
finishes properly (though a couple tests fail with timeout, as they do for you.)

If I look at the task manager while doing a full testsuite run, I see a bunch of leftover
gdb.exe processes and their children still running, because dejagnu fails to properly
close gdb.exe.

Pedro Alves