Commit 37dbfc51 authored by Heschi Kreinick's avatar Heschi Kreinick

cmd/link: emit DW_AT_data_member_location as a constant

Simplify the DWARF representation of structs by emitting field offsets
as constants rather than location descriptions.

This was not explicitly mentioned as an option in DWARF2. It is
mentioned in DWARF4, but isn't listed in the changes, so it's not clear
if this was always intended to work or is an undocumented change. Either
way, it should be valid DWARF4.

Change-Id: Idf7fdd397a21c8f8745673ecc77ef65afa3ffe1c
Reviewed-on: https://go-review.googlesource.com/51611
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: default avatarDavid Chase <drchase@google.com>
parent 1d07ed15
......@@ -383,7 +383,7 @@ var abbrevs = [DW_NABRV]dwAbbrev{
DW_CHILDREN_no,
[]dwAttrForm{
{DW_AT_name, DW_FORM_string},
{DW_AT_data_member_location, DW_FORM_block1},
{DW_AT_data_member_location, DW_FORM_udata},
{DW_AT_type, DW_FORM_ref_addr},
{DW_AT_go_embedded_field, DW_FORM_flag},
},
......
......@@ -286,10 +286,7 @@ func reversetree(list **dwarf.DWDie) {
}
func newmemberoffsetattr(die *dwarf.DWDie, offs int32) {
var block [20]byte
b := append(block[:0], dwarf.DW_OP_plus_uconst)
b = dwarf.AppendUleb128(b, uint64(offs))
newattr(die, dwarf.DW_AT_data_member_location, dwarf.DW_CLS_BLOCK, int64(len(b)), b)
newattr(die, dwarf.DW_AT_data_member_location, dwarf.DW_CLS_CONSTANT, int64(offs), nil)
}
// GDB doesn't like FORM_addr for AT_location, so emit a
......
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