Community
Participate
Working Groups
Build Identifier: Apply the attached patch. It makes RxThread to sleep for a second when it processes *stopped,reason="exited-normally" to simulate a realistic situation where GDB takes a split second to thing between =thread-group-exited and *stopped,reason="exited-normally". Run a hello-world program under DSF with this patch. When it stops in main, resume. Excepted result: program exits, launch is fully terminated. Observed result: launch is almost terminated, gdb is left running. The reason it happens is that termination of GDB is handled inside GDBControl_7_0.eventDispatched(ContainerExitedDMEevent), which calls isConnected which calls MIInferiorProcess.getState and checks if it's "terminated". However, the state is set to terminated when processing "*stopped" response. Normally, it works because dispatching of ContainerExitedDMEevent involves more DsfRunnable instances. However, if *stopped is a little bit late, the state of MIInferior is not yet TERMINATED, and therefore GDB is not terminated as well. At present, I don't have a viable approach to fixing this, and would appreciate some guidance. Reproducible: Always
Created attachment 180420 [details] The patch to make the bug more reproducable
I think the problem is that the concept of inferior was not properly updated (by me) to deal with Multi-process. If you run the same test with gdb 6.8, you will not see the problem. The reason is that GDBControl.eventDispatched(ContainerExitedDMEvent) blindly terminates GDB since it only deals with a single process. If I remember correctly, it is because GDBControl_7_0.eventDispatched(ContainerExitedDMEvent) deals with multi-process, that we have to call isConnected() to make sure that the ContainerExitedDMEvent is for the last process. Thing is, right now, multi-process only works for remote-attach sessions, so I think the call to isConnect() is unnecessary. Once we properly handle multi-process on Linux, we will have to deal with this better. Until then, this may be a good workaround for you.
Fixed by Bug 338319. Volodya, with HEAD of March 2nd I expect this problem to be gone. I've tried with your attach patch which allows to reproduce and I can't see it anymore. If I'm wrong, feel free to re-open.
Comment on attachment 180420 [details] The patch to make the bug more reproducable This patch was just a test patch and was never committed.