Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proc: fix stacktraces on freebsd/amd64/go1.20 #3458

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.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
11 changes: 10 additions & 1 deletion pkg/proc/arm64_arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,19 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *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.switchToGoroutineStack()
return true
}
it.atend = true
return true

case "crosscall2":
// The offsets get from runtime/cgo/asm_arm64.s:10
bpoff := uint64(14)
Expand Down
10 changes: 9 additions & 1 deletion pkg/proc/i386_arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,19 @@ func i386SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool {
switch it.frame.Current.Fn.Name {
case "runtime.asmcgocall", "runtime.cgocallback_gofunc": // TODO(chainhelen), need to support cgo stacktraces.
return false
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.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
9 changes: 8 additions & 1 deletion pkg/proc/ppc64le_arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,17 @@ func ppc64leSwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) boo
switch it.frame.Current.Fn.Name {
case "runtime.asmcgocall", "runtime.cgocallback_gofunc", "runtime.sigpanic", "runtime.cgocallback":
//do nothing
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.switchToGoroutineStack()
return true
}
it.atend = true
return true
case "crosscall2":
//The offsets get from runtime/cgo/asm_ppc64x.s:10
newsp, _ := readUintRaw(it.mem, it.regs.SP()+8*24, int64(it.bi.Arch.PtrSize()))
Expand Down