diff --git a/_fixtures/testvariables3.go b/_fixtures/testvariables3.go index 1abba34ef013d5f62866c13b846f4c42989963b3..0d23b608b91589d4e2211d0b326e920ea1c24d65 100644 --- a/_fixtures/testvariables3.go +++ b/_fixtures/testvariables3.go @@ -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) } diff --git a/proc/proc_test.go b/proc/proc_test.go index 824eb4d44fd5bae4a55f58964d4aa4b18c29656a..986b32f5ac3f7b2a4a713b8cc5de0602fc1c3ac4 100644 --- a/proc/proc_test.go +++ b/proc/proc_test.go @@ -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) + }) +} diff --git a/proc/variables.go b/proc/variables.go index 26eb61904be935f425563c6a19928dda65f521df..c386f454418e6e62117cc38f48723970c86ac960 100644 --- a/proc/variables.go +++ b/proc/variables.go @@ -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 }