Closed
Description
A recent discussion on the go-nuts mailing list had myself, and Robert Engels, confused why we didn't get core dumps when a process written in Go died from a signal such as SIGSEGV on our macOS platforms. The reason core dumps don't happen on macOS (at least on amd64) can be found in src/runtime/signal_unix.go:
//go:nosplit
func crash() {
// OS X core dumps are linear dumps of the mapped memory,
// from the first virtual byte to the last, with zeros in the gaps.
// Because of the way we arrange the address space on 64-bit systems,
// this means the OS X core file will be >128 GB and even on a zippy
// workstation can take OS X well over an hour to write (uninterruptible).
// Save users from making that mistake.
if GOOS == "darwin" && GOARCH == "amd64" {
return
}
dieFromSignal(_SIGABRT)
}
This should be documented. It is also unclear why the GOARCH restriction exists. Presumably the same issue affects macOS on arm64 (aka, Apple Silicon). However, I have not verified that since it requires creating a code-signed Go binary and I didn't have the necessary desire to jump through those hoops.