1
0
mirror of https://github.com/golang/go synced 2024-11-17 07:54:41 -07:00

cmd/internal/objfile: use aux symbol for pcdata references

Pcdata are now separate aux symbols. Read them from aux, instead
of using funcinfo.

Change-Id: Ib3e4b5cff1e3329d0600504a8829a969a9c9f517
Reviewed-on: https://go-review.googlesource.com/c/go/+/352612
Trust: Cherry Mui <cherryyz@google.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Cherry Mui 2021-09-27 15:55:53 -04:00
parent df63673d6a
commit 583eeaae50
2 changed files with 12 additions and 15 deletions

View File

@ -357,6 +357,8 @@ type SymRef struct {
SymIdx uint32
}
func (s SymRef) IsZero() bool { return s == SymRef{} }
// Hash64
type Hash64Type [Hash64Size]byte

View File

@ -250,26 +250,21 @@ func (f *goobjFile) PCToLine(pc uint64) (string, int, *gosym.Func) {
if pc < addr || pc >= addr+uint64(osym.Siz()) {
continue
}
isym := ^uint32(0)
auxs := r.Auxs(i)
for j := range auxs {
a := &auxs[j]
if a.Type() != goobj.AuxFuncInfo {
continue
var pcfileSym, pclineSym goobj.SymRef
for _, a := range r.Auxs(i) {
switch a.Type() {
case goobj.AuxPcfile:
pcfileSym = a.Sym()
case goobj.AuxPcline:
pclineSym = a.Sym()
}
if a.Sym().PkgIdx != goobj.PkgIdxSelf {
panic("funcinfo symbol not defined in current package")
}
isym = a.Sym().SymIdx
}
if isym == ^uint32(0) {
if pcfileSym.IsZero() || pclineSym.IsZero() {
continue
}
b := r.BytesAt(r.DataOff(isym), r.DataSize(isym))
var info *goobj.FuncInfo
pcline := getSymData(info.ReadPcline(b))
pcline := getSymData(pclineSym)
line := int(pcValue(pcline, pc-addr, f.arch))
pcfile := getSymData(info.ReadPcfile(b))
pcfile := getSymData(pcfileSym)
fileID := pcValue(pcfile, pc-addr, f.arch)
fileName := r.File(int(fileID))
// Note: we provide only the name in the Func structure.