diff --git a/elf.go b/elf.go
index 7993251..cf285d8 100644
--- a/elf.go
+++ b/elf.go
@@ -45,11 +45,11 @@ type elfFile struct {
osFile *os.File
}
-func (e *elfFile) GetParsedFile() any {
+func (e *elfFile) getParsedFile() any {
return e.file
}
-func (e *elfFile) GetFile() *os.File {
+func (e *elfFile) getFile() *os.File {
return e.osFile
}
@@ -88,12 +88,16 @@ func (e *elfFile) getRData() ([]byte, error) {
return section.Data()
}
-func (e *elfFile) getCodeSection() ([]byte, error) {
+func (e *elfFile) getCodeSection() (uint64, []byte, error) {
section := e.file.Section(".text")
if section == nil {
- return nil, ErrSectionDoesNotExist
+ return 0, nil, ErrSectionDoesNotExist
}
- return section.Data()
+ data, err := section.Data()
+ if err != nil {
+ return 0, nil, fmt.Errorf("error when getting the code section: %w", err)
+ }
+ return section.Addr, data, nil
}
func (e *elfFile) getPCLNTABData() (uint64, []byte, error) {
diff --git a/file.go b/file.go
index cbf2796..0efb75e 100644
--- a/file.go
+++ b/file.go
@@ -54,7 +54,7 @@ func Open(filePath string) (*GoFile, error) {
buf := make([]byte, maxMagicBufLen)
n, err := f.Read(buf)
- f.Close()
+ _ = f.Close()
if err != nil {
return nil, err
}
@@ -94,8 +94,9 @@ func Open(filePath string) (*GoFile, error) {
// Try to extract build information.
if bi, err := gofile.extractBuildInfo(); err == nil {
- // This error is a minor failure, it just means we don't have
- // this information. So if fails we just ignores it.
+ // This error is a minor failure; it just means we don't have
+ // this information.
+ // So if fails, we just ignore it.
gofile.BuildInfo = bi
if bi.Compiler != nil {
gofile.FileInfo.goversion = bi.Compiler
@@ -107,40 +108,72 @@ func Open(filePath string) (*GoFile, error) {
// GoFile is a structure representing a go binary file.
type GoFile struct {
- // BuildInfo holds the data from the buildinf structure. This can be nil
- // because it's not always available.
+ // BuildInfo holds the data from the buildinfo structure.
+ // This can be a nil because it's not always available.
BuildInfo *BuildInfo
// FileInfo holds information about the file.
FileInfo *FileInfo
// BuildID is the Go build ID hash extracted from the binary.
- BuildID string
- fh fileHandler
- stdPkgs []*Package
- generated []*Package
- pkgs []*Package
- vendors []*Package
- unknown []*Package
- pclntab *gosym.Table
- initPackages sync.Once
+ BuildID string
+
+ fh fileHandler
+
+ stdPkgs []*Package
+ generated []*Package
+ pkgs []*Package
+ vendors []*Package
+ unknown []*Package
+
+ pclntab *gosym.Table
+
+ initPackagesOnce sync.Once
+ initPackagesError error
+
+ moduledata moduledata
+
+ versionError error
+
+ initModuleDataOnce sync.Once
+ initModuleDataError error
}
-func (f *GoFile) init() error {
- var returnVal error
- f.initPackages.Do(func() {
+func (f *GoFile) initModuleData() error {
+ f.initModuleDataOnce.Do(func() {
+ err := f.ensureCompilerVersion()
+ if err != nil {
+ f.initModuleDataError = err
+ return
+ }
+ f.moduledata, f.initModuleDataError = extractModuledata(f.FileInfo, f.fh)
+ })
+ return f.initModuleDataError
+}
+
+// Moduledata extracts the file's moduledata.
+func (f *GoFile) Moduledata() (Moduledata, error) {
+ err := f.initModuleData()
+ if err != nil {
+ return moduledata{}, err
+ }
+ return f.moduledata, nil
+}
+
+func (f *GoFile) initPackages() error {
+ f.initPackagesOnce.Do(func() {
tab, err := f.PCLNTab()
if err != nil {
- returnVal = err
+ f.initPackagesError = err
return
}
f.pclntab = tab
- returnVal = f.enumPackages()
+ f.initPackagesError = f.enumPackages()
})
- return returnVal
+ return f.initPackagesError
}
// GetFile returns the raw file opened by the library.
func (f *GoFile) GetFile() *os.File {
- return f.fh.GetFile()
+ return f.fh.getFile()
}
// GetParsedFile returns the parsed file, should be cast based on the file type.
@@ -151,13 +184,38 @@ func (f *GoFile) GetFile() *os.File {
//
// all from the debug package.
func (f *GoFile) GetParsedFile() any {
- return f.fh.GetParsedFile()
+ return f.fh.getParsedFile()
}
// GetCompilerVersion returns the Go compiler version of the compiler
// that was used to compile the binary.
func (f *GoFile) GetCompilerVersion() (*GoVersion, error) {
- return findGoCompilerVersion(f)
+ err := f.ensureCompilerVersion()
+ if err != nil {
+ return nil, err
+ }
+ return f.FileInfo.goversion, nil
+}
+
+func (f *GoFile) ensureCompilerVersion() error {
+ if f.FileInfo.goversion == nil {
+ f.tryExtractCompilerVersion()
+ }
+ return f.versionError
+}
+
+// tryExtractCompilerVersion tries to extract the compiler version from the binary.
+// should only be called if FileInfo.goversion is nil.
+func (f *GoFile) tryExtractCompilerVersion() {
+ if f.FileInfo.goversion != nil {
+ return
+ }
+ v, err := findGoCompilerVersion(f)
+ if err != nil {
+ f.versionError = err
+ } else {
+ f.FileInfo.goversion = v
+ }
}
// SourceInfo returns the source code filename, starting line number
@@ -168,10 +226,9 @@ func (f *GoFile) SourceInfo(fn *Function) (string, int, int) {
return srcFile, start, end
}
-// GetGoRoot returns the Go Root path
-// that was used to compile the binary.
+// GetGoRoot returns the Go Root path used to compile the binary.
func (f *GoFile) GetGoRoot() (string, error) {
- err := f.init()
+ err := f.initPackages()
if err != nil {
return "", err
}
@@ -181,7 +238,7 @@ func (f *GoFile) GetGoRoot() (string, error) {
// SetGoVersion sets the assumed compiler version that was used. This
// can be used to force a version if gore is not able to determine the
// compiler version used. The version string must match one of the strings
-// normally extracted from the binary. For example to set the version to
+// normally extracted from the binary. For example, to set the version to
// go 1.12.0, use "go1.12". For 1.7.2, use "go1.7.2".
// If an incorrect version string or version not known to the library,
// ErrInvalidGoVersion is returned.
@@ -194,35 +251,35 @@ func (f *GoFile) SetGoVersion(version string) error {
return nil
}
-// GetPackages returns the go packages that has been classified as part of the main
+// GetPackages returns the go packages that have been classified as part of the main
// project.
func (f *GoFile) GetPackages() ([]*Package, error) {
- err := f.init()
+ err := f.initPackages()
return f.pkgs, err
}
-// GetVendors returns the 3rd party packages used by the binary.
+// GetVendors returns the third party packages used by the binary.
func (f *GoFile) GetVendors() ([]*Package, error) {
- err := f.init()
+ err := f.initPackages()
return f.vendors, err
}
// GetSTDLib returns the standard library packages used by the binary.
func (f *GoFile) GetSTDLib() ([]*Package, error) {
- err := f.init()
+ err := f.initPackages()
return f.stdPkgs, err
}
// GetGeneratedPackages returns the compiler generated packages used by the binary.
func (f *GoFile) GetGeneratedPackages() ([]*Package, error) {
- err := f.init()
+ err := f.initPackages()
return f.generated, err
}
-// GetUnknown returns unclassified packages used by the binary. This is a catch all
-// category when the classification could not be determined.
+// GetUnknown returns unclassified packages used by the binary.
+// This is a catch-all category when the classification could not be determined.
func (f *GoFile) GetUnknown() ([]*Package, error) {
- err := f.init()
+ err := f.initPackages()
return f.unknown, err
}
@@ -325,24 +382,21 @@ func (f *GoFile) PCLNTab() (*gosym.Table, error) {
// GetTypes returns a map of all types found in the binary file.
func (f *GoFile) GetTypes() ([]*GoType, error) {
- if f.FileInfo.goversion == nil {
- ver, err := f.GetCompilerVersion()
- if err != nil {
- return nil, err
- }
- f.FileInfo.goversion = ver
+ err := f.ensureCompilerVersion()
+ if err != nil {
+ return nil, err
}
t, err := getTypes(f.FileInfo, f.fh)
if err != nil {
return nil, err
}
- if err = f.init(); err != nil {
+ if err = f.initPackages(); err != nil {
return nil, err
}
return sortTypes(t), nil
}
-// Bytes returns a slice of raw bytes with the length in the file from the address.
+// Bytes return a slice of raw bytes with the length in the file from the address.
func (f *GoFile) Bytes(address uint64, length uint64) ([]byte, error) {
base, section, err := f.fh.getSectionDataFromOffset(address)
if err != nil {
@@ -377,15 +431,15 @@ type fileHandler interface {
io.Closer
getPCLNTab() (*gosym.Table, error)
getRData() ([]byte, error)
- getCodeSection() ([]byte, error)
+ getCodeSection() (uint64, []byte, error)
getSectionDataFromOffset(uint64) (uint64, []byte, error)
getSectionData(string) (uint64, []byte, error)
getFileInfo() *FileInfo
getPCLNTABData() (uint64, []byte, error)
moduledataSection() string
getBuildID() (string, error)
- GetFile() *os.File
- GetParsedFile() any
+ getFile() *os.File
+ getParsedFile() any
}
func fileMagicMatch(buf, magic []byte) bool {
diff --git a/file_test.go b/file_test.go
index 47fda6e..df817a1 100644
--- a/file_test.go
+++ b/file_test.go
@@ -101,9 +101,8 @@ func TestGoldFiles(t *testing.T) {
// Get info from filename gold-os-arch-goversion
fileInfo := strings.Split(file, "-")
- // If patch level is 0, it is dropped. For example. 10.0.0 is 10.0.
- // This was changed in 1.21 so if the version is 1.21 or greater, we take
- // the whole string.
+ // If the patch level is 0, it is dropped. For example. 10.0.0 is 10.0
+ // Up until 1.21.0, if patch level is 0, it is dropped. For example. 10.0.0 is 10.0
var actualVersion string
verArr := strings.Split(fileInfo[3], ".")
if len(verArr) == 3 && verArr[2] == "0" && mustParse(strconv.Atoi(verArr[1])) < 21 {
@@ -175,11 +174,11 @@ type mockFileHandler struct {
mGetSectionDataFromOffset func(uint64) (uint64, []byte, error)
}
-func (m *mockFileHandler) GetFile() *os.File {
+func (m *mockFileHandler) getFile() *os.File {
panic("not implemented")
}
-func (m *mockFileHandler) GetParsedFile() any {
+func (m *mockFileHandler) getParsedFile() any {
panic("not implemented")
}
@@ -195,7 +194,7 @@ func (m *mockFileHandler) getRData() ([]byte, error) {
panic("not implemented")
}
-func (m *mockFileHandler) getCodeSection() ([]byte, error) {
+func (m *mockFileHandler) getCodeSection() (uint64, []byte, error) {
panic("not implemented")
}
diff --git a/gen.go b/gen.go
deleted file mode 100644
index d55d93d..0000000
--- a/gen.go
+++ /dev/null
@@ -1,442 +0,0 @@
-// This file is part of GoRE.
-//
-// Copyright (C) 2019-2021 GoRE Authors
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-//go:build ignore
-// +build ignore
-
-// This program generates stdpkgs_gen.go. It can be invoked by running
-// go generate
-
-package main
-
-import (
- "bufio"
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "go/format"
- "io"
- "net/http"
- "os"
- "path/filepath"
- "strings"
- "text/template"
- "time"
-)
-
-var packageTemplate = template.Must(template.New("").Parse(`// This file is part of GoRE.
-//
-// Copyright (C) 2019-2021 GoRE Authors
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-// Code generated by go generate; DO NOT EDIT.
-// This file was generated at
-// {{ .Timestamp }}
-
-package gore
-
-var stdPkgs = map[string]struct{}{
-{{- range .StdPkg }}
- {{ printf "\"%s\": {}" . }},
-{{- end }}
-}
-`))
-
-var goversionTemplate = template.Must(template.New("").Parse(`// This file is part of GoRE.
-//
-// Copyright (C) 2019-2021 GoRE Authors
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-// Code generated by go generate; DO NOT EDIT.
-// This file was generated at
-// {{ .Timestamp }}
-
-package gore
-
-var goversions = map[string]*GoVersion{
-{{- range .GoVersions }}
- {{ printf "\"%s\": {Name: \"%s\", SHA: \"%s\", Timestamp: \"%s\"}" .Name .Name .Sha .Date }},
-{{- end }}
-}
-`))
-
-var client = &http.Client{}
-
-var authRequest func(*http.Request)
-
-func init() {
- token := os.Getenv("GITHUB_TOKEN")
- if token != "" {
- authRequest = func(r *http.Request) {
- r.Header.Set("Authorization", "Bearer "+token)
- }
- } else {
- authRequest = func(r *http.Request) {}
- }
-}
-
-type ghResp struct {
- Sha string `json:"sha"`
- Url string `json:"url"`
- Trees []ghTree `json:"tree"`
- Truncated bool `json:"truncated"`
-}
-
-type ghTree struct {
- Path string `json:"path"`
- Mode string `json:"mode"`
- Gittype string `json:"type"`
- Sha string `json:"sha"`
- Size int `json:"size"`
- Url string `json:"url"`
-}
-
-const (
- requestURLFormatStr = "https://api.github.com/repos/golang/go/git/trees/%s?recursive=0"
- commitRequestURLFormatStr = "https://api.github.com/repos/golang/go/git/commits/%s"
- outputFile = "stdpkg_gen.go"
- goversionOutputFile = "goversion_gen.go"
-)
-
-var (
- tagsRequestURL = "https://api.github.com/repos/golang/go/tags"
-)
-
-var (
- excludedPaths = []string{"src/cmd"}
-)
-
-type tagResp struct {
- Name string
- Commit *commitShort
-}
-
-type commitShort struct {
- Sha string
- URL string
-}
-
-type commitLong struct {
- Sha string
- Committer committer
-}
-
-type committer struct {
- Name string
- Date string
-}
-
-type goversion struct {
- Name string
- Sha string
- Date string
-}
-
-// diffCode returns false if a and b have different other than the date.
-func diffCode(a, b string) bool {
- if a == b {
- return false
- }
-
- aLines := strings.Split(a, "\n")
- bLines := strings.Split(b, "\n")
-
- // ignore the license and the date
- aLines = aLines[21:]
- bLines = bLines[21:]
-
- if len(aLines) != len(bLines) {
- return true
- }
-
- for i := 0; i < len(aLines); i++ {
- if aLines[i] != bLines[i] {
- return true
- }
- }
-
- return false
-}
-
-func writeOnDemand(new []byte, target string) {
- old, err := os.ReadFile(target)
- if err != nil {
- fmt.Println("Error when reading the old file:", target, err)
- return
- }
-
- old, _ = format.Source(old)
- new, _ = format.Source(new)
-
- // Compare the old and the new.
- if !diffCode(string(old), string(new)) {
- fmt.Println(target + " no changes.")
- return
- }
-
- fmt.Println(target + " changes detected.")
-
- // Write the new file.
- err = os.WriteFile(target, new, 0664)
- if err != nil {
- fmt.Println("Error when writing the new file:", err)
- return
- }
-}
-
-func processGoVersions() {
- tags := make([]*tagResp, 0)
-
- // Fetch all tags
-
- var requestURL *string
-
- requestURL = &tagsRequestURL
- for *requestURL != "" {
- fmt.Println("Fetching latests tags")
- req, _ := http.NewRequest(http.MethodGet, *requestURL, nil)
- authRequest(req)
- resp, err := client.Do(req)
- if err != nil {
- fmt.Println("Error when fetching tags:", err.Error())
- resp.Body.Close()
- continue
- }
- next := getNextPageURL(resp)
- *requestURL = next
- body, err := io.ReadAll(resp.Body)
- resp.Body.Close()
- if err != nil {
- fmt.Println("Error when ready response body:", err)
- continue
- }
- var newTags []*tagResp
- err = json.Unmarshal(body, &newTags)
- if err != nil {
- fmt.Println("Error when parsing the json:", string(body), err)
- continue
- }
- tags = append(tags, newTags...)
- }
-
- // Get mode commit info for new tags
-
- f, err := os.OpenFile(filepath.Join("resources", "goversions.csv"), os.O_CREATE|os.O_RDWR, 0664)
- if err != nil {
- fmt.Println("Error when opening goversions.csv:", err)
- return
- }
- defer f.Close()
- knownVersions, err := getStoredGoversions(f)
- if err != nil {
- fmt.Println("Error when getting stored go versions:", err)
- return
- }
-
- _, err = fmt.Fprintln(f, "version,sha,date")
- if err != nil {
- fmt.Println("Error when writing csv header:", err)
- return
- }
-
- for _, tag := range tags {
- if strings.HasPrefix(tag.Name, "weekly") || strings.HasPrefix(tag.Name, "release") {
- continue
- }
- if v, known := knownVersions[tag.Name]; known {
- fmt.Fprintf(f, "%s,%s,%s\n", v.Name, v.Sha, v.Date)
- continue
- }
-
- req, _ := http.NewRequest(http.MethodGet, fmt.Sprintf(commitRequestURLFormatStr, tag.Commit.Sha), nil)
- authRequest(req)
- resp, err := client.Do(req)
- if err != nil {
- fmt.Println("Error when fetching commit info:", err)
- resp.Body.Close()
- continue
- }
- body, err := io.ReadAll(resp.Body)
- resp.Body.Close()
-
- var commit commitLong
- err = json.Unmarshal(body, &commit)
- if err != nil {
- fmt.Println("Error when parsing commit json:", err)
- continue
- }
- fmt.Fprintf(f, "%s,%s,%s\n", tag.Name, commit.Sha, commit.Committer.Date)
- fmt.Println("New tag found:", tag.Name)
- knownVersions[tag.Name] = &goversion{Name: tag.Name, Sha: commit.Sha, Date: commit.Committer.Date}
- }
-
- // Generate the code.
- buf := bytes.NewBuffer(nil)
-
- err = goversionTemplate.Execute(buf, struct {
- Timestamp time.Time
- GoVersions map[string]*goversion
- }{
- Timestamp: time.Now().UTC(),
- GoVersions: knownVersions,
- })
- if err != nil {
- fmt.Println("Error when generating the code:", err)
- return
- }
-
- writeOnDemand(buf.Bytes(), goversionOutputFile)
-}
-
-func getStoredGoversions(f *os.File) (map[string]*goversion, error) {
- vers := make(map[string]*goversion)
- r := bufio.NewScanner(f)
- // Read header
- if !r.Scan() {
- return nil, errors.New("empty file")
- }
- r.Text()
-
- for r.Scan() {
- row := r.Text()
- if row == "" {
- continue
- }
- data := strings.Split(row, ",")
- if data[0] == "" {
- // No version
- continue
- }
- version := strings.TrimSpace(data[0])
- sha := strings.TrimSpace(data[1])
- date := strings.TrimSpace(data[2])
- vers[version] = &goversion{Name: version, Sha: sha, Date: date}
- }
- _, err := f.Seek(0, 0)
- return vers, err
-}
-
-func getNextPageURL(r *http.Response) string {
- h := r.Header.Get("Link")
- if h == "" {
- return ""
- }
- // Either we this type:
- // ; rel="next", ; rel="last"
- // or this type:
- // ; rel="prev", ; rel="first"
- data := strings.Split(h, ",")
- for _, l := range data {
- ll := strings.Split(l, ";")
- if len(ll) != 2 {
- continue
- }
- if strings.TrimSpace(ll[1]) != "rel=\"next\"" {
- continue
- }
- return strings.TrimLeft(strings.TrimRight(strings.TrimSpace(ll[0]), ">"), "<")
- }
- return ""
-}
-
-func main() {
- processGoVersions()
-
- resp, err := client.Get(fmt.Sprintf(requestURLFormatStr, "master"))
- if err != nil {
- fmt.Println("Error when fetching go src data:", err)
- return
- }
- defer resp.Body.Close()
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- fmt.Println("Error when reading response body:", err)
- return
- }
- var master ghResp
- err = json.Unmarshal(body, &master)
- if err != nil {
- fmt.Println("Error when decoding the response body:", err)
- return
- }
- var stdPkgs []string
- for _, tree := range master.Trees {
- if tree.Gittype != "tree" {
- continue
- }
- if !strings.HasPrefix(tree.Path, "src") || skipPath(tree.Path) {
- continue
- }
- // Skip src folder.
- if tree.Path == "src" {
- continue
- }
- // Strip "src/" and add to the list.
- stdPkgs = append(stdPkgs, strings.TrimPrefix(tree.Path, "src/"))
- }
-
- // Generate the code.
- buf := bytes.NewBuffer(nil)
-
- err = packageTemplate.Execute(buf, struct {
- Timestamp time.Time
- StdPkg []string
- }{
- Timestamp: time.Now().UTC(),
- StdPkg: stdPkgs,
- })
- if err != nil {
- fmt.Println("Error when generating the code:", err)
- return
- }
-
- writeOnDemand(buf.Bytes(), outputFile)
-}
-
-func skipPath(path string) bool {
- for _, exclude := range excludedPaths {
- if strings.HasPrefix(path, exclude) {
- return true
- }
- }
- return false
-}
diff --git a/gen/client.go b/gen/client.go
new file mode 100644
index 0000000..9e5258f
--- /dev/null
+++ b/gen/client.go
@@ -0,0 +1,33 @@
+// This file is part of GoRE.
+//
+// Copyright (C) 2019-2024 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+package main
+
+import (
+ "os"
+
+ "github.com/google/go-github/v58/github"
+)
+
+var githubClient = github.NewClient(nil)
+
+func init() {
+ token := os.Getenv("GITHUB_TOKEN")
+ if token != "" {
+ githubClient = githubClient.WithAuthToken(token)
+ }
+}
diff --git a/gen/gen.go b/gen/gen.go
new file mode 100644
index 0000000..a89fdd7
--- /dev/null
+++ b/gen/gen.go
@@ -0,0 +1,44 @@
+// This file is part of GoRE.
+//
+// Copyright (C) 2019-2024 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+// This program generates stdpkgs_gen.go, goversion_gen.go and moduledata_gen.go. It can be invoked by running
+// go generate
+
+package main
+
+import (
+ "fmt"
+ "os"
+)
+
+func main() {
+ if len(os.Args) != 2 {
+ fmt.Println("go run ./gen [stdpkgs|goversion|moduledata]")
+ return
+ }
+
+ switch os.Args[1] {
+ case "stdpkgs":
+ generateStdPkgs()
+ case "goversion":
+ generateGoVersions()
+ case "moduledata":
+ generateModuleData()
+ default:
+ fmt.Println("go run ./gen [stdpkgs|goversion|moduledata]")
+ }
+}
diff --git a/gen/goversion.go b/gen/goversion.go
new file mode 100644
index 0000000..46362c9
--- /dev/null
+++ b/gen/goversion.go
@@ -0,0 +1,132 @@
+// This file is part of GoRE.
+//
+// Copyright (C) 2019-2024 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+package main
+
+import (
+ "bytes"
+ "context"
+ "encoding/csv"
+ "fmt"
+ "github.com/google/go-github/v58/github"
+ "io"
+ "os"
+ "sort"
+ "strings"
+ "time"
+)
+
+func generateGoVersions() {
+ ctx := context.Background()
+
+ opts := &github.ListOptions{PerPage: 100}
+ var allTags []*github.RepositoryTag
+ for {
+ tags, resp, err := githubClient.Repositories.ListTags(ctx, "golang", "go", opts)
+ if err != nil {
+ fmt.Println(err)
+ return
+ }
+ allTags = append(allTags, tags...)
+ if resp.NextPage == 0 {
+ break
+ }
+ opts.Page = resp.NextPage
+ }
+
+ f, err := os.OpenFile(goversionCsv, os.O_CREATE|os.O_RDWR, 0664)
+ if err != nil {
+ fmt.Println("Error when opening goversions.csv:", err)
+ return
+ }
+ defer func(f *os.File) {
+ _ = f.Close()
+ }(f)
+
+ knownVersions, err := getCsvStoredGoversions(f)
+ if err != nil {
+ fmt.Println("Error when getting stored go versions:", err)
+ return
+ }
+
+ for _, tag := range allTags {
+ if strings.HasPrefix(tag.GetName(), "weekly") || strings.HasPrefix(tag.GetName(), "release") {
+ continue
+ }
+ if _, known := knownVersions[tag.GetName()]; known {
+ continue
+ }
+
+ commit, _, err := githubClient.Repositories.GetCommit(ctx, "golang", "go", tag.GetCommit().GetSHA(), nil)
+ if err != nil {
+ fmt.Println("Error when getting commit info:", err)
+ return
+ }
+
+ fmt.Println("New tag found:", tag.GetName())
+ knownVersions[tag.GetName()] = &goversion{Name: tag.GetName(), Sha: commit.GetSHA(), Date: commit.GetCommit().GetCommitter().GetDate().Format(time.RFC3339)}
+ }
+
+ sortedVersion := make([]*goversion, 0, len(knownVersions))
+ for _, ver := range knownVersions {
+ sortedVersion = append(sortedVersion, ver)
+ }
+
+ sort.Slice(sortedVersion, func(i, j int) bool {
+ time1, err := time.Parse(time.RFC3339, sortedVersion[i].Date)
+ if err != nil {
+ fmt.Println("Error when parsing time:", err)
+ return false
+ }
+ time2, err := time.Parse(time.RFC3339, sortedVersion[j].Date)
+ if err != nil {
+ fmt.Println("Error when parsing time:", err)
+ return false
+ }
+ return time1.Before(time2)
+ })
+
+ // Generate the code.
+
+ err = f.Truncate(0)
+ if err != nil {
+ fmt.Println("Error when truncating the file:", err)
+ return
+ }
+ _, _ = f.Seek(0, io.SeekStart)
+
+ cw := csv.NewWriter(f)
+ for _, ver := range sortedVersion {
+ _ = cw.Write([]string{ver.Name, ver.Sha, ver.Date})
+ }
+ cw.Flush()
+
+ buf := bytes.NewBuffer(nil)
+ err = goversionTemplate.Execute(buf, struct {
+ Timestamp time.Time
+ GoVersions []*goversion
+ }{
+ Timestamp: time.Now().UTC(),
+ GoVersions: sortedVersion,
+ })
+ if err != nil {
+ fmt.Println("Error when generating the code:", err)
+ return
+ }
+
+ writeOnDemand(buf.Bytes(), goversionOutputFile)
+}
diff --git a/gen/moduledata.go b/gen/moduledata.go
new file mode 100644
index 0000000..f5244b3
--- /dev/null
+++ b/gen/moduledata.go
@@ -0,0 +1,324 @@
+// This file is part of GoRE.
+//
+// Copyright (C) 2019-2024 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+package main
+
+import (
+ "bytes"
+ "context"
+ "fmt"
+ "github.com/google/go-github/v58/github"
+ "go/ast"
+ "go/format"
+ "go/parser"
+ "golang.org/x/mod/semver"
+ "os"
+ "regexp"
+ "sort"
+ "strconv"
+ "strings"
+)
+
+var moduleDataMatcher = regexp.MustCompile(`(?m:type moduledata struct {[^}]+})`)
+
+// generateModuleDataSources
+// returns a map of moduledata sources for each go version, from 1.5 to the latest we know so far.
+func getModuleDataSources() (map[int]string, error) {
+ ret := make(map[int]string)
+
+ f, err := os.OpenFile(goversionCsv, os.O_CREATE|os.O_RDWR, 0664)
+ if err != nil {
+ return nil, fmt.Errorf("error when opening goversions.csv: %w", err)
+ }
+ knownVersion, err := getCsvStoredGoversions(f)
+ if err != nil {
+ return nil, fmt.Errorf("error when getting stored go versions: %w", err)
+ }
+
+ knownVersionSlice := make([]string, 0, len(knownVersion))
+
+ matcher := regexp.MustCompile(`[a-zA-Z]`)
+ for ver := range knownVersion {
+ // rc/beta version not in consideration
+ if matcher.MatchString(ver[2:]) {
+ continue
+ }
+
+ knownVersionSlice = append(knownVersionSlice, semver.MajorMinor("v"+strings.TrimPrefix(ver, "go")))
+ }
+ semver.Sort(knownVersionSlice)
+
+ latest := knownVersionSlice[len(knownVersionSlice)-1]
+
+ maxMinor, err := strconv.Atoi(strings.Split(latest, ".")[1])
+ if err != nil {
+ return nil, fmt.Errorf("error when getting latest go version: %w, %s", err, latest)
+ }
+
+ for i := 5; i <= maxMinor; i++ {
+ fmt.Println("Fetching moduledata for go1." + strconv.Itoa(i) + "...")
+ branch := fmt.Sprintf("release-branch.go1.%d", i)
+ contents, _, _, err := githubClient.Repositories.GetContents(
+ context.Background(),
+ "golang", "go",
+ "src/runtime/symtab.go",
+ &github.RepositoryContentGetOptions{Ref: branch})
+ if err != nil {
+ return nil, err
+ }
+
+ content, err := contents.GetContent()
+ if err != nil {
+ return nil, err
+ }
+
+ structStr := moduleDataMatcher.FindString(content)
+ if structStr == "" {
+ return nil, fmt.Errorf("moduledata struct not found in symtab.go")
+ }
+
+ // make it an expression for further parse
+ structStr = strings.TrimPrefix(structStr, "type moduledata ")
+
+ ret[i] = structStr
+ }
+
+ return ret, nil
+}
+
+type moduleDataGenerator struct {
+ buf *bytes.Buffer
+
+ knownVersions []int
+}
+
+func (g *moduleDataGenerator) init() {
+ g.buf = &bytes.Buffer{}
+ g.buf.WriteString(moduleDataHeader)
+}
+
+func (g *moduleDataGenerator) add(versionCode int, code string) error {
+ g.knownVersions = append(g.knownVersions, versionCode)
+
+ err := g.writeVersionedModuleData(versionCode, code)
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (g *moduleDataGenerator) writeSelector() {
+ g.writeln("func selectModuleData(v int, bits int) (modulable,error) {")
+ g.writeln("switch {")
+
+ for _, versionCode := range g.knownVersions {
+ for _, bits := range []int{32, 64} {
+ g.writeln("case v == %d && bits == %d:", versionCode, bits)
+ g.writeln("return &%s{}, nil", g.generateTypeName(versionCode, bits))
+ }
+ }
+ g.writeln("default:")
+ g.writeln(`return nil, fmt.Errorf("unsupported version %%d and bits %%d", v, bits)`)
+
+ g.writeln("}\n}\n")
+
+}
+
+func (*moduleDataGenerator) generateTypeName(versionCode int, bits int) string {
+ return fmt.Sprintf("moduledata_1_%d_%d", versionCode, bits)
+}
+
+func (*moduleDataGenerator) wrapValue(name string, bits int) string {
+ if bits == 32 {
+ return fmt.Sprintf("uint64(%s)", name)
+ }
+ return name
+}
+
+func (*moduleDataGenerator) title(s string) string {
+ return strings.ToUpper(s[:1]) + s[1:]
+}
+
+func (g *moduleDataGenerator) writeln(format string, a ...interface{}) {
+ _, _ = fmt.Fprintf(g.buf, format+"\n", a...)
+}
+
+func (g *moduleDataGenerator) writeVersionedModuleData(versionCode int, code string) error {
+ expr, err := parser.ParseExpr(code)
+ if err != nil {
+ return fmt.Errorf("failed to parse moduledata expression: %w", err)
+ }
+ structExpr, ok := expr.(*ast.StructType)
+ if !ok {
+ return fmt.Errorf("failed to parse moduledata expression")
+ }
+
+ writeCode := func(bits int) {
+ g.writeln("type %s struct {\n", g.generateTypeName(versionCode, bits))
+
+ knownFields := make(map[string]struct{})
+ search:
+ for _, field := range structExpr.Fields.List {
+ if len(field.Names) == 0 {
+ // skip anonymous field
+ // currently only sys.NotInHeap
+ continue
+ }
+
+ for _, name := range field.Names {
+ if name.Name == "modulename" {
+ // no more data needed
+ break search
+ }
+ knownFields[name.Name] = struct{}{}
+
+ switch t := field.Type.(type) {
+ case *ast.StarExpr:
+ g.writeln("%s uint%d", g.title(name.Name), bits)
+ case *ast.ArrayType:
+ g.writeln("%s, %[1]slen, %[1]scap uint%d", g.title(name.Name), bits)
+ case *ast.Ident:
+ switch t.Name {
+ case "uintptr":
+ g.writeln("%s uint%d", g.title(name.Name), bits)
+ case "string":
+ g.writeln("%s, %[1]slen uint%d", g.title(name.Name), bits)
+ case "uint8":
+ g.writeln("%s uint8", g.title(name.Name))
+ default:
+ panic(fmt.Sprintf("unhandled type: %+v", t))
+ }
+ default:
+ panic(fmt.Sprintf("unhandled type: %+v", t))
+ }
+ }
+ }
+
+ g.writeln("}\n\n")
+
+ // generate toModuledata method
+ exist := func(name ...string) bool {
+ for _, n := range name {
+ if _, ok := knownFields[n]; !ok {
+ return false
+ }
+ }
+ return true
+ }
+
+ g.writeln("func (md %s) toModuledata() moduledata {", g.generateTypeName(versionCode, bits))
+ g.writeln("return moduledata{")
+
+ if exist("text", "etext") {
+ g.writeln("TextAddr: %s,", g.wrapValue("md.Text", bits))
+ g.writeln("TextLen: %s,", g.wrapValue("md.Etext - md.Text", bits))
+ }
+
+ if exist("noptrdata", "enoptrdata") {
+ g.writeln("NoPtrDataAddr: %s,", g.wrapValue("md.Noptrdata", bits))
+ g.writeln("NoPtrDataLen: %s,", g.wrapValue("md.Enoptrdata - md.Noptrdata", bits))
+ }
+
+ if exist("data", "edata") {
+ g.writeln("DataAddr: %s,", g.wrapValue("md.Data", bits))
+ g.writeln("DataLen: %s,", g.wrapValue("md.Edata - md.Data", bits))
+ }
+
+ if exist("bss", "ebss") {
+ g.writeln("BssAddr: %s,", g.wrapValue("md.Bss", bits))
+ g.writeln("BssLen: %s,", g.wrapValue("md.Ebss - md.Bss", bits))
+ }
+
+ if exist("noptrbss", "enoptrbss") {
+ g.writeln("NoPtrBssAddr: %s,", g.wrapValue("md.Noptrbss", bits))
+ g.writeln("NoPtrBssLen: %s,", g.wrapValue("md.Enoptrbss - md.Noptrbss", bits))
+ }
+
+ if exist("types", "etypes") {
+ g.writeln("TypesAddr: %s,", g.wrapValue("md.Types", bits))
+ g.writeln("TypesLen: %s,", g.wrapValue("md.Etypes - md.Types", bits))
+ }
+
+ if exist("typelinks") {
+ g.writeln("TypelinkAddr: %s,", g.wrapValue("md.Typelinks", bits))
+ g.writeln("TypelinkLen: %s,", g.wrapValue("md.Typelinkslen", bits))
+ }
+
+ if exist("itablinks") {
+ g.writeln("ITabLinkAddr: %s,", g.wrapValue("md.Itablinks", bits))
+ g.writeln("ITabLinkLen: %s,", g.wrapValue("md.Itablinkslen", bits))
+ }
+
+ if exist("ftab") {
+ g.writeln("FuncTabAddr: %s,", g.wrapValue("md.Ftab", bits))
+ g.writeln("FuncTabLen: %s,", g.wrapValue("md.Ftablen", bits))
+ }
+
+ if exist("pclntable") {
+ g.writeln("PCLNTabAddr: %s,", g.wrapValue("md.Pclntable", bits))
+ g.writeln("PCLNTabLen: %s,", g.wrapValue("md.Pclntablelen", bits))
+ }
+
+ if exist("gofunc") {
+ g.writeln("GoFuncVal: %s,", g.wrapValue("md.Gofunc", bits))
+ }
+
+ g.writeln("}\n}\n")
+ }
+
+ writeCode(32)
+ writeCode(64)
+
+ return nil
+}
+
+func generateModuleData() {
+ sources, err := getModuleDataSources()
+ if err != nil {
+ panic(err)
+ }
+
+ g := moduleDataGenerator{}
+ g.init()
+
+ versionCodes := make([]int, 0, len(sources))
+ for versionCode := range sources {
+ versionCodes = append(versionCodes, versionCode)
+ }
+
+ sort.Ints(versionCodes)
+
+ for _, versionCode := range versionCodes {
+ err = g.add(versionCode, sources[versionCode])
+ if err != nil {
+ panic(err)
+ }
+ }
+
+ g.writeSelector()
+
+ out, err := format.Source(g.buf.Bytes())
+ if err != nil {
+ panic(err)
+ }
+
+ err = os.WriteFile(moduleDataOutputFile, out, 0o666)
+ if err != nil {
+ panic(err)
+ }
+}
diff --git a/gen/static.go b/gen/static.go
new file mode 100644
index 0000000..aebc26b
--- /dev/null
+++ b/gen/static.go
@@ -0,0 +1,116 @@
+// This file is part of GoRE.
+//
+// Copyright (C) 2019-2024 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+package main
+
+import (
+ "path/filepath"
+ "text/template"
+)
+
+var packageTemplate = template.Must(template.New("").Parse(`// This file is part of GoRE.
+//
+// Copyright (C) 2019-2021 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+// Code generated by go generate; DO NOT EDIT.
+// This file was generated at
+// {{ .Timestamp }}
+
+package gore
+
+var stdPkgs = map[string]struct{}{
+{{- range .StdPkg }}
+ {{ printf "\"%s\": {}" . }},
+{{- end }}
+}
+`))
+
+var goversionTemplate = template.Must(template.New("").Parse(`// This file is part of GoRE.
+//
+// Copyright (C) 2019-2021 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+// Code generated by go generate; DO NOT EDIT.
+// This file was generated at
+// {{ .Timestamp }}
+
+package gore
+
+var goversions = map[string]*GoVersion{
+{{- range .GoVersions }}
+ {{ printf "\"%s\": {Name: \"%s\", SHA: \"%s\", Timestamp: \"%s\"}" .Name .Name .Sha .Date }},
+{{- end }}
+}
+`))
+
+const moduleDataHeader = `
+// This file is part of GoRE.
+//
+// Copyright (C) 2019-2023 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+// Code generated by go generate; DO NOT EDIT.
+
+package gore
+
+import "fmt"
+
+`
+
+var (
+ goversionCsv = filepath.Join(getSourceDir(), "resources", "goversions.csv")
+ outputFile = filepath.Join(getSourceDir(), "stdpkg_gen.go")
+ goversionOutputFile = filepath.Join(getSourceDir(), "goversion_gen.go")
+ moduleDataOutputFile = filepath.Join(getSourceDir(), "moduledata_gen.go")
+)
diff --git a/gen/stdpkgs.go b/gen/stdpkgs.go
new file mode 100644
index 0000000..acc7a63
--- /dev/null
+++ b/gen/stdpkgs.go
@@ -0,0 +1,121 @@
+// This file is part of GoRE.
+//
+// Copyright (C) 2019-2024 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+package main
+
+import (
+ "bytes"
+ "context"
+ "fmt"
+ "os"
+ "sort"
+ "strings"
+ "sync"
+ "time"
+)
+
+func generateStdPkgs() {
+ wg := &sync.WaitGroup{}
+ collect := func(ctx context.Context, cause context.CancelCauseFunc, tag string, result chan []string) {
+ tree, _, err := githubClient.Git.GetTree(ctx, "golang", "go", tag, true)
+ if err != nil {
+ cause(fmt.Errorf("error when getting tree for tag %s: %w", tag, err))
+ return
+ }
+
+ fmt.Println("Fetched std pkgs for tag:", tag)
+
+ if len(tree.Entries) == 100000 {
+ fmt.Printf("Warning: tree %s has 100000 entries, this may be limited by api, some might be missing", tag)
+ }
+
+ var stdPkgs []string
+
+ for _, entry := range tree.Entries {
+ if *entry.Type != "tree" {
+ continue
+ }
+
+ if !strings.HasPrefix(entry.GetPath(), "src/") ||
+ strings.HasPrefix(entry.GetPath(), "src/cmd") ||
+ strings.HasSuffix(entry.GetPath(), "_asm") ||
+ strings.Contains(entry.GetPath(), "/testdata") {
+ continue
+ }
+
+ stdPkgs = append(stdPkgs, strings.TrimPrefix(entry.GetPath(), "src/"))
+ }
+ result <- stdPkgs
+ wg.Done()
+ }
+
+ f, err := os.OpenFile(goversionCsv, os.O_CREATE|os.O_RDWR, 0664)
+ if err != nil {
+ fmt.Println("Error when opening goversions.csv:", err)
+ return
+ }
+ defer func(f *os.File) {
+ _ = f.Close()
+ }(f)
+ knownVersions, err := getCsvStoredGoversions(f)
+ wg.Add(len(knownVersions))
+
+ stdpkgsSet := map[string]struct{}{}
+
+ ctx, cause := context.WithCancelCause(context.Background())
+ pkgsChan := make(chan []string)
+
+ for tag := range knownVersions {
+ go collect(ctx, cause, tag, pkgsChan)
+ }
+
+ go func() {
+ wg.Wait()
+ close(pkgsChan)
+ }()
+
+ for pkgs := range pkgsChan {
+ for _, pkg := range pkgs {
+ stdpkgsSet[pkg] = struct{}{}
+ }
+ }
+
+ pkgs := make([]string, 0, len(stdpkgsSet))
+ for pkg := range stdpkgsSet {
+ pkgs = append(pkgs, pkg)
+ }
+ sort.Slice(pkgs, func(i, j int) bool {
+ return pkgs[i] < pkgs[j]
+ })
+
+ // Generate the code.
+ buf := bytes.NewBuffer(nil)
+
+ err = packageTemplate.Execute(buf, struct {
+ Timestamp time.Time
+ StdPkg []string
+ }{
+ Timestamp: time.Now().UTC(),
+ StdPkg: pkgs,
+ })
+ if err != nil {
+ fmt.Println("Error when generating the code:", err)
+ return
+ }
+
+ writeOnDemand(buf.Bytes(), outputFile)
+}
diff --git a/gen/types.go b/gen/types.go
new file mode 100644
index 0000000..6ddaec0
--- /dev/null
+++ b/gen/types.go
@@ -0,0 +1,24 @@
+// This file is part of GoRE.
+//
+// Copyright (C) 2019-2024 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+package main
+
+type goversion struct {
+ Name string
+ Sha string
+ Date string
+}
diff --git a/gen/utils.go b/gen/utils.go
new file mode 100644
index 0000000..8dca033
--- /dev/null
+++ b/gen/utils.go
@@ -0,0 +1,101 @@
+// This file is part of GoRE.
+//
+// Copyright (C) 2019-2024 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+package main
+
+import (
+ "encoding/csv"
+ "fmt"
+ "go/format"
+ "os"
+ "path/filepath"
+ "runtime"
+ "strings"
+)
+
+// diffCode returns false if a and b have different other than the date.
+func diffCode(a, b string) bool {
+ if a == b {
+ return false
+ }
+
+ aLines := strings.Split(a, "\n")
+ bLines := strings.Split(b, "\n")
+
+ // ignore the license and the date
+ aLines = aLines[21:]
+ bLines = bLines[21:]
+
+ if len(aLines) != len(bLines) {
+ return true
+ }
+
+ for i := 0; i < len(aLines); i++ {
+ if aLines[i] != bLines[i] {
+ return true
+ }
+ }
+
+ return false
+}
+
+func writeOnDemand(new []byte, target string) {
+ old, err := os.ReadFile(target)
+ if err != nil {
+ fmt.Println("Error when reading the old file:", target, err)
+ return
+ }
+
+ old, _ = format.Source(old)
+ new, _ = format.Source(new)
+
+ // Compare the old and the new.
+ if !diffCode(string(old), string(new)) {
+ fmt.Println(target + " no changes.")
+ return
+ }
+
+ fmt.Println(target + " changes detected.")
+
+ // Write the new file.
+ err = os.WriteFile(target, new, 0664)
+ if err != nil {
+ fmt.Println("Error when writing the new file:", err)
+ return
+ }
+}
+
+func getSourceDir() string {
+ _, filename, _, ok := runtime.Caller(0)
+ if !ok {
+ panic("No caller information")
+ }
+ return filepath.Join(filepath.Dir(filename), "..")
+}
+
+func getCsvStoredGoversions(f *os.File) (map[string]*goversion, error) {
+ vers := make(map[string]*goversion)
+ c, err := csv.NewReader(f).ReadAll()
+ if err != nil {
+ return nil, err
+ }
+ for _, line := range c {
+ vers[line[0]] = &goversion{Name: line[0], Sha: line[1], Date: line[2]}
+ }
+
+ return vers, err
+}
diff --git a/go.mod b/go.mod
index 9ff3ed4..db3f5bf 100644
--- a/go.mod
+++ b/go.mod
@@ -3,6 +3,7 @@ module github.com/goretk/gore
go 1.21
require (
+ github.com/google/go-github/v58 v58.0.0
github.com/stretchr/testify v1.8.4
golang.org/x/arch v0.6.0
golang.org/x/mod v0.14.0
@@ -10,6 +11,7 @@ require (
require (
github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/google/go-querystring v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
diff --git a/go.sum b/go.sum
index 065e681..5349b46 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,12 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
+github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/go-github/v58 v58.0.0 h1:Una7GGERlF/37XfkPwpzYJe0Vp4dt2k1kCjlxwjIvzw=
+github.com/google/go-github/v58 v58.0.0/go.mod h1:k4hxDKEfoWpSqFlc8LTpGd9fu2KrV1YAa6Hi6FmDNY4=
+github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
+github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
@@ -8,6 +15,7 @@ golang.org/x/arch v0.6.0 h1:S0JTfE48HbRj80+4tbvZDYsJ3tGv6BUU3XxyZ7CirAc=
golang.org/x/arch v0.6.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
diff --git a/goroot.go b/goroot.go
index 63107e9..6d5efde 100644
--- a/goroot.go
+++ b/goroot.go
@@ -219,7 +219,7 @@ func tryFromTimeInit(f *GoFile) (string, error) {
is32 = true
}
- // Find time.init function.
+ // Find time.initPackages function.
var fcn *Function
std, err := f.GetSTDLib()
if err != nil {
@@ -232,7 +232,7 @@ pkgLoop:
continue
}
for _, vv := range v.Functions {
- if vv.Name != "init" {
+ if vv.Name != "initPackages" {
continue
}
fcn = vv
diff --git a/goversion.go b/goversion.go
index befff42..a11d5bd 100644
--- a/goversion.go
+++ b/goversion.go
@@ -15,10 +15,13 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+//go:generate go run ./gen goversion
+
package gore
import (
"bytes"
+ "errors"
"regexp"
"strings"
@@ -26,7 +29,7 @@ import (
"golang.org/x/mod/semver"
)
-var goVersionMatcher = regexp.MustCompile(`(go[\d+\.]*(beta|rc)?[\d*])`)
+var goVersionMatcher = regexp.MustCompile(`(go[\d+.]*(beta|rc)?[\d*])`)
// GoVersion holds information about the compiler version.
type GoVersion struct {
@@ -85,21 +88,21 @@ func findGoCompilerVersion(f *GoFile) (*GoVersion, error) {
// version string.
data, err := f.fh.getRData()
- // If read only data section does not exist, try text.
- if err == ErrSectionDoesNotExist {
- data, err = f.fh.getCodeSection()
+ // If a read-only data section does not exist, try text.
+ if errors.Is(err, ErrSectionDoesNotExist) {
+ _, data, err = f.fh.getCodeSection()
}
if err != nil {
return nil, err
}
- notfound := false
- for !notfound {
+
+ for {
version := matchGoVersionString(data)
if version == "" {
return nil, ErrNoGoVersionFound
}
ver := ResolveGoVersion(version)
- // Go before 1.4 does not have the version string so if we have found
+ // Go before 1.4 does not have the version string, so if we have found
// a version string below 1.4beta1 it is a false positive.
if ver == nil || GoVersionCompare(ver.Name, "go1.4beta1") < 0 {
off := bytes.Index(data, []byte(version))
@@ -120,7 +123,7 @@ func findGoCompilerVersion(f *GoFile) (*GoVersion, error) {
// used to identify the version.
// The function returns nil if no version is found.
func tryFromSchedInit(f *GoFile) *GoVersion {
- // Check for non supported architectures.
+ // Check for non-supported architectures.
if f.FileInfo.Arch != Arch386 && f.FileInfo.Arch != ArchAMD64 {
return nil
}
diff --git a/macho.go b/macho.go
index 7f6f899..5337b7f 100644
--- a/macho.go
+++ b/macho.go
@@ -44,11 +44,11 @@ type machoFile struct {
osFile *os.File
}
-func (m *machoFile) GetParsedFile() any {
+func (m *machoFile) getParsedFile() any {
return m.file
}
-func (m *machoFile) GetFile() *os.File {
+func (m *machoFile) getFile() *os.File {
return m.osFile
}
@@ -78,9 +78,8 @@ func (m *machoFile) getRData() ([]byte, error) {
return data, err
}
-func (m *machoFile) getCodeSection() ([]byte, error) {
- _, data, err := m.getSectionData("__text")
- return data, err
+func (m *machoFile) getCodeSection() (uint64, []byte, error) {
+ return m.getSectionData("__text")
}
func (m *machoFile) getSectionDataFromOffset(off uint64) (uint64, []byte, error) {
@@ -137,7 +136,7 @@ func (m *machoFile) moduledataSection() string {
}
func (m *machoFile) getBuildID() (string, error) {
- data, err := m.getCodeSection()
+ _, data, err := m.getCodeSection()
if err != nil {
return "", fmt.Errorf("failed to get code section: %w", err)
}
diff --git a/modinfo.go b/modinfo.go
index 98f8f59..7668841 100644
--- a/modinfo.go
+++ b/modinfo.go
@@ -39,7 +39,7 @@ type BuildInfo struct {
}
func (f *GoFile) extractBuildInfo() (*BuildInfo, error) {
- info, err := buildinfo.Read(f.fh.GetFile())
+ info, err := buildinfo.Read(f.fh.getFile())
if err != nil {
return nil, fmt.Errorf("error when extracting build information: %w", err)
}
diff --git a/moduledata.go b/moduledata.go
index 8f00952..ab1b901 100644
--- a/moduledata.go
+++ b/moduledata.go
@@ -1,6 +1,6 @@
// This file is part of GoRE.
//
-// Copyright (C) 2019-2022 GoRE Authors
+// Copyright (C) 2019-2023 GoRE Authors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
@@ -17,32 +17,19 @@
package gore
+//go:generate go run ./gen moduledata
+
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
+ "golang.org/x/mod/semver"
"io"
- "reflect"
+ "strconv"
+ "strings"
)
-// Moduledata extracts the file's moduledata.
-func (f *GoFile) Moduledata() (Moduledata, error) {
- // We need the Go version to be defined to find the module data.
- ver, err := f.GetCompilerVersion()
- if err != nil {
- return nil, fmt.Errorf("could not get the Go version for the moduledata extraction: %w", err)
- }
- f.FileInfo.goversion = ver
-
- md, err := parseModuledata(f.FileInfo, f.fh)
- if err != nil {
- return nil, fmt.Errorf("error when parsing the moduledata: %w", err)
- }
-
- return md, nil
-}
-
// Moduledata holds information about the layout of the executable image in memory.
type Moduledata interface {
// Text returns the text secion.
@@ -87,7 +74,7 @@ type moduledata struct {
fh fileHandler
}
-// Text returns the text secion.
+// Text returns the text section.
func (m moduledata) Text() ModuleDataSection {
return ModuleDataSection{
Address: m.TextAddr,
@@ -198,7 +185,7 @@ func (m moduledata) GoFuncValue() uint64 {
// ModuleDataSection is a section defined in the Moduledata structure.
type ModuleDataSection struct {
- // Address is the virtual address where the section start.
+ // Address is the virtual address where the section starts.
Address uint64
// Length is the byte length for the data in this section.
Length uint64
@@ -224,691 +211,115 @@ func (m ModuleDataSection) Data() ([]byte, error) {
return buf, nil
}
-func findModuledata(f fileHandler) ([]byte, error) {
- _, secData, err := f.getSectionData(f.moduledataSection())
+func buildPclnTabAddrBinary(addr uint64) ([]byte, error) {
+ buf := new(bytes.Buffer)
+ err := binary.Write(buf, binary.LittleEndian, &addr)
if err != nil {
return nil, err
}
- tabAddr, _, err := f.getPCLNTABData()
- if err != nil {
- return nil, err
+ return buf.Bytes()[:intSize32], nil
+}
+
+func pickVersionedModuleData(info FileInfo) (modulable, error) {
+ var bits int
+ if info.WordSize == intSize32 {
+ bits = 32
+ } else {
+ bits = 64
}
- // Search for moduledata
- buf := new(bytes.Buffer)
- err = binary.Write(buf, binary.LittleEndian, &tabAddr)
+ ver := buildSemVerString(info.goversion.Name)
+ m := semver.MajorMinor(ver)
+ verBit, err := strconv.Atoi(strings.Split(m, ".")[1])
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("error when parsing the Go version: %w", err)
}
- off := bytes.Index(secData, buf.Bytes()[:intSize32])
- if off == -1 {
- return nil, errors.New("could not find moduledata")
+ // buf will hold the struct type that represents the data in the file we are processing.
+ buf, err := selectModuleData(verBit, bits)
+ if err != nil {
+ return nil, fmt.Errorf("error when selecting the module data: %w", err)
}
- // TODO: Verify that hit is correct.
- return secData[off : off+0x300], nil
+ return buf, nil
}
-func parseModuledata(fileInfo *FileInfo, f fileHandler) (moduledata, error) {
- data, err := findModuledata(f)
+func extractModuledata(fileInfo *FileInfo, f fileHandler) (moduledata, error) {
+ vmd, err := pickVersionedModuleData(*fileInfo)
if err != nil {
return moduledata{}, err
}
- // buf will hold the struct type that represents the data in the file we are processing.
- var buf interface{}
- is32bit := fileInfo.WordSize == intSize32
-
- // Determine what kind of struct we need to extract the module data from the file.
+ vmdSize := binary.Size(vmd)
- if GoVersionCompare("go1.20rc1", fileInfo.goversion.Name) <= 0 {
- if is32bit {
- buf = &moduledata2032{}
- } else {
- buf = &moduledata2064{}
- }
- } else if GoVersionCompare("go1.18beta1", fileInfo.goversion.Name) <= 0 {
- if is32bit {
- buf = &moduledata1832{}
- } else {
- buf = &moduledata1864{}
- }
- } else if GoVersionCompare("go1.16beta1", fileInfo.goversion.Name) <= 0 {
- if is32bit {
- buf = &moduledata1632{}
- } else {
- buf = &moduledata1664{}
- }
- } else if GoVersionCompare("go1.8beta1", fileInfo.goversion.Name) <= 0 {
- if is32bit {
- buf = &moduledata832{}
- } else {
- buf = &moduledata864{}
- }
- } else if GoVersionCompare("go1.7beta1", fileInfo.goversion.Name) <= 0 {
- if is32bit {
- buf = &moduledata732{}
- } else {
- buf = &moduledata764{}
- }
- } else {
- if is32bit {
- buf = &moduledata532{}
- } else {
- buf = &moduledata564{}
- }
+ _, secData, err := f.getSectionData(f.moduledataSection())
+ if err != nil {
+ return moduledata{}, err
}
-
- // Read the module struct from the file.
- r := bytes.NewReader(data)
- err = readStruct(r, fileInfo.ByteOrder, buf)
+ tabAddr, _, err := f.getPCLNTABData()
if err != nil {
- return moduledata{}, fmt.Errorf("error when reading module data from file: %w", err)
+ return moduledata{}, err
}
- // Convert the read struct to the type we return to the caller.
- md, err := processModuledata(buf)
+ magic, err := buildPclnTabAddrBinary(tabAddr)
if err != nil {
- return md, fmt.Errorf("error when processing module data: %w", err)
+ return moduledata{}, err
}
- // Add the file handler.
- md.fh = f
-
- return md, nil
-}
-
-func readUIntTo64(r io.Reader, byteOrder binary.ByteOrder, is32bit bool) (uint64, error) {
- if is32bit {
- var addr uint32
- err := binary.Read(r, byteOrder, &addr)
- return uint64(addr), err
+search:
+ off := bytes.Index(secData, magic)
+ if off == -1 || len(secData) < off+vmdSize {
+ return moduledata{}, errors.New("could not find moduledata")
}
- var addr uint64
- err := binary.Read(r, byteOrder, &addr)
- return addr, err
-}
-// readStruct performs a binary read from the reader to the data object. Data object must
-// be a pointer to the struct.
-func readStruct(r io.Reader, byteOrder binary.ByteOrder, data interface{}) error {
- return binary.Read(r, byteOrder, data)
-}
+ data := secData[off : off+vmdSize]
-func processModuledata(data interface{}) (moduledata, error) {
- md := moduledata{}
- // This will panic if the data passed in is not a pointer to
- // a struct. But this function should not be called outside
- // of this file, we can ensure this is always the case.
- val := reflect.ValueOf(data).Elem()
-
- extractModFieldValue(&md, "TextAddr", val, "Text")
- extractModFieldValue(&md, "TextLen", val, "Etext")
- if md.TextLen > md.TextAddr {
- md.TextLen = md.TextLen - md.TextAddr
+ // Read the module struct from the file.
+ r := bytes.NewReader(data)
+ err = binary.Read(r, fileInfo.ByteOrder, vmd)
+ if err != nil {
+ return moduledata{}, fmt.Errorf("error when reading module data from file: %w", err)
}
- extractModFieldValue(&md, "NoPtrDataAddr", val, "Noptrdata")
- extractModFieldValue(&md, "NoPtrDataLen", val, "Enoptrdata")
- if md.NoPtrDataLen > md.NoPtrDataAddr {
- md.NoPtrDataLen = md.NoPtrDataLen - md.NoPtrDataAddr
- }
+ // Convert the read struct to the type we return to the caller.
+ md := vmd.toModuledata()
- extractModFieldValue(&md, "DataAddr", val, "Data")
- extractModFieldValue(&md, "DataLen", val, "Edata")
- if md.DataLen > md.DataAddr {
- md.DataLen = md.DataLen - md.DataAddr
- }
+ // Take a simple validation step to ensure that the moduledata is valid.
+ text := md.TextAddr
+ etext := md.TextAddr + md.TextLen
- extractModFieldValue(&md, "BssAddr", val, "Bss")
- extractModFieldValue(&md, "BssLen", val, "Ebss")
- if md.BssLen > md.BssAddr {
- md.BssLen = md.BssLen - md.BssAddr
+ textSectAddr, textSect, err := f.getCodeSection()
+ if err != nil {
+ return moduledata{}, err
}
-
- extractModFieldValue(&md, "NoPtrBssAddr", val, "Noptrbss")
- extractModFieldValue(&md, "NoPtrBssLen", val, "Enoptrbss")
- if md.NoPtrBssLen > md.NoPtrBssAddr {
- md.NoPtrBssLen = md.NoPtrBssLen - md.NoPtrBssAddr
+ if text > etext {
+ goto invalidMD
}
- extractModFieldValue(&md, "TypelinkAddr", val, "Typelinks")
- extractModFieldValue(&md, "TypelinkLen", val, "Typelinkslen")
- extractModFieldValue(&md, "ITabLinkAddr", val, "Itablinks")
- extractModFieldValue(&md, "ITabLinkLen", val, "Itablinkslen")
- extractModFieldValue(&md, "FuncTabAddr", val, "Ftab")
- extractModFieldValue(&md, "FuncTabLen", val, "Ftablen")
- extractModFieldValue(&md, "PCLNTabAddr", val, "Pclntable")
- extractModFieldValue(&md, "PCLNTabLen", val, "Pclntablelen")
-
- extractModFieldValue(&md, "TypesAddr", val, "Types")
- extractModFieldValue(&md, "TypesLen", val, "Etypes")
- if md.TypesLen > md.TypesAddr {
- md.TypesLen = md.TypesLen - md.TypesAddr
+ if !(textSectAddr <= text && text < textSectAddr+uint64(len(textSect))) {
+ goto invalidMD
}
- extractModFieldValue(&md, "GoFuncVal", val, "GoFunc")
+ // Add the file handler.
+ md.fh = f
return md, nil
-}
-
-func extractModFieldValue(md *moduledata, dst string, val reflect.Value, src string) {
- field := val.FieldByName(src)
- // Not all versions of the module struct has all the fields. If we don't have the
- // field, we skip it.
- if !field.IsValid() {
- return
- }
-
- // Save 32 to 64 uint casting if needed.
- var num uint64
- switch field.Interface().(type) {
- case uint64:
- num = field.Uint()
- case uint32:
- t := field.Interface().(uint32)
- num = uint64(t)
- }
-
- // Set the value.
- mdField := reflect.ValueOf(md).Elem().FieldByName(dst)
- mdField.SetUint(num)
-}
-
-/*
- Internal module structures from Go's runtime.
-*/
-
-// Moduledata structure for Go 1.20 and newer
-
-type moduledata2064 struct {
- PcHeader uint64
- Funcnametab, Funcnametablen, Funcnametabcap uint64
- Cutab, Cutablen, Cutabcap uint64
- Filetab, Filetablen, Filetabcap uint64
- Pctab, Pctablen, Pctabcap uint64
- Pclntable, Pclntablelen, Pclntablecap uint64
- Ftab, Ftablen, Ftabcap uint64
- Findfunctab uint64
- Minpc, Maxpc uint64
-
- Text, Etext uint64
- Noptrdata, Enoptrdata uint64
- Data, Edata uint64
- Bss, Ebss uint64
- Noptrbss, Enoptrbss uint64
- Covctrs, Ecovctrs uint64
- End, Gcdata, Gcbss uint64
- Types, Etypes uint64
- RData uint64
- GoFunc uint64
-
- Textsectmap, Textsectmaplen, Textsectmapcap uint64
- Typelinks, Typelinkslen, Typelinkscap uint64 // offsets from types
- Itablinks, Itablinkslen, Itablinkscap uint64
-
- Ptab, Ptablen, Ptabcap uint64
-
- Pluginpath, Pluginpathlen uint64
- Pkghashes, Pkghasheslen, Pkghashescap uint64
-
- Modulename, Modulenamelen uint64
- Modulehashes, Modulehasheslen, Modulehashescap uint64
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- hasmain uint8 // 1 if module contains the main function, 0 otherwise
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- bad bool // module failed to load and should be ignored
-
- next *moduledata
- */
+invalidMD:
+ secData = secData[off+1:]
+ goto search
}
-type moduledata2032 struct {
- PcHeader uint32
- Funcnametab, Funcnametablen, Funcnametabcap uint32
- Cutab, Cutablen, Cutabcap uint32
- Filetab, Filetablen, Filetabcap uint32
- Pctab, Pctablen, Pctabcap uint32
- Pclntable, Pclntablelen, Pclntablecap uint32
- Ftab, Ftablen, Ftabcap uint32
- Findfunctab uint32
- Minpc, Maxpc uint32
-
- Text, Etext uint32
- Noptrdata, Enoptrdata uint32
- Data, Edata uint32
- Bss, Ebss uint32
- Noptrbss, Enoptrbss uint32
- Covctrs, Ecovctrs uint32
- End, Gcdata, Gcbss uint32
- Types, Etypes uint32
- RData uint32
- GoFunc uint32
-
- Textsectmap, Textsectmaplen, Textsectmapcap uint32
- Typelinks, Typelinkslen, Typelinkscap uint32 // offsets from types
- Itablinks, Itablinkslen, Itablinkscap uint32
-
- Ptab, Ptablen, Ptabcap uint32
-
- Pluginpath, Pluginpathlen uint32
- Pkghashes, Pkghasheslen, Pkghashescap uint32
-
- Modulename, Modulenamelen uint32
- Modulehashes, Modulehasheslen, Modulehashescap uint32
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- hasmain uint8 // 1 if module contains the main function, 0 otherwise
-
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- bad bool // module failed to load and should be ignored
-
- next *moduledata
- */
-}
-
-// Moduledata structure for Go 1.18 and Go 1.19
-
-type moduledata1864 struct {
- PcHeader uint64
- Funcnametab, Funcnametablen, Funcnametabcap uint64
- Cutab, Cutablen, Cutabcap uint64
- Filetab, Filetablen, Filetabcap uint64
- Pctab, Pctablen, Pctabcap uint64
- Pclntable, Pclntablelen, Pclntablecap uint64
- Ftab, Ftablen, Ftabcap uint64
- Findfunctab uint64
- Minpc, Maxpc uint64
-
- Text, Etext uint64
- Noptrdata, Enoptrdata uint64
- Data, Edata uint64
- Bss, Ebss uint64
- Noptrbss, Enoptrbss uint64
- End, Gcdata, Gcbss uint64
- Types, Etypes uint64
- RData uint64
- GoFunc uint64
-
- Textsectmap, Textsectmaplen, Textsectmapcap uint64
- Typelinks, Typelinkslen, Typelinkscap uint64 // offsets from types
- Itablinks, Itablinkslen, Itablinkscap uint64
-
- Ptab, Ptablen, Ptabcap uint64
-
- Pluginpath, Pluginpathlen uint64
- Pkghashes, Pkghasheslen, Pkghashescap uint64
-
- Modulename, Modulenamelen uint64
- Modulehashes, Modulehasheslen, Modulehashescap uint64
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- hasmain uint8 // 1 if module contains the main function, 0 otherwise
-
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- bad bool // module failed to load and should be ignored
-
- next *moduledata
- */
-}
-
-type moduledata1832 struct {
- PcHeader uint32
- Funcnametab, Funcnametablen, Funcnametabcap uint32
- Cutab, Cutablen, Cutabcap uint32
- Filetab, Filetablen, Filetabcap uint32
- Pctab, Pctablen, Pctabcap uint32
- Pclntable, Pclntablelen, Pclntablecap uint32
- Ftab, Ftablen, Ftabcap uint32
- Findfunctab uint32
- Minpc, Maxpc uint32
-
- Text, Etext uint32
- Noptrdata, Enoptrdata uint32
- Data, Edata uint32
- Bss, Ebss uint32
- Noptrbss, Enoptrbss uint32
- End, Gcdata, Gcbss uint32
- Types, Etypes uint32
- RData uint32
- GoFunc uint32
-
- Textsectmap, Textsectmaplen, Textsectmapcap uint32
- Typelinks, Typelinkslen, Typelinkscap uint32 // offsets from types
- Itablinks, Itablinkslen, Itablinkscap uint32
-
- Ptab, Ptablen, Ptabcap uint32
-
- Pluginpath, Pluginpathlen uint32
- Pkghashes, Pkghasheslen, Pkghashescap uint32
-
- Modulename, Modulenamelen uint32
- Modulehashes, Modulehasheslen, Modulehashescap uint32
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- hasmain uint8 // 1 if module contains the main function, 0 otherwise
-
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- bad bool // module failed to load and should be ignored
-
- next *moduledata
- */
-}
-
-// Moduledata structure for Go 1.16 to 1.17
-
-type moduledata1664 struct {
- PcHeader uint64
- Funcnametab, Funcnametablen, Funcnametabcap uint64
- Cutab, Cutablen, Cutabcap uint64
- Filetab, Filetablen, Filetabcap uint64
- Pctab, Pctablen, Pctabcap uint64
- Pclntable, Pclntablelen, Pclntablecap uint64
- Ftab, Ftablen, Ftabcap uint64
- Findfunctab uint64
- Minpc, Maxpc uint64
-
- Text, Etext uint64
- Noptrdata, Enoptrdata uint64
- Data, Edata uint64
- Bss, Ebss uint64
- Noptrbss, Enoptrbss uint64
- End, Gcdata, Gcbss uint64
- Types, Etypes uint64
-
- Textsectmap, Textsectmaplen, Textsectmapcap uint64
- Typelinks, Typelinkslen, Typelinkscap uint64 // offsets from types
- Itablinks, Itablinkslen, Itablinkscap uint64
-
- Ptab, Ptablen, Ptabcap uint64
-
- Pluginpath, Pluginpathlen uint64
- Pkghashes, Pkghasheslen, Pkghashescap uint64
-
- Modulename, Modulenamelen uint64
- Modulehashes, Modulehasheslen, Modulehashescap uint64
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- hasmain uint8 // 1 if module contains the main function, 0 otherwise
-
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- bad bool // module failed to load and should be ignored
-
- next *moduledata
- */
-}
-
-type moduledata1632 struct {
- PcHeader uint32
- Funcnametab, Funcnametablen, Funcnametabcap uint32
- Cutab, Cutablen, Cutabcap uint32
- Filetab, Filetablen, Filetabcap uint32
- Pctab, Pctablen, Pctabcap uint32
- Pclntable, Pclntablelen, Pclntablecap uint32
- Ftab, Ftablen, Ftabcap uint32
- Findfunctab uint32
- Minpc, Maxpc uint32
-
- Text, Etext uint32
- Noptrdata, Enoptrdata uint32
- Data, Edata uint32
- Bss, Ebss uint32
- Noptrbss, Enoptrbss uint32
- End, Gcdata, Gcbss uint32
- Types, Etypes uint32
-
- Textsectmap, Textsectmaplen, Textsectmapcap uint32
- Typelinks, Typelinkslen, Typelinkscap uint32 // offsets from types
- Itablinks, Itablinkslen, Itablinkscap uint32
-
- Ptab, Ptablen, Ptabcap uint32
-
- Pluginpath, Pluginpathlen uint32
- Pkghashes, Pkghasheslen, Pkghashescap uint32
-
- Modulename, Modulenamelen uint32
- Modulehashes, Modulehasheslen, Modulehashescap uint32
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- hasmain uint8 // 1 if module contains the main function, 0 otherwise
-
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- bad bool // module failed to load and should be ignored
-
- next *moduledata
- */
-}
-
-// Moduledata structure for Go 1.8 to 1.15
-
-type moduledata864 struct {
- Pclntable, Pclntablelen, Pclntablecap uint64
- Ftab, Ftablen, Ftabcap uint64
- Filetab, Filetablen, Filetabcap uint64
- Findfunctab uint64
- Minpc, Maxpc uint64
-
- Text, Etext uint64
- Noptrdata, Enoptrdata uint64
- Data, Edata uint64
- Bss, Ebss uint64
- Noptrbss, Enoptrbss uint64
- End, Gcdata, Gcbss uint64
- Types, Etypes uint64
-
- Textsectmap, Textsectmaplen, Textsectmapcap uint64
- Typelinks, Typelinkslen, Typelinkscap uint64 // offsets from types
- Itablinks, Itablinkslen, Itablinkscap uint64
-
- Ptab, Ptablen, Ptabcap uint64
-
- Pluginpath, Pluginpathlen uint64
- Pkghashes, Pkghasheslen, Pkghashescap uint64
-
- Modulename, Modulenamelen uint64
- Modulehashes, Modulehasheslen, Modulehashescap uint64
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- hasmain uint8 // 1 if module contains the main function, 0 otherwise
-
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- bad bool // module failed to load and should be ignored
-
- next *moduledata
- */
-}
-
-type moduledata832 struct {
- Pclntable, Pclntablelen, Pclntablecap uint32
- Ftab, Ftablen, Ftabcap uint32
- Filetab, Filetablen, Filetabcap uint32
- Findfunctab uint32
- Minpc, Maxpc uint32
-
- Text, Etext uint32
- Noptrdata, Enoptrdata uint32
- Data, Edata uint32
- Bss, Ebss uint32
- Noptrbss, Enoptrbss uint32
- End, Gcdata, Gcbss uint32
- Types, Etypes uint32
-
- Textsectmap, Textsectmaplen, Textsectmapcap uint32
- Typelinks, Typelinkslen, Typelinkscap uint32 // offsets from types
- Itablinks, Itablinkslen, Itablinkscap uint32
-
- Ptab, Ptablen, Ptabcap uint32
-
- Pluginpath, Pluginpathlen uint32
- Pkghashes, Pkghasheslen, Pkghashescap uint32
-
- Modulename, Modulenamelen uint32
- Modulehashes, Modulehasheslen, Modulehashescap uint32
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- hasmain uint8 // 1 if module contains the main function, 0 otherwise
-
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- bad bool // module failed to load and should be ignored
-
- next *moduledata
- */
-}
-
-// Moduledata structure for Go 1.7
-
-type moduledata764 struct {
- Pclntable, Pclntablelen, Pclntablecap uint64
- Ftab, Ftablen, Ftabcap uint64
- Filetab, Filetablen, Filetabcap uint64
- Findfunctab uint64
- Minpc, Maxpc uint64
-
- Text, Etext uint64
- Noptrdata, Enoptrdata uint64
- Data, Edata uint64
- Bss, Ebss uint64
- Noptrbss, Enoptrbss uint64
- End, Gcdata, Gcbss uint64
- Types, Etypes uint64
-
- Typelinks, Typelinkslen, Typelinkscap uint64 // offsets from types
- Itablinks, Itablinkslen, Itablinkscap uint64
-
- Modulename, Modulenamelen uint64
- Modulehashes, Modulehasheslen, Modulehashescap uint64
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- next *moduledata
- */
-}
-
-type moduledata732 struct {
- Pclntable, Pclntablelen, Pclntablecap uint32
- Ftab, Ftablen, Ftabcap uint32
- Filetab, Filetablen, Filetabcap uint32
- Findfunctab uint32
- Minpc, Maxpc uint32
-
- Text, Etext uint32
- Noptrdata, Enoptrdata uint32
- Data, Edata uint32
- Bss, Ebss uint32
- Noptrbss, Enoptrbss uint32
- End, Gcdata, Gcbss uint32
- Types, Etypes uint32
-
- Typelinks, Typelinkslen, Typelinkscap uint32 // offsets from types
- Itablinks, Itablinkslen, Itablinkscap uint32
-
- Modulename, Modulenamelen uint32
- Modulehashes, Modulehasheslen, Modulehashescap uint32
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- next *moduledata
- */
-}
-
-// Moduledata structure for Go 1.5 to 1.6
-
-type moduledata564 struct {
- Pclntable, Pclntablelen, Pclntablecap uint64
- Ftab, Ftablen, Ftabcap uint64
- Filetab, Filetablen, Filetabcap uint64
- Findfunctab uint64
- Minpc, Maxpc uint64
-
- Text, Etext uint64
- Noptrdata, Enoptrdata uint64
- Data, Edata uint64
- Bss, Ebss uint64
- Noptrbss, Enoptrbss uint64
- End, Gcdata, Gcbss uint64
-
- Typelinks, Typelinkslen, Typelinkscap uint64
-
- Modulename, Modulenamelen uint64
- Modulehashes, Modulehasheslen, Modulehashescap uint64
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- next *moduledata
- */
+func readUIntTo64(r io.Reader, byteOrder binary.ByteOrder, is32bit bool) (addr uint64, err error) {
+ if is32bit {
+ var addr32 uint32
+ err = binary.Read(r, byteOrder, &addr32)
+ addr = uint64(addr32)
+ } else {
+ err = binary.Read(r, byteOrder, &addr)
+ }
+ return
}
-type moduledata532 struct {
- Pclntable, Pclntablelen, Pclntablecap uint32
- Ftab, Ftablen, Ftabcap uint32
- Filetab, Filetablen, Filetabcap uint32
- Findfunctab uint32
- Minpc, Maxpc uint32
-
- Text, Etext uint32
- Noptrdata, Enoptrdata uint32
- Data, Edata uint32
- Bss, Ebss uint32
- Noptrbss, Enoptrbss uint32
- End, Gcdata, Gcbss uint32
-
- Typelinks, Typelinkslen, Typelinkscap uint32
-
- Modulename, Modulenamelen uint32
- Modulehashes, Modulehasheslen, Modulehashescap uint32
-
- /* These fields we are not planning to use so skipping the parsing of them.
-
- gcdatamask, gcbssmask bitvector
-
- typemap map[typeOff]*_type // offset to *_rtype in previous module
-
- next *moduledata
- */
+type modulable interface {
+ toModuledata() moduledata
}
diff --git a/moduledata_gen.go b/moduledata_gen.go
new file mode 100644
index 0000000..fbb08cb
--- /dev/null
+++ b/moduledata_gen.go
@@ -0,0 +1,1997 @@
+// This file is part of GoRE.
+//
+// Copyright (C) 2019-2023 GoRE Authors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+// Code generated by go generate; DO NOT EDIT.
+
+package gore
+
+import "fmt"
+
+type moduledata_1_5_32 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+}
+
+func (md moduledata_1_5_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_5_64 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+}
+
+func (md moduledata_1_5_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_6_32 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+}
+
+func (md moduledata_1_6_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_6_64 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+}
+
+func (md moduledata_1_6_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_7_32 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+}
+
+func (md moduledata_1_7_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_7_64 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+}
+
+func (md moduledata_1_7_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_8_32 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_8_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_8_64 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_8_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_9_32 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_9_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_9_64 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_9_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_10_32 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_10_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_10_64 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_10_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_11_32 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_11_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_11_64 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_11_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_12_32 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_12_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_12_64 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_12_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_13_32 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_13_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_13_64 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_13_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_14_32 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_14_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_14_64 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_14_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_15_32 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_15_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_15_64 struct {
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_15_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_16_32 struct {
+ PcHeader uint32
+ Funcnametab, Funcnametablen, Funcnametabcap uint32
+ Cutab, Cutablen, Cutabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Pctab, Pctablen, Pctabcap uint32
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_16_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_16_64 struct {
+ PcHeader uint64
+ Funcnametab, Funcnametablen, Funcnametabcap uint64
+ Cutab, Cutablen, Cutabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Pctab, Pctablen, Pctabcap uint64
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_16_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_17_32 struct {
+ PcHeader uint32
+ Funcnametab, Funcnametablen, Funcnametabcap uint32
+ Cutab, Cutablen, Cutabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Pctab, Pctablen, Pctabcap uint32
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_17_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ }
+}
+
+type moduledata_1_17_64 struct {
+ PcHeader uint64
+ Funcnametab, Funcnametablen, Funcnametabcap uint64
+ Cutab, Cutablen, Cutabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Pctab, Pctablen, Pctabcap uint64
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_17_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ }
+}
+
+type moduledata_1_18_32 struct {
+ PcHeader uint32
+ Funcnametab, Funcnametablen, Funcnametabcap uint32
+ Cutab, Cutablen, Cutabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Pctab, Pctablen, Pctabcap uint32
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Rodata uint32
+ Gofunc uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_18_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ GoFuncVal: uint64(md.Gofunc),
+ }
+}
+
+type moduledata_1_18_64 struct {
+ PcHeader uint64
+ Funcnametab, Funcnametablen, Funcnametabcap uint64
+ Cutab, Cutablen, Cutabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Pctab, Pctablen, Pctabcap uint64
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Rodata uint64
+ Gofunc uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_18_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ GoFuncVal: md.Gofunc,
+ }
+}
+
+type moduledata_1_19_32 struct {
+ PcHeader uint32
+ Funcnametab, Funcnametablen, Funcnametabcap uint32
+ Cutab, Cutablen, Cutabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Pctab, Pctablen, Pctabcap uint32
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Rodata uint32
+ Gofunc uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_19_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ GoFuncVal: uint64(md.Gofunc),
+ }
+}
+
+type moduledata_1_19_64 struct {
+ PcHeader uint64
+ Funcnametab, Funcnametablen, Funcnametabcap uint64
+ Cutab, Cutablen, Cutabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Pctab, Pctablen, Pctabcap uint64
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Rodata uint64
+ Gofunc uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_19_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ GoFuncVal: md.Gofunc,
+ }
+}
+
+type moduledata_1_20_32 struct {
+ PcHeader uint32
+ Funcnametab, Funcnametablen, Funcnametabcap uint32
+ Cutab, Cutablen, Cutabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Pctab, Pctablen, Pctabcap uint32
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ Covctrs uint32
+ Ecovctrs uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Rodata uint32
+ Gofunc uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+}
+
+func (md moduledata_1_20_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ GoFuncVal: uint64(md.Gofunc),
+ }
+}
+
+type moduledata_1_20_64 struct {
+ PcHeader uint64
+ Funcnametab, Funcnametablen, Funcnametabcap uint64
+ Cutab, Cutablen, Cutabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Pctab, Pctablen, Pctabcap uint64
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ Covctrs uint64
+ Ecovctrs uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Rodata uint64
+ Gofunc uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+}
+
+func (md moduledata_1_20_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ GoFuncVal: md.Gofunc,
+ }
+}
+
+type moduledata_1_21_32 struct {
+ PcHeader uint32
+ Funcnametab, Funcnametablen, Funcnametabcap uint32
+ Cutab, Cutablen, Cutabcap uint32
+ Filetab, Filetablen, Filetabcap uint32
+ Pctab, Pctablen, Pctabcap uint32
+ Pclntable, Pclntablelen, Pclntablecap uint32
+ Ftab, Ftablen, Ftabcap uint32
+ Findfunctab uint32
+ Minpc uint32
+ Maxpc uint32
+ Text uint32
+ Etext uint32
+ Noptrdata uint32
+ Enoptrdata uint32
+ Data uint32
+ Edata uint32
+ Bss uint32
+ Ebss uint32
+ Noptrbss uint32
+ Enoptrbss uint32
+ Covctrs uint32
+ Ecovctrs uint32
+ End uint32
+ Gcdata uint32
+ Gcbss uint32
+ Types uint32
+ Etypes uint32
+ Rodata uint32
+ Gofunc uint32
+ Textsectmap, Textsectmaplen, Textsectmapcap uint32
+ Typelinks, Typelinkslen, Typelinkscap uint32
+ Itablinks, Itablinkslen, Itablinkscap uint32
+ Ptab, Ptablen, Ptabcap uint32
+ Pluginpath, Pluginpathlen uint32
+ Pkghashes, Pkghasheslen, Pkghashescap uint32
+ Inittasks, Inittaskslen, Inittaskscap uint32
+}
+
+func (md moduledata_1_21_32) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: uint64(md.Text),
+ TextLen: uint64(md.Etext - md.Text),
+ NoPtrDataAddr: uint64(md.Noptrdata),
+ NoPtrDataLen: uint64(md.Enoptrdata - md.Noptrdata),
+ DataAddr: uint64(md.Data),
+ DataLen: uint64(md.Edata - md.Data),
+ BssAddr: uint64(md.Bss),
+ BssLen: uint64(md.Ebss - md.Bss),
+ NoPtrBssAddr: uint64(md.Noptrbss),
+ NoPtrBssLen: uint64(md.Enoptrbss - md.Noptrbss),
+ TypesAddr: uint64(md.Types),
+ TypesLen: uint64(md.Etypes - md.Types),
+ TypelinkAddr: uint64(md.Typelinks),
+ TypelinkLen: uint64(md.Typelinkslen),
+ ITabLinkAddr: uint64(md.Itablinks),
+ ITabLinkLen: uint64(md.Itablinkslen),
+ FuncTabAddr: uint64(md.Ftab),
+ FuncTabLen: uint64(md.Ftablen),
+ PCLNTabAddr: uint64(md.Pclntable),
+ PCLNTabLen: uint64(md.Pclntablelen),
+ GoFuncVal: uint64(md.Gofunc),
+ }
+}
+
+type moduledata_1_21_64 struct {
+ PcHeader uint64
+ Funcnametab, Funcnametablen, Funcnametabcap uint64
+ Cutab, Cutablen, Cutabcap uint64
+ Filetab, Filetablen, Filetabcap uint64
+ Pctab, Pctablen, Pctabcap uint64
+ Pclntable, Pclntablelen, Pclntablecap uint64
+ Ftab, Ftablen, Ftabcap uint64
+ Findfunctab uint64
+ Minpc uint64
+ Maxpc uint64
+ Text uint64
+ Etext uint64
+ Noptrdata uint64
+ Enoptrdata uint64
+ Data uint64
+ Edata uint64
+ Bss uint64
+ Ebss uint64
+ Noptrbss uint64
+ Enoptrbss uint64
+ Covctrs uint64
+ Ecovctrs uint64
+ End uint64
+ Gcdata uint64
+ Gcbss uint64
+ Types uint64
+ Etypes uint64
+ Rodata uint64
+ Gofunc uint64
+ Textsectmap, Textsectmaplen, Textsectmapcap uint64
+ Typelinks, Typelinkslen, Typelinkscap uint64
+ Itablinks, Itablinkslen, Itablinkscap uint64
+ Ptab, Ptablen, Ptabcap uint64
+ Pluginpath, Pluginpathlen uint64
+ Pkghashes, Pkghasheslen, Pkghashescap uint64
+ Inittasks, Inittaskslen, Inittaskscap uint64
+}
+
+func (md moduledata_1_21_64) toModuledata() moduledata {
+ return moduledata{
+ TextAddr: md.Text,
+ TextLen: md.Etext - md.Text,
+ NoPtrDataAddr: md.Noptrdata,
+ NoPtrDataLen: md.Enoptrdata - md.Noptrdata,
+ DataAddr: md.Data,
+ DataLen: md.Edata - md.Data,
+ BssAddr: md.Bss,
+ BssLen: md.Ebss - md.Bss,
+ NoPtrBssAddr: md.Noptrbss,
+ NoPtrBssLen: md.Enoptrbss - md.Noptrbss,
+ TypesAddr: md.Types,
+ TypesLen: md.Etypes - md.Types,
+ TypelinkAddr: md.Typelinks,
+ TypelinkLen: md.Typelinkslen,
+ ITabLinkAddr: md.Itablinks,
+ ITabLinkLen: md.Itablinkslen,
+ FuncTabAddr: md.Ftab,
+ FuncTabLen: md.Ftablen,
+ PCLNTabAddr: md.Pclntable,
+ PCLNTabLen: md.Pclntablelen,
+ GoFuncVal: md.Gofunc,
+ }
+}
+
+func selectModuleData(v int, bits int) (modulable, error) {
+ switch {
+ case v == 5 && bits == 32:
+ return &moduledata_1_5_32{}, nil
+ case v == 5 && bits == 64:
+ return &moduledata_1_5_64{}, nil
+ case v == 6 && bits == 32:
+ return &moduledata_1_6_32{}, nil
+ case v == 6 && bits == 64:
+ return &moduledata_1_6_64{}, nil
+ case v == 7 && bits == 32:
+ return &moduledata_1_7_32{}, nil
+ case v == 7 && bits == 64:
+ return &moduledata_1_7_64{}, nil
+ case v == 8 && bits == 32:
+ return &moduledata_1_8_32{}, nil
+ case v == 8 && bits == 64:
+ return &moduledata_1_8_64{}, nil
+ case v == 9 && bits == 32:
+ return &moduledata_1_9_32{}, nil
+ case v == 9 && bits == 64:
+ return &moduledata_1_9_64{}, nil
+ case v == 10 && bits == 32:
+ return &moduledata_1_10_32{}, nil
+ case v == 10 && bits == 64:
+ return &moduledata_1_10_64{}, nil
+ case v == 11 && bits == 32:
+ return &moduledata_1_11_32{}, nil
+ case v == 11 && bits == 64:
+ return &moduledata_1_11_64{}, nil
+ case v == 12 && bits == 32:
+ return &moduledata_1_12_32{}, nil
+ case v == 12 && bits == 64:
+ return &moduledata_1_12_64{}, nil
+ case v == 13 && bits == 32:
+ return &moduledata_1_13_32{}, nil
+ case v == 13 && bits == 64:
+ return &moduledata_1_13_64{}, nil
+ case v == 14 && bits == 32:
+ return &moduledata_1_14_32{}, nil
+ case v == 14 && bits == 64:
+ return &moduledata_1_14_64{}, nil
+ case v == 15 && bits == 32:
+ return &moduledata_1_15_32{}, nil
+ case v == 15 && bits == 64:
+ return &moduledata_1_15_64{}, nil
+ case v == 16 && bits == 32:
+ return &moduledata_1_16_32{}, nil
+ case v == 16 && bits == 64:
+ return &moduledata_1_16_64{}, nil
+ case v == 17 && bits == 32:
+ return &moduledata_1_17_32{}, nil
+ case v == 17 && bits == 64:
+ return &moduledata_1_17_64{}, nil
+ case v == 18 && bits == 32:
+ return &moduledata_1_18_32{}, nil
+ case v == 18 && bits == 64:
+ return &moduledata_1_18_64{}, nil
+ case v == 19 && bits == 32:
+ return &moduledata_1_19_32{}, nil
+ case v == 19 && bits == 64:
+ return &moduledata_1_19_64{}, nil
+ case v == 20 && bits == 32:
+ return &moduledata_1_20_32{}, nil
+ case v == 20 && bits == 64:
+ return &moduledata_1_20_64{}, nil
+ case v == 21 && bits == 32:
+ return &moduledata_1_21_32{}, nil
+ case v == 21 && bits == 64:
+ return &moduledata_1_21_64{}, nil
+ default:
+ return nil, fmt.Errorf("unsupported version %d and bits %d", v, bits)
+ }
+}
diff --git a/moduledata_test.go b/moduledata_test.go
index 62b48af..c5e8add 100644
--- a/moduledata_test.go
+++ b/moduledata_test.go
@@ -48,7 +48,9 @@ func TestModuledata(t *testing.T) {
t.Run("moduledata-"+test.file, func(t *testing.T) {
f, err := Open(filepath.Join("testdata", "gold", test.file))
r.NoError(err)
- defer f.Close()
+ defer func(f *GoFile) {
+ _ = f.Close()
+ }(f)
md, err := f.Moduledata()
r.NoError(err)
diff --git a/package.go b/package.go
index 2264381..f861677 100644
--- a/package.go
+++ b/package.go
@@ -25,7 +25,7 @@ import (
"strings"
)
-//go:generate go run gen.go
+//go:generate go run ./gen stdpkgs
var (
knownRepos = []string{"golang.org", "github.com", "gitlab.com"}
diff --git a/package_test.go b/package_test.go
index 744ccd0..e9f49f8 100644
--- a/package_test.go
+++ b/package_test.go
@@ -308,14 +308,14 @@ func TestClassifyPackage(t *testing.T) {
{"type..hash.text/template/parse", "C:/Go/src/text/template/parse", ClassGenerated},
{"unicode", "C:/Go/src/unicode", ClassSTD},
{"unicode/utf8", "C:/Go/src/unicode/utf8", ClassSTD},
- {"vendor/golang_org/x/net/http2/hpack", "c:/go/src/vendor/golang_org/x/net/http2/hpack", ClassVendor},
- {"vendor/golang_org/x/text/unicode/norm", "c:/go/src/vendor/golang_org/x/text/unicode/norm", ClassVendor},
- {"vendor/golang_org/x/net/dns/dnsmessage", ".", ClassVendor},
- {"vendor/golang_org/x/text/unicode/bidi", "c:/go/src/vendor/golang_org/x/text/unicode/bidi", ClassVendor},
+ {"vendor/golang_org/x/net/http2/hpack", "c:/go/src/vendor/golang_org/x/net/http2/hpack", ClassSTD},
+ {"vendor/golang_org/x/text/unicode/norm", "c:/go/src/vendor/golang_org/x/text/unicode/norm", ClassSTD},
+ {"vendor/golang_org/x/net/dns/dnsmessage", ".", ClassSTD},
+ {"vendor/golang_org/x/text/unicode/bidi", "c:/go/src/vendor/golang_org/x/text/unicode/bidi", ClassSTD},
{"github.com/go-ole/go-ole", "c:/go/src/github.com/go-ole/go-ole", ClassVendor},
- {"vendor/golang_org/x/text/secure/bidirule", "c:/go/src/vendor/golang_org/x/text/secure/bidirule", ClassVendor},
- {"vendor/golang_org/x/crypto/poly1305", "c:/go/src/vendor/golang_org/x/crypto/poly1305", ClassVendor},
- {"vendor/golang_org/x/crypto/curve25519", "c:/go/src/vendor/golang_org/x/crypto/curve25519", ClassVendor},
+ {"vendor/golang_org/x/text/secure/bidirule", "c:/go/src/vendor/golang_org/x/text/secure/bidirule", ClassSTD},
+ {"vendor/golang_org/x/crypto/poly1305", "c:/go/src/vendor/golang_org/x/crypto/poly1305", ClassSTD},
+ {"vendor/golang_org/x/crypto/curve25519", "c:/go/src/vendor/golang_org/x/crypto/curve25519", ClassSTD},
{"github.com/kbinani/screenshot", "c:/go/src/github.com/kbinani/screenshot", ClassVendor},
{"github.com/go-ole/go-ole/oleutil", "c:/go/src/github.com/go-ole/go-ole/oleutil", ClassVendor},
{"github.com/shirou/gopsutil/net", ".", ClassUnknown},
@@ -325,22 +325,22 @@ func TestClassifyPackage(t *testing.T) {
{"github.com/shirou/gopsutil/cpu", "c:/go/src/github.com/shirou/gopsutil/cpu", ClassVendor},
{"github.com/StackExchange/wmi", "c:/go/src/github.com/StackExchange/wmi", ClassVendor},
{"github.com/shirou/gopsutil/internal/common", "c:/go/src/github.com/shirou/gopsutil/internal/common", ClassVendor},
- {"vendor/golang_org/x/net/idna", "c:/go/src/vendor/golang_org/x/net/idna", ClassVendor},
+ {"vendor/golang_org/x/net/idna", "c:/go/src/vendor/golang_org/x/net/idna", ClassSTD},
{"github.com/lxn/win", "c:/go/src/github.com/lxn/win", ClassVendor},
{"github.com/shirou/gopsutil/host", "c:/go/src/github.com/shirou/gopsutil/host", ClassVendor},
{"golang.org/x/sys/windows", "c:/go/src/golang.org/x/sys/windows", ClassVendor},
{"", "c:/go/src/internal/bytealg", ClassUnknown},
- {"vendor/golang_org/x/net/http/httpguts", "c:/go/src/vendor/golang_org/x/net/http/httpguts", ClassVendor},
- {"vendor/golang_org/x/crypto/internal/chacha20", "c:/go/src/vendor/golang_org/x/crypto/internal/chacha20", ClassVendor},
- {"vendor/golang_org/x/crypto/cryptobyte", "c:/go/src/vendor/golang_org/x/crypto/cryptobyte", ClassVendor},
- {"vendor/golang_org/x/crypto/chacha20poly1305", "c:/go/src/vendor/golang_org/x/crypto/chacha20poly1305", ClassVendor},
+ {"vendor/golang_org/x/net/http/httpguts", "c:/go/src/vendor/golang_org/x/net/http/httpguts", ClassSTD},
+ {"vendor/golang_org/x/crypto/internal/chacha20", "c:/go/src/vendor/golang_org/x/crypto/internal/chacha20", ClassSTD},
+ {"vendor/golang_org/x/crypto/cryptobyte", "c:/go/src/vendor/golang_org/x/crypto/cryptobyte", ClassSTD},
+ {"vendor/golang_org/x/crypto/chacha20poly1305", "c:/go/src/vendor/golang_org/x/crypto/chacha20poly1305", ClassSTD},
{"golang.org/x/sys/windows/registry", "c:/go/src/golang.org/x/sys/windows/registry", ClassVendor},
- {"vendor/golang_org/x/text/transform", ".", ClassVendor},
+ {"vendor/golang_org/x/text/transform", ".", ClassSTD},
{"golang.org/x/sys/windows/svc/mgr", ".", ClassUnknown},
{"github.com/shirou/gopsutil/mem", ".", ClassUnknown},
{"github.com/shirou/gopsutil/process", "c:/go/src/github.com/shirou/gopsutil/process", ClassVendor},
{"github.com/iamacarpet/go-win64api/shared", "c:/go/src/github.com/iamacarpet/go-win64api/shared", ClassVendor},
- {"vendor/golang_org/x/net/http/httpproxy", "c:/go/src/vendor/golang_org/x/net/http/httpproxy", ClassVendor},
+ {"vendor/golang_org/x/net/http/httpproxy", "c:/go/src/vendor/golang_org/x/net/http/httpproxy", ClassSTD},
{"github.com/shirou/w32", "c:/go/src/github.com/shirou/w32", ClassVendor},
}
diff --git a/pe.go b/pe.go
index 04e662e..df0a919 100644
--- a/pe.go
+++ b/pe.go
@@ -59,11 +59,11 @@ type peFile struct {
imageBase uint64
}
-func (p *peFile) GetParsedFile() any {
+func (p *peFile) getParsedFile() any {
return p.file
}
-func (p *peFile) GetFile() *os.File {
+func (p *peFile) getFile() *os.File {
return p.osFile
}
@@ -93,12 +93,13 @@ func (p *peFile) getRData() ([]byte, error) {
return section.Data()
}
-func (p *peFile) getCodeSection() ([]byte, error) {
+func (p *peFile) getCodeSection() (uint64, []byte, error) {
section := p.file.Section(".text")
if section == nil {
- return nil, ErrSectionDoesNotExist
+ return 0, nil, ErrSectionDoesNotExist
}
- return section.Data()
+ data, err := section.Data()
+ return p.imageBase + uint64(section.VirtualAddress), data, err
}
func (p *peFile) moduledataSection() string {
@@ -151,7 +152,7 @@ func (p *peFile) getFileInfo() *FileInfo {
}
func (p *peFile) getBuildID() (string, error) {
- data, err := p.getCodeSection()
+ _, data, err := p.getCodeSection()
if err != nil {
return "", fmt.Errorf("failed to get code section: %w", err)
}
diff --git a/stdpkg_gen.go b/stdpkg_gen.go
index aa41d7d..19f6afb 100644
--- a/stdpkg_gen.go
+++ b/stdpkg_gen.go
@@ -17,487 +17,607 @@
// Code generated by go generate; DO NOT EDIT.
// This file was generated at
-// 2024-01-25 19:24:26.1768459 +0000 UTC
+// 2024-02-03 13:33:47.6214248 +0000 UTC
package gore
var stdPkgs = map[string]struct{}{
- "archive": {},
- "archive/tar": {},
- "archive/tar/testdata": {},
- "archive/zip": {},
- "archive/zip/testdata": {},
- "arena": {},
- "bufio": {},
- "builtin": {},
- "bytes": {},
- "cmp": {},
- "compress": {},
- "compress/bzip2": {},
- "compress/bzip2/testdata": {},
- "compress/flate": {},
- "compress/flate/testdata": {},
- "compress/gzip": {},
- "compress/gzip/testdata": {},
- "compress/lzw": {},
- "compress/testdata": {},
- "compress/zlib": {},
- "container": {},
- "container/heap": {},
- "container/list": {},
- "container/ring": {},
- "context": {},
- "crypto": {},
- "crypto/aes": {},
- "crypto/boring": {},
- "crypto/cipher": {},
- "crypto/des": {},
- "crypto/dsa": {},
- "crypto/ecdh": {},
- "crypto/ecdsa": {},
- "crypto/ecdsa/testdata": {},
- "crypto/ed25519": {},
- "crypto/ed25519/testdata": {},
- "crypto/elliptic": {},
- "crypto/hmac": {},
- "crypto/internal": {},
- "crypto/internal/alias": {},
- "crypto/internal/bigmod": {},
- "crypto/internal/bigmod/_asm": {},
- "crypto/internal/boring": {},
- "crypto/internal/boring/bbig": {},
- "crypto/internal/boring/bcache": {},
- "crypto/internal/boring/fipstls": {},
- "crypto/internal/boring/sig": {},
- "crypto/internal/boring/syso": {},
- "crypto/internal/edwards25519": {},
- "crypto/internal/edwards25519/field": {},
- "crypto/internal/edwards25519/field/_asm": {},
- "crypto/internal/nistec": {},
- "crypto/internal/nistec/fiat": {},
- "crypto/internal/randutil": {},
- "crypto/md5": {},
- "crypto/rand": {},
- "crypto/rc4": {},
- "crypto/rsa": {},
- "crypto/rsa/testdata": {},
- "crypto/sha1": {},
- "crypto/sha256": {},
- "crypto/sha512": {},
- "crypto/subtle": {},
- "crypto/tls": {},
- "crypto/tls/fipsonly": {},
- "crypto/tls/testdata": {},
- "crypto/x509": {},
- "crypto/x509/internal": {},
- "crypto/x509/internal/macos": {},
- "crypto/x509/pkix": {},
- "crypto/x509/testdata": {},
- "database": {},
- "database/sql": {},
- "database/sql/driver": {},
- "debug": {},
- "debug/buildinfo": {},
- "debug/dwarf": {},
- "debug/dwarf/testdata": {},
- "debug/elf": {},
- "debug/elf/testdata": {},
- "debug/gosym": {},
- "debug/gosym/testdata": {},
- "debug/macho": {},
- "debug/macho/testdata": {},
- "debug/pe": {},
- "debug/pe/testdata": {},
- "debug/plan9obj": {},
- "debug/plan9obj/testdata": {},
- "embed": {},
- "embed/internal": {},
- "embed/internal/embedtest": {},
- "embed/internal/embedtest/testdata": {},
- "embed/internal/embedtest/testdata/-not-hidden": {},
- "embed/internal/embedtest/testdata/.hidden": {},
- "embed/internal/embedtest/testdata/.hidden/.more": {},
- "embed/internal/embedtest/testdata/.hidden/_more": {},
- "embed/internal/embedtest/testdata/.hidden/more": {},
- "embed/internal/embedtest/testdata/_hidden": {},
- "embed/internal/embedtest/testdata/i": {},
- "embed/internal/embedtest/testdata/i/j": {},
- "embed/internal/embedtest/testdata/i/j/k": {},
- "encoding": {},
- "encoding/ascii85": {},
- "encoding/asn1": {},
- "encoding/base32": {},
- "encoding/base64": {},
- "encoding/binary": {},
- "encoding/csv": {},
- "encoding/gob": {},
- "encoding/hex": {},
- "encoding/json": {},
- "encoding/json/testdata": {},
- "encoding/pem": {},
- "encoding/xml": {},
- "errors": {},
- "expvar": {},
- "flag": {},
- "fmt": {},
- "go": {},
- "go/ast": {},
- "go/build": {},
- "go/build/constraint": {},
- "go/build/testdata": {},
- "go/build/testdata/alltags": {},
- "go/build/testdata/bads": {},
- "go/build/testdata/cgo_disabled": {},
- "go/build/testdata/directives": {},
- "go/build/testdata/doc": {},
- "go/build/testdata/empty": {},
- "go/build/testdata/multi": {},
- "go/build/testdata/non_source_tags": {},
- "go/build/testdata/other": {},
- "go/build/testdata/other/file": {},
- "go/build/testdata/withvendor": {},
- "go/build/testdata/withvendor/src": {},
- "go/build/testdata/withvendor/src/a": {},
- "go/build/testdata/withvendor/src/a/b": {},
- "go/build/testdata/withvendor/src/a/vendor": {},
- "go/build/testdata/withvendor/src/a/vendor/c": {},
- "go/build/testdata/withvendor/src/a/vendor/c/d": {},
- "go/constant": {},
- "go/doc": {},
- "go/doc/comment": {},
- "go/doc/comment/testdata": {},
- "go/doc/testdata": {},
- "go/doc/testdata/examples": {},
- "go/doc/testdata/pkgdoc": {},
- "go/format": {},
- "go/importer": {},
- "go/internal": {},
- "go/internal/gccgoimporter": {},
- "go/internal/gccgoimporter/testdata": {},
- "go/internal/gcimporter": {},
- "go/internal/gcimporter/testdata": {},
- "go/internal/gcimporter/testdata/versions": {},
- "go/internal/srcimporter": {},
- "go/internal/srcimporter/testdata": {},
- "go/internal/srcimporter/testdata/issue20855": {},
- "go/internal/srcimporter/testdata/issue23092": {},
- "go/internal/srcimporter/testdata/issue24392": {},
- "go/internal/typeparams": {},
- "go/parser": {},
- "go/parser/testdata": {},
- "go/parser/testdata/goversion": {},
- "go/parser/testdata/issue42951": {},
- "go/parser/testdata/issue42951/not_a_file.go": {},
- "go/parser/testdata/resolution": {},
- "go/printer": {},
- "go/printer/testdata": {},
- "go/scanner": {},
- "go/token": {},
- "go/types": {},
- "go/types/testdata": {},
- "go/types/testdata/local": {},
- "go/version": {},
- "hash": {},
- "hash/adler32": {},
- "hash/crc32": {},
- "hash/crc64": {},
- "hash/fnv": {},
- "hash/maphash": {},
- "html": {},
- "html/template": {},
- "html/template/testdata": {},
- "image": {},
- "image/color": {},
- "image/color/palette": {},
- "image/draw": {},
- "image/gif": {},
- "image/internal": {},
- "image/internal/imageutil": {},
- "image/jpeg": {},
- "image/png": {},
- "image/png/testdata": {},
- "image/png/testdata/pngsuite": {},
- "image/testdata": {},
- "index": {},
- "index/suffixarray": {},
- "internal": {},
- "internal/abi": {},
- "internal/abi/testdata": {},
- "internal/bisect": {},
- "internal/buildcfg": {},
- "internal/bytealg": {},
- "internal/cfg": {},
- "internal/chacha8rand": {},
- "internal/coverage": {},
- "internal/coverage/calloc": {},
- "internal/coverage/cformat": {},
- "internal/coverage/cmerge": {},
- "internal/coverage/decodecounter": {},
- "internal/coverage/decodemeta": {},
- "internal/coverage/encodecounter": {},
- "internal/coverage/encodemeta": {},
- "internal/coverage/pods": {},
- "internal/coverage/rtcov": {},
- "internal/coverage/slicereader": {},
- "internal/coverage/slicewriter": {},
- "internal/coverage/stringtab": {},
- "internal/coverage/test": {},
- "internal/coverage/uleb128": {},
- "internal/cpu": {},
- "internal/dag": {},
- "internal/diff": {},
- "internal/diff/testdata": {},
- "internal/fmtsort": {},
- "internal/fuzz": {},
- "internal/goarch": {},
- "internal/godebug": {},
- "internal/godebugs": {},
- "internal/goexperiment": {},
- "internal/goos": {},
- "internal/goroot": {},
- "internal/gover": {},
- "internal/goversion": {},
- "internal/intern": {},
- "internal/itoa": {},
- "internal/lazyregexp": {},
- "internal/lazytemplate": {},
- "internal/nettrace": {},
- "internal/obscuretestdata": {},
- "internal/oserror": {},
- "internal/pkgbits": {},
- "internal/platform": {},
- "internal/poll": {},
- "internal/profile": {},
- "internal/race": {},
- "internal/reflectlite": {},
- "internal/safefilepath": {},
- "internal/saferio": {},
- "internal/singleflight": {},
- "internal/syscall": {},
- "internal/syscall/execenv": {},
- "internal/syscall/unix": {},
- "internal/syscall/windows": {},
- "internal/syscall/windows/registry": {},
- "internal/syscall/windows/sysdll": {},
- "internal/sysinfo": {},
- "internal/testenv": {},
- "internal/testlog": {},
- "internal/testpty": {},
- "internal/trace": {},
- "internal/trace/testdata": {},
- "internal/trace/traceviewer": {},
- "internal/trace/traceviewer/format": {},
- "internal/trace/traceviewer/static": {},
- "internal/trace/v2": {},
- "internal/trace/v2/event": {},
- "internal/trace/v2/event/go122": {},
- "internal/trace/v2/internal": {},
- "internal/trace/v2/internal/testgen": {},
- "internal/trace/v2/internal/testgen/go122": {},
- "internal/trace/v2/raw": {},
- "internal/trace/v2/testdata": {},
- "internal/trace/v2/testdata/cmd": {},
- "internal/trace/v2/testdata/cmd/gotraceraw": {},
- "internal/trace/v2/testdata/cmd/gotracevalidate": {},
- "internal/trace/v2/testdata/fuzz": {},
- "internal/trace/v2/testdata/fuzz/FuzzReader": {},
- "internal/trace/v2/testdata/generators": {},
- "internal/trace/v2/testdata/testprog": {},
- "internal/trace/v2/testdata/tests": {},
- "internal/trace/v2/testtrace": {},
- "internal/trace/v2/version": {},
- "internal/txtar": {},
- "internal/types": {},
- "internal/types/errors": {},
- "internal/types/testdata": {},
- "internal/types/testdata/check": {},
- "internal/types/testdata/check/decls2": {},
- "internal/types/testdata/check/importdecl0": {},
- "internal/types/testdata/check/importdecl1": {},
- "internal/types/testdata/check/issue25008": {},
- "internal/types/testdata/examples": {},
- "internal/types/testdata/fixedbugs": {},
- "internal/types/testdata/spec": {},
- "internal/unsafeheader": {},
- "internal/xcoff": {},
- "internal/xcoff/testdata": {},
- "internal/zstd": {},
- "internal/zstd/testdata": {},
- "io": {},
- "io/fs": {},
- "io/ioutil": {},
- "io/ioutil/testdata": {},
- "iter": {},
- "log": {},
- "log/internal": {},
- "log/slog": {},
- "log/slog/internal": {},
- "log/slog/internal/benchmarks": {},
- "log/slog/internal/buffer": {},
- "log/slog/internal/slogtest": {},
- "log/syslog": {},
- "maps": {},
- "math": {},
- "math/big": {},
- "math/bits": {},
- "math/cmplx": {},
- "math/rand": {},
- "math/rand/v2": {},
- "mime": {},
- "mime/multipart": {},
- "mime/multipart/testdata": {},
- "mime/quotedprintable": {},
- "mime/testdata": {},
- "net": {},
- "net/http": {},
- "net/http/cgi": {},
- "net/http/cookiejar": {},
- "net/http/fcgi": {},
- "net/http/httptest": {},
- "net/http/httptrace": {},
- "net/http/httputil": {},
- "net/http/internal": {},
- "net/http/internal/ascii": {},
- "net/http/internal/testcert": {},
- "net/http/pprof": {},
- "net/http/pprof/testdata": {},
- "net/http/testdata": {},
- "net/internal": {},
- "net/internal/cgotest": {},
- "net/internal/socktest": {},
- "net/mail": {},
- "net/netip": {},
- "net/rpc": {},
- "net/rpc/jsonrpc": {},
- "net/smtp": {},
- "net/testdata": {},
- "net/textproto": {},
- "net/url": {},
- "os": {},
- "os/exec": {},
- "os/exec/internal": {},
- "os/exec/internal/fdtest": {},
- "os/signal": {},
- "os/testdata": {},
- "os/testdata/dirfs": {},
- "os/testdata/dirfs/dir": {},
- "os/testdata/issue37161": {},
- "os/user": {},
- "path": {},
- "path/filepath": {},
- "plugin": {},
- "reflect": {},
- "reflect/internal": {},
- "reflect/internal/example1": {},
- "reflect/internal/example2": {},
- "regexp": {},
- "regexp/syntax": {},
- "regexp/testdata": {},
- "runtime": {},
- "runtime/asan": {},
- "runtime/cgo": {},
- "runtime/coverage": {},
- "runtime/coverage/testdata": {},
- "runtime/coverage/testdata/issue56006": {},
- "runtime/coverage/testdata/issue59563": {},
- "runtime/debug": {},
- "runtime/debug/testdata": {},
- "runtime/debug/testdata/fuzz": {},
- "runtime/debug/testdata/fuzz/FuzzParseBuildInfoRoundTrip": {},
- "runtime/internal": {},
- "runtime/internal/atomic": {},
- "runtime/internal/math": {},
- "runtime/internal/startlinetest": {},
- "runtime/internal/sys": {},
- "runtime/internal/syscall": {},
- "runtime/internal/wasitest": {},
- "runtime/internal/wasitest/testdata": {},
- "runtime/metrics": {},
- "runtime/msan": {},
- "runtime/pprof": {},
- "runtime/pprof/testdata": {},
- "runtime/pprof/testdata/mappingtest": {},
- "runtime/race": {},
- "runtime/race/internal": {},
- "runtime/race/internal/amd64v1": {},
- "runtime/race/internal/amd64v3": {},
- "runtime/race/testdata": {},
- "runtime/testdata": {},
- "runtime/testdata/testexithooks": {},
- "runtime/testdata/testfaketime": {},
- "runtime/testdata/testfds": {},
- "runtime/testdata/testprog": {},
- "runtime/testdata/testprogcgo": {},
- "runtime/testdata/testprogcgo/windows": {},
- "runtime/testdata/testprognet": {},
- "runtime/testdata/testsuid": {},
- "runtime/testdata/testwinlib": {},
- "runtime/testdata/testwinlibsignal": {},
- "runtime/testdata/testwinlibthrow": {},
- "runtime/testdata/testwinsignal": {},
- "runtime/testdata/testwintls": {},
- "runtime/trace": {},
- "slices": {},
- "sort": {},
- "strconv": {},
- "strconv/testdata": {},
- "strings": {},
- "sync": {},
- "sync/atomic": {},
- "syscall": {},
- "syscall/js": {},
- "testdata": {},
- "testing": {},
- "testing/fstest": {},
- "testing/internal": {},
- "testing/internal/testdeps": {},
- "testing/iotest": {},
- "testing/quick": {},
- "testing/slogtest": {},
- "text": {},
- "text/scanner": {},
- "text/tabwriter": {},
- "text/template": {},
- "text/template/parse": {},
- "text/template/testdata": {},
- "time": {},
- "time/testdata": {},
- "time/tzdata": {},
- "unicode": {},
- "unicode/utf16": {},
- "unicode/utf8": {},
- "unsafe": {},
- "vendor": {},
- "vendor/golang.org": {},
- "vendor/golang.org/x": {},
- "vendor/golang.org/x/crypto": {},
- "vendor/golang.org/x/crypto/chacha20": {},
- "vendor/golang.org/x/crypto/chacha20poly1305": {},
- "vendor/golang.org/x/crypto/cryptobyte": {},
- "vendor/golang.org/x/crypto/cryptobyte/asn1": {},
- "vendor/golang.org/x/crypto/hkdf": {},
- "vendor/golang.org/x/crypto/internal": {},
- "vendor/golang.org/x/crypto/internal/alias": {},
- "vendor/golang.org/x/crypto/internal/poly1305": {},
- "vendor/golang.org/x/net": {},
- "vendor/golang.org/x/net/dns": {},
- "vendor/golang.org/x/net/dns/dnsmessage": {},
- "vendor/golang.org/x/net/http": {},
- "vendor/golang.org/x/net/http/httpguts": {},
- "vendor/golang.org/x/net/http/httpproxy": {},
- "vendor/golang.org/x/net/http2": {},
- "vendor/golang.org/x/net/http2/hpack": {},
- "vendor/golang.org/x/net/idna": {},
- "vendor/golang.org/x/net/lif": {},
- "vendor/golang.org/x/net/nettest": {},
- "vendor/golang.org/x/net/route": {},
- "vendor/golang.org/x/sys": {},
- "vendor/golang.org/x/sys/cpu": {},
- "vendor/golang.org/x/text": {},
- "vendor/golang.org/x/text/secure": {},
- "vendor/golang.org/x/text/secure/bidirule": {},
- "vendor/golang.org/x/text/transform": {},
- "vendor/golang.org/x/text/unicode": {},
- "vendor/golang.org/x/text/unicode/bidi": {},
- "vendor/golang.org/x/text/unicode/norm": {},
+ "archive": {},
+ "archive/tar": {},
+ "archive/zip": {},
+ "arena": {},
+ "bufio": {},
+ "builtin": {},
+ "bytes": {},
+ "cmp": {},
+ "compress": {},
+ "compress/bzip2": {},
+ "compress/flate": {},
+ "compress/gzip": {},
+ "compress/lzw": {},
+ "compress/zlib": {},
+ "constraints": {},
+ "container": {},
+ "container/heap": {},
+ "container/list": {},
+ "container/ring": {},
+ "context": {},
+ "crypto": {},
+ "crypto/aes": {},
+ "crypto/boring": {},
+ "crypto/cipher": {},
+ "crypto/des": {},
+ "crypto/dsa": {},
+ "crypto/ecdh": {},
+ "crypto/ecdsa": {},
+ "crypto/ed25519": {},
+ "crypto/ed25519/internal": {},
+ "crypto/ed25519/internal/edwards25519": {},
+ "crypto/ed25519/internal/edwards25519/field": {},
+ "crypto/elliptic": {},
+ "crypto/elliptic/internal": {},
+ "crypto/elliptic/internal/fiat": {},
+ "crypto/elliptic/internal/nistec": {},
+ "crypto/hmac": {},
+ "crypto/internal": {},
+ "crypto/internal/alias": {},
+ "crypto/internal/bigmod": {},
+ "crypto/internal/boring": {},
+ "crypto/internal/boring/bbig": {},
+ "crypto/internal/boring/bcache": {},
+ "crypto/internal/boring/fipstls": {},
+ "crypto/internal/boring/sig": {},
+ "crypto/internal/boring/syso": {},
+ "crypto/internal/cipherhw": {},
+ "crypto/internal/edwards25519": {},
+ "crypto/internal/edwards25519/field": {},
+ "crypto/internal/nistec": {},
+ "crypto/internal/nistec/fiat": {},
+ "crypto/internal/randutil": {},
+ "crypto/internal/subtle": {},
+ "crypto/md5": {},
+ "crypto/rand": {},
+ "crypto/rc4": {},
+ "crypto/rsa": {},
+ "crypto/sha1": {},
+ "crypto/sha256": {},
+ "crypto/sha512": {},
+ "crypto/subtle": {},
+ "crypto/tls": {},
+ "crypto/tls/fipsonly": {},
+ "crypto/x509": {},
+ "crypto/x509/internal": {},
+ "crypto/x509/internal/macOS": {},
+ "crypto/x509/internal/macos": {},
+ "crypto/x509/pkix": {},
+ "database": {},
+ "database/sql": {},
+ "database/sql/driver": {},
+ "database/sql/internal": {},
+ "debug": {},
+ "debug/buildinfo": {},
+ "debug/dwarf": {},
+ "debug/elf": {},
+ "debug/goobj": {},
+ "debug/gosym": {},
+ "debug/macho": {},
+ "debug/pe": {},
+ "debug/plan9obj": {},
+ "embed": {},
+ "embed/internal": {},
+ "embed/internal/embedtest": {},
+ "encoding": {},
+ "encoding/ascii85": {},
+ "encoding/asn1": {},
+ "encoding/base32": {},
+ "encoding/base64": {},
+ "encoding/binary": {},
+ "encoding/csv": {},
+ "encoding/gob": {},
+ "encoding/hex": {},
+ "encoding/json": {},
+ "encoding/pem": {},
+ "encoding/xml": {},
+ "errors": {},
+ "expvar": {},
+ "flag": {},
+ "fmt": {},
+ "go": {},
+ "go/ast": {},
+ "go/build": {},
+ "go/build/constraint": {},
+ "go/constant": {},
+ "go/doc": {},
+ "go/doc/comment": {},
+ "go/format": {},
+ "go/importer": {},
+ "go/internal": {},
+ "go/internal/gccgoimporter": {},
+ "go/internal/gcimporter": {},
+ "go/internal/srcimporter": {},
+ "go/internal/typeparams": {},
+ "go/parser": {},
+ "go/printer": {},
+ "go/scanner": {},
+ "go/token": {},
+ "go/types": {},
+ "go/types/fixedbugs": {},
+ "go/version": {},
+ "hash": {},
+ "hash/adler32": {},
+ "hash/crc32": {},
+ "hash/crc64": {},
+ "hash/fnv": {},
+ "hash/maphash": {},
+ "html": {},
+ "html/template": {},
+ "image": {},
+ "image/color": {},
+ "image/color/palette": {},
+ "image/draw": {},
+ "image/gif": {},
+ "image/internal": {},
+ "image/internal/imageutil": {},
+ "image/jpeg": {},
+ "image/png": {},
+ "index": {},
+ "index/suffixarray": {},
+ "internal": {},
+ "internal/abi": {},
+ "internal/bisect": {},
+ "internal/buildcfg": {},
+ "internal/bytealg": {},
+ "internal/cfg": {},
+ "internal/chacha8rand": {},
+ "internal/coverage": {},
+ "internal/coverage/calloc": {},
+ "internal/coverage/cformat": {},
+ "internal/coverage/cmerge": {},
+ "internal/coverage/decodecounter": {},
+ "internal/coverage/decodemeta": {},
+ "internal/coverage/encodecounter": {},
+ "internal/coverage/encodemeta": {},
+ "internal/coverage/pods": {},
+ "internal/coverage/rtcov": {},
+ "internal/coverage/slicereader": {},
+ "internal/coverage/slicewriter": {},
+ "internal/coverage/stringtab": {},
+ "internal/coverage/test": {},
+ "internal/coverage/uleb128": {},
+ "internal/cpu": {},
+ "internal/dag": {},
+ "internal/diff": {},
+ "internal/execabs": {},
+ "internal/fmtsort": {},
+ "internal/format": {},
+ "internal/fuzz": {},
+ "internal/goarch": {},
+ "internal/godebug": {},
+ "internal/godebugs": {},
+ "internal/goexperiment": {},
+ "internal/golang.org": {},
+ "internal/golang.org/x": {},
+ "internal/golang.org/x/net": {},
+ "internal/golang.org/x/net/http2": {},
+ "internal/golang.org/x/net/http2/hpack": {},
+ "internal/goos": {},
+ "internal/goroot": {},
+ "internal/gover": {},
+ "internal/goversion": {},
+ "internal/intern": {},
+ "internal/itoa": {},
+ "internal/lazyregexp": {},
+ "internal/lazytemplate": {},
+ "internal/nettrace": {},
+ "internal/obscuretestdata": {},
+ "internal/oserror": {},
+ "internal/pkgbits": {},
+ "internal/platform": {},
+ "internal/poll": {},
+ "internal/pprof": {},
+ "internal/pprof/profile": {},
+ "internal/profile": {},
+ "internal/race": {},
+ "internal/reflectlite": {},
+ "internal/safefilepath": {},
+ "internal/saferio": {},
+ "internal/singleflight": {},
+ "internal/syscall": {},
+ "internal/syscall/execenv": {},
+ "internal/syscall/unix": {},
+ "internal/syscall/windows": {},
+ "internal/syscall/windows/registry": {},
+ "internal/syscall/windows/sysdll": {},
+ "internal/sysinfo": {},
+ "internal/testenv": {},
+ "internal/testlog": {},
+ "internal/testpty": {},
+ "internal/trace": {},
+ "internal/trace/traceviewer": {},
+ "internal/trace/traceviewer/format": {},
+ "internal/trace/traceviewer/static": {},
+ "internal/trace/v2": {},
+ "internal/trace/v2/event": {},
+ "internal/trace/v2/event/go122": {},
+ "internal/trace/v2/internal": {},
+ "internal/trace/v2/internal/testgen": {},
+ "internal/trace/v2/internal/testgen/go122": {},
+ "internal/trace/v2/raw": {},
+ "internal/trace/v2/testtrace": {},
+ "internal/trace/v2/version": {},
+ "internal/txtar": {},
+ "internal/types": {},
+ "internal/types/errors": {},
+ "internal/unsafeheader": {},
+ "internal/x": {},
+ "internal/x/crypto": {},
+ "internal/x/crypto/chacha20poly1305": {},
+ "internal/x/crypto/cryptobyte": {},
+ "internal/x/crypto/cryptobyte/asn1": {},
+ "internal/x/crypto/curve25519": {},
+ "internal/x/crypto/hkdf": {},
+ "internal/x/crypto/internal": {},
+ "internal/x/crypto/internal/chacha20": {},
+ "internal/x/crypto/poly1305": {},
+ "internal/x/net": {},
+ "internal/x/net/dns": {},
+ "internal/x/net/dns/dnsmessage": {},
+ "internal/x/net/http": {},
+ "internal/x/net/http/httpguts": {},
+ "internal/x/net/http/httpproxy": {},
+ "internal/x/net/http2": {},
+ "internal/x/net/http2/hpack": {},
+ "internal/x/net/idna": {},
+ "internal/x/net/internal": {},
+ "internal/x/net/internal/nettest": {},
+ "internal/x/net/lif": {},
+ "internal/x/net/nettest": {},
+ "internal/x/net/route": {},
+ "internal/x/text": {},
+ "internal/x/text/secure": {},
+ "internal/x/text/secure/bidirule": {},
+ "internal/x/text/transform": {},
+ "internal/x/text/unicode": {},
+ "internal/x/text/unicode/bidi": {},
+ "internal/x/text/unicode/norm": {},
+ "internal/xcoff": {},
+ "internal/zstd": {},
+ "io": {},
+ "io/fs": {},
+ "io/ioutil": {},
+ "iter": {},
+ "lib9": {},
+ "lib9/fmt": {},
+ "lib9/utf": {},
+ "libbio": {},
+ "liblink": {},
+ "libmach": {},
+ "log": {},
+ "log/internal": {},
+ "log/slog": {},
+ "log/slog/internal": {},
+ "log/slog/internal/benchmarks": {},
+ "log/slog/internal/buffer": {},
+ "log/slog/internal/slogtest": {},
+ "log/syslog": {},
+ "maps": {},
+ "math": {},
+ "math/big": {},
+ "math/bits": {},
+ "math/cmplx": {},
+ "math/rand": {},
+ "math/rand/v2": {},
+ "mime": {},
+ "mime/multipart": {},
+ "mime/quotedprintable": {},
+ "net": {},
+ "net/http": {},
+ "net/http/cgi": {},
+ "net/http/cookiejar": {},
+ "net/http/fcgi": {},
+ "net/http/httptest": {},
+ "net/http/httptrace": {},
+ "net/http/httputil": {},
+ "net/http/internal": {},
+ "net/http/internal/ascii": {},
+ "net/http/internal/testcert": {},
+ "net/http/pprof": {},
+ "net/internal": {},
+ "net/internal/socktest": {},
+ "net/mail": {},
+ "net/netip": {},
+ "net/rpc": {},
+ "net/rpc/jsonrpc": {},
+ "net/smtp": {},
+ "net/textproto": {},
+ "net/url": {},
+ "os": {},
+ "os/exec": {},
+ "os/exec/internal": {},
+ "os/exec/internal/fdtest": {},
+ "os/signal": {},
+ "os/signal/internal": {},
+ "os/signal/internal/pty": {},
+ "os/user": {},
+ "path": {},
+ "path/filepath": {},
+ "pkg": {},
+ "pkg/archive": {},
+ "pkg/archive/tar": {},
+ "pkg/archive/zip": {},
+ "pkg/bufio": {},
+ "pkg/builtin": {},
+ "pkg/bytes": {},
+ "pkg/compress": {},
+ "pkg/compress/bzip2": {},
+ "pkg/compress/flate": {},
+ "pkg/compress/gzip": {},
+ "pkg/compress/lzw": {},
+ "pkg/compress/zlib": {},
+ "pkg/container": {},
+ "pkg/container/heap": {},
+ "pkg/container/list": {},
+ "pkg/container/ring": {},
+ "pkg/crypto": {},
+ "pkg/crypto/aes": {},
+ "pkg/crypto/cipher": {},
+ "pkg/crypto/des": {},
+ "pkg/crypto/dsa": {},
+ "pkg/crypto/ecdsa": {},
+ "pkg/crypto/elliptic": {},
+ "pkg/crypto/hmac": {},
+ "pkg/crypto/md5": {},
+ "pkg/crypto/rand": {},
+ "pkg/crypto/rc4": {},
+ "pkg/crypto/rsa": {},
+ "pkg/crypto/sha1": {},
+ "pkg/crypto/sha256": {},
+ "pkg/crypto/sha512": {},
+ "pkg/crypto/subtle": {},
+ "pkg/crypto/tls": {},
+ "pkg/crypto/x509": {},
+ "pkg/crypto/x509/pkix": {},
+ "pkg/database": {},
+ "pkg/database/sql": {},
+ "pkg/database/sql/driver": {},
+ "pkg/debug": {},
+ "pkg/debug/dwarf": {},
+ "pkg/debug/elf": {},
+ "pkg/debug/goobj": {},
+ "pkg/debug/gosym": {},
+ "pkg/debug/macho": {},
+ "pkg/debug/pe": {},
+ "pkg/debug/plan9obj": {},
+ "pkg/encoding": {},
+ "pkg/encoding/ascii85": {},
+ "pkg/encoding/asn1": {},
+ "pkg/encoding/base32": {},
+ "pkg/encoding/base64": {},
+ "pkg/encoding/binary": {},
+ "pkg/encoding/csv": {},
+ "pkg/encoding/gob": {},
+ "pkg/encoding/hex": {},
+ "pkg/encoding/json": {},
+ "pkg/encoding/pem": {},
+ "pkg/encoding/xml": {},
+ "pkg/errors": {},
+ "pkg/expvar": {},
+ "pkg/flag": {},
+ "pkg/fmt": {},
+ "pkg/go": {},
+ "pkg/go/ast": {},
+ "pkg/go/build": {},
+ "pkg/go/doc": {},
+ "pkg/go/format": {},
+ "pkg/go/parser": {},
+ "pkg/go/printer": {},
+ "pkg/go/scanner": {},
+ "pkg/go/token": {},
+ "pkg/hash": {},
+ "pkg/hash/adler32": {},
+ "pkg/hash/crc32": {},
+ "pkg/hash/crc64": {},
+ "pkg/hash/fnv": {},
+ "pkg/html": {},
+ "pkg/html/template": {},
+ "pkg/image": {},
+ "pkg/image/color": {},
+ "pkg/image/color/palette": {},
+ "pkg/image/draw": {},
+ "pkg/image/gif": {},
+ "pkg/image/jpeg": {},
+ "pkg/image/png": {},
+ "pkg/index": {},
+ "pkg/index/suffixarray": {},
+ "pkg/io": {},
+ "pkg/io/ioutil": {},
+ "pkg/log": {},
+ "pkg/log/syslog": {},
+ "pkg/math": {},
+ "pkg/math/big": {},
+ "pkg/math/cmplx": {},
+ "pkg/math/rand": {},
+ "pkg/mime": {},
+ "pkg/mime/multipart": {},
+ "pkg/net": {},
+ "pkg/net/http": {},
+ "pkg/net/http/cgi": {},
+ "pkg/net/http/cookiejar": {},
+ "pkg/net/http/fcgi": {},
+ "pkg/net/http/httptest": {},
+ "pkg/net/http/httputil": {},
+ "pkg/net/http/pprof": {},
+ "pkg/net/mail": {},
+ "pkg/net/rpc": {},
+ "pkg/net/rpc/jsonrpc": {},
+ "pkg/net/smtp": {},
+ "pkg/net/textproto": {},
+ "pkg/net/url": {},
+ "pkg/os": {},
+ "pkg/os/exec": {},
+ "pkg/os/signal": {},
+ "pkg/os/user": {},
+ "pkg/path": {},
+ "pkg/path/filepath": {},
+ "pkg/reflect": {},
+ "pkg/regexp": {},
+ "pkg/regexp/syntax": {},
+ "pkg/runtime": {},
+ "pkg/runtime/cgo": {},
+ "pkg/runtime/debug": {},
+ "pkg/runtime/pprof": {},
+ "pkg/runtime/race": {},
+ "pkg/sort": {},
+ "pkg/strconv": {},
+ "pkg/strings": {},
+ "pkg/sync": {},
+ "pkg/sync/atomic": {},
+ "pkg/syscall": {},
+ "pkg/testing": {},
+ "pkg/testing/iotest": {},
+ "pkg/testing/quick": {},
+ "pkg/text": {},
+ "pkg/text/scanner": {},
+ "pkg/text/tabwriter": {},
+ "pkg/text/template": {},
+ "pkg/text/template/parse": {},
+ "pkg/time": {},
+ "pkg/unicode": {},
+ "pkg/unicode/utf16": {},
+ "pkg/unicode/utf8": {},
+ "pkg/unsafe": {},
+ "plugin": {},
+ "reflect": {},
+ "reflect/internal": {},
+ "reflect/internal/example1": {},
+ "reflect/internal/example2": {},
+ "regexp": {},
+ "regexp/syntax": {},
+ "runtime": {},
+ "runtime/asan": {},
+ "runtime/cgo": {},
+ "runtime/coverage": {},
+ "runtime/debug": {},
+ "runtime/internal": {},
+ "runtime/internal/atomic": {},
+ "runtime/internal/math": {},
+ "runtime/internal/startlinetest": {},
+ "runtime/internal/sys": {},
+ "runtime/internal/syscall": {},
+ "runtime/internal/wasitest": {},
+ "runtime/metrics": {},
+ "runtime/msan": {},
+ "runtime/pprof": {},
+ "runtime/pprof/internal": {},
+ "runtime/pprof/internal/profile": {},
+ "runtime/pprof/internal/protopprof": {},
+ "runtime/race": {},
+ "runtime/race/internal": {},
+ "runtime/race/internal/amd64v1": {},
+ "runtime/race/internal/amd64v3": {},
+ "runtime/trace": {},
+ "slices": {},
+ "sort": {},
+ "strconv": {},
+ "strings": {},
+ "sync": {},
+ "sync/atomic": {},
+ "syscall": {},
+ "syscall/js": {},
+ "testing": {},
+ "testing/fstest": {},
+ "testing/internal": {},
+ "testing/internal/testdeps": {},
+ "testing/iotest": {},
+ "testing/quick": {},
+ "testing/slogtest": {},
+ "text": {},
+ "text/scanner": {},
+ "text/tabwriter": {},
+ "text/template": {},
+ "text/template/parse": {},
+ "time": {},
+ "time/tzdata": {},
+ "unicode": {},
+ "unicode/utf16": {},
+ "unicode/utf8": {},
+ "unsafe": {},
+ "vendor": {},
+ "vendor/golang.org": {},
+ "vendor/golang.org/x": {},
+ "vendor/golang.org/x/crypto": {},
+ "vendor/golang.org/x/crypto/chacha20": {},
+ "vendor/golang.org/x/crypto/chacha20poly1305": {},
+ "vendor/golang.org/x/crypto/cryptobyte": {},
+ "vendor/golang.org/x/crypto/cryptobyte/asn1": {},
+ "vendor/golang.org/x/crypto/curve25519": {},
+ "vendor/golang.org/x/crypto/curve25519/internal": {},
+ "vendor/golang.org/x/crypto/curve25519/internal/field": {},
+ "vendor/golang.org/x/crypto/hkdf": {},
+ "vendor/golang.org/x/crypto/internal": {},
+ "vendor/golang.org/x/crypto/internal/alias": {},
+ "vendor/golang.org/x/crypto/internal/chacha20": {},
+ "vendor/golang.org/x/crypto/internal/poly1305": {},
+ "vendor/golang.org/x/crypto/internal/subtle": {},
+ "vendor/golang.org/x/crypto/poly1305": {},
+ "vendor/golang.org/x/net": {},
+ "vendor/golang.org/x/net/dns": {},
+ "vendor/golang.org/x/net/dns/dnsmessage": {},
+ "vendor/golang.org/x/net/http": {},
+ "vendor/golang.org/x/net/http/httpguts": {},
+ "vendor/golang.org/x/net/http/httpproxy": {},
+ "vendor/golang.org/x/net/http2": {},
+ "vendor/golang.org/x/net/http2/hpack": {},
+ "vendor/golang.org/x/net/idna": {},
+ "vendor/golang.org/x/net/lex": {},
+ "vendor/golang.org/x/net/lex/httplex": {},
+ "vendor/golang.org/x/net/lif": {},
+ "vendor/golang.org/x/net/nettest": {},
+ "vendor/golang.org/x/net/route": {},
+ "vendor/golang.org/x/sys": {},
+ "vendor/golang.org/x/sys/cpu": {},
+ "vendor/golang.org/x/text": {},
+ "vendor/golang.org/x/text/secure": {},
+ "vendor/golang.org/x/text/secure/bidirule": {},
+ "vendor/golang.org/x/text/transform": {},
+ "vendor/golang.org/x/text/unicode": {},
+ "vendor/golang.org/x/text/unicode/bidi": {},
+ "vendor/golang.org/x/text/unicode/norm": {},
+ "vendor/golang_org": {},
+ "vendor/golang_org/x": {},
+ "vendor/golang_org/x/crypto": {},
+ "vendor/golang_org/x/crypto/chacha20poly1305": {},
+ "vendor/golang_org/x/crypto/chacha20poly1305/internal": {},
+ "vendor/golang_org/x/crypto/chacha20poly1305/internal/chacha20": {},
+ "vendor/golang_org/x/crypto/cryptobyte": {},
+ "vendor/golang_org/x/crypto/cryptobyte/asn1": {},
+ "vendor/golang_org/x/crypto/curve25519": {},
+ "vendor/golang_org/x/crypto/internal": {},
+ "vendor/golang_org/x/crypto/internal/chacha20": {},
+ "vendor/golang_org/x/crypto/poly1305": {},
+ "vendor/golang_org/x/net": {},
+ "vendor/golang_org/x/net/dns": {},
+ "vendor/golang_org/x/net/dns/dnsmessage": {},
+ "vendor/golang_org/x/net/http": {},
+ "vendor/golang_org/x/net/http/httpguts": {},
+ "vendor/golang_org/x/net/http/httpproxy": {},
+ "vendor/golang_org/x/net/http2": {},
+ "vendor/golang_org/x/net/http2/hpack": {},
+ "vendor/golang_org/x/net/idna": {},
+ "vendor/golang_org/x/net/internal": {},
+ "vendor/golang_org/x/net/internal/nettest": {},
+ "vendor/golang_org/x/net/lex": {},
+ "vendor/golang_org/x/net/lex/httplex": {},
+ "vendor/golang_org/x/net/lif": {},
+ "vendor/golang_org/x/net/nettest": {},
+ "vendor/golang_org/x/net/proxy": {},
+ "vendor/golang_org/x/net/route": {},
+ "vendor/golang_org/x/text": {},
+ "vendor/golang_org/x/text/secure": {},
+ "vendor/golang_org/x/text/secure/bidirule": {},
+ "vendor/golang_org/x/text/transform": {},
+ "vendor/golang_org/x/text/unicode": {},
+ "vendor/golang_org/x/text/unicode/bidi": {},
+ "vendor/golang_org/x/text/unicode/norm": {},
+ "vendor/golang_org/x/text/width": {},
}
diff --git a/type.go b/type.go
index 6e518d6..e4795bc 100644
--- a/type.go
+++ b/type.go
@@ -60,7 +60,7 @@ func getTypes(fileInfo *FileInfo, f fileHandler) (map[uint64]*GoType, error) {
return getLegacyTypes(fileInfo, f)
}
- md, err := parseModuledata(fileInfo, f)
+ md, err := extractModuledata(fileInfo, f)
if err != nil {
return nil, fmt.Errorf("failed to parse the module data: %w", err)
}
@@ -87,7 +87,7 @@ func getTypes(fileInfo *FileInfo, f fileHandler) (map[uint64]*GoType, error) {
}
func getLegacyTypes(fileInfo *FileInfo, f fileHandler) (map[uint64]*GoType, error) {
- md, err := parseModuledata(fileInfo, f)
+ md, err := extractModuledata(fileInfo, f)
if err != nil {
return nil, err
}