This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Workaround for glibc/BZ5983: following a child fork shows stale parent threads in the child.


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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]