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

runtime: panic does not print function parameters trace #27678

Open
rockmenjack opened this Issue Sep 14, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@rockmenjack

rockmenjack commented Sep 14, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.11 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/rockmen1/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/rockmen1/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build729838165=/tmp/go-build -gno-record-gcc-switches"

What did you expect to see?

run this in go playground, which runs version 1.10.3

panic: oops

goroutine 1 [running]:
main.test(0xc420045f68, 0x1, 0x1, 0x469f51, 0x7, 0x2710, 0xc420078000)  <- parameters trace
        /tmp/test.go:4 +0x39
main.main()
        /tmp/test.go:8 +0x73

What did you see instead?

panic: oops

goroutine 1 [running]:
main.test(...)                                           <- gone 
        /tmp/test.go:4
main.main()
        /tmp/test.go:8 +0x39

@agnivade agnivade changed the title from panic does not print function parameters trace in go1.11 to runtime: panic does not print function parameters trace Sep 14, 2018

@agnivade agnivade added this to the Go1.12 milestone Sep 14, 2018

@agnivade

This comment has been minimized.

Member

agnivade commented Sep 14, 2018

@thanm

This comment has been minimized.

Member

thanm commented Sep 14, 2018

This is presumably because main.test is now being inlined. If you add something that prevents the inline, you'll see the params in the panic trace. E.g.

func test(a []string, b string, c int) int {
	defer func() { fmt.Printf("whee!\n") }()
	panic("oops")
}
@rockmenjack

This comment has been minimized.

rockmenjack commented Sep 17, 2018

Any rules for function inlining? Assuming complex function won't be inlined?

@cznic

This comment has been minimized.

Contributor

cznic commented Sep 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment