예배 규칙서 찾다
archive archive/tar archive/zip bufio bufio(缓存) builtin builtin(内置包) bytes bytes(包字节) compress compress/bzip2(压缩/bzip2) compress/flate(压缩/flate) compress/gzip(压缩/gzip) compress/lzw(压缩/lzw) compress/zlib(压缩/zlib) container container/heap(容器数据结构heap) container/list(容器数据结构list) container/ring(容器数据结构ring) context context(上下文) crypto crypto(加密) crypto/aes(加密/aes) crypto/cipher(加密/cipher) crypto/des(加密/des) crypto/dsa(加密/dsa) crypto/ecdsa(加密/ecdsa) crypto/elliptic(加密/elliptic) crypto/hmac(加密/hmac) crypto/md5(加密/md5) crypto/rand(加密/rand) crypto/rc4(加密/rc4) crypto/rsa(加密/rsa) crypto/sha1(加密/sha1) crypto/sha256(加密/sha256) crypto/sha512(加密/sha512) crypto/subtle(加密/subtle) crypto/tls(加密/tls) crypto/x509(加密/x509) crypto/x509/pkix(加密/x509/pkix) database database/sql(数据库/sql) database/sql/driver(数据库/sql/driver) debug debug/dwarf(调试/dwarf) debug/elf(调试/elf) debug/gosym(调试/gosym) debug/macho(调试/macho) debug/pe(调试/pe) debug/plan9obj(调试/plan9obj) encoding encoding(编码) encoding/ascii85(编码/ascii85) encoding/asn1(编码/asn1) encoding/base32(编码/base32) encoding/base64(编码/base64) encoding/binary(编码/binary) encoding/csv(编码/csv) encoding/gob(编码/gob) encoding/hex(编码/hex) encoding/json(编码/json) encoding/pem(编码/pem) encoding/xml(编码/xml) errors errors(错误) expvar expvar flag flag(命令行参数解析flag包) fmt fmt go go/ast(抽象语法树) go/build go/constant(常量) go/doc(文档) go/format(格式) go/importer go/parser go/printer go/scanner(扫描仪) go/token(令牌) go/types(类型) hash hash(散列) hash/adler32 hash/crc32 hash/crc64 hash/fnv html html html/template(模板) image image(图像) image/color(颜色) image/color/palette(调色板) image/draw(绘图) image/gif image/jpeg image/png index index/suffixarray io io io/ioutil log log log/syslog(日志系统) math math math/big math/big math/bits math/bits math/cmplx math/cmplx math/rand math/rand mime mime mime/multipart(多部分) mime/quotedprintable net net net/http net/http net/http/cgi net/http/cookiejar net/http/fcgi net/http/httptest net/http/httptrace net/http/httputil net/http/internal net/http/pprof net/mail net/mail net/rpc net/rpc net/rpc/jsonrpc net/smtp net/smtp net/textproto net/textproto net/url net/url os os os/exec os/signal os/user path path path/filepath(文件路径) plugin plugin(插件) reflect reflect(反射) regexp regexp(正则表达式) regexp/syntax runtime runtime(运行时) runtime/debug(调试) runtime/internal/sys runtime/pprof runtime/race(竞争) runtime/trace(执行追踪器) sort sort(排序算法) strconv strconv(转换) strings strings(字符串) sync sync(同步) sync/atomic(原子操作) syscall syscall(系统调用) testing testing(测试) testing/iotest testing/quick text text/scanner(扫描文本) text/tabwriter text/template(定义模板) text/template/parse time time(时间戳) unicode unicode unicode/utf16 unicode/utf8 unsafe unsafe
문자

  • 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 的 Next 函数从树的预定义遍历中返回连续的条目。如果一个条目有子类,它的子类字段将是真实的,并且子类跟随,终止于具有标签 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
이전 기사: 다음 기사: