From 49d1206b9406240fb506b3c5eee4effd70f513a1 Mon Sep 17 00:00:00 2001 From: aarzilli Date: Wed, 9 May 2018 10:08:49 +0200 Subject: [PATCH] proc: do not assume g.gopc is valid Fixes #1203 --- pkg/proc/variables.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/proc/variables.go b/pkg/proc/variables.go index 3261a2ea..4d826c5f 100644 --- a/pkg/proc/variables.go +++ b/pkg/proc/variables.go @@ -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} -- GitLab