From fecf14bd195878767757a963e5a9a7724aa629e1 Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Wed, 3 Jun 2020 19:54:07 +0200 Subject: [PATCH] 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). --- pkg/terminal/command.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/terminal/command.go b/pkg/terminal/command.go index 419ebbbb..5c780aa1 100644 --- a/pkg/terminal/command.go +++ b/pkg/terminal/command.go @@ -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) } -- GitLab