Skip to content

Commit

Permalink
adding Gofunc field to Pclntabcandidate struct and as param to New ta…
Browse files Browse the repository at this point in the history
…ble() -- objfile.go
  • Loading branch information
brigadier-general authored Jun 10, 2024
1 parent a116cfd commit 1309938
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions objfile/objfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type StompMagicCandidate struct {
type PclntabCandidate struct {
SecStart uint64
PclntabVA uint64
GofuncVA uint64
StompMagicCandidateMeta *StompMagicCandidate // some search modes might optimistically try to find moduledata or guess endianess, these hints must match the found moduleData VA later to be considered good candidate
Pclntab []byte
Symtab []byte // optional
Expand Down Expand Up @@ -129,8 +130,8 @@ func (f *File) Symbols() ([]Sym, error) {
}

// previously : func (f *File) PCLineTable() (Liner, error) {
func (f *File) PCLineTable(versionOverride string, knownPclntabVA uint64, knownGoTextBase uint64) ([]PclntabCandidate, error) {
return f.entries[0].PCLineTable(versionOverride, knownPclntabVA, knownGoTextBase)
func (f *File) PCLineTable(versionOverride string, knownPclntabVA uint64, knownGoTextBase uint64, knownGofuncVA uint64) ([]PclntabCandidate, error) {
return f.entries[0].PCLineTable(versionOverride, knownPclntabVA, knownGoTextBase, knownGofuncVA)
}

func (f *File) ModuleDataTable(pclntabVA uint64, runtimeVersion string, version string, is64bit bool, littleendian bool) (secStart uint64, moduleData *ModuleData, err error) {
Expand Down Expand Up @@ -211,7 +212,7 @@ func findAllOccurrences(data []byte, searches [][]byte) []int {
}

// previously: func (e *Entry) PCLineTable() (Liner, error)
func (e *Entry) PCLineTable(versionOverride string, knownPclntabVA uint64, knownGoTextBase uint64) ([]PclntabCandidate, error) {
func (e *Entry) PCLineTable(versionOverride string, knownPclntabVA uint64, knownGoTextBase uint64, knownGofuncVA uint64) ([]PclntabCandidate, error) {
// If the raw file implements Liner directly, use that.
// Currently, only Go intermediate objects and archives (goobj) use this path.

Expand Down Expand Up @@ -251,11 +252,16 @@ func (e *Entry) PCLineTable(versionOverride string, knownPclntabVA uint64, known
continue
}

parsedTable, err := gosym.NewTable(candidate.Symtab, gosym.NewLineTable(candidate.Pclntab, candidate.SecStart), versionOverride)
if knownGofuncVA != 0 {
candidate.Gofunc

Check failure on line 256 in objfile/objfile.go

View workflow job for this annotation

GitHub Actions / build

candidate.Gofunc undefined (type PclntabCandidate has no field or method Gofunc)

Check failure on line 256 in objfile/objfile.go

View workflow job for this annotation

GitHub Actions / build

candidate.Gofunc undefined (type PclntabCandidate has no field or method Gofunc)
}

parsedTable, err := gosym.NewTable(candidate.Symtab, gosym.NewLineTable(candidate.Pclntab, candidate.SecStart, candidate.Gofunc), versionOverride)

Check failure on line 259 in objfile/objfile.go

View workflow job for this annotation

GitHub Actions / build

too many arguments in call to gosym.NewLineTable

Check failure on line 259 in objfile/objfile.go

View workflow job for this annotation

GitHub Actions / build

candidate.Gofunc undefined (type PclntabCandidate has no field or method Gofunc)

Check failure on line 259 in objfile/objfile.go

View workflow job for this annotation

GitHub Actions / build

too many arguments in call to gosym.NewLineTable

Check failure on line 259 in objfile/objfile.go

View workflow job for this annotation

GitHub Actions / build

candidate.Gofunc undefined (type PclntabCandidate has no field or method Gofunc)
if err != nil || parsedTable.Go12line == nil {
continue
}


// the first good one happens to be correct more often than the last
candidate.ParsedPclntab = parsedTable
finalCandidates = append(finalCandidates, candidate)
Expand Down

0 comments on commit 1309938

Please sign in to comment.