On 20/10/2021 10:35, Alex Bennée wrote:
Maybe this is related to the weird output I was seeing above?
Yes, that's definitely related. What's happening is that the qemu does
not stop other thread when one of them hits a breakpoint (or stops for
any other reason) -- as far as I can tell it does not have any code
which would even attempt to do that. This is why you're seeing the
output even after the process is purportedly stopped.
Things get even more interesting when you have two threads hitting a
breakpoint simultaneously. At that point both of them will enter their
gdb stubs and attempt to talk to gdb at the same time. As you can
imagine, this cannot end well, and eventually the connection will
become so messed up that one side just gives up and terminates the
link.
I am aware of this issue, and I (well, Stan (cc'ed) is, for the most
part) looking for a way to fix it. If you have any ideas, we'd very
much like to hear them. The way I see it, we need to implement some
kind of a "stop the world" mechanism, to stop/interrupt all threads
whenever the gdb stub becomes active (and make sure it can handle
simultaneous debug events).