From b4fc18feec94531f83f8881268f300a99ffb9016 Mon Sep 17 00:00:00 2001 From: brigadier-general Date: Wed, 5 Jun 2024 19:05:58 -0500 Subject: [PATCH] Update main.go -- fixed parsing v1.20+ inlining --- main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index b8aac7f..548cab9 100644 --- a/main.go +++ b/main.go @@ -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 { @@ -49,6 +50,7 @@ type FuncMetadata struct { End uint64 PackageName string FullName string + InlinedList []gosym.InlinedCall } type ExtractMetadata struct { @@ -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 { @@ -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), }) } } - // TODO -- remove! - os.Exit(0) return extractMetadata, nil }