Skip to content

Commit

Permalink
internal/gocore: fix funcdata offset
Browse files Browse the repository at this point in the history
CL 354011 remove unnecessary funcdata alignment. Update references.

For golang/go#57447.

Change-Id: I14414ea4be048c3bb8bbde711c10474f7f0515e4
Reviewed-on: https://go-review.googlesource.com/c/debug/+/589035
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Keith Randall <[email protected]>
Reviewed-by: Michael Knyszek <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
  • Loading branch information
WangLeonard authored and gopherbot committed Jun 4, 2024
1 parent 0a45c20 commit 6a082a1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/gocore/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,20 @@ func (m *module) readFunc(r region, pctab region, funcnametab region) *Func {
f.pcdata = append(f.pcdata, r.p.proc.ReadInt32(a))
a = a.Add(4)
}
a = a.Align(r.p.proc.PtrSize())

is118OrGreater := m.r.HasField("gofunc")
if !is118OrGreater {
// Since 1.18, funcdata no longer needs to be aligned.
a = a.Align(r.p.proc.PtrSize())
}

if nfd.typ.Size == 1 { // go 1.12 and beyond, this is a uint8
n = uint32(nfd.Uint8())
} else { // go 1.11 and earlier, this is an int32
n = uint32(nfd.Int32())
}
for i := uint32(0); i < n; i++ {
if m.r.HasField("gofunc") {
if is118OrGreater {
// Since 1.18, funcdata contains offsets from go.func.*.
off := r.p.proc.ReadUint32(a)
if off == ^uint32(0) {
Expand Down

0 comments on commit 6a082a1

Please sign in to comment.