非常教程

Go参考手册

调试 | debug

debug/dwarf

  • import "debug/dwarf"
  • 概述
  • 参数

概述

Package dwarf 提供对从可执行文件加载的 DWARF调试信息的访问,这些信息在 DWARF 2.0 标准中定义,http://dwarfstd.org/doc/dwarf-2.0.0.pdf

参数

  • Variables (变量)
  • type AddrType
  • type ArrayType
  • func (t *ArrayType) Size() int64
  • func (t *ArrayType) String() string
  • type Attr
  • func (a Attr) GoString() string
  • func (a Attr) String() string
  • type BasicType
  • func (b *BasicType) Basic() *BasicType
  • func (t *BasicType) String() string
  • type BoolType
  • type CharType
  • type Class
  • func (i Class) GoString() string
  • func (i Class) String() string
  • type CommonType
  • func (c *CommonType) Common() *CommonType
  • func (c *CommonType) Size() int64
  • type ComplexType
  • type Data
  • func New(abbrev, aranges, frame, info, line, pubnames, ranges, str []byte) (*Data, error)
  • func (d *Data) AddTypes(name string, types []byte) error
  • func (d *Data) LineReader(cu *Entry) (*LineReader, error)
  • func (d *Data) Ranges(e *Entry) ([][2]uint64, error)
  • func (d *Data) Reader() *Reader
  • func (d *Data) Type(off Offset) (Type, error)
  • type DecodeError
  • func (e DecodeError) Error() string
  • type DotDotDotType
  • func (t *DotDotDotType) String() string
  • type Entry
  • func (e *Entry) AttrField(a Attr) *Field
  • func (e *Entry) Val(a Attr) interface{}
  • type EnumType
  • func (t *EnumType) String() string
  • type EnumValue
  • type Field
  • type FloatType
  • type FuncType
  • func (t *FuncType) String() string
  • type IntType
  • type LineEntry
  • type LineFile
  • type LineReader
  • func (r *LineReader) Next(entry *LineEntry) error
  • func (r *LineReader) Reset()
  • func (r *LineReader) Seek(pos LineReaderPos)
  • func (r *LineReader) SeekPC(pc uint64, entry *LineEntry) error
  • func (r *LineReader) Tell() LineReaderPos
  • type LineReaderPos
  • type Offset
  • type PtrType
  • func (t *PtrType) String() string
  • type QualType
  • func (t *QualType) Size() int64
  • func (t *QualType) String() string
  • type Reader
  • func (r *Reader) AddressSize() int
  • func (r *Reader) Next() (*Entry, error)
  • func (r *Reader) Seek(off Offset)
  • func (r *Reader) SeekPC(pc uint64) (*Entry, error)
  • func (r *Reader) SkipChildren()
  • type StructField
  • type StructType
  • func (t *StructType) Defn() string
  • func (t *StructType) String() string
  • type Tag
  • func (t Tag) GoString() string
  • func (t Tag) String() string
  • type Type
  • type TypedefType
  • func (t *TypedefType) Size() int64
  • func (t *TypedefType) String() string
  • type UcharType
  • type UintType
  • type UnspecifiedType
  • type VoidType
  • func (t *VoidType) String() string

打包文件

buf.go class_string.go const.go entry.go line.go open.go type.go typeunit.go unit.go

变量

ErrUnknownPC 是 LineReader.ScanPC 在查找 PC未被行表中的任何条目覆盖时返回的错误。

var ErrUnknownPC = errors.New("ErrUnknownPC")

type AddrType(查看源代码)

AddrType 代表机器地址类型。

type AddrType struct {
        BasicType
}

type ArrayType(查看源代码)

ArrayType表示固定大小的数组类型。

type ArrayType struct {
        CommonType
        Type          Type
        StrideBitSize int64 // 如果> 0,则保持每个元素的位数
        Count         int64 // 如果== -1,一个不完整的数组,如char x []。
}

func (*ArrayType) Size(查看源代码)

func (t *ArrayType) Size() int64

func (*ArrayType) String(查看源代码)

func (t *ArrayType) String() string

type Attr(查看源代码)

Attr 在 DWARF 条目字段中标识属性类型。

type Attr uint32
const (
        AttrSibling        Attr = 0x01
        AttrLocation       Attr = 0x02
        AttrName           Attr = 0x03
        AttrOrdering       Attr = 0x09
        AttrByteSize       Attr = 0x0B
        AttrBitOffset      Attr = 0x0C
        AttrBitSize        Attr = 0x0D
        AttrStmtList       Attr = 0x10
        AttrLowpc          Attr = 0x11
        AttrHighpc         Attr = 0x12
        AttrLanguage       Attr = 0x13
        AttrDiscr          Attr = 0x15
        AttrDiscrValue     Attr = 0x16
        AttrVisibility     Attr = 0x17
        AttrImport         Attr = 0x18
        AttrStringLength   Attr = 0x19
        AttrCommonRef      Attr = 0x1A
        AttrCompDir        Attr = 0x1B
        AttrConstValue     Attr = 0x1C
        AttrContainingType Attr = 0x1D
        AttrDefaultValue   Attr = 0x1E
        AttrInline         Attr = 0x20
        AttrIsOptional     Attr = 0x21
        AttrLowerBound     Attr = 0x22
        AttrProducer       Attr = 0x25
        AttrPrototyped     Attr = 0x27
        AttrReturnAddr     Attr = 0x2A
        AttrStartScope     Attr = 0x2C
        AttrStrideSize     Attr = 0x2E
        AttrUpperBound     Attr = 0x2F
        AttrAbstractOrigin Attr = 0x31
        AttrAccessibility  Attr = 0x32
        AttrAddrClass      Attr = 0x33
        AttrArtificial     Attr = 0x34
        AttrBaseTypes      Attr = 0x35
        AttrCalling        Attr = 0x36
        AttrCount          Attr = 0x37
        AttrDataMemberLoc  Attr = 0x38
        AttrDeclColumn     Attr = 0x39
        AttrDeclFile       Attr = 0x3A
        AttrDeclLine       Attr = 0x3B
        AttrDeclaration    Attr = 0x3C
        AttrDiscrList      Attr = 0x3D
        AttrEncoding       Attr = 0x3E
        AttrExternal       Attr = 0x3F
        AttrFrameBase      Attr = 0x40
        AttrFriend         Attr = 0x41
        AttrIdentifierCase Attr = 0x42
        AttrMacroInfo      Attr = 0x43
        AttrNamelistItem   Attr = 0x44
        AttrPriority       Attr = 0x45
        AttrSegment        Attr = 0x46
        AttrSpecification  Attr = 0x47
        AttrStaticLink     Attr = 0x48
        AttrType           Attr = 0x49
        AttrUseLocation    Attr = 0x4A
        AttrVarParam       Attr = 0x4B
        AttrVirtuality     Attr = 0x4C
        AttrVtableElemLoc  Attr = 0x4D
        AttrAllocated      Attr = 0x4E
        AttrAssociated     Attr = 0x4F
        AttrDataLocation   Attr = 0x50
        AttrStride         Attr = 0x51
        AttrEntrypc        Attr = 0x52
        AttrUseUTF8        Attr = 0x53
        AttrExtension      Attr = 0x54
        AttrRanges         Attr = 0x55
        AttrTrampoline     Attr = 0x56
        AttrCallColumn     Attr = 0x57
        AttrCallFile       Attr = 0x58
        AttrCallLine       Attr = 0x59
        AttrDescription    Attr = 0x5A
)

func (Attr) GoString(查看源代码)

func (a Attr) GoString() string

func (Attr) String(查看源代码)

func (a Attr) String() string

type BasicType(查看源代码)

BasicType 保存所有基本类型通用的字段。

type BasicType struct {
        CommonType
        BitSize   int64
        BitOffset int64
}

func (*BasicType) Basic(查看源代码)

func (b *BasicType) Basic() *BasicType

func (*BasicType) String(查看源代码)

func (t *BasicType) String() string

type BoolType(查看源代码)

BoolType表示 Bool类型。

type BoolType struct {
        BasicType
}

type CharType(查看源代码)

CharType 表示有符号的字符类型。

type CharType struct {
        BasicType
}

type Class(查看源代码)

Class 是属性值的DWARF 4类。

通常,给定属性的值可能采用 DWARF 定义的几个可能的类之一,每个类都会导致对该属性的稍微不同的解释。

DWARF 第4版比以前版本的 DWARF 更精细地区分属性值类。读者可以将早期版本的 DWAR F中较粗糙的类混淆到适当的D WARF 4类中。例如, DWARF 2对常量以及所有类型的部分偏移使用“constant”,但读者将规范DWARF 2文件中的属性,这些属性指向某个类 *Ptr 类的部分偏移,尽管这些类只是在 DWARF 3 中定义。

type Class int
const (
        // ClassUnknown表示未知的DWARF类的值。
        ClassUnknown Class = iota

        // ClassAddress表示类型为uint64的值
        // 目标机器上的地址。

        // ClassBlock表示其类型为[]bype的值
        // 解释取决于属性。
        ClassBlock

        // ClassConstant表示类型为int64的值
        // 常量。 这个常数的解释取决于
        // 属性。
        ClassConstant

        // ClassExprLoc表示包含的[]字节的值
        // 一个编码的DWARF表达式或位置描述。
        ClassExprLoc

        // ClassFlag表示bool类型的值。
        ClassFlag

        // ClassLinePtr表示值为int64的偏移量
        // 进入“line”部分。
        ClassLinePtr

        // ClassLocListPtr表示值为int64的偏移量
        // 到“loclist”部分。
        ClassLocListPtr

        // ClassMacPtr表示int64偏移量的值
        // “mac”部分。
        ClassMacPtr

        // ClassMacPtr表示int64偏移量的值
        // “rangelist”部分。
        ClassRangeListPtr

        // ClassReference表示偏移量偏移量的值
        // 信息部分中的条目(用于Reader.Seek)。
        // DWARF规范结合了ClassReference和
        // ClassReferenceSig入类“reference”。
        ClassReference

        // ClassReferenceSig表示一个uint64类型的值
        // 引用类型Entry的签名。
        ClassReferenceSig

        // ClassString表示值是字符串。 如果
        // 编译单元指定AttrUseUTF8标志(强烈地
        // 推荐),字符串值将以UTF-8编码。
        // 否则,未指定编码。
        ClassString

        // ClassReferenceAlt表示int64类型的值
        // DWARF“info”部分中的偏移量
        // 对象文件。
        ClassReferenceAlt

        // ClassStringAlt表示类型为int64的值
        // 偏移到备用对象的DWARF字符串部分
        // 文件。
        ClassStringAlt
)

func (Class) GoString(查看源代码)

func (i Class) GoString() string

func (Class) String(查看源代码)

func (i Class) String() string

type CommonType (查看源代码)

CommonType 保存多种类型通用的字段。如果某个字段对于给定的类型不知道或不适用,则使用零值。

type CommonType struct {
        ByteSize int64  // 此类型的值的大小,以字节为单位
        Name     string // 可用于引用类型的名称

func (*CommonType) Common(查看源代码)

func (c *CommonType) Common() *CommonType

func (*CommonType) Size(查看源代码)

func (c *CommonType) Size() int64

type ComplexType(查看源代码)

ComplexType 表示复杂的浮点类型。

type ComplexType struct {
        BasicType
}

type Data(查看源代码)

数据表示从可执行文件(例如,ELF 或 Mach-O 可执行文件)加载的 DWARF 调试信息。

type Data struct {
        // 包含过滤或未导出的字段
}

func New(查看源代码)

func New(abbrev, aranges, frame, info, line, pubnames, ranges, str []byte) (*Data, error)

New 返回从给定参数初始化的新 Data 对象。客户端不应该直接调用此函数,而应使用适当的包 debug/elf,debug/macho 或 debug/pe 的 File 类型的 DWARF 方法。

[]byte 参数是来自对象文件中相应调试部分的数据; 例如,对于 ELF 对象,缩写是 “.debug_abbrev” 部分的内容。

func (*Data) AddTypes(查看源代码)

func (d *Data) AddTypes(name string, types []byte) error

AddTypes 将为 DWARF数据添加一个 .debug_types 节。具有DWARF 版本4调试信息的典型对象将具有多个 .debug_types 部分。名称仅用于错误报告,用于区分一个 .debug_types 和另一个。

func (*Data) LineReader(查看源代码)

func (d *Data) LineReader(cu *Entry) (*LineReader, error)

LineReader 为编译单元 cu 的行表返回一个新的读取器,该读取器必须是具有标记 TagCompileUnit 的条目。

如果此编译单元没有行表,则返回 nil,nil。

func (*Data) Ranges(查看源代码)

func (d *Data) Ranges(e *Entry) ([][2]uint64, error)

范围返回由e覆盖的PC范围,这是一对[低,高]对。只有一些条目类型(如 TagCompileUnit 或 TagSubprogram)具有PC范围;对于其他人,这将返回零,没有错误。

func (*Data) Reader(查看源代码)

func (d *Data) Reader() *Reader

Reader会返回一个新的数据读取器。阅读器位于DWARF“info”部分的字节偏移量0处。

func (*Data) Type(查看源代码)

func (d *Data) Type(off Offset) (Type, error)

类型在 DWARF “info”部分关闭时读取类型。

type DecodeError(查看源代码)

type DecodeError struct {
        Name   string
        Offset Offset
        Err    string
}

func (DecodeError) Error(查看源代码)

func (e DecodeError) Error() string

type DotDotDotType(查看源代码)

DotDotDotType 表示可变参数...函数参数。

type DotDotDotType struct {
        CommonType
}

func (*DotDotDotType) String(查看源代码)

func (t *DotDotDotType) String() string

type Entry(查看源代码)

entry 是一系列属性/值(attribute/value)对。

type Entry struct {
        Offset   Offset // DWARF信息中的条目偏移
        Tag      Tag    // 标签(Entry的种类)
        Children bool   // whether Entry is followed by children
        Field    []Field
}

func (*Entry) AttrField(查看源代码)

func (e *Entry) AttrField(a Attr) *Field

AttrField 返回 Entry中与属性 Attr 关联的字段,如果没有此属性,则返回 nil。

func (*Entry) Val(查看源代码)

func (e *Entry) Val(a Attr) interface{}

Val 在 Entry 中返回与属性 Attr 相关的值,如果没有这个属性,则返回 nil。

一个常见的习惯用法是将无返回检查与检查该值是否具有预期的动态类型进行合并,如下所示:

v, ok := e.Val(AttrSibling).(int64)

type EnumType (查看源代码)

EnumType 表示枚举类型。其本地整数类型的唯一指示是它的ByteSize (在 CommonType中)。

type EnumType struct {
        CommonType
        EnumName string
        Val      []*EnumValue
}

func (*EnumType) String(查看源代码)

func (t *EnumType) String() string

type EnumValue (查看源代码)

EnumValue 表示一个枚举值。

type EnumValue struct {
        Name string
        Val  int64
}

type Field(查看源代码)

字段是 Entry 中的单个属性/值对。

值可以是由 DWARF 定义的几个“属性类(attribute classes)”之一。每个类对应的 Go类型是:

DWARF class       Go type        Class
-----------       -------        -----
address           uint64         ClassAddress
block             []byte         ClassBlock
constant          int64          ClassConstant
flag              bool           ClassFlag
reference
  to info         dwarf.Offset   ClassReference
  to type unit    uint64         ClassReferenceSig
string            string         ClassString
exprloc           []byte         ClassExprLoc
lineptr           int64          ClassLinePtr
loclistptr        int64          ClassLocListPtr
macptr            int64          ClassMacPtr
rangelistptr      int64          ClassRangeListPtr

对于无法识别的或供应商定义的属性,Class 可能是ClassUnknown。

type Field struct {
        Attr  Attr
        Val   interface{}
        Class Class
}

type FloatType(查看源代码)

FloatType 表示浮点类型。

type FloatType struct {
        BasicType
}

type FuncType(查看源代码)

FuncType 表示一个函数类型。

type FuncType struct {
        CommonType
        ReturnType Type
        ParamType  []Type
}

func (*FuncType) String(查看源代码)

func (t *FuncType) String() string

type IntType(查看源代码)

IntType 表示一个有符号的整数类型。

type IntType struct {
        BasicType
}

type LineEntry(查看源代码)

LineEntry 是 DWARF 行表中的一行。

type LineEntry struct {
        // 地址是机器的程序计数器值
        // 由编译器生成的指令。 LineEntry
        // 适用于Address中的每条指令
        // 下一个LineEntry的地址。
        Address uint64

        // OpIndex是VLIW内操作的索引
        // 指令。 第一个操作的索引是0. 对于
        // 非VLIW体系结构,它将始终为0。地址和
        // OpIndex一起形成一个可以的操作指针
        // 参考指令中的任何单独操作
        // 流(stream)。
        OpIndex int

        // 文件是与这些相对应的源文件
        // 说明。
        File *LineFile

        // Line是与这些对应的源代码行号
        // 说明。 行从1开始编号。可能是
        // 0如果这些说明不能归因于任何来源
        // 行。
        Line int

        // 列是这些源代码行中的列号
        // 说明。 列从1开始编号。它可以
        // 为0表示该行的“左边缘”。
        Column int

        // IsStmt表示Address是推荐的断点
        // 位置,如行,语句或以下的开头
        // 声明的不同部分。
        IsStmt bool

        // BasicBlock表示Address是以下的开头
        // 基本块。
        BasicBlock bool

        // PrologueEnd表示地址是一个(可能是
        // 许多)PCs,执行应该暂停一个
        // 进入包含函数的断点。
        //
        // 在DWARF 3中添加。
        PrologueEnd bool

        // EpilogueBegin指出Address是可能的
        // 许多)PCs,执行应该暂停一个
        // 退出此函数时的断点。
        //
        // 在DWARF 3中添加。
        EpilogueBegin bool

        // ISA是这些指令集架构
        //说明。 可能的ISA值应该由
        // 适用的ABI规范。
        //
        // 在DWARF 3中添加。
        ISA int

        // 鉴别器是指示块的任意整数
        // 这些说明属于哪些。 它服务于
        // 区分可能与之相关的多个区块
        // 相同的源文件,行和列。 当只有一个
        // 块对于给定的源位置存在,它应该是0。
        //
        // 在DWARF 3中添加。
        Discriminator int

        // EndSequence表示该地址是之后的第一个字节
        // 一系列目标机器指令的结束。 如果它
        // 被设置,只有这个和地址字段是有意义的。 一个
        // 行号表可能包含多个信息
        // 可能不相交的指令序列。 最后一项
        // 在行表中应始终设置EndSequence。
        EndSequence bool
}

type LineFile(查看源代码)

LineFile 是由 DWARF 行表项引用的源文件。

type LineFile struct {
        Name   string
        Mtime  uint64 // 实现定义了修改时间,如果未知则为0
        Length int    // 文件长度,如果未知,则为0
}

type LineReader(查看源代码)

LineReader 从 DWARF“line”部分为单个编译单元读取一系列LineEntry 结构。LineEntries 按照增加PC的顺序发生,并且每个LineEntry 都为从该 LineEntry 的PC到下一个 LineEntry 的PC之前的指令提供元数据。最后一项将设置其 EndSequence 字段。

type LineReader struct {
        // 包含过滤或未导出的字段
}

func (*LineReader) Next(查看源代码)

func (r *LineReader) Next(entry *LineEntry) error

接下来将*entry 设置到此行表中的下一行并移至下一行。如果没有更多条目并且行表正确终止,它将返回 io.EOF。

行总是按照递增条目的顺序排列。地址,但 entry.Line 可以前进或后退。

func (*LineReader) Reset(查看源代码)

func (r *LineReader) Reset()

复位重新定位行表格 reader 在行表格的开头。

func (*LineReader) Seek(查看源代码)

func (r *LineReader) Seek(pos LineReaderPos)

Seek 将行表读取器恢复到 Tell 返回的位置。

参数 pos 必须已经通过在此行表上调用 Tell 来返回。

func (*LineReader) SeekPC(查看源代码)

func (r *LineReader) SeekPC(pc uint64, entry *LineEntry) error

SeekPC 将*entry 设置为包含 pc 的 LineEntry,并将读取器放置在行表中的下一个条目上。如有必要,这将寻求反向查找电脑。

如果pc未被此行表中的任何条目覆盖,SeekPC 将返回ErrUnknownPC。在这种情况下,*entry 和最终的查找位置是未指定的。

请注意,DWARF 行表只允许顺序扫描,正向扫描。因此,在最坏的情况下,线表的大小需要时间线性。如果调用者希望重复进行快速的 PC 查找,则应该为行表建立适当的索引。

func (*LineReader) Tell(查看源代码)

func (r *LineReader) Tell() LineReaderPos

Tell 返回行表中的当前位置。

type LineReaderPos(查看源代码)

LineReaderPos 表示行表中的位置。

type LineReaderPos struct {
        // 包含过滤或未导出的字段
}

type Offset(查看源代码)

Offset 表示 DWARF 信息内条目的位置。(见 Reader.Seek。)

type Offset uint32

type PtrType(查看源代码)

PtrType 表示一个指针类型。

type PtrType struct {
        CommonType
        Type Type
}

func (*PtrType) String(查看源代码)

func (t *PtrType) String() string

type QualType(查看源代码)

QualType 表示具有 C/C++“const”,“restrict” 或 “volatile” 限定符的类型。

type QualType struct {
        CommonType
        Qual string
        Type Type
}

func (*QualType) Size(查看源代码)

func (t *QualType) Size() int64

func (*QualType) String(查看源代码)

func (t *QualType) String() string

type Reader(查看源代码)

阅读器允许从 DWARF “info”部分读取条目结构。Entry 结构排列在树中。Reader 的 Ne​​xt 函数从树的预定义遍历中返回连续的条目。如果一个条目有子类,它的子类字段将是真实的,并且子类跟随,终止于具有标签 0 的条目。

type Reader struct {
        // 包含过滤或未导出的字段
}

func (*Reader) AddressSize(查看源代码)

func (r *Reader) AddressSize() int

AddressSize 返回当前编译单元中地址的大小(以字节为单位)。

func (*Reader) Next(查看源代码)

func (r *Reader) Next() (*Entry, error)

接下来从编码的入口流中读取下一个条目。当它到达该部分的末尾时返回 nil,nil。如果当前偏移量无效或者偏移量中的数据无法解码为有效条目,则返回错误。

func (*Reader) Seek(查看源代码)

func (r *Reader) Seek(off Offset)

在编码的入口流中寻找偏移读取器的位置。偏移量 0 可以用来表示第一个条目。

func (*Reader) SeekPC(查看源代码)

func (r *Reader) SeekPC(pc uint64) (*Entry, error)

SeekPC 返回包含 pc 的编译单元的 Entry,并让阅读器读取该单元的子元素。如果 pc 没有被任何单元覆盖,SeekPC 返回ErrUnknownPC 并且读取器的位置是未定义的。

因为编译单元可以描述可执行文件的多个区域,所以最糟糕的情况是 SeekPC 必须搜索所有编译单元中的所有范围。每次调用SeekPC 时都会在最后一次调用的编译单元中开始搜索,因此一般来说,查看一系列 PC 时,如果它们被分类,速度会更快。如果调用者希望重复进行快速 PC 查找,则应使用 Ranges 方法构建适当的索引。

func (*Reader) SkipChildren(查看源代码)

func (r *Reader) SkipChildren()

SkipChildren 跳过与 Next 返回的最后一个条目关联的子条目。如果该条目没有子类,或者 Next 未被调用,则 SkipChildren 是无操作的。

type StructField(查看源代码)

StructField 表示结构体,联合体或 C ++ 类类型中的字段。

type StructField struct {
        Name       string
        Type       Type
        ByteOffset int64
        ByteSize   int64
        BitOffset  int64 // 在ByteOffset的ByteSize字节内
        BitSize    int64 // 如果不是位域,则为零
}

type StructType(查看源代码)

StructType 表示结构体,联合体或 C ++ 类的类型。

type StructType struct {
        CommonType
        StructName string
        Kind       string // “struct”,“union”或“class”。
        Incomplete bool // 如果为true,则struct,union,class被声明但未被定义
}

func (*StructType) Defn(查看源代码)

func (t *StructType) Defn() string

func (*StructType) String(查看源代码)

func (t *StructType) String() string

type Tag(查看源代码)

标签是条目的分类(类型)。

type Tag uint32
const (
        TagArrayType              Tag = 0x01
        TagClassType              Tag = 0x02
        TagEntryPoint             Tag = 0x03
        TagEnumerationType        Tag = 0x04
        TagFormalParameter        Tag = 0x05
        TagImportedDeclaration    Tag = 0x08
        TagLabel                  Tag = 0x0A
        TagLexDwarfBlock          Tag = 0x0B
        TagMember                 Tag = 0x0D
        TagPointerType            Tag = 0x0F
        TagReferenceType          Tag = 0x10
        TagCompileUnit            Tag = 0x11
        TagStringType             Tag = 0x12
        TagStructType             Tag = 0x13
        TagSubroutineType         Tag = 0x15
        TagTypedef                Tag = 0x16
        TagUnionType              Tag = 0x17
        TagUnspecifiedParameters  Tag = 0x18
        TagVariant                Tag = 0x19
        TagCommonDwarfBlock       Tag = 0x1A
        TagCommonInclusion        Tag = 0x1B
        TagInheritance            Tag = 0x1C
        TagInlinedSubroutine      Tag = 0x1D
        TagModule                 Tag = 0x1E
        TagPtrToMemberType        Tag = 0x1F
        TagSetType                Tag = 0x20
        TagSubrangeType           Tag = 0x21
        TagWithStmt               Tag = 0x22
        TagAccessDeclaration      Tag = 0x23
        TagBaseType               Tag = 0x24
        TagCatchDwarfBlock        Tag = 0x25
        TagConstType              Tag = 0x26
        TagConstant               Tag = 0x27
        TagEnumerator             Tag = 0x28
        TagFileType               Tag = 0x29
        TagFriend                 Tag = 0x2A
        TagNamelist               Tag = 0x2B
        TagNamelistItem           Tag = 0x2C
        TagPackedType             Tag = 0x2D
        TagSubprogram             Tag = 0x2E
        TagTemplateTypeParameter  Tag = 0x2F
        TagTemplateValueParameter Tag = 0x30
        TagThrownType             Tag = 0x31
        TagTryDwarfBlock          Tag = 0x32
        TagVariantPart            Tag = 0x33
        TagVariable               Tag = 0x34
        TagVolatileType           Tag = 0x35
        // 以下是DWARF 3中的新增内容。
        TagDwarfProcedure  Tag = 0x36
        TagRestrictType    Tag = 0x37
        TagInterfaceType   Tag = 0x38
        TagNamespace       Tag = 0x39
        TagImportedModule  Tag = 0x3A
        TagUnspecifiedType Tag = 0x3B
        TagPartialUnit     Tag = 0x3C
        TagImportedUnit    Tag = 0x3D
        TagMutableType     Tag = 0x3E // 后来从DWARF中删除.
        TagCondition       Tag = 0x3F
        TagSharedType      Tag = 0x40
        // 以下是DWARF 4中的新功能。
        TagTypeUnit            Tag = 0x41
        TagRvalueReferenceType Tag = 0x42
        TagTemplateAlias       Tag = 0x43
)

func (Tag) GoString(查看源代码)

func (t Tag) GoString() string

func (Tag) String(查看源代码)

func (t Tag) String() string

type Type(查看源代码)

类型通常表示指向任何特定类型结构(CharType,StructType等)的指针。

type Type interface {
        Common() *CommonType
        String() string
        Size() int64
}

type TypedefType(查看源代码)

TypedefType 表示一个命名的类型。

type TypedefType struct {
        CommonType
        Type Type
}

func (*TypedefType) Size(查看源代码)

func (t *TypedefType) Size() int64

func (*TypedefType) String(查看源代码)

func (t *TypedefType) String() string

type UcharType(查看源代码)

UcharType 表示一个无符号字符类型。

type UcharType struct {
        BasicType
}

type UintType(查看源代码)

UintType 表示无符号整数类型。

type UintType struct {
        BasicType
}

type UnspecifiedType(查看源代码)

UnspecifiedType 表示隐式,未知,模糊或不存在的类型。

type UnspecifiedType struct {
        BasicType
}

type VoidType(查看源代码)

VoidType 表示 C void 类型。

type VoidType struct {
        CommonType
}

func (*VoidType) String(查看源代码)

func (t *VoidType) String() string
Go

Go 是一种编译型语言,它结合了解释型语言的游刃有余,动态类型语言的开发效率,以及静态类型的安全性。它也打算成为现代的,支持网络与多核计算的语言。要满足这些目标,需要解决一些语言上的问题:一个富有表达能力但轻量级的类型系统,并发与垃圾回收机制,严格的依赖规范等等。这些无法通过库或工具解决好,因此Go也就应运而生了。

主页 https://golang.org/
源码 https://go.googlesource.com/go
发布版本 1.9.2

Go目录

1.档案 | archive
2.缓冲区 | bufio
3.内置 | builtin
4.字节 | bytes
5.压缩 | compress
6.容器 | container
7.上下文 | context
8.加密 | crypto
9.数据库 | database
10.调试 | debug
11.编码 | encoding
12.错误 | errors
13. expvar
14.flag
15. fmt
16. go
17.散列 | hash
18.html
19.图像 | image
20.索引 | index
21.io
22.日志 | log
23.数学 | math
24. math/big
25.math/bits
26.math/cmplx
27.math/rand
28.拟态 | mime
29.net
30.net/http
31. net/mail
32. net/rpc
33.net/smtp
34. net/textproto
35. net/url
36.os
37.路径 | path
38.插件 | plugin
39.反射 | reflect
40.正则表达式 | regexp
41.运行时 | runtime
42.排序算法 | sort
43.转换 | strconv
44.字符串 | strings
45.同步 | sync
46.系统调用 | syscall
47.测试 | testing
48.文本 | text
49.时间戳 | time
50.unicode
51.不安全性 | unsafe
52.Go 语言数据类型
53.Go 语言基础语法
54.Go 语言结构
55.Go 语言 select 语句
56.Go 语言 switch 语句
57.Go 语言 if 语句嵌套
58.Go 语言 if…else 语句
59.Go 语言 if 语句
60.Go 语言运算符
61.Go 语言常量
62.Go 语言函数闭包
63.Go 语言函数作为实参
64.Go 语言函数引用传递值
65.Go 语言函数值传递值
66.Go 语言函数
67.Go 语言 goto 语句
68.Go 语言 continue 语句
69.Go 语言 break 语句
70.Go 语言循环嵌套
71.Go 语言 for 循环
72.Go 语言结构体
73.Go 语言指针作为函数参数
74.Go 语言指向指针的指针
75.Go 语言指针数组
76.Go 语言指针
77.Go 语言向函数传递数组
78.Go 语言多维数组
79.Go 语言变量作用域
80.Go 语言函数方法
81.Go 错误处理
82.Go 语言接口
83.Go 语言类型转换
84.Go 语言递归函数
85.Go 语言Map(集合)
86.Go 语言范围(Range)
87.Go 语言切片(Slice)
88.Go 并发
89.Go fmt.Sprintf 格式化字符串