Commit 79b106ec authored by Rob Pike's avatar Rob Pike

cmd/ld: generate correct upper bound value for array types.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/115820043
parent fd7b82b4
......@@ -104,7 +104,7 @@ decodetype_arrayelem(LSym *s)
vlong
decodetype_arraylen(LSym *s)
{
return decode_inuxi(s->p + commonsize()+PtrSize, PtrSize);
return decode_inuxi(s->p + commonsize()+2*PtrSize, PtrSize);
}
// Type.PtrType.elem
......@@ -120,6 +120,7 @@ decodetype_mapkey(LSym *s)
{
return decode_reloc_sym(s, commonsize()); // 0x1c / 0x30
}
LSym*
decodetype_mapvalue(LSym *s)
{
......
......@@ -992,7 +992,7 @@ defgotype(LSym *gotype)
s = decodetype_arrayelem(gotype);
newrefattr(die, DW_AT_type, defgotype(s));
fld = newdie(die, DW_ABRV_ARRAYRANGE, "range");
newattr(fld, DW_AT_upper_bound, DW_CLS_CONSTANT, decodetype_arraylen(gotype), 0);
newattr(fld, DW_AT_upper_bound, DW_CLS_CONSTANT, decodetype_arraylen(gotype)-1, 0); // -1: want upper bound, not count.
newrefattr(fld, DW_AT_type, find_or_diag(&dwtypes, "uintptr"));
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment