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
This commit is contained in:
parent
7555d1c063
commit
e07bfd3180
7
_fixtures/issue2162.go
Normal file
7
_fixtures/issue2162.go
Normal file
@ -0,0 +1,7 @@
|
||||
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()")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user