Re: [PATCH v7 5/5] gdb/infrun: handle already-exited threads when attempting to stop

Pedro Alves
2020-05-14T11:25:54Z

On 5/13/20 10:15 PM, Pedro Alves via Gdb-patches wrote:

> After giving it some thought and experimentation, I think we should
> go back to your idea of not deleting the last thread of the process.

There's one point that I forgot to mention about the benefit of this
approach, which I should mention for the archives.

The current use case we're handling deals with the update_thread_list
call from within stop_all_threads.

However, update_thread_list calls can happen at any point while the
inferior is running. Say, in non-stop mode or async background mode, and
the user types "info threads". At that point, an inferior may have exited,
and GDB finds no threads for the process, before the inferior exit event
is seen. If that happens, then the user is not able to switch to that
inferior any longer in order to collect the process exit. The solution in
v8 handles this scenario too, while the "don't delete if pending event"
solution only handled the stop_all_threads scenario.

Thanks,
Pedro Alves