提交 6d50aba7 编写于 作者: A aarzilli

proc/variables: bugfix: infinite loading loop through maps

Fixes #341
上级 26c0307a
......@@ -46,6 +46,8 @@ type dstruct struct {
x interface{}
}
type maptype map[string]interface{}
func main() {
i1 := 1
i2 := 2
......@@ -134,6 +136,8 @@ func main() {
var iface5 interface{} = &recursive1
var iface2fn1 interface{} = afunc1
var iface2fn2 interface{} = afunc2
var mapinf maptype = map[string]interface{}{}
mapinf["inf"] = mapinf
var amb1 = 1
runtime.Breakpoint()
......@@ -141,5 +145,5 @@ func main() {
fmt.Println(amb1)
}
runtime.Breakpoint()
fmt.Println(i1, i2, i3, p1, amb1, s1, s3, a1, p2, p3, s2, as1, str1, f1, fn1, fn2, nilslice, nilptr, ch1, chnil, m1, mnil, m2, m3, up1, i4, i5, i6, err1, err2, errnil, iface1, iface2, ifacenil, arr1, parr, cpx1, const1, iface3, iface4, recursive1, recursive1.x, iface5, iface2fn1, iface2fn2)
fmt.Println(i1, i2, i3, p1, amb1, s1, s3, a1, p2, p3, s2, as1, str1, f1, fn1, fn2, nilslice, nilptr, ch1, chnil, m1, mnil, m2, m3, up1, i4, i5, i6, err1, err2, errnil, iface1, iface2, ifacenil, arr1, parr, cpx1, const1, iface3, iface4, recursive1, recursive1.x, iface5, iface2fn1, iface2fn2, mapinf)
}
......@@ -1264,3 +1264,14 @@ func TestIssue262(t *testing.T) {
}
})
}
func TestIssue341(t *testing.T) {
// pointer loop through map entries
withTestProcess("testvariables3", t, func(p *Process, fixture protest.Fixture) {
assertNoError(p.Continue(), t, "Continue()")
t.Logf("requesting mapinf")
mapinf, err := evalVariable(p, "mapinf")
assertNoError(err, t, "EvalVariable()")
t.Logf("mapinf: %v\n", mapinf)
})
}
......@@ -1160,8 +1160,10 @@ func (v *Variable) loadMap(recurseLevel int) {
}
key := it.key()
val := it.value()
key.loadValue()
val.loadValue()
if recurseLevel <= maxVariableRecurse {
key.loadValueInternal(recurseLevel + 1)
val.loadValueInternal(recurseLevel + 1)
}
if key.Unreadable != nil || val.Unreadable != nil {
errcount++
}
......@@ -1428,7 +1430,7 @@ func (v *Variable) loadInterface(recurseLevel int, loadData bool) {
// interface to nil
data = data.maybeDereference()
v.Children = []Variable{*data}
v.Children[0].loadValue()
v.Children[0].loadValueInternal(recurseLevel)
return
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册