This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFA/gdbserver: GDB internal-error debugging threaded program with breakpoint and forks
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 27 Jun 2016 15:32:00 -0700
- Subject: Re: RFA/gdbserver: GDB internal-error debugging threaded program with breakpoint and forks
- Authentication-results: sourceware.org; auth=none
- References: <20160512171650 dot GC26324 at adacore dot com> <5734C06C dot 8040008 at codesourcery dot com> <20160623225935 dot GC3295 at adacore dot com> <20160624181152 dot GD3295 at adacore dot com> <31daa4d2-359d-db9a-e9c8-d7bfbb327570 at redhat dot com> <20160624223616 dot GE3295 at adacore dot com> <9170a848-2c63-0e42-a478-23753c1f495b at redhat dot com>
> >> I haven't gone through this with fine-tooth comb yet, but,
> >> will we still have the same problem if _two_ threads (or inferiors...)
> >> fork at the "same" time, and we end up reporting one fork, while
> >> leaving the another one pending?
> >
> > At the moment, I do not think so, because we seem to just process
> > the fork even without requesting an update of the thread list.
>
> "catch fork" would make us stop though.
:-(. Most likely. I had the weekend to mull this over. The only
possible solutions I can see are:
a. Make gdbserver "hide" the threads that are children of forks
until we've reported the corresponding fork event to GDB.
But then, I think it's unclear what to do if the user does
a "step" or "continue" while you have multiple pending
fork events. That's probably a question that's likely not
specific to forks, as you might have the same issue when
requesting an action after seeing the first of multiple
events received at the same time. Perhaps simply just return
the next event without resuming anything? Is that what we do?
b. Somehow enhance GDB to handle the extra unknown threads
more gracefully.
I don't really see how (b) could work. It seems that (a) would
be more promising. That said, I would still consider my current
patch, as reporting the forks early allow us to either detach
from them earlier.
--
Joel