proc: Bug loading maps

Past the maximum recursion depth maps shouldn't be loaded at all,
adding map children and not loading them breaks assumptions in
the prettyprinter.

Fixes #406
This commit is contained in:
aarzilli
2016-02-07 08:56:11 +01:00
committed by Derek Parker
parent 270ebbbb8c
commit 51e87386da
3 changed files with 287 additions and 6 deletions

View File

@ -734,7 +734,9 @@ func (v *Variable) loadValueInternal(recurseLevel int) {
v.Base = sv.Addr
case reflect.Map:
v.loadMap(recurseLevel)
if recurseLevel <= maxVariableRecurse {
v.loadMap(recurseLevel)
}
case reflect.String:
var val string
@ -1149,10 +1151,8 @@ func (v *Variable) loadMap(recurseLevel int) {
}
key := it.key()
val := it.value()
if recurseLevel <= maxVariableRecurse {
key.loadValueInternal(recurseLevel + 1)
val.loadValueInternal(recurseLevel + 1)
}
key.loadValueInternal(recurseLevel + 1)
val.loadValueInternal(recurseLevel + 1)
if key.Unreadable != nil || val.Unreadable != nil {
errcount++
}
@ -1429,7 +1429,9 @@ func (v *Variable) loadInterface(recurseLevel int, loadData bool) {
// interface to nil
data = data.maybeDereference()
v.Children = []Variable{*data}
v.Children[0].loadValueInternal(recurseLevel)
if loadData {
v.Children[0].loadValueInternal(recurseLevel)
}
return
}