mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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:
parent
df63673d6a
commit
583eeaae50
2 changed files with 12 additions and 15 deletions
|
|
@ -357,6 +357,8 @@ type SymRef struct {
|
||||||
SymIdx uint32
|
SymIdx uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s SymRef) IsZero() bool { return s == SymRef{} }
|
||||||
|
|
||||||
// Hash64
|
// Hash64
|
||||||
type Hash64Type [Hash64Size]byte
|
type Hash64Type [Hash64Size]byte
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -250,26 +250,21 @@ func (f *goobjFile) PCToLine(pc uint64) (string, int, *gosym.Func) {
|
||||||
if pc < addr || pc >= addr+uint64(osym.Siz()) {
|
if pc < addr || pc >= addr+uint64(osym.Siz()) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
isym := ^uint32(0)
|
var pcfileSym, pclineSym goobj.SymRef
|
||||||
auxs := r.Auxs(i)
|
for _, a := range r.Auxs(i) {
|
||||||
for j := range auxs {
|
switch a.Type() {
|
||||||
a := &auxs[j]
|
case goobj.AuxPcfile:
|
||||||
if a.Type() != goobj.AuxFuncInfo {
|
pcfileSym = a.Sym()
|
||||||
continue
|
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
|
continue
|
||||||
}
|
}
|
||||||
b := r.BytesAt(r.DataOff(isym), r.DataSize(isym))
|
pcline := getSymData(pclineSym)
|
||||||
var info *goobj.FuncInfo
|
|
||||||
pcline := getSymData(info.ReadPcline(b))
|
|
||||||
line := int(pcValue(pcline, pc-addr, f.arch))
|
line := int(pcValue(pcline, pc-addr, f.arch))
|
||||||
pcfile := getSymData(info.ReadPcfile(b))
|
pcfile := getSymData(pcfileSym)
|
||||||
fileID := pcValue(pcfile, pc-addr, f.arch)
|
fileID := pcValue(pcfile, pc-addr, f.arch)
|
||||||
fileName := r.File(int(fileID))
|
fileName := r.File(int(fileID))
|
||||||
// Note: we provide only the name in the Func structure.
|
// Note: we provide only the name in the Func structure.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue