]> Cypherpunks repositories - gostls13.git/commitdiff
debug/dwarf: refactor entry DIE reading helper
authorThan McIntosh <thanm@golang.org>
Fri, 7 Mar 2025 18:34:55 +0000 (13:34 -0500)
committerThan McIntosh <thanm@golang.org>
Mon, 10 Mar 2025 15:35:44 +0000 (08:35 -0700)
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 <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
src/debug/dwarf/entry.go
src/debug/dwarf/typeunit.go

index 4541d74d4db408ad0041c177bd447df000f4288a..3e54a1a13aa979c01aab1e1a3d3cbae7d4bbfbf9 100644 (file)
@@ -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
                }
index 8ecf876416ccdfdc5ac6042be722053c4b3d689d..e5b8973ac9c4f2e7cb35cf97eca84bfb3594c5b2 100644 (file)
@@ -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