Skip to content

Commit

Permalink
Update main.go -- fixed parsing v1.20+ inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
brigadier-general authored Jun 6, 2024
1 parent 682a59f commit b4fc18f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/mandiant/GoReSym/buildinfo"
"github.com/mandiant/GoReSym/objfile"
"github.com/mandiant/GoReSym/runtime/debug"
"github.com/mandiant/GoReSym/debug/gosym"
)

func isStdPackage(pkg string) bool {
Expand Down Expand Up @@ -49,6 +50,7 @@ type FuncMetadata struct {
End uint64
PackageName string
FullName string
InlinedList []gosym.InlinedCall
}

type ExtractMetadata struct {
Expand Down Expand Up @@ -286,6 +288,7 @@ restartParseWithRealTextBase:
}
}

// TODO -- move var above so we don't have to re-read the whole file
fileData, _ := os.ReadFile(fileName)
// TODO -- use error or remove
for _, elem := range finalTab.ParsedPclntab.Funcs {
Expand All @@ -299,17 +302,15 @@ restartParseWithRealTextBase:
})
}
} else {
elem.CheckInline(moduleData.Gofunc, fileData)
extractMetadata.UserFunctions = append(extractMetadata.UserFunctions, FuncMetadata{
Start: elem.Entry,
End: elem.End,
PackageName: elem.PackageName(),
FullName: elem.Name,
InlinedList: elem.CheckInline(moduleData.Gofunc, fileData),

Check failure on line 310 in main.go

View workflow job for this annotation

GitHub Actions / build

cannot use elem.CheckInline(moduleData.Gofunc, fileData) (value of type bool) as []gosym.InlinedCall value in struct literal

Check failure on line 310 in main.go

View workflow job for this annotation

GitHub Actions / build

moduleData.Gofunc undefined (type *objfile.ModuleData has no field or method Gofunc)
})
}
}
// TODO -- remove!
os.Exit(0)
return extractMetadata, nil
}

Expand Down

0 comments on commit b4fc18f

Please sign in to comment.