To look up the file and line number of the call itself, use pc[i]-1. As an exception to this rule, if pc[i-1] corresponds to the function runtime.sigpanic, then pc[i] is the program counter of a faulting instruction and should be used without any subtraction.
It doesn't look like this library implements the second part, since it only converts a frame one at a time.
If I get some time, I can do a pull request. I'd like to add an argument to NewStackFrame(), like bool triggeredPanic or something, but I don't know how much code actually calls that directly.
The docs for
runtime.Callers()
( https://golang.org/pkg/runtime/#Callers ) says:It doesn't look like this library implements the second part, since it only converts a frame one at a time.
If I get some time, I can do a pull request. I'd like to add an argument to
NewStackFrame()
, likebool triggeredPanic
or something, but I don't know how much code actually calls that directly.