Skip to content

Commit

Permalink
proc: fix stacktraces on freebsd/amd64/go1.20
Browse files Browse the repository at this point in the history
TestStacktraceGoroutine failed intermittently on freebsd/amd64/go1.20
due to stacktraces being broken when doing a runtime.nanotime system
call.
  • Loading branch information
aarzilli committed Aug 8, 2023
1 parent 2b785f2 commit fd198fc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/proc/amd64_arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,19 @@ func amd64SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool {

return true

case "runtime.goexit", "runtime.rt0_go", "runtime.mcall":
case "runtime.goexit", "runtime.rt0_go":
// Look for "top of stack" functions.
it.atend = true
return true

case "runtime.mcall":
if it.systemstack && it.g != nil && it.bi.GOOS == "freebsd" {
it.switchToGoroutineStack()
return true
}
it.atend = true
return true

case "runtime.mstart":
// Calls to runtime.systemstack will switch to the systemstack then:
// 1. alter the goroutine stack so that it looks like systemstack_switch
Expand Down

0 comments on commit fd198fc

Please sign in to comment.