package dwarf

Import Path
	debug/dwarf (on go.dev)

Dependency Relation
	imports 9 packages, and imported by 4 packages

Involved Source Files attr_string.go buf.go class_string.go const.go entry.go line.go Package dwarf provides access to DWARF debugging information loaded from executable files, as defined in the DWARF 2.0 Standard at http://dwarfstd.org/doc/dwarf-2.0.0.pdf. # Security This package is not designed to be hardened against adversarial inputs, and is outside the scope of https://go.dev/security/policy. In particular, only basic validation is done when parsing object files. As such, care should be taken when parsing untrusted inputs, as parsing malformed files may consume significant resources, or cause panics. tag_string.go type.go typeunit.go unit.go
Package-Level Type Names (total 37)
/* sort by: | */
An AddrType represents a machine address type. BasicType BasicType BasicType.BitOffset int64 BasicType.BitSize int64 BasicType.CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type BasicType.DataBitOffset int64 (*AddrType) Basic() *BasicType (*AddrType) Common() *CommonType (*AddrType) Size() int64 (*AddrType) String() string *AddrType : Type *AddrType : expvar.Var *AddrType : fmt.Stringer
An ArrayType represents a fixed size array type. CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type // if == -1, an incomplete array, like char x[]. // if > 0, number of bits to hold each element Type Type (*ArrayType) Common() *CommonType (*ArrayType) Size() int64 (*ArrayType) String() string *ArrayType : Type *ArrayType : expvar.Var *ArrayType : fmt.Stringer
An Attr identifies the attribute type in a DWARF [Entry.Field]. ( Attr) GoString() string ( Attr) String() string Attr : expvar.Var Attr : fmt.GoStringer Attr : fmt.Stringer func (*Entry).AttrField(a Attr) *Field func (*Entry).Val(a Attr) any const AttrAbstractOrigin const AttrAccessibility const AttrAddrBase const AttrAddrClass const AttrAlignment const AttrAllocated const AttrArtificial const AttrAssociated const AttrBaseTypes const AttrBinaryScale const AttrBitOffset const AttrBitSize const AttrByteSize const AttrCallAllCalls const AttrCallAllSourceCalls const AttrCallAllTailCalls const AttrCallColumn const AttrCallDataLocation const AttrCallDataValue const AttrCallFile const AttrCalling const AttrCallLine const AttrCallOrigin const AttrCallParameter const AttrCallPC const AttrCallReturnPC const AttrCallTailCall const AttrCallTarget const AttrCallTargetClobbered const AttrCallValue const AttrCommonRef const AttrCompDir const AttrConstExpr const AttrConstValue const AttrContainingType const AttrCount const AttrDataBitOffset const AttrDataLocation const AttrDataMemberLoc const AttrDecimalScale const AttrDecimalSign const AttrDeclaration const AttrDeclColumn const AttrDeclFile const AttrDeclLine const AttrDefaulted const AttrDefaultValue const AttrDeleted const AttrDescription const AttrDigitCount const AttrDiscr const AttrDiscrList const AttrDiscrValue const AttrDwoName const AttrElemental const AttrEncoding const AttrEndianity const AttrEntrypc const AttrEnumClass const AttrExplicit const AttrExportSymbols const AttrExtension const AttrExternal const AttrFrameBase const AttrFriend const AttrHighpc const AttrIdentifierCase const AttrImport const AttrInline const AttrIsOptional const AttrLanguage const AttrLinkageName const AttrLocation const AttrLoclistsBase const AttrLowerBound const AttrLowpc const AttrMacroInfo const AttrMacros const AttrMainSubprogram const AttrMutable const AttrName const AttrNamelistItem const AttrNoreturn const AttrObjectPointer const AttrOrdering const AttrPictureString const AttrPriority const AttrProducer const AttrPrototyped const AttrPure const AttrRanges const AttrRank const AttrRecursive const AttrReference const AttrReturnAddr const AttrRnglistsBase const AttrRvalueReference const AttrSegment const AttrSibling const AttrSignature const AttrSmall const AttrSpecification const AttrStartScope const AttrStaticLink const AttrStmtList const AttrStride const AttrStrideSize const AttrStringLength const AttrStringLengthBitSize const AttrStringLengthByteSize const AttrStrOffsetsBase const AttrThreadsScaled const AttrTrampoline const AttrType const AttrUpperBound const AttrUseLocation const AttrUseUTF8 const AttrVarParam const AttrVirtuality const AttrVisibility const AttrVtableElemLoc
A BasicType holds fields common to all basic types. See the documentation for [StructField] for more info on the interpretation of the BitSize/BitOffset/DataBitOffset fields. BitOffset int64 BitSize int64 CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type DataBitOffset int64 (*BasicType) Basic() *BasicType (*BasicType) Common() *CommonType (*BasicType) Size() int64 (*BasicType) String() string *BasicType : Type *BasicType : expvar.Var *BasicType : fmt.Stringer func (*BasicType).Basic() *BasicType
A BoolType represents a boolean type. BasicType BasicType BasicType.BitOffset int64 BasicType.BitSize int64 BasicType.CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type BasicType.DataBitOffset int64 (*BoolType) Basic() *BasicType (*BoolType) Common() *CommonType (*BoolType) Size() int64 (*BoolType) String() string *BoolType : Type *BoolType : expvar.Var *BoolType : fmt.Stringer
A CharType represents a signed character type. BasicType BasicType BasicType.BitOffset int64 BasicType.BitSize int64 BasicType.CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type BasicType.DataBitOffset int64 (*CharType) Basic() *BasicType (*CharType) Common() *CommonType (*CharType) Size() int64 (*CharType) String() string *CharType : Type *CharType : expvar.Var *CharType : fmt.Stringer
A Class is the DWARF 4 class of an attribute value. In general, a given attribute's value may take on one of several possible classes defined by DWARF, each of which leads to a slightly different interpretation of the attribute. DWARF version 4 distinguishes attribute value classes more finely than previous versions of DWARF. The reader will disambiguate coarser classes from earlier versions of DWARF into the appropriate DWARF 4 class. For example, DWARF 2 uses "constant" for constants as well as all types of section offsets, but the reader will canonicalize attributes in DWARF 2 files that refer to section offsets to one of the Class*Ptr classes, even though these classes were only defined in DWARF 3. ( Class) GoString() string ( Class) String() string Class : expvar.Var Class : fmt.GoStringer Class : fmt.Stringer const ClassAddress const ClassAddrPtr const ClassBlock const ClassConstant const ClassExprLoc const ClassFlag const ClassLinePtr const ClassLocList const ClassLocListPtr const ClassMacPtr const ClassRangeListPtr const ClassReference const ClassReferenceAlt const ClassReferenceSig const ClassRngList const ClassRngListsPtr const ClassString const ClassStringAlt const ClassStrOffsetsPtr const ClassUnknown
A CommonType holds fields common to multiple types. If a field is not known or not applicable for a given type, the zero value is used. // size of value of this type, in bytes // name that can be used to refer to type (*CommonType) Common() *CommonType (*CommonType) Size() int64 func (*CommonType).Common() *CommonType func Type.Common() *CommonType
A ComplexType represents a complex floating point type. BasicType BasicType BasicType.BitOffset int64 BasicType.BitSize int64 BasicType.CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type BasicType.DataBitOffset int64 (*ComplexType) Basic() *BasicType (*ComplexType) Common() *CommonType (*ComplexType) Size() int64 (*ComplexType) String() string *ComplexType : Type *ComplexType : expvar.Var *ComplexType : fmt.Stringer
Data represents the DWARF debugging information loaded from an executable file (for example, an ELF or Mach-O executable). AddSection adds another DWARF section by name. The name should be a DWARF section name such as ".debug_addr", ".debug_str_offsets", and so forth. This approach is used for new DWARF sections added in DWARF 5 and later. AddTypes will add one .debug_types section to the DWARF data. A typical object with DWARF version 4 debug info will have multiple .debug_types sections. The name is used for error reporting only, and serves to distinguish one .debug_types section from another. LineReader returns a new reader for the line table of compilation unit cu, which must be an [Entry] with tag [TagCompileUnit]. If this compilation unit has no line table, it returns nil, nil. Ranges returns the PC ranges covered by e, a slice of [low,high) pairs. Only some entry types, such as [TagCompileUnit] or [TagSubprogram], have PC ranges; for others, this will return nil with no error. Reader returns a new Reader for [Data]. The reader is positioned at byte offset 0 in the DWARF “info” section. Type reads the type at off in the DWARF “info” section. func New(abbrev, aranges, frame, info, line, pubnames, ranges, str []byte) (*Data, error) func debug/elf.(*File).DWARF() (*Data, error) func debug/macho.(*File).DWARF() (*Data, error) func debug/pe.(*File).DWARF() (*Data, error) func internal/xcoff.(*File).DWARF() (*Data, error)
Err string Name string Offset Offset ( DecodeError) Error() string DecodeError : error
A DotDotDotType represents the variadic ... function parameter. CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type (*DotDotDotType) Common() *CommonType (*DotDotDotType) Size() int64 (*DotDotDotType) String() string *DotDotDotType : Type *DotDotDotType : expvar.Var *DotDotDotType : fmt.Stringer
An entry is a sequence of attribute/value pairs. // whether Entry is followed by children Field []Field // offset of Entry in DWARF info // tag (kind of Entry) AttrField returns the [Field] associated with attribute [Attr] in [Entry], or nil if there is no such attribute. Val returns the value associated with attribute [Attr] in [Entry], or nil if there is no such attribute. A common idiom is to merge the check for nil return with the check that the value has the expected dynamic type, as in: v, ok := e.Val(AttrSibling).(int64) func (*Reader).Next() (*Entry, error) func (*Reader).SeekPC(pc uint64) (*Entry, error) func (*Data).LineReader(cu *Entry) (*LineReader, error) func (*Data).Ranges(e *Entry) ([][2]uint64, error)
An EnumType represents an enumerated type. The only indication of its native integer type is its ByteSize (inside [CommonType]). CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type EnumName string Val []*EnumValue (*EnumType) Common() *CommonType (*EnumType) Size() int64 (*EnumType) String() string *EnumType : Type *EnumType : expvar.Var *EnumType : fmt.Stringer
An EnumValue represents a single enumeration value. Name string Val int64
A Field is a single attribute/value pair in an [Entry]. A value can be one of several "attribute classes" defined by DWARF. The Go types corresponding to each class are: 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 For unrecognized or vendor-defined attributes, [Class] may be [ClassUnknown]. Attr Attr Class Class Val any func (*Entry).AttrField(a Attr) *Field
A FloatType represents a floating point type. BasicType BasicType BasicType.BitOffset int64 BasicType.BitSize int64 BasicType.CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type BasicType.DataBitOffset int64 (*FloatType) Basic() *BasicType (*FloatType) Common() *CommonType (*FloatType) Size() int64 (*FloatType) String() string *FloatType : Type *FloatType : expvar.Var *FloatType : fmt.Stringer
A FuncType represents a function type. CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type ParamType []Type ReturnType Type (*FuncType) Common() *CommonType (*FuncType) Size() int64 (*FuncType) String() string *FuncType : Type *FuncType : expvar.Var *FuncType : fmt.Stringer
An IntType represents a signed integer type. BasicType BasicType BasicType.BitOffset int64 BasicType.BitSize int64 BasicType.CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type BasicType.DataBitOffset int64 (*IntType) Basic() *BasicType (*IntType) Common() *CommonType (*IntType) Size() int64 (*IntType) String() string *IntType : Type *IntType : expvar.Var *IntType : fmt.Stringer
A LineEntry is a row in a DWARF line table. Address is the program-counter value of a machine instruction generated by the compiler. This LineEntry applies to each instruction from Address to just before the Address of the next LineEntry. BasicBlock indicates that Address is the beginning of a basic block. Column is the column number within the source line of these instructions. Columns are numbered beginning at 1. It may be 0 to indicate the "left edge" of the line. Discriminator is an arbitrary integer indicating the block to which these instructions belong. It serves to distinguish among multiple blocks that may all have with the same source file, line, and column. Where only one block exists for a given source position, it should be 0. Added in DWARF 3. EndSequence indicates that Address is the first byte after the end of a sequence of target machine instructions. If it is set, only this and the Address field are meaningful. A line number table may contain information for multiple potentially disjoint instruction sequences. The last entry in a line table should always have EndSequence set. EpilogueBegin indicates that Address is one (of possibly many) PCs where execution should be suspended for a breakpoint on exit from this function. Added in DWARF 3. File is the source file corresponding to these instructions. ISA is the instruction set architecture for these instructions. Possible ISA values should be defined by the applicable ABI specification. Added in DWARF 3. IsStmt indicates that Address is a recommended breakpoint location, such as the beginning of a line, statement, or a distinct subpart of a statement. Line is the source code line number corresponding to these instructions. Lines are numbered beginning at 1. It may be 0 if these instructions cannot be attributed to any source line. OpIndex is the index of an operation within a VLIW instruction. The index of the first operation is 0. For non-VLIW architectures, it will always be 0. Address and OpIndex together form an operation pointer that can reference any individual operation within the instruction stream. PrologueEnd indicates that Address is one (of possibly many) PCs where execution should be suspended for a breakpoint on entry to the containing function. Added in DWARF 3. func (*LineReader).Next(entry *LineEntry) error func (*LineReader).SeekPC(pc uint64, entry *LineEntry) error
A LineFile is a source file referenced by a DWARF line table entry. // File length, or 0 if unknown // Implementation defined modification time, or 0 if unknown Name string func (*LineReader).Files() []*LineFile
A LineReader reads a sequence of [LineEntry] structures from a DWARF "line" section for a single compilation unit. LineEntries occur in order of increasing PC and each [LineEntry] gives metadata for the instructions from that [LineEntry]'s PC to just before the next [LineEntry]'s PC. The last entry will have the [LineEntry.EndSequence] field set. Files returns the file name table of this compilation unit as of the current position in the line table. The file name table may be referenced from attributes in this compilation unit such as [AttrDeclFile]. Entry 0 is always nil, since file index 0 represents "no file". The file name table of a compilation unit is not fixed. Files returns the file table as of the current position in the line table. This may contain more entries than the file table at an earlier position in the line table, though existing entries never change. Next sets *entry to the next row in this line table and moves to the next row. If there are no more entries and the line table is properly terminated, it returns [io.EOF]. Rows are always in order of increasing entry.Address, but entry.Line may go forward or backward. Reset repositions the line table reader at the beginning of the line table. Seek restores the line table reader to a position returned by [LineReader.Tell]. The argument pos must have been returned by a call to [LineReader.Tell] on this line table. SeekPC sets *entry to the [LineEntry] that includes pc and positions the reader on the next entry in the line table. If necessary, this will seek backwards to find pc. If pc is not covered by any entry in this line table, SeekPC returns [ErrUnknownPC]. In this case, *entry and the final seek position are unspecified. Note that DWARF line tables only permit sequential, forward scans. Hence, in the worst case, this takes time linear in the size of the line table. If the caller wishes to do repeated fast PC lookups, it should build an appropriate index of the line table. Tell returns the current position in the line table. func (*Data).LineReader(cu *Entry) (*LineReader, error)
A LineReaderPos represents a position in a line table. func (*LineReader).Tell() LineReaderPos func (*LineReader).Seek(pos LineReaderPos)
An Offset represents the location of an [Entry] within the DWARF info. (See [Reader.Seek].) func (*Data).Type(off Offset) (Type, error) func (*Reader).Seek(off Offset)
A PtrType represents a pointer type. CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type Type Type (*PtrType) Common() *CommonType (*PtrType) Size() int64 (*PtrType) String() string *PtrType : Type *PtrType : expvar.Var *PtrType : fmt.Stringer
A QualType represents a type that has the C/C++ "const", "restrict", or "volatile" qualifier. CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type Qual string Type Type (*QualType) Common() *CommonType (*QualType) Size() int64 (*QualType) String() string *QualType : Type *QualType : expvar.Var *QualType : fmt.Stringer
A Reader allows reading [Entry] structures from a DWARF “info” section. The [Entry] structures are arranged in a tree. The [Reader.Next] function return successive entries from a pre-order traversal of the tree. If an entry has children, its Children field will be true, and the children follow, terminated by an [Entry] with [Tag] 0. AddressSize returns the size in bytes of addresses in the current compilation unit. ByteOrder returns the byte order in the current compilation unit. Next reads the next entry from the encoded entry stream. It returns nil, nil when it reaches the end of the section. It returns an error if the current offset is invalid or the data at the offset cannot be decoded as a valid [Entry]. Seek positions the [Reader] at offset off in the encoded entry stream. Offset 0 can be used to denote the first entry. SeekPC returns the [Entry] for the compilation unit that includes pc, and positions the reader to read the children of that unit. If pc is not covered by any unit, SeekPC returns [ErrUnknownPC] and the position of the reader is undefined. Because compilation units can describe multiple regions of the executable, in the worst case SeekPC must search through all the ranges in all the compilation units. Each call to SeekPC starts the search at the compilation unit of the last call, so in general looking up a series of PCs will be faster if they are sorted. If the caller wishes to do repeated fast PC lookups, it should build an appropriate index using the Ranges method. SkipChildren skips over the child entries associated with the last [Entry] returned by [Reader.Next]. If that [Entry] did not have children or [Reader.Next] has not been called, SkipChildren is a no-op. func (*Data).Reader() *Reader
A StructField represents a field in a struct, union, or C++ class type. # Bit Fields The BitSize, BitOffset, and DataBitOffset fields describe the bit size and offset of data members declared as bit fields in C/C++ struct/union/class types. BitSize is the number of bits in the bit field. DataBitOffset, if non-zero, is the number of bits from the start of the enclosing entity (e.g. containing struct/class/union) to the start of the bit field. This corresponds to the DW_AT_data_bit_offset DWARF attribute that was introduced in DWARF 4. BitOffset, if non-zero, is the number of bits between the most significant bit of the storage unit holding the bit field to the most significant bit of the bit field. Here "storage unit" is the type name before the bit field (for a field "unsigned x:17", the storage unit is "unsigned"). BitOffset values can vary depending on the endianness of the system. BitOffset corresponds to the DW_AT_bit_offset DWARF attribute that was deprecated in DWARF 4 and removed in DWARF 5. At most one of DataBitOffset and BitOffset will be non-zero; DataBitOffset/BitOffset will only be non-zero if BitSize is non-zero. Whether a C compiler uses one or the other will depend on compiler vintage and command line options. Here is an example of C/C++ bit field use, along with what to expect in terms of DWARF bit offset info. Consider this code: struct S { int q; int j:5; int k:6; int m:5; int n:8; } s; For the code above, one would expect to see the following for DW_AT_bit_offset values (using GCC 8): Little | Big Endian | Endian | "j": 27 | 0 "k": 21 | 5 "m": 16 | 11 "n": 8 | 16 Note that in the above the offsets are purely with respect to the containing storage unit for j/k/m/n -- these values won't vary based on the size of prior data members in the containing struct. If the compiler emits DW_AT_data_bit_offset, the expected values would be: "j": 32 "k": 37 "m": 43 "n": 48 Here the value 32 for "j" reflects the fact that the bit field is preceded by other data members (recall that DW_AT_data_bit_offset values are relative to the start of the containing struct). Hence DW_AT_data_bit_offset values can be quite large for structs with many fields. DWARF also allow for the possibility of base types that have non-zero bit size and bit offset, so this information is also captured for base types, but it is worth noting that it is not possible to trigger this behavior using mainstream languages. BitOffset int64 // zero if not a bit field ByteOffset int64 // usually zero; use Type.Size() for normal fields DataBitOffset int64 Name string Type Type
A StructType represents a struct, union, or C++ class type. CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type Field []*StructField // if true, struct, union, class is declared but not defined // "struct", "union", or "class". StructName string (*StructType) Common() *CommonType (*StructType) Defn() string (*StructType) Size() int64 (*StructType) String() string *StructType : Type *StructType : expvar.Var *StructType : fmt.Stringer
A Tag is the classification (the type) of an [Entry]. ( Tag) GoString() string ( Tag) String() string Tag : expvar.Var Tag : fmt.GoStringer Tag : fmt.Stringer const TagAccessDeclaration const TagArrayType const TagAtomicType const TagBaseType const TagCallSite const TagCallSiteParameter const TagCatchDwarfBlock const TagClassType const TagCoarrayType const TagCommonDwarfBlock const TagCommonInclusion const TagCompileUnit const TagCondition const TagConstant const TagConstType const TagDwarfProcedure const TagDynamicType const TagEntryPoint const TagEnumerationType const TagEnumerator const TagFileType const TagFormalParameter const TagFriend const TagGenericSubrange const TagImmutableType const TagImportedDeclaration const TagImportedModule const TagImportedUnit const TagInheritance const TagInlinedSubroutine const TagInterfaceType const TagLabel const TagLexDwarfBlock const TagMember const TagModule const TagMutableType const TagNamelist const TagNamelistItem const TagNamespace const TagPackedType const TagPartialUnit const TagPointerType const TagPtrToMemberType const TagReferenceType const TagRestrictType const TagRvalueReferenceType const TagSetType const TagSharedType const TagSkeletonUnit const TagStringType const TagStructType const TagSubprogram const TagSubrangeType const TagSubroutineType const TagTemplateAlias const TagTemplateTypeParameter const TagTemplateValueParameter const TagThrownType const TagTryDwarfBlock const TagTypedef const TagTypeUnit const TagUnionType const TagUnspecifiedParameters const TagUnspecifiedType const TagVariable const TagVariant const TagVariantPart const TagVolatileType const TagWithStmt
A Type conventionally represents a pointer to any of the specific Type structures ([CharType], [StructType], etc.). ( Type) Common() *CommonType ( Type) Size() int64 ( Type) String() string *AddrType *ArrayType *BasicType *BoolType *CharType *ComplexType *DotDotDotType *EnumType *FloatType *FuncType *IntType *PtrType *QualType *StructType *TypedefType *UcharType *UintType *UnspecifiedType *UnsupportedType *VoidType Type : expvar.Var Type : fmt.Stringer func (*Data).Type(off Offset) (Type, error)
A TypedefType represents a named type. CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type Type Type (*TypedefType) Common() *CommonType (*TypedefType) Size() int64 (*TypedefType) String() string *TypedefType : Type *TypedefType : expvar.Var *TypedefType : fmt.Stringer
A UcharType represents an unsigned character type. BasicType BasicType BasicType.BitOffset int64 BasicType.BitSize int64 BasicType.CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type BasicType.DataBitOffset int64 (*UcharType) Basic() *BasicType (*UcharType) Common() *CommonType (*UcharType) Size() int64 (*UcharType) String() string *UcharType : Type *UcharType : expvar.Var *UcharType : fmt.Stringer
A UintType represents an unsigned integer type. BasicType BasicType BasicType.BitOffset int64 BasicType.BitSize int64 BasicType.CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type BasicType.DataBitOffset int64 (*UintType) Basic() *BasicType (*UintType) Common() *CommonType (*UintType) Size() int64 (*UintType) String() string *UintType : Type *UintType : expvar.Var *UintType : fmt.Stringer
An UnspecifiedType represents an implicit, unknown, ambiguous or nonexistent type. BasicType BasicType BasicType.BitOffset int64 BasicType.BitSize int64 BasicType.CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type BasicType.DataBitOffset int64 (*UnspecifiedType) Basic() *BasicType (*UnspecifiedType) Common() *CommonType (*UnspecifiedType) Size() int64 (*UnspecifiedType) String() string *UnspecifiedType : Type *UnspecifiedType : expvar.Var *UnspecifiedType : fmt.Stringer
An UnsupportedType is a placeholder returned in situations where we encounter a type that isn't supported. CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type Tag Tag (*UnsupportedType) Common() *CommonType (*UnsupportedType) Size() int64 (*UnsupportedType) String() string *UnsupportedType : Type *UnsupportedType : expvar.Var *UnsupportedType : fmt.Stringer
A VoidType represents the C void type. CommonType CommonType // size of value of this type, in bytes // name that can be used to refer to type (*VoidType) Common() *CommonType (*VoidType) Size() int64 (*VoidType) String() string *VoidType : Type *VoidType : expvar.Var *VoidType : fmt.Stringer
Package-Level Functions (only one)
New returns a new [Data] object initialized from the given parameters. Rather than calling this function directly, clients should typically use the DWARF method of the File type of the appropriate package [debug/elf], [debug/macho], or [debug/pe]. The []byte arguments are the data from the corresponding debug section in the object file; for example, for an ELF object, abbrev is the contents of the ".debug_abbrev" section.
Package-Level Variables (only one)
ErrUnknownPC is the error returned by LineReader.ScanPC when the seek PC is not covered by any entry in the line table.
Package-Level Constants (total 210)
const AttrAddrBase Attr = 115
const AttrAddrClass Attr = 51
const AttrAlignment Attr = 136
The following are new in DWARF 3.
const AttrArtificial Attr = 52
const AttrAssociated Attr = 79
const AttrBaseTypes Attr = 53
const AttrBinaryScale Attr = 91
const AttrBitOffset Attr = 12
const AttrBitSize Attr = 13
const AttrByteSize Attr = 11
const AttrCallAllCalls Attr = 122
const AttrCallColumn Attr = 87
const AttrCallDataValue Attr = 134
const AttrCallFile Attr = 88
const AttrCalling Attr = 54
const AttrCallLine Attr = 89
const AttrCallOrigin Attr = 127
const AttrCallParameter Attr = 128
const AttrCallPC Attr = 129
const AttrCallReturnPC Attr = 125
const AttrCallTailCall Attr = 130
const AttrCallTarget Attr = 131
const AttrCallValue Attr = 126
const AttrCommonRef Attr = 26
const AttrCompDir Attr = 27
const AttrConstExpr Attr = 108
const AttrConstValue Attr = 28
const AttrCount Attr = 55
const AttrDataBitOffset Attr = 107
const AttrDecimalSign Attr = 94
const AttrDeclaration Attr = 60
const AttrDeclColumn Attr = 57
const AttrDeclFile Attr = 58
const AttrDeclLine Attr = 59
const AttrDefaulted Attr = 139
const AttrDeleted Attr = 138
const AttrDescription Attr = 90
const AttrDigitCount Attr = 95
const AttrDiscr Attr = 21
const AttrDiscrList Attr = 61
const AttrDiscrValue Attr = 22
const AttrDwoName Attr = 118
const AttrElemental Attr = 102
const AttrEncoding Attr = 62
const AttrEndianity Attr = 101
const AttrEntrypc Attr = 82
const AttrEnumClass Attr = 109
const AttrExplicit Attr = 99
const AttrExportSymbols Attr = 137
const AttrExtension Attr = 84
const AttrExternal Attr = 63
const AttrFrameBase Attr = 64
const AttrFriend Attr = 65
const AttrHighpc Attr = 18
const AttrImport Attr = 24
const AttrInline Attr = 32
const AttrIsOptional Attr = 33
const AttrLanguage Attr = 19
const AttrLinkageName Attr = 110
const AttrLocation Attr = 2
const AttrLoclistsBase Attr = 140
const AttrLowerBound Attr = 34
const AttrLowpc Attr = 17
const AttrMacroInfo Attr = 67
const AttrMacros Attr = 121
const AttrMutable Attr = 97
const AttrName Attr = 3
const AttrNoreturn Attr = 135
const AttrObjectPointer Attr = 100
const AttrOrdering Attr = 9
const AttrPriority Attr = 69
const AttrProducer Attr = 37
const AttrPrototyped Attr = 39
const AttrPure Attr = 103
const AttrRanges Attr = 85
const AttrRank Attr = 113
const AttrRecursive Attr = 104
const AttrReference Attr = 119
const AttrReturnAddr Attr = 42
const AttrRnglistsBase Attr = 116
const AttrSegment Attr = 70
const AttrSibling Attr = 1
The following are new in DWARF 4.
const AttrSmall Attr = 93
const AttrStartScope Attr = 44
const AttrStmtList Attr = 16
const AttrStride Attr = 81
const AttrStrideSize Attr = 46
The following are new in DWARF 5.
const AttrTrampoline Attr = 86
const AttrType Attr = 73
const AttrUpperBound Attr = 47
const AttrUseLocation Attr = 74
const AttrUseUTF8 Attr = 83
const AttrVarParam Attr = 75
const AttrVirtuality Attr = 76
const AttrVisibility Attr = 23
ClassAddress represents values of type uint64 that are addresses on the target machine.
ClassAddrPtr represents values that are an int64 offset into the "addr" section.
ClassBlock represents values of type []byte whose interpretation depends on the attribute.
ClassConstant represents values of type int64 that are constants. The interpretation of this constant depends on the attribute.
ClassExprLoc represents values of type []byte that contain an encoded DWARF expression or location description.
ClassFlag represents values of type bool.
ClassLinePtr represents values that are an int64 offset into the "line" section.
ClassLocList represents values that are an int64 offset into the "loclists" section.
ClassLocListPtr represents values that are an int64 offset into the "loclist" section.
ClassMacPtr represents values that are an int64 offset into the "mac" section.
ClassRangeListPtr represents values that are an int64 offset into the "rangelist" section.
ClassReference represents values that are an Offset offset of an Entry in the info section (for use with Reader.Seek). The DWARF specification combines ClassReference and ClassReferenceSig into class "reference".
ClassReferenceAlt represents values of type int64 that are an offset into the DWARF "info" section of an alternate object file.
ClassReferenceSig represents values that are a uint64 type signature referencing a type Entry.
ClassRngList represents values that are a uint64 offset from the base of the "rnglists" section.
ClassRngListsPtr represents values that are an int64 offset into the "rnglists" section. These are used as the base for ClassRngList values.
ClassString represents values that are strings. If the compilation unit specifies the AttrUseUTF8 flag (strongly recommended), the string value will be encoded in UTF-8. Otherwise, the encoding is unspecified.
ClassStringAlt represents values of type int64 that are an offset into the DWARF string section of an alternate object file.
ClassStrOffsetsPtr represents values that are an int64 offset into the "str_offsets" section.
ClassUnknown represents values of unknown DWARF class.
const TagArrayType Tag = 1
const TagAtomicType Tag = 71
const TagBaseType Tag = 36
const TagCallSite Tag = 72
const TagClassType Tag = 2
The following are new in DWARF 5.
const TagCompileUnit Tag = 17
const TagCondition Tag = 63
const TagConstant Tag = 39
const TagConstType Tag = 38
The following are new in DWARF 3.
const TagDynamicType Tag = 70
const TagEntryPoint Tag = 3
const TagEnumerator Tag = 40
const TagFileType Tag = 41
const TagFriend Tag = 42
const TagImmutableType Tag = 75
const TagImportedUnit Tag = 61
const TagInheritance Tag = 28
const TagInterfaceType Tag = 56
const TagLabel Tag = 10
const TagLexDwarfBlock Tag = 11
const TagMember Tag = 13
const TagModule Tag = 30
const TagMutableType Tag = 62 // Later removed from DWARF.
const TagNamelist Tag = 43
const TagNamelistItem Tag = 44
const TagNamespace Tag = 57
const TagPackedType Tag = 45
const TagPartialUnit Tag = 60
const TagPointerType Tag = 15
const TagReferenceType Tag = 16
const TagRestrictType Tag = 55
const TagSetType Tag = 32
const TagSharedType Tag = 64
const TagSkeletonUnit Tag = 74
const TagStringType Tag = 18
const TagStructType Tag = 19
const TagSubprogram Tag = 46
const TagSubrangeType Tag = 33
const TagTemplateAlias Tag = 67
const TagThrownType Tag = 49
const TagTryDwarfBlock Tag = 50
const TagTypedef Tag = 22
The following are new in DWARF 4.
const TagUnionType Tag = 23
const TagVariable Tag = 52
const TagVariant Tag = 25
const TagVariantPart Tag = 51
const TagVolatileType Tag = 53
const TagWithStmt Tag = 34