Windows native GDB event handling enhancement

Joel Brobecker
2019-04-16T22:33:06Z

Hello,

This patch series introduces two patches:

* [RFA 1/2][master+8.3] (Windows) fix thr != nullptr assert failure in delete_thread_1
* [RFA 2/2][master only] gdb/windows-nat.c: Get rid of main_thread_id global

I started working on those when I realized that GDB 8.3 showed
some crashes which seemed more frequent than the typical instability
we might have seen from time to time. And sure enough, I found
something.

It's split into two patches, although conceptually, they should be
one patch. The reason for that is that the change in its globality
is, in my opinion, potentially risky, because it is a bit of a jump
in the unknown, because I don't really know the reasons behind doing
the things the way we used to do them. What I know is that what
I propose seems to make better sense to me, and seems cleaner too;
but there might be something behind them I didn't know.

So I've extracted the part that avoids the crash into a first patch,
knowing that this part seems clear enough to me that the risk, if
any, should be at worst that we crash later on. In a couple of weeks
of nightly testing on various Windows versions, though, I haven't
seen it happen, so I think we're good. That way, this patch could
be reviewed on its own, and eventually find its way to the gdb-8.3-branch
as well.

Then the second patch, which complete the first one, could be poushed
to master. It's potentially more disruptive, which is why we give it
more time in master, and don't consider it for gdb-8.3-branch.

--
Joel