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.
On Mon, May 18, 2009 at 11:26 PM, Doug Evans <dje@google.com> wrote:
> 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).
>
Well, that's messed up (in at least two ways!).
[he says after jumping to the terminal after waking up with a sick
feeling in his stomach ...]