proc/native: fix FreeBSD backend (#3224)

- use PT_SUSPEND/PT_RESUME to control running threads in
  resume/stop/singleStep
- change manual stop signal from SIGTRAP to SIGSTOP to make manual stop
  handling simpler
- change (*nativeProcess).trapWaitInternal to suspend newly created
  threads when we are stepping a thread
- change (*nativeProcess).trapWaitInternal to handle some unhandled
  stop events
- remove misleading (*nativeProcess).waitFast which does not do
  anything different from the normal wait variant
- rewrite (*nativeProcess).stop to only set breakpoints for threads of
  which we have received SIGTRAP
- rewrite (*nativeThread).singleStep to actually execute a single
  instruction and to properly route signals
This commit is contained in:
Alessandro Arzilli
2022-12-20 18:54:16 +01:00
committed by GitHub
parent 32df4071d2
commit 00df758d57
15 changed files with 269 additions and 168 deletions

View File

@ -456,9 +456,6 @@ func TestScopePrefix(t *testing.T) {
}
func TestOnPrefix(t *testing.T) {
if runtime.GOOS == "freebsd" {
t.Skip("test is not valid on FreeBSD")
}
const prefix = "\ti: "
test.AllowRecording(t)
lenient := false
@ -520,9 +517,6 @@ func TestNoVars(t *testing.T) {
}
func TestOnPrefixLocals(t *testing.T) {
if runtime.GOOS == "freebsd" {
t.Skip("test is not valid on FreeBSD")
}
const prefix = "\ti: "
test.AllowRecording(t)
withTestTerminal("goroutinestackprog", t, func(term *FakeTerminal) {