// Generated by Lisette bindgen
// Source: debug/dwarf (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.11
import "go:encoding/binary"
pub enum Attr: uint32 {
AttrAbstractOrigin = 0x31,
AttrAccessibility = 0x32,
AttrAddrBase = 0x73,
AttrAddrClass = 0x33,
AttrAlignment = 0x88,
AttrAllocated = 0x4E,
AttrArtificial = 0x34,
AttrAssociated = 0x4F,
AttrBaseTypes = 0x35,
AttrBinaryScale = 0x5B,
AttrBitOffset = 0x0C,
AttrBitSize = 0x0D,
AttrByteSize = 0x0B,
AttrCallAllCalls = 0x7A,
AttrCallAllSourceCalls = 0x7B,
AttrCallAllTailCalls = 0x7C,
AttrCallColumn = 0x57,
AttrCallDataLocation = 0x85,
AttrCallDataValue = 0x86,
AttrCallFile = 0x58,
AttrCallLine = 0x59,
AttrCallOrigin = 0x7F,
AttrCallPC = 0x81,
AttrCallParameter = 0x80,
AttrCallReturnPC = 0x7D,
AttrCallTailCall = 0x82,
AttrCallTarget = 0x83,
AttrCallTargetClobbered = 0x84,
AttrCallValue = 0x7E,
AttrCalling = 0x36,
AttrCommonRef = 0x1A,
AttrCompDir = 0x1B,
AttrConstExpr = 0x6C,
AttrConstValue = 0x1C,
AttrContainingType = 0x1D,
AttrCount = 0x37,
AttrDataBitOffset = 0x6B,
AttrDataLocation = 0x50,
AttrDataMemberLoc = 0x38,
AttrDecimalScale = 0x5C,
AttrDecimalSign = 0x5E,
AttrDeclColumn = 0x39,
AttrDeclFile = 0x3A,
AttrDeclLine = 0x3B,
AttrDeclaration = 0x3C,
AttrDefaultValue = 0x1E,
AttrDefaulted = 0x8B,
AttrDeleted = 0x8A,
AttrDescription = 0x5A,
AttrDigitCount = 0x5F,
AttrDiscr = 0x15,
AttrDiscrList = 0x3D,
AttrDiscrValue = 0x16,
AttrDwoName = 0x76,
AttrElemental = 0x66,
AttrEncoding = 0x3E,
AttrEndianity = 0x65,
AttrEntrypc = 0x52,
AttrEnumClass = 0x6D,
AttrExplicit = 0x63,
AttrExportSymbols = 0x89,
AttrExtension = 0x54,
AttrExternal = 0x3F,
AttrFrameBase = 0x40,
AttrFriend = 0x41,
AttrHighpc = 0x12,
AttrIdentifierCase = 0x42,
AttrImport = 0x18,
AttrInline = 0x20,
AttrIsOptional = 0x21,
AttrLanguage = 0x13,
AttrLinkageName = 0x6E,
AttrLocation = 0x02,
AttrLoclistsBase = 0x8C,
AttrLowerBound = 0x22,
AttrLowpc = 0x11,
AttrMacroInfo = 0x43,
AttrMacros = 0x79,
AttrMainSubprogram = 0x6A,
AttrMutable = 0x61,
AttrName = 0x03,
AttrNamelistItem = 0x44,
AttrNoreturn = 0x87,
AttrObjectPointer = 0x64,
AttrOrdering = 0x09,
AttrPictureString = 0x60,
AttrPriority = 0x45,
AttrProducer = 0x25,
AttrPrototyped = 0x27,
AttrPure = 0x67,
AttrRanges = 0x55,
AttrRank = 0x71,
AttrRecursive = 0x68,
AttrReference = 0x77,
AttrReturnAddr = 0x2A,
AttrRnglistsBase = 0x74,
AttrRvalueReference = 0x78,
AttrSegment = 0x46,
AttrSibling = 0x01,
AttrSignature = 0x69,
AttrSmall = 0x5D,
AttrSpecification = 0x47,
AttrStartScope = 0x2C,
AttrStaticLink = 0x48,
AttrStmtList = 0x10,
AttrStrOffsetsBase = 0x72,
AttrStride = 0x51,
AttrStrideSize = 0x2E,
AttrStringLength = 0x19,
AttrStringLengthBitSize = 0x6F,
AttrStringLengthByteSize = 0x70,
AttrThreadsScaled = 0x62,
AttrTrampoline = 0x56,
AttrType = 0x49,
AttrUpperBound = 0x2F,
AttrUseLocation = 0x4A,
AttrUseUTF8 = 0x53,
AttrVarParam = 0x4B,
AttrVirtuality = 0x4C,
AttrVisibility = 0x17,
AttrVtableElemLoc = 0x4D,
}
pub const AttrAbstractOrigin: Attr = 0x31
pub const AttrAccessibility: Attr = 0x32
pub const AttrAddrBase: Attr = 0x73
pub const AttrAddrClass: Attr = 0x33
pub const AttrAlignment: Attr = 0x88
pub const AttrAllocated: Attr = 0x4E
pub const AttrArtificial: Attr = 0x34
pub const AttrAssociated: Attr = 0x4F
pub const AttrBaseTypes: Attr = 0x35
pub const AttrBinaryScale: Attr = 0x5B
pub const AttrBitOffset: Attr = 0x0C
pub const AttrBitSize: Attr = 0x0D
pub const AttrByteSize: Attr = 0x0B
pub const AttrCallAllCalls: Attr = 0x7A
pub const AttrCallAllSourceCalls: Attr = 0x7B
pub const AttrCallAllTailCalls: Attr = 0x7C
pub const AttrCallColumn: Attr = 0x57
pub const AttrCallDataLocation: Attr = 0x85
pub const AttrCallDataValue: Attr = 0x86
pub const AttrCallFile: Attr = 0x58
pub const AttrCallLine: Attr = 0x59
pub const AttrCallOrigin: Attr = 0x7F
pub const AttrCallPC: Attr = 0x81
pub const AttrCallParameter: Attr = 0x80
pub const AttrCallReturnPC: Attr = 0x7D
pub const AttrCallTailCall: Attr = 0x82
pub const AttrCallTarget: Attr = 0x83
pub const AttrCallTargetClobbered: Attr = 0x84
pub const AttrCallValue: Attr = 0x7E
pub const AttrCalling: Attr = 0x36
pub const AttrCommonRef: Attr = 0x1A
pub const AttrCompDir: Attr = 0x1B
pub const AttrConstExpr: Attr = 0x6C
pub const AttrConstValue: Attr = 0x1C
pub const AttrContainingType: Attr = 0x1D
pub const AttrCount: Attr = 0x37
pub const AttrDataBitOffset: Attr = 0x6B
pub const AttrDataLocation: Attr = 0x50
pub const AttrDataMemberLoc: Attr = 0x38
pub const AttrDecimalScale: Attr = 0x5C
pub const AttrDecimalSign: Attr = 0x5E
pub const AttrDeclColumn: Attr = 0x39
pub const AttrDeclFile: Attr = 0x3A
pub const AttrDeclLine: Attr = 0x3B
pub const AttrDeclaration: Attr = 0x3C
pub const AttrDefaultValue: Attr = 0x1E
pub const AttrDefaulted: Attr = 0x8B
pub const AttrDeleted: Attr = 0x8A
pub const AttrDescription: Attr = 0x5A
pub const AttrDigitCount: Attr = 0x5F
pub const AttrDiscr: Attr = 0x15
pub const AttrDiscrList: Attr = 0x3D
pub const AttrDiscrValue: Attr = 0x16
pub const AttrDwoName: Attr = 0x76
pub const AttrElemental: Attr = 0x66
pub const AttrEncoding: Attr = 0x3E
pub const AttrEndianity: Attr = 0x65
pub const AttrEntrypc: Attr = 0x52
pub const AttrEnumClass: Attr = 0x6D
pub const AttrExplicit: Attr = 0x63
pub const AttrExportSymbols: Attr = 0x89
pub const AttrExtension: Attr = 0x54
pub const AttrExternal: Attr = 0x3F
pub const AttrFrameBase: Attr = 0x40
pub const AttrFriend: Attr = 0x41
pub const AttrHighpc: Attr = 0x12
pub const AttrIdentifierCase: Attr = 0x42
pub const AttrImport: Attr = 0x18
pub const AttrInline: Attr = 0x20
pub const AttrIsOptional: Attr = 0x21
pub const AttrLanguage: Attr = 0x13
pub const AttrLinkageName: Attr = 0x6E
pub const AttrLocation: Attr = 0x02
pub const AttrLoclistsBase: Attr = 0x8C
pub const AttrLowerBound: Attr = 0x22
pub const AttrLowpc: Attr = 0x11
pub const AttrMacroInfo: Attr = 0x43
pub const AttrMacros: Attr = 0x79
pub const AttrMainSubprogram: Attr = 0x6A
pub const AttrMutable: Attr = 0x61
pub const AttrName: Attr = 0x03
pub const AttrNamelistItem: Attr = 0x44
pub const AttrNoreturn: Attr = 0x87
pub const AttrObjectPointer: Attr = 0x64
pub const AttrOrdering: Attr = 0x09
pub const AttrPictureString: Attr = 0x60
pub const AttrPriority: Attr = 0x45
pub const AttrProducer: Attr = 0x25
pub const AttrPrototyped: Attr = 0x27
pub const AttrPure: Attr = 0x67
pub const AttrRanges: Attr = 0x55
pub const AttrRank: Attr = 0x71
pub const AttrRecursive: Attr = 0x68
pub const AttrReference: Attr = 0x77
pub const AttrReturnAddr: Attr = 0x2A
pub const AttrRnglistsBase: Attr = 0x74
pub const AttrRvalueReference: Attr = 0x78
pub const AttrSegment: Attr = 0x46
pub const AttrSibling: Attr = 0x01
pub const AttrSignature: Attr = 0x69
pub const AttrSmall: Attr = 0x5D
pub const AttrSpecification: Attr = 0x47
pub const AttrStartScope: Attr = 0x2C
pub const AttrStaticLink: Attr = 0x48
pub const AttrStmtList: Attr = 0x10
pub const AttrStrOffsetsBase: Attr = 0x72
pub const AttrStride: Attr = 0x51
pub const AttrStrideSize: Attr = 0x2E
pub const AttrStringLength: Attr = 0x19
pub const AttrStringLengthBitSize: Attr = 0x6F
pub const AttrStringLengthByteSize: Attr = 0x70
pub const AttrThreadsScaled: Attr = 0x62
pub const AttrTrampoline: Attr = 0x56
pub const AttrType: Attr = 0x49
pub const AttrUpperBound: Attr = 0x2F
pub const AttrUseLocation: Attr = 0x4A
pub const AttrUseUTF8: Attr = 0x53
pub const AttrVarParam: Attr = 0x4B
pub const AttrVirtuality: Attr = 0x4C
pub const AttrVisibility: Attr = 0x17
pub const AttrVtableElemLoc: Attr = 0x4D
pub enum Class: int {
ClassAddrPtr = 15,
ClassAddress = 1,
ClassBlock = 2,
ClassConstant = 3,
ClassExprLoc = 4,
ClassFlag = 5,
ClassLinePtr = 6,
ClassLocList = 16,
ClassLocListPtr = 7,
ClassMacPtr = 8,
ClassRangeListPtr = 9,
ClassReference = 10,
ClassReferenceAlt = 13,
ClassReferenceSig = 11,
ClassRngList = 17,
ClassRngListsPtr = 18,
ClassStrOffsetsPtr = 19,
ClassString = 12,
ClassStringAlt = 14,
ClassUnknown = 0,
}
pub const ClassAddrPtr: Class = 15
pub const ClassAddress: Class = 1
pub const ClassBlock: Class = 2
pub const ClassConstant: Class = 3
pub const ClassExprLoc: Class = 4
pub const ClassFlag: Class = 5
pub const ClassLinePtr: Class = 6
pub const ClassLocList: Class = 16
pub const ClassLocListPtr: Class = 7
pub const ClassMacPtr: Class = 8
pub const ClassRangeListPtr: Class = 9
pub const ClassReference: Class = 10
pub const ClassReferenceAlt: Class = 13
pub const ClassReferenceSig: Class = 11
pub const ClassRngList: Class = 17
pub const ClassRngListsPtr: Class = 18
pub const ClassStrOffsetsPtr: Class = 19
pub const ClassString: Class = 12
pub const ClassStringAlt: Class = 14
pub const ClassUnknown: Class = 0
pub enum Tag: uint32 {
TagAccessDeclaration = 0x23,
TagArrayType = 0x01,
TagAtomicType = 0x47,
TagBaseType = 0x24,
TagCallSite = 0x48,
TagCallSiteParameter = 0x49,
TagCatchDwarfBlock = 0x25,
TagClassType = 0x02,
TagCoarrayType = 0x44,
TagCommonDwarfBlock = 0x1A,
TagCommonInclusion = 0x1B,
TagCompileUnit = 0x11,
TagCondition = 0x3F,
TagConstType = 0x26,
TagConstant = 0x27,
TagDwarfProcedure = 0x36,
TagDynamicType = 0x46,
TagEntryPoint = 0x03,
TagEnumerationType = 0x04,
TagEnumerator = 0x28,
TagFileType = 0x29,
TagFormalParameter = 0x05,
TagFriend = 0x2A,
TagGenericSubrange = 0x45,
TagImmutableType = 0x4B,
TagImportedDeclaration = 0x08,
TagImportedModule = 0x3A,
TagImportedUnit = 0x3D,
TagInheritance = 0x1C,
TagInlinedSubroutine = 0x1D,
TagInterfaceType = 0x38,
TagLabel = 0x0A,
TagLexDwarfBlock = 0x0B,
TagMember = 0x0D,
TagModule = 0x1E,
TagMutableType = 0x3E,
TagNamelist = 0x2B,
TagNamelistItem = 0x2C,
TagNamespace = 0x39,
TagPackedType = 0x2D,
TagPartialUnit = 0x3C,
TagPointerType = 0x0F,
TagPtrToMemberType = 0x1F,
TagReferenceType = 0x10,
TagRestrictType = 0x37,
TagRvalueReferenceType = 0x42,
TagSetType = 0x20,
TagSharedType = 0x40,
TagSkeletonUnit = 0x4A,
TagStringType = 0x12,
TagStructType = 0x13,
TagSubprogram = 0x2E,
TagSubrangeType = 0x21,
TagSubroutineType = 0x15,
TagTemplateAlias = 0x43,
TagTemplateTypeParameter = 0x2F,
TagTemplateValueParameter = 0x30,
TagThrownType = 0x31,
TagTryDwarfBlock = 0x32,
TagTypeUnit = 0x41,
TagTypedef = 0x16,
TagUnionType = 0x17,
TagUnspecifiedParameters = 0x18,
TagUnspecifiedType = 0x3B,
TagVariable = 0x34,
TagVariant = 0x19,
TagVariantPart = 0x33,
TagVolatileType = 0x35,
TagWithStmt = 0x22,
}
pub const TagAccessDeclaration: Tag = 0x23
pub const TagArrayType: Tag = 0x01
pub const TagAtomicType: Tag = 0x47
pub const TagBaseType: Tag = 0x24
pub const TagCallSite: Tag = 0x48
pub const TagCallSiteParameter: Tag = 0x49
pub const TagCatchDwarfBlock: Tag = 0x25
pub const TagClassType: Tag = 0x02
pub const TagCoarrayType: Tag = 0x44
pub const TagCommonDwarfBlock: Tag = 0x1A
pub const TagCommonInclusion: Tag = 0x1B
pub const TagCompileUnit: Tag = 0x11
pub const TagCondition: Tag = 0x3F
pub const TagConstType: Tag = 0x26
pub const TagConstant: Tag = 0x27
pub const TagDwarfProcedure: Tag = 0x36
pub const TagDynamicType: Tag = 0x46
pub const TagEntryPoint: Tag = 0x03
pub const TagEnumerationType: Tag = 0x04
pub const TagEnumerator: Tag = 0x28
pub const TagFileType: Tag = 0x29
pub const TagFormalParameter: Tag = 0x05
pub const TagFriend: Tag = 0x2A
pub const TagGenericSubrange: Tag = 0x45
pub const TagImmutableType: Tag = 0x4B
pub const TagImportedDeclaration: Tag = 0x08
pub const TagImportedModule: Tag = 0x3A
pub const TagImportedUnit: Tag = 0x3D
pub const TagInheritance: Tag = 0x1C
pub const TagInlinedSubroutine: Tag = 0x1D
pub const TagInterfaceType: Tag = 0x38
pub const TagLabel: Tag = 0x0A
pub const TagLexDwarfBlock: Tag = 0x0B
pub const TagMember: Tag = 0x0D
pub const TagModule: Tag = 0x1E
pub const TagMutableType: Tag = 0x3E
pub const TagNamelist: Tag = 0x2B
pub const TagNamelistItem: Tag = 0x2C
pub const TagNamespace: Tag = 0x39
pub const TagPackedType: Tag = 0x2D
pub const TagPartialUnit: Tag = 0x3C
pub const TagPointerType: Tag = 0x0F
pub const TagPtrToMemberType: Tag = 0x1F
pub const TagReferenceType: Tag = 0x10
pub const TagRestrictType: Tag = 0x37
pub const TagRvalueReferenceType: Tag = 0x42
pub const TagSetType: Tag = 0x20
pub const TagSharedType: Tag = 0x40
pub const TagSkeletonUnit: Tag = 0x4A
pub const TagStringType: Tag = 0x12
pub const TagStructType: Tag = 0x13
pub const TagSubprogram: Tag = 0x2E
pub const TagSubrangeType: Tag = 0x21
pub const TagSubroutineType: Tag = 0x15
pub const TagTemplateAlias: Tag = 0x43
pub const TagTemplateTypeParameter: Tag = 0x2F
pub const TagTemplateValueParameter: Tag = 0x30
pub const TagThrownType: Tag = 0x31
pub const TagTryDwarfBlock: Tag = 0x32
pub const TagTypeUnit: Tag = 0x41
pub const TagTypedef: Tag = 0x16
pub const TagUnionType: Tag = 0x17
pub const TagUnspecifiedParameters: Tag = 0x18
pub const TagUnspecifiedType: Tag = 0x3B
pub const TagVariable: Tag = 0x34
pub const TagVariant: Tag = 0x19
pub const TagVariantPart: Tag = 0x33
pub const TagVolatileType: Tag = 0x35
pub const TagWithStmt: Tag = 0x22
pub fn New(
abbrev: Slice<uint8>,
aranges: Slice<uint8>,
frame: Slice<uint8>,
info: Slice<uint8>,
line: Slice<uint8>,
pubnames: Slice<uint8>,
ranges: Slice<uint8>,
str: Slice<uint8>,
) -> Result<Ref<Data>, error>
/// An AddrType represents a machine address type.
pub struct AddrType {
pub BasicType: BasicType,
}
/// An ArrayType represents a fixed size array type.
pub struct ArrayType {
pub CommonType: CommonType,
pub Type: Option<Type>,
pub StrideBitSize: int64,
pub Count: int64,
}
/// 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.
pub struct BasicType {
pub CommonType: CommonType,
pub BitSize: int64,
pub BitOffset: int64,
pub DataBitOffset: int64,
}
/// A BoolType represents a boolean type.
pub struct BoolType {
pub BasicType: BasicType,
}
/// A CharType represents a signed character type.
pub struct CharType {
pub BasicType: BasicType,
}
/// 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.
pub struct CommonType {
pub ByteSize: int64,
pub Name: string,
}
/// A ComplexType represents a complex floating point type.
pub struct ComplexType {
pub BasicType: BasicType,
}
/// Data represents the DWARF debugging information
/// loaded from an executable file (for example, an ELF or Mach-O executable).
pub type Data
pub struct DecodeError {
pub Name: string,
pub Offset: Offset,
pub Err: string,
}
/// A DotDotDotType represents the variadic ... function parameter.
pub struct DotDotDotType {
pub CommonType: CommonType,
}
/// An entry is a sequence of attribute/value pairs.
pub struct Entry {
pub Offset: Offset,
pub Tag: Tag,
pub Children: bool,
pub Field: Slice<Field>,
}
/// An EnumType represents an enumerated type.
/// The only indication of its native integer type is its ByteSize
/// (inside [CommonType]).
pub struct EnumType {
pub CommonType: CommonType,
pub EnumName: string,
pub Val: Slice<Option<Ref<EnumValue>>>,
}
/// An EnumValue represents a single enumeration value.
pub struct EnumValue {
pub Name: string,
pub 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].
pub struct Field {
pub Attr: Attr,
pub Val: Unknown,
pub Class: Class,
}
/// A FloatType represents a floating point type.
pub struct FloatType {
pub BasicType: BasicType,
}
/// A FuncType represents a function type.
pub struct FuncType {
pub CommonType: CommonType,
pub ReturnType: Option<Type>,
pub ParamType: Slice<Option<Type>>,
}
/// An IntType represents a signed integer type.
pub struct IntType {
pub BasicType: BasicType,
}
/// A LineEntry is a row in a DWARF line table.
pub struct LineEntry {
pub Address: uint64,
pub OpIndex: int,
pub File: Option<Ref<LineFile>>,
pub Line: int,
pub Column: int,
pub IsStmt: bool,
pub BasicBlock: bool,
pub PrologueEnd: bool,
pub EpilogueBegin: bool,
pub ISA: int,
pub Discriminator: int,
pub EndSequence: bool,
}
/// A LineFile is a source file referenced by a DWARF line table entry.
pub struct LineFile {
pub Name: string,
pub Mtime: uint64,
pub Length: int,
}
/// 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.
pub type LineReader
/// A LineReaderPos represents a position in a line table.
pub type LineReaderPos
/// An Offset represents the location of an [Entry] within the DWARF info.
/// (See [Reader.Seek].)
pub struct Offset(uint32)
/// A PtrType represents a pointer type.
pub struct PtrType {
pub CommonType: CommonType,
pub Type: Option<Type>,
}
/// A QualType represents a type that has the C/C++ "const", "restrict", or "volatile" qualifier.
pub struct QualType {
pub CommonType: CommonType,
pub Qual: string,
pub Type: Option<Type>,
}
/// 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.
pub type 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.
pub struct StructField {
pub Name: string,
pub Type: Option<Type>,
pub ByteOffset: int64,
pub ByteSize: int64,
pub BitOffset: int64,
pub DataBitOffset: int64,
pub BitSize: int64,
}
/// A StructType represents a struct, union, or C++ class type.
pub struct StructType {
pub CommonType: CommonType,
pub StructName: string,
pub Kind: string,
pub Field: Slice<Option<Ref<StructField>>>,
pub Incomplete: bool,
}
/// A Type conventionally represents a pointer to any of the
/// specific Type structures ([CharType], [StructType], etc.).
pub interface Type {
fn Common() -> Ref<CommonType>
fn Size() -> int64
fn String() -> string
}
/// A TypedefType represents a named type.
pub struct TypedefType {
pub CommonType: CommonType,
pub Type: Option<Type>,
}
/// A UcharType represents an unsigned character type.
pub struct UcharType {
pub BasicType: BasicType,
}
/// A UintType represents an unsigned integer type.
pub struct UintType {
pub BasicType: BasicType,
}
/// An UnspecifiedType represents an implicit, unknown, ambiguous or nonexistent type.
pub struct UnspecifiedType {
pub BasicType: BasicType,
}
/// An UnsupportedType is a placeholder returned in situations where we
/// encounter a type that isn't supported.
pub struct UnsupportedType {
pub CommonType: CommonType,
pub Tag: Tag,
}
/// A VoidType represents the C void type.
pub struct VoidType {
pub CommonType: CommonType,
}
/// ErrUnknownPC is the error returned by LineReader.ScanPC when the
/// seek PC is not covered by any entry in the line table.
pub var ErrUnknownPC: error
impl AddrType {
fn Basic(self: Ref<AddrType>) -> Ref<BasicType>
fn Common(self: Ref<AddrType>) -> Ref<CommonType>
fn Size(self: Ref<AddrType>) -> int64
fn String(self: Ref<AddrType>) -> string
}
impl ArrayType {
fn Common(self: Ref<ArrayType>) -> Ref<CommonType>
fn Size(self: Ref<ArrayType>) -> int64
fn String(self: Ref<ArrayType>) -> string
}
impl Attr {
fn GoString(self) -> string
fn String(self) -> string
}
impl BasicType {
fn Basic(self: Ref<BasicType>) -> Ref<BasicType>
fn Common(self: Ref<BasicType>) -> Ref<CommonType>
fn Size(self: Ref<BasicType>) -> int64
fn String(self: Ref<BasicType>) -> string
}
impl BoolType {
fn Basic(self: Ref<BoolType>) -> Ref<BasicType>
fn Common(self: Ref<BoolType>) -> Ref<CommonType>
fn Size(self: Ref<BoolType>) -> int64
fn String(self: Ref<BoolType>) -> string
}
impl CharType {
fn Basic(self: Ref<CharType>) -> Ref<BasicType>
fn Common(self: Ref<CharType>) -> Ref<CommonType>
fn Size(self: Ref<CharType>) -> int64
fn String(self: Ref<CharType>) -> string
}
impl Class {
fn GoString(self) -> string
fn String(self) -> string
}
impl CommonType {
fn Common(self: Ref<CommonType>) -> Ref<CommonType>
fn Size(self: Ref<CommonType>) -> int64
}
impl ComplexType {
fn Basic(self: Ref<ComplexType>) -> Ref<BasicType>
fn Common(self: Ref<ComplexType>) -> Ref<CommonType>
fn Size(self: Ref<ComplexType>) -> int64
fn String(self: Ref<ComplexType>) -> string
}
impl Data {
/// 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.
fn AddSection(self: Ref<Data>, name: string, contents: Slice<uint8>) -> Result<(), error>
/// 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.
fn AddTypes(self: Ref<Data>, name: string, types: Slice<uint8>) -> Result<(), error>
/// 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.
fn LineReader(self: Ref<Data>, cu: Ref<Entry>) -> Result<Ref<LineReader>, error>
/// 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.
fn Ranges(self: Ref<Data>, e: Ref<Entry>) -> Result<Slice<Slice<uint64>>, error>
/// Reader returns a new Reader for [Data].
/// The reader is positioned at byte offset 0 in the DWARF “info” section.
fn Reader(self: Ref<Data>) -> Ref<Reader>
/// Type reads the type at off in the DWARF “info” section.
fn Type(self: Ref<Data>, off: Offset) -> Result<Type, error>
}
impl DecodeError {
fn Error(self) -> string
}
impl DotDotDotType {
fn Common(self: Ref<DotDotDotType>) -> Ref<CommonType>
fn Size(self: Ref<DotDotDotType>) -> int64
fn String(self: Ref<DotDotDotType>) -> string
}
impl Entry {
/// AttrField returns the [Field] associated with attribute [Attr] in
/// [Entry], or nil if there is no such attribute.
fn AttrField(self: Ref<Entry>, a: Attr) -> Option<Ref<Field>>
/// 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)
fn Val(self: Ref<Entry>, a: Attr) -> Unknown
}
impl EnumType {
fn Common(self: Ref<EnumType>) -> Ref<CommonType>
fn Size(self: Ref<EnumType>) -> int64
fn String(self: Ref<EnumType>) -> string
}
impl FloatType {
fn Basic(self: Ref<FloatType>) -> Ref<BasicType>
fn Common(self: Ref<FloatType>) -> Ref<CommonType>
fn Size(self: Ref<FloatType>) -> int64
fn String(self: Ref<FloatType>) -> string
}
impl FuncType {
fn Common(self: Ref<FuncType>) -> Ref<CommonType>
fn Size(self: Ref<FuncType>) -> int64
fn String(self: Ref<FuncType>) -> string
}
impl IntType {
fn Basic(self: Ref<IntType>) -> Ref<BasicType>
fn Common(self: Ref<IntType>) -> Ref<CommonType>
fn Size(self: Ref<IntType>) -> int64
fn String(self: Ref<IntType>) -> string
}
impl LineReader {
/// 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.
fn Files(self: Ref<LineReader>) -> Slice<Ref<LineFile>>
/// 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.
fn Next(self: Ref<LineReader>, entry: Ref<LineEntry>) -> Result<(), error>
/// Reset repositions the line table reader at the beginning of the
/// line table.
fn Reset(self: Ref<LineReader>)
/// 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.
fn Seek(self: Ref<LineReader>, pos: LineReaderPos)
/// 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.
fn SeekPC(self: Ref<LineReader>, pc: uint64, entry: Ref<LineEntry>) -> Result<(), error>
/// Tell returns the current position in the line table.
fn Tell(self: Ref<LineReader>) -> LineReaderPos
}
impl PtrType {
fn Common(self: Ref<PtrType>) -> Ref<CommonType>
fn Size(self: Ref<PtrType>) -> int64
fn String(self: Ref<PtrType>) -> string
}
impl QualType {
fn Common(self: Ref<QualType>) -> Ref<CommonType>
fn Size(self: Ref<QualType>) -> int64
fn String(self: Ref<QualType>) -> string
}
impl Reader {
/// AddressSize returns the size in bytes of addresses in the current compilation
/// unit.
fn AddressSize(self: Ref<Reader>) -> int
/// ByteOrder returns the byte order in the current compilation unit.
fn ByteOrder(self: Ref<Reader>) -> binary.ByteOrder
/// 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].
fn Next(self: Ref<Reader>) -> Result<Ref<Entry>, error>
/// Seek positions the [Reader] at offset off in the encoded entry stream.
/// Offset 0 can be used to denote the first entry.
fn Seek(self: Ref<Reader>, off: Offset)
/// 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.
fn SeekPC(self: Ref<Reader>, pc: uint64) -> Result<Ref<Entry>, error>
/// 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.
fn SkipChildren(self: Ref<Reader>)
}
impl StructType {
fn Common(self: Ref<StructType>) -> Ref<CommonType>
fn Defn(self: Ref<StructType>) -> string
fn Size(self: Ref<StructType>) -> int64
fn String(self: Ref<StructType>) -> string
}
impl Tag {
fn GoString(self) -> string
fn String(self) -> string
}
impl TypedefType {
fn Common(self: Ref<TypedefType>) -> Ref<CommonType>
fn Size(self: Ref<TypedefType>) -> int64
fn String(self: Ref<TypedefType>) -> string
}
impl UcharType {
fn Basic(self: Ref<UcharType>) -> Ref<BasicType>
fn Common(self: Ref<UcharType>) -> Ref<CommonType>
fn Size(self: Ref<UcharType>) -> int64
fn String(self: Ref<UcharType>) -> string
}
impl UintType {
fn Basic(self: Ref<UintType>) -> Ref<BasicType>
fn Common(self: Ref<UintType>) -> Ref<CommonType>
fn Size(self: Ref<UintType>) -> int64
fn String(self: Ref<UintType>) -> string
}
impl UnspecifiedType {
fn Basic(self: Ref<UnspecifiedType>) -> Ref<BasicType>
fn Common(self: Ref<UnspecifiedType>) -> Ref<CommonType>
fn Size(self: Ref<UnspecifiedType>) -> int64
fn String(self: Ref<UnspecifiedType>) -> string
}
impl UnsupportedType {
fn Common(self: Ref<UnsupportedType>) -> Ref<CommonType>
fn Size(self: Ref<UnsupportedType>) -> int64
fn String(self: Ref<UnsupportedType>) -> string
}
impl VoidType {
fn Common(self: Ref<VoidType>) -> Ref<CommonType>
fn Size(self: Ref<VoidType>) -> int64
fn String(self: Ref<VoidType>) -> string
}