Skip to content

Commit c3e7d5f

Browse files
committed
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent c40a373 commit c3e7d5f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/debug/dwarf/entry.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ type Offset uint32
407407

408408
// Entry reads a single entry from buf, decoding
409409
// according to the given abbreviation table.
410-
func (b *buf) entry(cu *Entry, atab abbrevTable, ubase Offset, vers int) *Entry {
410+
func (b *buf) entry(cu *Entry, u *unit) *Entry {
411+
atab, ubase, vers := u.atable, u.base, u.vers
411412
off := b.off
412413
id := uint32(b.uint())
413414
if id == 0 {
@@ -884,7 +885,7 @@ func (r *Reader) Next() (*Entry, error) {
884885
return nil, nil
885886
}
886887
u := &r.d.unit[r.unit]
887-
e := r.b.entry(r.cu, u.atable, u.base, u.vers)
888+
e := r.b.entry(r.cu, u)
888889
if r.b.err != nil {
889890
r.err = r.b.err
890891
return nil, r.err
@@ -1091,7 +1092,7 @@ func (d *Data) baseAddressForEntry(e *Entry) (*Entry, uint64, error) {
10911092
}
10921093
u := &d.unit[i]
10931094
b := makeBuf(d, u, "info", u.off, u.data)
1094-
cu = b.entry(nil, u.atable, u.base, u.vers)
1095+
cu = b.entry(nil, u)
10951096
if b.err != nil {
10961097
return nil, 0, b.err
10971098
}

src/debug/dwarf/typeunit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (tur *typeUnitReader) Next() (*Entry, error) {
137137
if len(tur.tu.data) == 0 {
138138
return nil, nil
139139
}
140-
e := tur.b.entry(nil, tur.tu.atable, tur.tu.base, tur.tu.vers)
140+
e := tur.b.entry(nil, &tur.tu.unit)
141141
if tur.b.err != nil {
142142
tur.err = tur.b.err
143143
return nil, tur.err

0 commit comments

Comments
 (0)