Movatterモバイル変換


[0]ホーム

URL:


dwarf

packagestandard library
go1.25.2Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2025 License:BSD-3-ClauseImports:9Imported by:1,491

Details

Repository

cs.opensource.google/go/go

Links

Documentation

Overview

Package dwarf provides access to DWARF debugging information loaded fromexecutable files, as defined in the DWARF 2.0 Standard athttp://dwarfstd.org/doc/dwarf-2.0.0.pdf.

Security

This package is not designed to be hardened against adversarial inputs, and isoutside the scope ofhttps://go.dev/security/policy. In particular, only basicvalidation is done when parsing object files. As such, care should be taken whenparsing untrusted inputs, as parsing malformed files may consume significantresources, or cause panics.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownPC =errors.New("ErrUnknownPC")

ErrUnknownPC is the error returned by LineReader.ScanPC when theseek PC is not covered by any entry in the line table.

Functions

This section is empty.

Types

typeAddrType

type AddrType struct {BasicType}

An AddrType represents a machine address type.

typeArrayType

type ArrayType struct {CommonTypeTypeTypeStrideBitSizeint64// if > 0, number of bits to hold each elementCountint64// if == -1, an incomplete array, like char x[].}

An ArrayType represents a fixed size array type.

func (*ArrayType)Size

func (t *ArrayType) Size()int64

func (*ArrayType)String

func (t *ArrayType) String()string

typeAttr

type Attruint32

An Attr identifies the attribute type in a DWARF [Entry.Field].

const (AttrSiblingAttr = 0x01AttrLocationAttr = 0x02AttrNameAttr = 0x03AttrOrderingAttr = 0x09AttrByteSizeAttr = 0x0BAttrBitOffsetAttr = 0x0CAttrBitSizeAttr = 0x0DAttrStmtListAttr = 0x10AttrLowpcAttr = 0x11AttrHighpcAttr = 0x12AttrLanguageAttr = 0x13AttrDiscrAttr = 0x15AttrDiscrValueAttr = 0x16AttrVisibilityAttr = 0x17AttrImportAttr = 0x18AttrStringLengthAttr = 0x19AttrCommonRefAttr = 0x1AAttrCompDirAttr = 0x1BAttrConstValueAttr = 0x1CAttrContainingTypeAttr = 0x1DAttrDefaultValueAttr = 0x1EAttrInlineAttr = 0x20AttrIsOptionalAttr = 0x21AttrLowerBoundAttr = 0x22AttrProducerAttr = 0x25AttrPrototypedAttr = 0x27AttrReturnAddrAttr = 0x2AAttrStartScopeAttr = 0x2CAttrStrideSizeAttr = 0x2EAttrUpperBoundAttr = 0x2FAttrAbstractOriginAttr = 0x31AttrAccessibilityAttr = 0x32AttrAddrClassAttr = 0x33AttrArtificialAttr = 0x34AttrBaseTypesAttr = 0x35AttrCallingAttr = 0x36AttrCountAttr = 0x37AttrDataMemberLocAttr = 0x38AttrDeclColumnAttr = 0x39AttrDeclFileAttr = 0x3AAttrDeclLineAttr = 0x3BAttrDeclarationAttr = 0x3CAttrDiscrListAttr = 0x3DAttrEncodingAttr = 0x3EAttrExternalAttr = 0x3FAttrFrameBaseAttr = 0x40AttrFriendAttr = 0x41AttrIdentifierCaseAttr = 0x42AttrMacroInfoAttr = 0x43AttrNamelistItemAttr = 0x44AttrPriorityAttr = 0x45AttrSegmentAttr = 0x46AttrSpecificationAttr = 0x47AttrStaticLinkAttr = 0x48AttrTypeAttr = 0x49AttrUseLocationAttr = 0x4AAttrVarParamAttr = 0x4BAttrVirtualityAttr = 0x4CAttrVtableElemLocAttr = 0x4D// The following are new in DWARF 3.AttrAllocatedAttr = 0x4EAttrAssociatedAttr = 0x4FAttrDataLocationAttr = 0x50AttrStrideAttr = 0x51AttrEntrypcAttr = 0x52AttrUseUTF8Attr = 0x53AttrExtensionAttr = 0x54AttrRangesAttr = 0x55AttrTrampolineAttr = 0x56AttrCallColumnAttr = 0x57AttrCallFileAttr = 0x58AttrCallLineAttr = 0x59AttrDescriptionAttr = 0x5AAttrBinaryScaleAttr = 0x5BAttrDecimalScaleAttr = 0x5CAttrSmallAttr = 0x5DAttrDecimalSignAttr = 0x5EAttrDigitCountAttr = 0x5FAttrPictureStringAttr = 0x60AttrMutableAttr = 0x61AttrThreadsScaledAttr = 0x62AttrExplicitAttr = 0x63AttrObjectPointerAttr = 0x64AttrEndianityAttr = 0x65AttrElementalAttr = 0x66AttrPureAttr = 0x67AttrRecursiveAttr = 0x68// The following are new in DWARF 4.AttrSignatureAttr = 0x69AttrMainSubprogramAttr = 0x6AAttrDataBitOffsetAttr = 0x6BAttrConstExprAttr = 0x6CAttrEnumClassAttr = 0x6DAttrLinkageNameAttr = 0x6E// The following are new in DWARF 5.AttrStringLengthBitSizeAttr = 0x6FAttrStringLengthByteSizeAttr = 0x70AttrRankAttr = 0x71AttrStrOffsetsBaseAttr = 0x72AttrAddrBaseAttr = 0x73AttrRnglistsBaseAttr = 0x74AttrDwoNameAttr = 0x76AttrReferenceAttr = 0x77AttrRvalueReferenceAttr = 0x78AttrMacrosAttr = 0x79AttrCallAllCallsAttr = 0x7AAttrCallAllSourceCallsAttr = 0x7BAttrCallAllTailCallsAttr = 0x7CAttrCallReturnPCAttr = 0x7DAttrCallValueAttr = 0x7EAttrCallOriginAttr = 0x7FAttrCallParameterAttr = 0x80AttrCallPCAttr = 0x81AttrCallTailCallAttr = 0x82AttrCallTargetAttr = 0x83AttrCallTargetClobberedAttr = 0x84AttrCallDataLocationAttr = 0x85AttrCallDataValueAttr = 0x86AttrNoreturnAttr = 0x87AttrAlignmentAttr = 0x88AttrExportSymbolsAttr = 0x89AttrDeletedAttr = 0x8AAttrDefaultedAttr = 0x8BAttrLoclistsBaseAttr = 0x8C)

func (Attr)GoString

func (aAttr) GoString()string

func (Attr)String

func (iAttr) String()string

typeBasicType

type BasicType struct {CommonTypeBitSizeint64BitOffsetint64DataBitOffsetint64}

A BasicType holds fields common to all basic types.

See the documentation forStructField for more info on the interpretation ofthe BitSize/BitOffset/DataBitOffset fields.

func (*BasicType)Basic

func (b *BasicType) Basic() *BasicType

func (*BasicType)String

func (t *BasicType) String()string

typeBoolType

type BoolType struct {BasicType}

A BoolType represents a boolean type.

typeCharType

type CharType struct {BasicType}

A CharType represents a signed character type.

typeClassadded ingo1.5

type Classint

A Class is the DWARF 4 class of an attribute value.

In general, a given attribute's value may take on one of severalpossible classes defined by DWARF, each of which leads to aslightly different interpretation of the attribute.

DWARF version 4 distinguishes attribute value classes more finelythan previous versions of DWARF. The reader will disambiguatecoarser classes from earlier versions of DWARF into the appropriateDWARF 4 class. For example, DWARF 2 uses "constant" for constantsas well as all types of section offsets, but the reader willcanonicalize attributes in DWARF 2 files that refer to sectionoffsets to one of the Class*Ptr classes, even though these classeswere only defined in DWARF 3.

const (// ClassUnknown represents values of unknown DWARF class.ClassUnknownClass =iota// ClassAddress represents values of type uint64 that are// addresses on the target machine.ClassAddress// ClassBlock represents values of type []byte whose// interpretation depends on the attribute.ClassBlock// ClassConstant represents values of type int64 that are// constants. The interpretation of this constant depends on// the attribute.ClassConstant// ClassExprLoc represents values of type []byte that contain// an encoded DWARF expression or location description.ClassExprLoc// ClassFlag represents values of type bool.ClassFlag// ClassLinePtr represents values that are an int64 offset// into the "line" section.ClassLinePtr// ClassLocListPtr represents values that are an int64 offset// into the "loclist" section.ClassLocListPtr// ClassMacPtr represents values that are an int64 offset into// the "mac" section.ClassMacPtr// ClassRangeListPtr represents values that are an int64 offset into// the "rangelist" section.ClassRangeListPtr// 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".ClassReference// ClassReferenceSig represents values that are a uint64 type// signature referencing a type Entry.ClassReferenceSig// 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.ClassString// ClassReferenceAlt represents values of type int64 that are// an offset into the DWARF "info" section of an alternate// object file.ClassReferenceAlt// ClassStringAlt represents values of type int64 that are an// offset into the DWARF string section of an alternate object// file.ClassStringAlt// ClassAddrPtr represents values that are an int64 offset// into the "addr" section.ClassAddrPtr// ClassLocList represents values that are an int64 offset// into the "loclists" section.ClassLocList// ClassRngList represents values that are a uint64 offset// from the base of the "rnglists" section.ClassRngList// ClassRngListsPtr represents values that are an int64 offset// into the "rnglists" section. These are used as the base for// ClassRngList values.ClassRngListsPtr// ClassStrOffsetsPtr represents values that are an int64// offset into the "str_offsets" section.ClassStrOffsetsPtr)

func (Class)GoStringadded ingo1.5

func (iClass) GoString()string

func (Class)Stringadded ingo1.5

func (iClass) String()string

typeCommonType

type CommonType struct {ByteSizeint64// size of value of this type, in bytesNamestring// name that can be used to refer to type}

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.

func (*CommonType)Common

func (c *CommonType) Common() *CommonType

func (*CommonType)Size

func (c *CommonType) Size()int64

typeComplexType

type ComplexType struct {BasicType}

A ComplexType represents a complex floating point type.

typeData

type Data struct {// contains filtered or unexported fields}

Data represents the DWARF debugging informationloaded from an executable file (for example, an ELF or Mach-O executable).

funcNew

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

New returns a newData object initialized from the given parameters.Rather than calling this function directly, clients should typically usethe DWARF method of the File type of the appropriate packagedebug/elf,debug/macho, ordebug/pe.

The []byte arguments are the data from the corresponding debug sectionin the object file; for example, for an ELF object, abbrev is the contents ofthe ".debug_abbrev" section.

func (*Data)AddSectionadded ingo1.14

func (d *Data) AddSection(namestring, contents []byte)error

AddSection adds another DWARF section by name. The name should be aDWARF section name such as ".debug_addr", ".debug_str_offsets", andso forth. This approach is used for new DWARF sections added inDWARF 5 and later.

func (*Data)AddTypesadded ingo1.3

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

AddTypes will add one .debug_types section to the DWARF data. Atypical 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.

func (*Data)LineReaderadded ingo1.5

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

LineReader returns a new reader for the line table of compilationunit cu, which must be anEntry with tagTagCompileUnit.

If this compilation unit has no line table, it returns nil, nil.

func (*Data)Rangesadded ingo1.7

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

Ranges returns the PC ranges covered by e, a slice of [low,high) pairs.Only some entry types, such asTagCompileUnit orTagSubprogram, have PCranges; for others, this will return nil with no error.

func (*Data)Reader

func (d *Data) Reader() *Reader

Reader returns a new Reader forData.The reader is positioned at byte offset 0 in the DWARF “info” section.

func (*Data)Type

func (d *Data) Type(offOffset) (Type,error)

Type reads the type at off in the DWARF “info” section.

typeDecodeError

type DecodeError struct {NamestringOffsetOffsetErrstring}

func (DecodeError)Error

func (eDecodeError) Error()string

typeDotDotDotType

type DotDotDotType struct {CommonType}

A DotDotDotType represents the variadic ... function parameter.

func (*DotDotDotType)String

func (t *DotDotDotType) String()string

typeEntry

type Entry struct {OffsetOffset// offset of Entry in DWARF infoTagTag// tag (kind of Entry)Childrenbool// whether Entry is followed by childrenField    []Field}

An entry is a sequence of attribute/value pairs.

func (*Entry)AttrFieldadded ingo1.5

func (e *Entry) AttrField(aAttr) *Field

AttrField returns theField associated with attributeAttr inEntry, or nil if there is no such attribute.

func (*Entry)Val

func (e *Entry) Val(aAttr)any

Val returns the value associated with attributeAttr inEntry,or nil if there is no such attribute.

A common idiom is to merge the check for nil return withthe check that the value has the expected dynamic type, as in:

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

typeEnumType

type EnumType struct {CommonTypeEnumNamestringVal      []*EnumValue}

An EnumType represents an enumerated type.The only indication of its native integer type is its ByteSize(insideCommonType).

func (*EnumType)String

func (t *EnumType) String()string

typeEnumValue

type EnumValue struct {NamestringValint64}

An EnumValue represents a single enumeration value.

typeField

type Field struct {AttrAttrValanyClassClass}

A Field is a single attribute/value pair in anEntry.

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         ClassAddressblock             []byte         ClassBlockconstant          int64          ClassConstantflag              bool           ClassFlagreference  to info         dwarf.Offset   ClassReference  to type unit    uint64         ClassReferenceSigstring            string         ClassStringexprloc           []byte         ClassExprLoclineptr           int64          ClassLinePtrloclistptr        int64          ClassLocListPtrmacptr            int64          ClassMacPtrrangelistptr      int64          ClassRangeListPtr

For unrecognized or vendor-defined attributes,Class may beClassUnknown.

typeFloatType

type FloatType struct {BasicType}

A FloatType represents a floating point type.

typeFuncType

type FuncType struct {CommonTypeReturnTypeTypeParamType  []Type}

A FuncType represents a function type.

func (*FuncType)String

func (t *FuncType) String()string

typeIntType

type IntType struct {BasicType}

An IntType represents a signed integer type.

typeLineEntryadded ingo1.5

type LineEntry struct {// 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.Addressuint64// 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.OpIndexint// File is the source file corresponding to these// instructions.File *LineFile// 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.Lineint// 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.Columnint// IsStmt indicates that Address is a recommended breakpoint// location, such as the beginning of a line, statement, or a// distinct subpart of a statement.IsStmtbool// BasicBlock indicates that Address is the beginning of a// basic block.BasicBlockbool// 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.PrologueEndbool// 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.EpilogueBeginbool// ISA is the instruction set architecture for these// instructions. Possible ISA values should be defined by the// applicable ABI specification.//// Added in DWARF 3.ISAint// 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.Discriminatorint// 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.EndSequencebool}

A LineEntry is a row in a DWARF line table.

typeLineFileadded ingo1.5

type LineFile struct {NamestringMtimeuint64// Implementation defined modification time, or 0 if unknownLengthint// File length, or 0 if unknown}

A LineFile is a source file referenced by a DWARF line table entry.

typeLineReaderadded ingo1.5

type LineReader struct {// contains filtered or unexported fields}

A LineReader reads a sequence ofLineEntry structures from a DWARF"line" section for a single compilation unit. LineEntries occur inorder of increasing PC and eachLineEntry gives metadata for theinstructions from thatLineEntry's PC to just before the nextLineEntry's PC. The last entry will have the [LineEntry.EndSequence] field set.

func (*LineReader)Filesadded ingo1.14

func (r *LineReader) Files() []*LineFile

Files returns the file name table of this compilation unit as ofthe current position in the line table. The file name table may bereferenced from attributes in this compilation unit such asAttrDeclFile.

Entry 0 is always nil, since file index 0 represents "no file".

The file name table of a compilation unit is not fixed. Filesreturns the file table as of the current position in the linetable. This may contain more entries than the file table at anearlier position in the line table, though existing entries neverchange.

func (*LineReader)Nextadded ingo1.5

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

Next sets *entry to the next row in this line table and moves tothe next row. If there are no more entries and the line table isproperly terminated, it returnsio.EOF.

Rows are always in order of increasing entry.Address, butentry.Line may go forward or backward.

func (*LineReader)Resetadded ingo1.5

func (r *LineReader) Reset()

Reset repositions the line table reader at the beginning of theline table.

func (*LineReader)Seekadded ingo1.5

func (r *LineReader) Seek(posLineReaderPos)

Seek restores the line table reader to a position returned byLineReader.Tell.

The argument pos must have been returned by a call toLineReader.Tell on thisline table.

func (*LineReader)SeekPCadded ingo1.5

func (r *LineReader) SeekPC(pcuint64, entry *LineEntry)error

SeekPC sets *entry to theLineEntry that includes pc and positionsthe reader on the next entry in the line table. If necessary, thiswill seek backwards to find pc.

If pc is not covered by any entry in this line table, SeekPCreturnsErrUnknownPC. In this case, *entry and the final seekposition 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 theline table. If the caller wishes to do repeated fast PC lookups, itshould build an appropriate index of the line table.

func (*LineReader)Telladded ingo1.5

func (r *LineReader) Tell()LineReaderPos

Tell returns the current position in the line table.

typeLineReaderPosadded ingo1.5

type LineReaderPos struct {// contains filtered or unexported fields}

A LineReaderPos represents a position in a line table.

typeOffset

type Offsetuint32

An Offset represents the location of anEntry within the DWARF info.(SeeReader.Seek.)

typePtrType

type PtrType struct {CommonTypeTypeType}

A PtrType represents a pointer type.

func (*PtrType)String

func (t *PtrType) String()string

typeQualType

type QualType struct {CommonTypeQualstringTypeType}

A QualType represents a type that has the C/C++ "const", "restrict", or "volatile" qualifier.

func (*QualType)Size

func (t *QualType) Size()int64

func (*QualType)String

func (t *QualType) String()string

typeReader

type Reader struct {// contains filtered or unexported fields}

A Reader allows readingEntry structures from a DWARF “info” section.TheEntry structures are arranged in a tree. TheReader.Next functionreturn successive entries from a pre-order traversal of the tree.If an entry has children, its Children field will be true, and the childrenfollow, terminated by anEntry withTag 0.

func (*Reader)AddressSizeadded ingo1.5

func (r *Reader) AddressSize()int

AddressSize returns the size in bytes of addresses in the current compilationunit.

func (*Reader)ByteOrderadded ingo1.14

func (r *Reader) ByteOrder()binary.ByteOrder

ByteOrder returns the byte order in the current compilation unit.

func (*Reader)Next

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

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 theoffset cannot be decoded as a validEntry.

func (*Reader)Seek

func (r *Reader) Seek(offOffset)

Seek positions theReader at offset off in the encoded entry stream.Offset 0 can be used to denote the first entry.

func (*Reader)SeekPCadded ingo1.7

func (r *Reader) SeekPC(pcuint64) (*Entry,error)

SeekPC returns theEntry for the compilation unit that includes pc,and positions the reader to read the children of that unit. If pcis not covered by any unit, SeekPC returnsErrUnknownPC and theposition of the reader is undefined.

Because compilation units can describe multiple regions of theexecutable, in the worst case SeekPC must search through all theranges in all the compilation units. Each call to SeekPC starts thesearch at the compilation unit of the last call, so in generallooking up a series of PCs will be faster if they are sorted. Ifthe caller wishes to do repeated fast PC lookups, it should buildan appropriate index using the Ranges method.

func (*Reader)SkipChildren

func (r *Reader) SkipChildren()

SkipChildren skips over the child entries associated withthe lastEntry returned byReader.Next. If thatEntry did not havechildren orReader.Next has not been called, SkipChildren is a no-op.

typeStructField

type StructField struct {NamestringTypeTypeByteOffsetint64ByteSizeint64// usually zero; use Type.Size() for normal fieldsBitOffsetint64DataBitOffsetint64BitSizeint64// zero if not a bit field}

A StructField represents a field in a struct, union, or C++ class type.

Bit Fields

The BitSize, BitOffset, and DataBitOffset fields describe the bitsize 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 ofthe enclosing entity (e.g. containing struct/class/union) to thestart of the bit field. This corresponds to the DW_AT_data_bit_offsetDWARF attribute that was introduced in DWARF 4.

BitOffset, if non-zero, is the number of bits between the mostsignificant bit of the storage unit holding the bit field to themost significant bit of the bit field. Here "storage unit" is thetype name before the bit field (for a field "unsigned x:17", thestorage unit is "unsigned"). BitOffset values can vary depending onthe endianness of the system. BitOffset corresponds to theDW_AT_bit_offset DWARF attribute that was deprecated in DWARF 4 andremoved in DWARF 5.

At most one of DataBitOffset and BitOffset will be non-zero;DataBitOffset/BitOffset will only be non-zero if BitSize isnon-zero. Whether a C compiler uses one or the otherwill depend on compiler vintage and command line options.

Here is an example of C/C++ bit field use, along with what toexpect 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 forDW_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 thecontaining storage unit for j/k/m/n -- these values won't vary basedon the size of prior data members in the containing struct.

If the compiler emits DW_AT_data_bit_offset, the expected valueswould be:

"j":     32"k":     37"m":     43"n":     48

Here the value 32 for "j" reflects the fact that the bit field ispreceded by other data members (recall that DW_AT_data_bit_offsetvalues are relative to the start of the containing struct). HenceDW_AT_data_bit_offset values can be quite large for structs withmany fields.

DWARF also allow for the possibility of base types that havenon-zero bit size and bit offset, so this information is alsocaptured for base types, but it is worth noting that it is notpossible to trigger this behavior using mainstream languages.

typeStructType

type StructType struct {CommonTypeStructNamestringKindstring// "struct", "union", or "class".Field      []*StructFieldIncompletebool// if true, struct, union, class is declared but not defined}

A StructType represents a struct, union, or C++ class type.

func (*StructType)Defn

func (t *StructType) Defn()string

func (*StructType)String

func (t *StructType) String()string

typeTag

type Taguint32

A Tag is the classification (the type) of anEntry.

const (TagArrayTypeTag = 0x01TagClassTypeTag = 0x02TagEntryPointTag = 0x03TagEnumerationTypeTag = 0x04TagFormalParameterTag = 0x05TagImportedDeclarationTag = 0x08TagLabelTag = 0x0ATagLexDwarfBlockTag = 0x0BTagMemberTag = 0x0DTagPointerTypeTag = 0x0FTagReferenceTypeTag = 0x10TagCompileUnitTag = 0x11TagStringTypeTag = 0x12TagStructTypeTag = 0x13TagSubroutineTypeTag = 0x15TagTypedefTag = 0x16TagUnionTypeTag = 0x17TagUnspecifiedParametersTag = 0x18TagVariantTag = 0x19TagCommonDwarfBlockTag = 0x1ATagCommonInclusionTag = 0x1BTagInheritanceTag = 0x1CTagInlinedSubroutineTag = 0x1DTagModuleTag = 0x1ETagPtrToMemberTypeTag = 0x1FTagSetTypeTag = 0x20TagSubrangeTypeTag = 0x21TagWithStmtTag = 0x22TagAccessDeclarationTag = 0x23TagBaseTypeTag = 0x24TagCatchDwarfBlockTag = 0x25TagConstTypeTag = 0x26TagConstantTag = 0x27TagEnumeratorTag = 0x28TagFileTypeTag = 0x29TagFriendTag = 0x2ATagNamelistTag = 0x2BTagNamelistItemTag = 0x2CTagPackedTypeTag = 0x2DTagSubprogramTag = 0x2ETagTemplateTypeParameterTag = 0x2FTagTemplateValueParameterTag = 0x30TagThrownTypeTag = 0x31TagTryDwarfBlockTag = 0x32TagVariantPartTag = 0x33TagVariableTag = 0x34TagVolatileTypeTag = 0x35// The following are new in DWARF 3.TagDwarfProcedureTag = 0x36TagRestrictTypeTag = 0x37TagInterfaceTypeTag = 0x38TagNamespaceTag = 0x39TagImportedModuleTag = 0x3ATagUnspecifiedTypeTag = 0x3BTagPartialUnitTag = 0x3CTagImportedUnitTag = 0x3DTagMutableTypeTag = 0x3E// Later removed from DWARF.TagConditionTag = 0x3FTagSharedTypeTag = 0x40// The following are new in DWARF 4.TagTypeUnitTag = 0x41TagRvalueReferenceTypeTag = 0x42TagTemplateAliasTag = 0x43// The following are new in DWARF 5.TagCoarrayTypeTag = 0x44TagGenericSubrangeTag = 0x45TagDynamicTypeTag = 0x46TagAtomicTypeTag = 0x47TagCallSiteTag = 0x48TagCallSiteParameterTag = 0x49TagSkeletonUnitTag = 0x4ATagImmutableTypeTag = 0x4B)

func (Tag)GoString

func (tTag) GoString()string

func (Tag)String

func (iTag) String()string

typeType

type Type interface {Common() *CommonTypeString()stringSize()int64}

A Type conventionally represents a pointer to any of thespecific Type structures (CharType,StructType, etc.).

typeTypedefType

type TypedefType struct {CommonTypeTypeType}

A TypedefType represents a named type.

func (*TypedefType)Size

func (t *TypedefType) Size()int64

func (*TypedefType)String

func (t *TypedefType) String()string

typeUcharType

type UcharType struct {BasicType}

A UcharType represents an unsigned character type.

typeUintType

type UintType struct {BasicType}

A UintType represents an unsigned integer type.

typeUnspecifiedTypeadded ingo1.4

type UnspecifiedType struct {BasicType}

An UnspecifiedType represents an implicit, unknown, ambiguous or nonexistent type.

typeUnsupportedTypeadded ingo1.13

type UnsupportedType struct {CommonTypeTagTag}

An UnsupportedType is a placeholder returned in situations where weencounter a type that isn't supported.

func (*UnsupportedType)Stringadded ingo1.13

func (t *UnsupportedType) String()string

typeVoidType

type VoidType struct {CommonType}

A VoidType represents the C void type.

func (*VoidType)String

func (t *VoidType) String()string

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp