delve/vendor/github.com/go-delve/gore
Derek Parker dda8f693e6
*: Use forked goretk/gore module (#3597)
This allows us to update this dependency on our schedule which is important because the module relies on manually updating the known list of Go versions to function correctly. Forking allows us to keep this up to date ourselves and possibly create a new system to prevent having to perform this manual step in the future.
2023-12-12 10:13:32 +01:00
..
.gitignore *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
.gitmodules *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
buildid.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
CONTRIBUTING.md *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
doc.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
elf.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
error.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
file.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
function.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
goroot.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
goversion_gen.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
goversion.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
LICENSE *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
macho.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
modinfo.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
moduledata.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
package.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
pclntab.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
pe.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
README.md *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
stdpkg_gen.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
type2.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
type.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00

Build Status GitHub tag (latest SemVer) codecov Go Report Card Go Reference

GoRE - Package gore is a library for analyzing Go binaries

How to use

  1. Use go get to download the library.
  2. Import it into your project.
  3. Write a new cool tool.

For an example use case, please checkout redress.

Sample code

Extract the main package, child packages, and sibling packages:

f, err := gore.Open(fileStr)
pkgs, err := f.GetPackages()

Extract all the types in the binary:

f, err := gore.Open(fileStr)
typs, err := f.GetTypes()

Update get new Go release information

Instead of downloading new release of the library to get detection for new Go releases, it is possible to do a local pull.

Run go generate and new compiler releases will be generated from the git tags.

Functionality

Go compiler

The library has functionality for guessing the compiler version used. It searches the binary for the identifiable string left by the compiler. It is not perfect, so functionality for assuming a specific version is also provided. The version strings used are identical to the identifiers. For example version "1.10.1" is represented as "go1.10.1" and version "1.10" is represented as "go1.10"

Function recovery

Function information is recovered from the pclntab. Information that is recovered includes: function start and end location in the text section, source file. The library also tries to estimate the first and last line number in the source file for the function. The methods recovered includes the receiver. All functions and methods belong to a package. The library tries to classify the type of package. If it is a standard library package, 3rd-party package, or part of the main application. If it unable to classify the package, it is classified as unknown.

Type recovery

The types in the binary are parsed from the "typelink" list. Not all versions of Go are supported equally. Versions 1.7 and later are fully supported. Versions 1.5 and 1.6 are partially supported. Version prior to 1.5 are not supported at all at the moment.