未验证 提交 fecf14bd 编写于 作者: A Alessandro Arzilli 提交者: GitHub

terminal: fix nil pointer dereference when printing tracepoints (#2071)

This issue causes a failure of TestTracePid that was observed in CI:

https://travis-ci.com/github/go-delve/delve/jobs/343053383

I'm not sure what causes it in this particular instance but there are
several ways in which a thread stopped at a breakpoint might have a
BreakpointInfo == nil field (see variable withBreakpointInfo in
debugger.Debugger.Command).
上级 04a08919
......@@ -2269,7 +2269,7 @@ func printTracepoint(th *api.Thread, bpname string, fn *api.Function, args strin
fmt.Fprintf(os.Stderr, " => (%s)\n", strings.Join(retVals, ","))
}
if th.Breakpoint.TraceReturn || !hasReturnValue {
if th.BreakpointInfo.Stacktrace != nil {
if th.BreakpointInfo != nil && th.BreakpointInfo.Stacktrace != nil {
fmt.Fprintf(os.Stderr, "\tStack:\n")
printStack(os.Stderr, th.BreakpointInfo.Stacktrace, "\t\t", false)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册