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: stack trace on linux/windows does not print correct value #46740

Closed
tobiaskohlbau opened this issue Jun 14, 2021 · 2 comments
Closed

Comments

@tobiaskohlbau
Copy link

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

$ go version
go version devel go1.17-326ea438bb Mon Jun 14 07:12:37 2021 +0000 darwin/arm6

Does this issue reproduce with the latest release?

No

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

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/tobias/Library/Caches/go-build"
GOENV="/Users/tobias/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/tobias/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/tobias/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/tobias/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/tobias/gotip/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="devel go1.17-326ea438bb Mon Jun 14 07:12:37 2021 +0000"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/tobias/src/github.com/tobiaskohlbau/gotest/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/d2/cvcwxhxn7sg0qz9r12cnljtr0000gn/T/go-build173569476=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

package main

//go:noinline
func crash(x int) {
	panic(x)
}

func main() {
	crash(5)
}

Based on the release notes for the 1.17 beta 1 I've tried to check the new stack trace format. I've put together a simple program, which crashes und purpose. If run on darwin/arm64 the output is as expected:

darwin/arm64

panic: 5

goroutine 1 [running]:
main.crash(0x5)
	/Users/tobias/src/github.com/tobiaskohlbau/gotest/main.go:5 +0x38
main.main()
	/Users/tobias/src/github.com/tobiaskohlbau/gotest/main.go:9 +0x28
exit status 2

The same program cross compiled to linux/amd64 does not contain the value 0x5 but instead shows 0xc0000001a0. The output of 0xc0000001a0 is consistent for multiple machines and builds. I've tried to repeat this test with a windows machine and the output is also _0xc0000001a0. I'm not sure if this is related to linux<>darwin or to arm64<>amd64.

What did you expect to see?

I would expect to see 0x5 under linux/amd64 as well.

What did you see instead?

linux/amd64

panic: 5

goroutine 1 [running]:
main.crash(0xc0000001a0)
	/Users/tobias/src/github.com/tobiaskohlbau/gotest/main.go:5 +0x28
main.main()
	/Users/tobias/src/github.com/tobiaskohlbau/gotest/main.go:9 +0x1e
@seankhliao
Copy link
Member

Duplicate of #45728

@seankhliao seankhliao marked this as a duplicate of #45728 Jun 14, 2021
@tobiaskohlbau
Copy link
Author

Damn, I searched for stack trace and stacktrace but did not find anything related.

Many thanks!

@golang golang locked and limited conversation to collaborators Jun 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants