delve
delve copied to clipboard
eval: support arbitrary map types?
Adding something like this:
if mtyp, ok := expr.(*ast.MapType); ok {
keyTyp, err := bi.findTypeExpr(mtyp.Key)
if err != nil {
return nil, err
}
elemTyp, err := bi.findTypeExpr(mtyp.Value)
if err != nil {
return nil, err
}
typ := new(godwarf.MapType)
typ.KeyType = keyTyp
typ.ElemType = elemTyp
typ.Name = fmt.Sprintf("map[%v]%v", keyTyp, elemTyp)
typ.Type = typ
return typ, nil
}
to (*BinaryInfo).findTypeExpr
would allow evaluating arbitrary map types. I can't think of a scenario where this would matter, but it also seems a bit odd that evaluating a map[Key]Value
expression will fail if that specific type does not exist in the DWARF section.