This remove reliance on the procfs for figuring out what threads are
already active when we attach to a running process. The allm linked list
will be present to matter what OS we're on, whereas procfs will not be
present everywhere.
This is the first in a series of steps to support more platforms.
Remove any assumption that a wait syscall on a thread id after a
continue will return. Any time we continue a thread, wait for activity
from any thread, because the scheduler may well have switched contexts
on us due to syscall entrace, channel op, etc...
There are several more things to be done here including:
* Potential tracking of goroutine id as we jump around to thread
contexts.
* Potential of selectively choosing threads to operate on based on the
internal M data structures, ensuring that our M has an active G.
This commit partially fixes#23 and #24, however there are still some
random hangs that happen and need to be ironed out.
Wrap syscall.Wait4 and cleanup a few coordination issues.
There are still some issues here where background threads are left
sleeping. This could potentially cause weird issues. There are a few
more things I have planned to cleanup thread coordination issues.
Areas that need improving:
* Code cleanup
* Promote breakpoints back out of thread context
* Fix potential bug in "Next" implementation, when thread contexts
switch
Once the program detects that we have stepped into another function,
we simply calculate the return address and then set a breakpoint and
continue to that location, avoiding numerous syscalls.
Now that I'm using the step strategy, I put in an optimization where if
stepping into another function, simply find the return address, put a
breakpoint there, and then continue.