mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/objfile: correct file table reading for Go object file
Apparently I never actually understood the new file table in Go object files. The PC value stream actually encodes the file index in the per-CU table. I thought it was indexing into a per-function table, which then contains index to the per-CU table. Remove the extra indirection. Change-Id: I0aea5629f7b3888ebe3a04fea437aa15ce89519e Reviewed-on: https://go-review.googlesource.com/c/go/+/262779 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
771f5f2e48
commit
20819440fc
6 changed files with 63 additions and 3 deletions
|
|
@ -267,13 +267,11 @@ 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)
|
||||
pcline := getSymData(info.ReadPcline(b))
|
||||
line := int(pcValue(pcline, pc-addr, f.arch))
|
||||
pcfile := getSymData(info.ReadPcfile(b))
|
||||
fileID := pcValue(pcfile, pc-addr, f.arch)
|
||||
globalFileID := info.ReadFile(b, lengths.FileOff, uint32(fileID))
|
||||
fileName := r.File(int(globalFileID))
|
||||
fileName := r.File(int(fileID))
|
||||
// Note: we provide only the name in the Func structure.
|
||||
// We could provide more if needed.
|
||||
return fileName, line, &gosym.Func{Sym: &gosym.Sym{Name: osym.Name(r)}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue