Version: v0.0.0-...-a6e299d Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2019 License: MIT Imports: 6 Imported by: 0




View Source
const (
	DW_OP_addr = 0x03

	// type in elf binary
	UTYPE_VAR    string = "Variable"
	UTYPE_STRUCT string = "StructType"


This section is empty.


This section is empty.


type Binary

type Binary struct {
	Path string

	SymTable *gosym.Table

	// following fields are parsed from binary dwarf during starting
	GoVerAddr      uint64 // parsed vma of runtime.buildVersion
	GStruct        *Strt  // parsed runtime.g struct
	MStruct        *Strt  // parsed runtime.m struct
	PStruct        *Strt  // parsed runtime.p struct
	GobufStruct    *Strt  // parsed runtime.gobuf struct
	SchedtStruct   *Strt  // parsed runtime.schedt struct
	SchedAddr      uint64 // parsed vma of runtime.sched
	AllglenAddr    uint64 // parsed vma of runtime.allglen
	AllgsAddr      uint64 // parsed vma of runtime.allgs
	AllpAddr       uint64 // parsed vma of runtime.allp
	GomaxprocsAddr uint64 // parsed vma of runtime.gomaxprocs
	// contains filtered or unexported fields

func Load

func Load(path string) (*Binary, error)

func (*Binary) Initialize

func (b *Binary) Initialize() error

Initialize will pre parse some info from elf binary

func (*Binary) PCToFunc

func (b *Binary) PCToFunc(addr uint64) *Location

PCToFunc convert program counter to symbolic information

func (*Binary) Parse

func (b *Binary) Parse(units ...*unit) (map[string]interface{}, error)

type Location

type Location struct {
	PC   uint64      // program counter
	File string      // source code file name, from dwarf info
	Line int         // soure code line, from dwarf info
	Func *gosym.Func // function name

func (Location) String

func (l Location) String() string

type Strt

type Strt struct {
	Name    string
	Size    int64
	Members map[string]*StrtMember

Strt is a abstruct struct parsed from dwarf info

func (*Strt) GetFieldAddr

func (s *Strt) GetFieldAddr(baseAddr uint64, name string) uint64

type StrtMember

type StrtMember struct {
	Name       string
	Size       int64  // member field size
	Offset     uint32 // offset in binary
	StrtOffset int64  // offset inside struct

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL