From: Don Breazeal <donb@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>, <gdb-patches@sourceware.org>
Subject: Re: RFH: failed assert debugging threaded+fork program over gdbserver
Date: Thu, 12 May 2016 17:42:00 -0000 [thread overview]
Message-ID: <5734C06C.8040008@codesourcery.com> (raw)
In-Reply-To: <20160512171650.GC26324@adacore.com>
On 5/12/2016 10:16 AM, Joel Brobecker wrote:
> Hello,
>
> I have noticed the following problem, when debugging a program which
> uses both threads and fork. The program is attached in copy, and
> it was compiled by simply doing:
>
> % gnatmake -g a_test
>
> The issue appears only randomly, but it seems to show up fairly
> reliably when using certain versions of GNU/Linux such as RHES7,
> or WRSLinux. I also see it on Ubuntu, but less reliably. Here is
> what I have found, debugging on WRSLinux (we set it up as a cross,
> but it should be the same with native GNU/Linux distros):
>
> % gdb a_test
> (gdb) break a_test.adb:30
> (gdb) break a_test.adb:39
> (gdb) target remote my_board:4444
> (gdb) continue
> Continuing.
> [...]
> [New Thread 866.868]
> [New Thread 866.869]
> [New Thread 870.870]
> /[...]/gdb/thread.c:89: internal-error: thread_info* inferior_thread(): Assertion `tp' failed.
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
> Quit this debugging session? (y or n)
>
> The error happens because GDBserver returns a list of threads
> to GDB where a new thread as a different PID (870 in the case
> above, instead of 866).
Hi Joel,
This is not supposed to happen. In remote.c:remote_update_thread_list
there is a call to remove_new_fork_children that is explicitly supposed
to prevent this scenario. The new fork child thread should be deleted
from the thread list ("context") before we call remote_notice_new_inferior.
We don't want the remote to report new threads related to the fork child
until after we have handled the fork using infrun.c:follow_fork. (Note:
it looks like the function comment for remove_new_fork_children is
stale, since there are scenarios other than being stopped at a fork
catchpoint where this can occur.)
> Any advice on how I should be fixing the issue?
It looks like there is a case that remove_new_fork_children isn't
handling correctly with your test+target(s). I'd start there to find out
how the new thread is getting through.
Thanks
--Don
next prev parent reply other threads:[~2016-05-12 17:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 17:16 Joel Brobecker
2016-05-12 17:42 ` Don Breazeal [this message]
2016-06-23 22:59 ` Joel Brobecker
2016-06-24 18:12 ` RFA/gdbserver: GDB internal-error debugging threaded program with breakpoint and forks (was: "Re: RFH: failed assert debugging threaded+fork program over gdbserver") Joel Brobecker
2016-06-24 21:57 ` RFA/gdbserver: GDB internal-error debugging threaded program with breakpoint and forks Pedro Alves
2016-06-24 22:36 ` Joel Brobecker
2016-06-24 22:37 ` Pedro Alves
2016-06-27 22:32 ` Joel Brobecker
2016-06-28 19:40 ` Pedro Alves
2016-07-05 16:49 ` Joel Brobecker
2016-06-24 21:52 ` RFH: failed assert debugging threaded+fork program over gdbserver Breazeal, Don
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5734C06C.8040008@codesourcery.com \
--to=donb@codesourcery.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox