未验证 提交 e07bfd31 编写于 作者: C chainhelen 提交者: GitHub

pkg/proc: fix dlv panic when sameGCond is nil. (#2164)

`sameFrameCond` should not be constructed as one `And Express` when
`sameGCond` which is the first child of `BinaryExpr` is nil.

Fixes: #2162
上级 7555d1c0
package main
import "fmt"
func main() {
fmt.Println("test dlv")
}
......@@ -529,7 +529,10 @@ func next(dbp *Target, stepInto, inlinedStepOut bool) error {
return err
}
sameFrameCond := astutil.And(sameGCond, frameoffCondition(&topframe))
var sameFrameCond ast.Expr
if sameGCond != nil {
sameFrameCond = astutil.And(sameGCond, frameoffCondition(&topframe))
}
if stepInto && !backward {
err := setStepIntoBreakpoints(dbp, topframe.Current.Fn, text, topframe, sameGCond)
......
......@@ -2098,3 +2098,20 @@ func TestRedirects(t *testing.T) {
}
})
}
func TestIssue2162(t *testing.T) {
if buildMode == "pie" || runtime.GOOS == "windows" {
t.Skip("skip it for stepping into one place where no source for pc when on pie mode or windows")
}
withTestClient2("issue2162", t, func(c service.Client) {
_, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main"})
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
_, err = c.Step()
if err != nil {
assertNoError(err, t, "Step()")
}
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册