From: Than McIntosh Date: Fri, 7 Mar 2025 18:34:55 +0000 (-0500) Subject: debug/dwarf: refactor entry DIE reading helper X-Git-Tag: go1.25rc1~788 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c3e7d5f5cee29669d5d824f697e3b16a08815df0;p=gostls13.git debug/dwarf: refactor entry DIE reading helper Simplify the signature of the "entry()" buf method to accept a unit as opposed to a collection of unit components (version, atable, etc). No change in functionality, this is a pure refactoring that will be needed in subsequent patch. Change-Id: I688def34e39d36b6a62733bc73dc42b49f78ca41 Reviewed-on: https://go-review.googlesource.com/c/go/+/655975 Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Reviewed-by: David Chase --- diff --git a/src/debug/dwarf/entry.go b/src/debug/dwarf/entry.go index 4541d74d4d..3e54a1a13a 100644 --- a/src/debug/dwarf/entry.go +++ b/src/debug/dwarf/entry.go @@ -407,7 +407,8 @@ type Offset uint32 // Entry reads a single entry from buf, decoding // according to the given abbreviation table. -func (b *buf) entry(cu *Entry, atab abbrevTable, ubase Offset, vers int) *Entry { +func (b *buf) entry(cu *Entry, u *unit) *Entry { + atab, ubase, vers := u.atable, u.base, u.vers off := b.off id := uint32(b.uint()) if id == 0 { @@ -884,7 +885,7 @@ func (r *Reader) Next() (*Entry, error) { return nil, nil } u := &r.d.unit[r.unit] - e := r.b.entry(r.cu, u.atable, u.base, u.vers) + e := r.b.entry(r.cu, u) if r.b.err != nil { r.err = r.b.err return nil, r.err @@ -1091,7 +1092,7 @@ func (d *Data) baseAddressForEntry(e *Entry) (*Entry, uint64, error) { } u := &d.unit[i] b := makeBuf(d, u, "info", u.off, u.data) - cu = b.entry(nil, u.atable, u.base, u.vers) + cu = b.entry(nil, u) if b.err != nil { return nil, 0, b.err } diff --git a/src/debug/dwarf/typeunit.go b/src/debug/dwarf/typeunit.go index 8ecf876416..e5b8973ac9 100644 --- a/src/debug/dwarf/typeunit.go +++ b/src/debug/dwarf/typeunit.go @@ -137,7 +137,7 @@ func (tur *typeUnitReader) Next() (*Entry, error) { if len(tur.tu.data) == 0 { return nil, nil } - e := tur.b.entry(nil, tur.tu.atable, tur.tu.base, tur.tu.vers) + e := tur.b.entry(nil, &tur.tu.unit) if tur.b.err != nil { tur.err = tur.b.err return nil, tur.err