mirror of
https://github.com/go-delve/delve.git
synced 2025-11-01 20:20:40 +08:00
proc/variables: bugfix: parsing of maps with zero sized value type (#851)
Buckets of maps with zero sized value types (i.e. map[T]struct{}) have
zero length value arrays.
This commit is contained in:
committed by
Derek Parker
parent
40b482130a
commit
cf84483672
@ -1245,7 +1245,12 @@ func (v *Variable) loadMap(recurseLevel int, cfg LoadConfig) {
|
||||
break
|
||||
}
|
||||
key := it.key()
|
||||
val := it.value()
|
||||
var val *Variable
|
||||
if it.values.fieldType.Size() > 0 {
|
||||
val = it.value()
|
||||
} else {
|
||||
val = v.newVariable("", it.values.Addr, it.values.fieldType)
|
||||
}
|
||||
key.loadValueInternal(recurseLevel+1, cfg)
|
||||
val.loadValueInternal(recurseLevel+1, cfg)
|
||||
if key.Unreadable != nil || val.Unreadable != nil {
|
||||
@ -1425,7 +1430,14 @@ func (it *mapIterator) nextBucket() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if it.tophashes.Len != it.keys.Len || it.tophashes.Len != it.values.Len {
|
||||
if it.tophashes.Len != it.keys.Len {
|
||||
it.v.Unreadable = mapBucketContentsInconsistentLenErr
|
||||
return false
|
||||
}
|
||||
|
||||
if it.values.fieldType.Size() > 0 && it.tophashes.Len != it.values.Len {
|
||||
// if the type of the value is zero-sized (i.e. struct{}) then the values
|
||||
// array's length is zero.
|
||||
it.v.Unreadable = mapBucketContentsInconsistentLenErr
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user