diff options
| author | Jeremy Faller <jeremy@golang.org> | 2020-08-07 11:31:20 -0400 |
|---|---|---|
| committer | Jeremy Faller <jeremy@golang.org> | 2020-08-13 16:47:08 +0000 |
| commit | 5387cdcb24a07f5d0d49d5105ced2b69e6aafde9 (patch) | |
| tree | 65241c32e5d26fb3916a80ff316a6b368ce2e6f9 /src/cmd/internal/objfile | |
| parent | 954db9fe51154e5d4663c0c1a62c82a99eef1ed4 (diff) | |
| download | go-5387cdcb24a07f5d0d49d5105ced2b69e6aafde9.tar.xz | |
[dev.link] cmd/link, cmd/compile: create content addressable pcdata syms
Switch pcdata over to content addressable symbols. This is the last
step before removing these from pclntab_old.
No meaningful benchmarks changes come from this work.
Change-Id: I3f74f3d6026a278babe437c8010e22992c92bd89
Reviewed-on: https://go-review.googlesource.com/c/go/+/247399
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/internal/objfile')
| -rw-r--r-- | src/cmd/internal/objfile/goobj.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/cmd/internal/objfile/goobj.go b/src/cmd/internal/objfile/goobj.go index e838f58aed..8eecebb1df 100644 --- a/src/cmd/internal/objfile/goobj.go +++ b/src/cmd/internal/objfile/goobj.go @@ -236,7 +236,15 @@ func (f *goobjFile) PCToLine(pc uint64) (string, int, *gosym.Func) { if arch == nil { return "", 0, nil } - pcdataBase := r.PcdataBase() + getSymData := func(s goobj.SymRef) []byte { + if s.PkgIdx != goobj.PkgIdxHashed { + // We don't need the data for non-hashed symbols, yet. + panic("not supported") + } + i := uint32(s.SymIdx + uint32(r.NSym()+r.NHashed64def())) + return r.BytesAt(r.DataOff(i), r.DataSize(i)) + } + ndef := uint32(r.NSym() + r.NHashed64def() + r.NHasheddef() + r.NNonpkgdef()) for i := uint32(0); i < ndef; i++ { osym := r.Sym(i) @@ -262,11 +270,9 @@ func (f *goobjFile) PCToLine(pc uint64) (string, int, *gosym.Func) { b := r.BytesAt(r.DataOff(isym), r.DataSize(isym)) var info *goobj.FuncInfo lengths := info.ReadFuncInfoLengths(b) - off, end := info.ReadPcline(b) - pcline := r.BytesAt(pcdataBase+off, int(end-off)) + pcline := getSymData(info.ReadPcline(b)) line := int(pcValue(pcline, pc-addr, arch)) - off, end = info.ReadPcfile(b) - pcfile := r.BytesAt(pcdataBase+off, int(end-off)) + pcfile := getSymData(info.ReadPcfile(b)) fileID := pcValue(pcfile, pc-addr, arch) globalFileID := info.ReadFile(b, lengths.FileOff, uint32(fileID)) fileName := r.File(int(globalFileID)) |
