Stack trace 中行尾的 +0xXX 是什么意思?

xuchunyang · · 845 次点击
非常感谢。我也试过源代码但没找到。虽然还是不懂什么用处、怎么个用法,但可以放着以后再研究。
#2
更多评论
特地去扒了下源码。。 https://golang.org/src/runtime/traceback.go#L661 ```golang print("\t", file, ":", line) if pc > f.entry { print(" +", hex(pc-f.entry)) } ``` `hex(pc-f.entry)` 向上追踪这两个变量 https://golang.org/src/runtime/traceback.go#L654 ```golang pc := gp.gopc f := findfunc(pc) ``` 字段注释如下 `gp.gopc // pc of go statement that created this goroutine` `f.entry // start pc`
#1
这里pc是program counter的意思。 应该也是用来定位引起panic代码的位置。 类似行号精确到行,这个是在二进制指令底层这个精确度做定位。
#3