gdb: replace inferior::waiting_for_vfork_done with inferior::thread_waiting_for_vfork...
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 12 Jan 2022 02:40:34 +0000 (21:40 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 18 Jan 2022 18:14:21 +0000 (13:14 -0500)
commite6e25d5a7c1e572dc5875844c5340fcc65f42511
tree5d6c9c6f63d641417f407e126a38e43e15c700a3
parent83e7a0ecee4a9eb27ac75651b37870463c625733
gdb: replace inferior::waiting_for_vfork_done with inferior::thread_waiting_for_vfork_done

The inferior::waiting_for_vfork_done flag indicates that some thread in
that inferior is waiting for a vfork-done event.  Subsequent patches
will need to know which thread is waiting for that event.

I think there is a latent buglet in that waiting_for_vfork_done is
currently not reset on inferior exec or exit.  I could imagine that if a
thread in the parent process calls exec or exit while another thread of
the parent process is waiting for its vfork child to exec or exit, we
could end up with inferior::waiting_for_vfork_done without a thread
actually waiting for a vfork-done event anymore.  And since that flag is
checked in resume_1, things could misbehave there.

Since the new field points to a thread_info object, and those are
destroyed on exec or exit, it could be worse now since we could try to
access freed memory, if thread_waiting_for_vfork_done were to point to a
stale thread_info.  To avoid this, clear the field in
infrun_inferior_exit and infrun_inferior_execd.

Change-Id: I31b847278613a49ba03fc4915f74d9ceb228fdce
gdb/inferior.h
gdb/infrun.c
This page took 0.02491 seconds and 4 git commands to generate.