This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Workaround for glibc/BZ5983: following a child fork shows stale parent threads in the child.
- From: Doug Evans <dje at google dot com>
- To: Pedro Alves <pedro at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 18 May 2009 23:26:07 -0700
- Subject: Re: Workaround for glibc/BZ5983: following a child fork shows stale parent threads in the child.
- References: <200905181813.48596.pedro@codesourcery.com>
On Mon, May 18, 2009 at 10:13 AM, Pedro Alves <pedro@codesourcery.com> wrote:
> [...]
> + ? ? ?while (fgets (buf, sizeof (buf), status_file))
> + ? ? ? {
> + ? ? ? ? if (strncmp (buf, "Tgid:", 5) == 0)
> + ? ? ? ? ? {
> + ? ? ? ? ? ? tgid = strtoul (buf + strlen ("Tgid:"), NULL, 10);
> + ? ? ? ? ? ? break;
> + ? ? ? ? ? }
> + ? ? ? }
This works, but only because of an assumption of the strlen including
the trailing NUL in "Tgid:" consuming the TAB between "Tgid:" and the
number.
We should probably document that (or make the parsing more robust).