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

runtime: tracebacks don't print function arguments for inlined functions #27678

Open
rockmenjack opened this issue Sep 14, 2018 · 5 comments
Open
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@rockmenjack
Copy link

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 panic does not print function parameters trace in go1.11 runtime: panic does not print function parameters trace Sep 14, 2018
@agnivade agnivade added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 14, 2018
@agnivade agnivade added this to the Go1.12 milestone Sep 14, 2018
@agnivade
Copy link
Contributor

/cc @ianlancetaylor @aclements

@thanm
Copy link
Contributor

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
Copy link
Author

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

@cznic
Copy link
Contributor

cznic commented Sep 17, 2018 via email

@randall77
Copy link
Contributor

I'm going to punt this to unplanned. It would be nice to fill in the ... for inlined functions, but I don't think anyone has a good idea of how to do that.
(It would require DWARF-like annotations in the runtime data structures to reconstruct the args from registers or locals and/or report them as unavailable.)

@randall77 randall77 modified the milestones: Go1.12, Unplanned Dec 28, 2018
@randall77 randall77 changed the title runtime: panic does not print function parameters trace runtime: tracebacks don't print function arguments for inlined functions Dec 28, 2018
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants