Go 语言

Go 语言教程 Go 语言环境安装 Go 语言结构 Go 语言基础语法 Go 语言数据类型 Go 语言变量 Go 语言常量 Go 语言运算符 Go 语言条件语句 Go 语言 if 语句 Go 语言 if...else 语句 Go 语言 if 语句嵌套 Go 语言 switch 语句 Go 语言 select 语句 Go 语言循环语句 Go 语言 for 循环 Go 语言循环嵌套 Go 语言 break 语句 Go 语言 continue 语句 Go 语言 goto 语句 Go 语言函数 Go 语言函数值传递值 Go 语言函数引用传递值 Go 语言函数作为值 Go 语言函数闭包 Go 语言函数方法 Go 语言变量作用域 Go 语言数组 Go 语言多维数组 Go 语言向函数传递数组 Go 语言指针 Go 语言指针数组 Go 语言指向指针的指针 Go 语言指针作为函数参数 Go 语言结构体 Go 语言切片(Slice) Go 语言范围(Range) Go 语言Map(集合) Go 语言递归函数 Go 语言类型转换 Go 语言接口 Go 错误处理 Go 语言开发工具Go 语言标准库

Go 语言标准库


package plan9obj

import "debug/plan9obj"

Package plan9obj implements access to Plan 9 a.out object files.

Package Files

file.go plan9obj.go

Constants

const (
    Magic64 = 0x8000 // 64-bit expanded header

    Magic386   = (4*11+0)*11 + 7
    MagicAMD64 = (4*26+0)*26 + 7 + Magic64
    MagicARM   = (4*20+0)*20 + 7
)

type File Uses

type File struct {
    FileHeader
    Sections []*Section
    // contains filtered or unexported fields
}

A File represents an open Plan 9 a.out file.

func NewFile Uses

func NewFile(r io.ReaderAt) (*File, error)

NewFile creates a new File for accessing a Plan 9 binary in an underlying reader. The Plan 9 binary is expected to start at position 0 in the ReaderAt.

func Open Uses

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

Open opens the named file using os.Open and prepares it for use as a Plan 9 a.out binary.

func (*File) Close Uses

func (f *File) Close() error

Close closes the File. If the File was created using NewFile directly instead of Open, Close has no effect.

func (*File) Section Uses

func (f *File) Section(name string) *Section

Section returns a section with the given name, or nil if no such section exists.

func (*File) Symbols Uses

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

Symbols returns the symbol table for f.

type FileHeader Uses

type FileHeader struct {
    Magic       uint32
    Bss         uint32
    Entry       uint64
    PtrSize     int
    LoadAddress uint64
    HdrSize     uint64
}

A FileHeader represents a Plan 9 a.out file header.

type Section Uses

type Section struct {
    SectionHeader

    // Embed ReaderAt for ReadAt method.
    // Do not embed SectionReader directly
    // to avoid having Read and Seek.
    // If a client wants Read and Seek it must use
    // Open() to avoid fighting over the seek offset
    // with other clients.
    io.ReaderAt
    // contains filtered or unexported fields
}

A Section represents a single section in a Plan 9 a.out file.

func (*Section) Data Uses

func (s *Section) Data() ([]byte, error)

Data reads and returns the contents of the Plan 9 a.out section.

func (*Section) Open Uses

func (s *Section) Open() io.ReadSeeker

Open returns a new ReadSeeker reading the Plan 9 a.out section.

type SectionHeader Uses

type SectionHeader struct {
    Name   string
    Size   uint32
    Offset uint32
}

A SectionHeader represents a single Plan 9 a.out section header. This structure doesn't exist on-disk, but eases navigation through the object file.

type Sym Uses

type Sym struct {
    Value uint64
    Type  rune
    Name  string
}

A Symbol represents an entry in a Plan 9 a.out symbol table section.