Skip to content

GoTip: New Stack Trace Output Wrong #46708

Closed
@ardan-bkennedy

Description

@ardan-bkennedy

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

$ gotip version
go version devel go1.17-770f1de8c5 Thu Jun 10 20:20:58 2021 +0000 darwin/amd64

Does this issue reproduce with the latest release?

NO, this is fine in 1.16

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/bill/Library/Caches/go-build"
GOENV="/Users/bill/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/bill/code/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/bill/code/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/bill/code/go/src/github.com/ardanlabs/gotraining/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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/6l/gplcbsd16y14gzx7wzyv_dtc0000gn/T/go-build4139548450=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Given this program
https://github.com/ardanlabs/gotraining/blob/master/topics/go/profiling/stack_trace/example1/example1.go

package main

func main() {
    example(make([]string, 2, 4), "hello", 10)
}

//go:noinline
func example(slice []string, str string, i int) error {
    panic("Want stack trace")
}

Running this program with 1.16, I get the following output.

$ go run example1.go
panic: Want stack trace

goroutine 1 [running]:
main.example(0xc000054738, 0x2, 0x4, 0x1073c53, 0x5, 0xa, 0x0, 0xc000054778)
	/Users/bill/code/go/src/github.com/ardanlabs/gotraining/topics/go/profiling/stack_trace/example1/example1.go:13 +0x39
main.main()
	/Users/bill/code/go/src/github.com/ardanlabs/gotraining/topics/go/profiling/stack_trace/example1/example1.go:8 +0x85
exit status 2

This is great, I can see the slice, string and integer that are passed in as parameters.

Slice:  0xc000054738, 0x2, 0x4
String: 0x1073c53, 0x5
Int:    0xa

Now I run this program with tip.

$ gotip run example1.go
panic: Want stack trace

goroutine 1 [running]:
main.example({0x60, 0x10bb6c0, 0xc0000002e8}, {0xc000024060, 0x0}, 0xc0000001a0)
	/Users/bill/code/go/src/github.com/ardanlabs/gotraining/topics/go/profiling/stack_trace/example1/example1.go:13 +0x27
main.main()
	/Users/bill/code/go/src/github.com/ardanlabs/gotraining/topics/go/profiling/stack_trace/example1/example1.go:8 +0x59
exit status 2

It seems I have different values than expected.

Slice:  0x60, 0x10bb6c0, 0xc0000002e8
String: 0xc000024060, 0x0
Int:    0xc0000001a0

I expected to see the same values from 1.16 but in the new format.

main.example({0xc000054738, 0x2, 0x4}, {0x1073c53, 0x5}, 0xa)

Is my assumption correct or am I not reading the stack trace properly?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions