Skip to content

Commit

Permalink
interp/FilterStack: filter out non-callExpr
Browse files Browse the repository at this point in the history
this makes the filtered stack look identical to the regular go stacktrace
  • Loading branch information
bailsman committed Dec 31, 2021
1 parent 0ff627e commit 7acf89f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions interp/interp.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,10 +717,14 @@ func (interp *Interpreter) FilterStackAndCallers(stack []byte, callers []uintptr
if callersIndex >= 0 {
newCallers = append(newCallers, handle)
}
f := interp.FuncForCall(handle)
n, ok := interp.calls[handle]
if !ok || n.kind != callExpr {
continue
}
pos := n.interp.fset.Position(n.pos)
newFrames = append(newFrames, []string{
f.Name + "()",
fmt.Sprintf("\t%s", f.Pos),
funcName(n) + "()",
fmt.Sprintf("\t%s", pos),
})
}
}
Expand Down

0 comments on commit 7acf89f

Please sign in to comment.