Fix serious race in attach to many-threaded process
- the gist is that tasks continue running while we attach, so more tasks
come into existence, or the ones that we didn't attach to yet disappear,
etc.
- besides, we really can't enable breakpoints before we are done attaching,
otherwise the still-running tasks risk running into them and dying of
SIGTRAP.
diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c
index a3fb3af..e3b71e5 100644
--- a/sysdeps/linux-gnu/proc.c
+++ b/sysdeps/linux-gnu/proc.c
@@ -102,7 +102,7 @@
pid_t
process_leader(pid_t pid)
{
- pid_t tgid = pid;
+ pid_t tgid = 0;
FILE * file = open_status_file(pid);
if (file != NULL) {
each_line_starting(file, "Tgid:\t", &process_leader_cb, &tgid);