internal/gocore: fix funcdata offset 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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
diff --git a/internal/gocore/module.go b/internal/gocore/module.go index 925138b..9429a8d 100644 --- a/internal/gocore/module.go +++ b/internal/gocore/module.go
@@ -126,7 +126,12 @@ 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()) @@ -134,7 +139,7 @@ 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) {