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);
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index c934d49..dbe4eec 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -148,7 +148,6 @@
continue_process(pid_t pid)
{
debug(DEBUG_PROCESS, "continue_process: pid=%d", pid);
- //printf("continue_process %d\n", pid);
/* Only really continue the process if there are no events in
the queue for this process. Otherwise just for the other