提交 49d1206b 编写于 作者: A aarzilli 提交者: Derek Parker

proc: do not assume g.gopc is valid

Fixes #1203
上级 8efff6e5
......@@ -535,11 +535,12 @@ func (g *G) UserCurrent() Location {
// that spawned this goroutine.
func (g *G) Go() Location {
pc := g.GoPC
fn := g.variable.bi.PCToFunc(pc)
// Backup to CALL instruction.
// Mimics runtime/traceback.go:677.
if g.GoPC > fn.Entry {
pc -= 1
if fn := g.variable.bi.PCToFunc(pc); fn != nil {
// Backup to CALL instruction.
// Mimics runtime/traceback.go:677.
if g.GoPC > fn.Entry {
pc -= 1
}
}
f, l, fn := g.variable.bi.PCToLine(pc)
return Location{PC: g.GoPC, File: f, Line: l, Fn: fn}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册