diff options
| author | Cherry Mui <cherryyz@google.com> | 2021-09-27 15:55:53 -0400 |
|---|---|---|
| committer | Cherry Mui <cherryyz@google.com> | 2021-09-28 15:26:21 +0000 |
| commit | 583eeaae509a01cc50955c4174044b9dac539ff6 (patch) | |
| tree | 251b1750bf8c4a8de2a128eeefb16044ba0ef007 /src/cmd/internal/objfile | |
| parent | df63673d6a85d4243cc68c2225264afab6cfbf3b (diff) | |
| download | go-583eeaae509a01cc50955c4174044b9dac539ff6.tar.xz | |
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>
Diffstat (limited to 'src/cmd/internal/objfile')
| -rw-r--r-- | src/cmd/internal/objfile/goobj.go | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/cmd/internal/objfile/goobj.go b/src/cmd/internal/objfile/goobj.go index dd21d22351..24d2d0bb5c 100644 --- a/src/cmd/internal/objfile/goobj.go +++ b/src/cmd/internal/objfile/goobj.go @@ -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. |
