mirror of
https://github.com/golang/go.git
synced 2025-10-19 19:13:18 +00:00
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 <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
c40a3731f4
commit
c3e7d5f5ce
2 changed files with 5 additions and 4 deletions
|
@ -407,7 +407,8 @@ type Offset uint32
|
||||||
|
|
||||||
// Entry reads a single entry from buf, decoding
|
// Entry reads a single entry from buf, decoding
|
||||||
// according to the given abbreviation table.
|
// 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
|
off := b.off
|
||||||
id := uint32(b.uint())
|
id := uint32(b.uint())
|
||||||
if id == 0 {
|
if id == 0 {
|
||||||
|
@ -884,7 +885,7 @@ func (r *Reader) Next() (*Entry, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
u := &r.d.unit[r.unit]
|
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 {
|
if r.b.err != nil {
|
||||||
r.err = r.b.err
|
r.err = r.b.err
|
||||||
return nil, r.err
|
return nil, r.err
|
||||||
|
@ -1091,7 +1092,7 @@ func (d *Data) baseAddressForEntry(e *Entry) (*Entry, uint64, error) {
|
||||||
}
|
}
|
||||||
u := &d.unit[i]
|
u := &d.unit[i]
|
||||||
b := makeBuf(d, u, "info", u.off, u.data)
|
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 {
|
if b.err != nil {
|
||||||
return nil, 0, b.err
|
return nil, 0, b.err
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ func (tur *typeUnitReader) Next() (*Entry, error) {
|
||||||
if len(tur.tu.data) == 0 {
|
if len(tur.tu.data) == 0 {
|
||||||
return nil, nil
|
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 {
|
if tur.b.err != nil {
|
||||||
tur.err = tur.b.err
|
tur.err = tur.b.err
|
||||||
return nil, tur.err
|
return nil, tur.err
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue