Open
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
This problem was introduced by b1d1ec9 (CL 110065) and is still present at tip.
Does this issue reproduce with the latest release?
No.
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/a/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/a/n/go/"
GORACE=""
GOROOT="/usr/local/go-tip"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go-tip/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build495464568=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Given:
package main
import "runtime/debug"
func main() {
debug.SetTraceback("crash")
crash()
}
func crash() {
panic("panic!")
}
Running it under gdb will produce this stacktrace:
(gdb) bt
#0 0x000000000044fff4 in runtime.raise () at <autogenerated>:1
#1 0x0000000000438c2b in runtime.dieFromSignal (sig=6) at /usr/local/go-tip/src/runtime/signal_unix.go:424
#2 0x0000000000438dea in runtime.crash () at /usr/local/go-tip/src/runtime/signal_unix.go:526
#3 0x0000000000426487 in runtime.fatalpanic (msgs=<optimized out>) at /usr/local/go-tip/src/runtime/panic.go:696
#4 0x0000000000425e6b in runtime.gopanic (e=...) at /usr/local/go-tip/src/runtime/panic.go:502
#5 0x0000000000470ac9 in main.crash () at /home/a/temp/simple.go:11
#6 0x0000000000470a7b in main.main () at /home/a/temp/simple.go:7
however letting it produce a core file then reading the core file with gdb produces this:
$ gdb ./simple simple-core
...
(gdb) bt
#0 0x000000000044fff4 in runtime.raise () at <autogenerated>:1
#1 0x0000000000438c2b in runtime.dieFromSignal (sig=6) at /usr/local/go-tip/src/runtime/signal_unix.go:424
#2 0x00000000004390a8 in runtime.sigfwdgo (ctx=0xc000009ac0, info=0xc000009bf0, sig=6, ~r3=<optimized out>) at /usr/local/go-tip/src/runtime/signal_unix.go:637
#3 0x0000000000438488 in runtime.sigtrampgo (ctx=0xc000009ac0, info=0xc000009bf0, sig=<optimized out>) at /usr/local/go-tip/src/runtime/signal_unix.go:289
#4 0x00000000004502e3 in runtime.sigtramp () at <autogenerated>:1
#5 0x00000000004503d0 in ?? () at <autogenerated>:1
#6 0x0000000000000001 in ?? ()
#7 0x0000000000000000 in ?? ()
I'm not sure what's happening here. Is the signal handler running and overwriting part of the stack?