英文:
go stack trace: what is the meaning of a question(?) mark after certain function call arguments or return values?
问题
我正在尝试调试泄漏的 goroutine(使用 Gomega 的 gleak)。当在单元测试结束时,一些 goroutine 仍然不终止,gleak 会输出它们的堆栈跟踪。这些堆栈跟踪中的某些调用的参数或返回值中包含多个问号,例如:
foo.(*Fooler).Foo(0x40003efa40, {0xeeb638?, 0x40005bc580}, {0x400013a000?, 0x6, 0xd9c3a4?}) at foo.go
对应的接收者函数签名如下:
func (f *Fooler) Foo(context.Context, []string)
我查阅了一些关于“解读 Golang 堆栈跟踪”的帖子、文章和问题,包括 https://stackoverflow.com/questions/36459827/how-to-interpret-go-stacktrace,但没有找到关于 Go 堆栈跟踪中问号的任何提及。我找到的解释示例中从未提到过任何可疑的调用参数或返回值。
那么堆栈跟踪中的问号是什么原因造成的?这可能与在寄存器中传递的参数有关,而无法正确地恢复堆栈跟踪吗?
英文:
I'm trying to debug leaking goroutines (using Gomega's gleak). When at the end of a unit test some goroutines "stubbornly" persist to not terminate, gleak
dumps the culprits with their stack traces. Some calls in these stack traces contain even several question marks in their arguments or return values, such as:
foo.(*Fooler).Foo(0x40003efa40, {0xeeb638?, 0x40005bc580}, {0x400013a000?, 0x6, 0xd9c3a4?}) at foo.go
the corresponding receiver function signature is as follows:
func (f *Fooler) Foo(context.Context, []string)
I've checked several posts/articles/questions on "interpreting golang stack traces", not least https://stackoverflow.com/questions/36459827/how-to-interpret-go-stacktrace, but didn't find any mentioning of question marks in Go stack traces. The examples I find explained never mention any questionable(?) call arguments or return values.
So what is the reason for question marks in stack traces? Could this be related to args passed in registers and not properly recoverable for the stack trace?
答案1
得分: 3
从 https://go.dev/doc/go1.18#runtime :
> Go 1.17通常改进了堆栈跟踪中参数的格式,但可能会打印寄存器中传递的参数的不准确值。在Go 1.18中通过在每个可能不准确的值后打印一个问号(?)来改进这一点。
英文:
From https://go.dev/doc/go1.18#runtime :
> Go 1.17 generally improved the formatting of arguments in stack traces, but could print inaccurate values for arguments passed in registers. This is improved in Go 1.18 by printing a question mark (?) after each value that may be inaccurate.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论