v0.0.0-...-313ecc2 Latest Latest

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

Go to latest
Published: Apr 2, 2019 License: BSD-3-Clause, MIT Imports: 19 Imported by: 0



Package objfile implements portable access to OS-specific executable files.



This section is empty.


This section is empty.


This section is empty.


type Disasm

type Disasm struct {
	// contains filtered or unexported fields

Disasm is a disassembler for a given File.

func (*Disasm) Decode

func (d *Disasm) Decode(start, end uint64, f func(pc, size uint64, file string, line int, text string))

Decode disassembles the text segment range [start, end), calling f for each instruction.

func (*Disasm) Print

func (d *Disasm) Print(w io.Writer, filter *regexp.Regexp, start, end uint64)

Print prints a disassembly of the file to w. If filter is non-nil, the disassembly only includes functions with names matching filter. The disassembly only includes functions that overlap the range [start, end).

type File

type File struct {
	// contains filtered or unexported fields

A File is an opened executable file.

func Open

func Open(name string) (*File, error)

Open opens the named file. The caller must call f.Close when the file is no longer needed.

func (*File) Close

func (f *File) Close() error

func (*File) DWARF

func (f *File) DWARF() (*dwarf.Data, error)

DWARF returns DWARF debug data for the file, if any. This is for cmd/pprof to locate cgo functions.

func (*File) Disasm

func (f *File) Disasm() (*Disasm, error)

Disasm returns a disassembler for the file f.

func (*File) GOARCH

func (f *File) GOARCH() string

func (*File) LoadAddress

func (f *File) LoadAddress() (uint64, error)

LoadAddress returns the expected load address of the file. This differs from the actual load address for a position-independent executable.

func (*File) PCLineTable

func (f *File) PCLineTable() (*gosym.Table, error)

func (*File) Symbols

func (f *File) Symbols() ([]Sym, error)

func (*File) Text

func (f *File) Text() (uint64, []byte, error)

type Sym

type Sym struct {
	Name string // symbol name
	Addr uint64 // virtual address of symbol
	Size int64  // size in bytes
	Code rune   // nm code (T for text, D for data, and so on)
	Type string // XXX?

A Sym is a symbol defined in an executable file.

Jump to

Keyboard shortcuts

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