This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 7/8] Avoid crashes when stepping through ravenscar context-switching
- From: Tom Tromey <tromey at adacore dot com>
- To: Tom Tromey <tromey at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 27 Sep 2019 13:17:25 -0600
- Subject: Re: [RFA 7/8] Avoid crashes when stepping through ravenscar context-switching
- References: <20190326144404.6670-1-tromey@adacore.com> <20190326144404.6670-8-tromey@adacore.com>
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:
Tom> When stepping through the ravenscar context-switching code, gdb will
Tom> try to single-step the current thread, while leaving the other threads
Tom> stopped. This results in an assertion failure in finish_step_over,
Tom> because the event thread is not the request thread.
Tom> This patch introduces a new target method so that infrun can ask the
Tom> target whether this can happen; and then changes infrun to handle this
Tom> case. When the target can have an unexpected thread switch,
Tom> single-stepping may also switch threads.
It's been a while since I wrote this. I still haven't put it in,
because it touches a tricky area.
I found out today that it can help with a different bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=22992
That bug has a test case that causes a native Windows gdb to crash.
Debugging it, I found that (I think) there's an oversight in
windows-nat.c -- namely, stepping doesn't suspend other threads.
However, this oversight doesn't exist in gdbserver, and the bug still
exists when using that.
I am not 100% sure, but I think this bug shows a Windows kernel problem
or the like, as even with thread suspension hacked in, gdb can get a
debug event on an ostensibly suspended thread.
Changing windows-nat.c to report that it is a "random thread switch"
target (which is introduced by the patch I'm replying to) at least
causes the crash to go away... so I think that's an improvement, even
though it isn't fantastic.
So, if you have some time and understand infrun, I'd appreciate it if
you could take a look at this patch; or if you understand Windows
debugging, if you could take a look at 22992 and see if I've missed
something.
thanks,
Tom