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.
6 files changed