...

Source file src/pkg/debug/dwarf/const.go

     1	// Copyright 2009 The Go Authors. All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	// Constants
     6	
     7	package dwarf
     8	
     9	//go:generate stringer -type Attr -trimprefix=Attr
    10	
    11	// An Attr identifies the attribute type in a DWARF Entry's Field.
    12	type Attr uint32
    13	
    14	const (
    15		AttrSibling        Attr = 0x01
    16		AttrLocation       Attr = 0x02
    17		AttrName           Attr = 0x03
    18		AttrOrdering       Attr = 0x09
    19		AttrByteSize       Attr = 0x0B
    20		AttrBitOffset      Attr = 0x0C
    21		AttrBitSize        Attr = 0x0D
    22		AttrStmtList       Attr = 0x10
    23		AttrLowpc          Attr = 0x11
    24		AttrHighpc         Attr = 0x12
    25		AttrLanguage       Attr = 0x13
    26		AttrDiscr          Attr = 0x15
    27		AttrDiscrValue     Attr = 0x16
    28		AttrVisibility     Attr = 0x17
    29		AttrImport         Attr = 0x18
    30		AttrStringLength   Attr = 0x19
    31		AttrCommonRef      Attr = 0x1A
    32		AttrCompDir        Attr = 0x1B
    33		AttrConstValue     Attr = 0x1C
    34		AttrContainingType Attr = 0x1D
    35		AttrDefaultValue   Attr = 0x1E
    36		AttrInline         Attr = 0x20
    37		AttrIsOptional     Attr = 0x21
    38		AttrLowerBound     Attr = 0x22
    39		AttrProducer       Attr = 0x25
    40		AttrPrototyped     Attr = 0x27
    41		AttrReturnAddr     Attr = 0x2A
    42		AttrStartScope     Attr = 0x2C
    43		AttrStrideSize     Attr = 0x2E
    44		AttrUpperBound     Attr = 0x2F
    45		AttrAbstractOrigin Attr = 0x31
    46		AttrAccessibility  Attr = 0x32
    47		AttrAddrClass      Attr = 0x33
    48		AttrArtificial     Attr = 0x34
    49		AttrBaseTypes      Attr = 0x35
    50		AttrCalling        Attr = 0x36
    51		AttrCount          Attr = 0x37
    52		AttrDataMemberLoc  Attr = 0x38
    53		AttrDeclColumn     Attr = 0x39
    54		AttrDeclFile       Attr = 0x3A
    55		AttrDeclLine       Attr = 0x3B
    56		AttrDeclaration    Attr = 0x3C
    57		AttrDiscrList      Attr = 0x3D
    58		AttrEncoding       Attr = 0x3E
    59		AttrExternal       Attr = 0x3F
    60		AttrFrameBase      Attr = 0x40
    61		AttrFriend         Attr = 0x41
    62		AttrIdentifierCase Attr = 0x42
    63		AttrMacroInfo      Attr = 0x43
    64		AttrNamelistItem   Attr = 0x44
    65		AttrPriority       Attr = 0x45
    66		AttrSegment        Attr = 0x46
    67		AttrSpecification  Attr = 0x47
    68		AttrStaticLink     Attr = 0x48
    69		AttrType           Attr = 0x49
    70		AttrUseLocation    Attr = 0x4A
    71		AttrVarParam       Attr = 0x4B
    72		AttrVirtuality     Attr = 0x4C
    73		AttrVtableElemLoc  Attr = 0x4D
    74		AttrAllocated      Attr = 0x4E
    75		AttrAssociated     Attr = 0x4F
    76		AttrDataLocation   Attr = 0x50
    77		AttrStride         Attr = 0x51
    78		AttrEntrypc        Attr = 0x52
    79		AttrUseUTF8        Attr = 0x53
    80		AttrExtension      Attr = 0x54
    81		AttrRanges         Attr = 0x55
    82		AttrTrampoline     Attr = 0x56
    83		AttrCallColumn     Attr = 0x57
    84		AttrCallFile       Attr = 0x58
    85		AttrCallLine       Attr = 0x59
    86		AttrDescription    Attr = 0x5A
    87	)
    88	
    89	func (a Attr) GoString() string {
    90		if str, ok := _Attr_map[a]; ok {
    91			return "dwarf.Attr" + str
    92		}
    93		return "dwarf." + a.String()
    94	}
    95	
    96	// A format is a DWARF data encoding format.
    97	type format uint32
    98	
    99	const (
   100		// value formats
   101		formAddr        format = 0x01
   102		formDwarfBlock2 format = 0x03
   103		formDwarfBlock4 format = 0x04
   104		formData2       format = 0x05
   105		formData4       format = 0x06
   106		formData8       format = 0x07
   107		formString      format = 0x08
   108		formDwarfBlock  format = 0x09
   109		formDwarfBlock1 format = 0x0A
   110		formData1       format = 0x0B
   111		formFlag        format = 0x0C
   112		formSdata       format = 0x0D
   113		formStrp        format = 0x0E
   114		formUdata       format = 0x0F
   115		formRefAddr     format = 0x10
   116		formRef1        format = 0x11
   117		formRef2        format = 0x12
   118		formRef4        format = 0x13
   119		formRef8        format = 0x14
   120		formRefUdata    format = 0x15
   121		formIndirect    format = 0x16
   122		// The following are new in DWARF 4.
   123		formSecOffset   format = 0x17
   124		formExprloc     format = 0x18
   125		formFlagPresent format = 0x19
   126		formRefSig8     format = 0x20
   127		// Extensions for multi-file compression (.dwz)
   128		// http://www.dwarfstd.org/ShowIssue.php?issue=120604.1
   129		formGnuRefAlt  format = 0x1f20
   130		formGnuStrpAlt format = 0x1f21
   131	)
   132	
   133	//go:generate stringer -type Tag -trimprefix=Tag
   134	
   135	// A Tag is the classification (the type) of an Entry.
   136	type Tag uint32
   137	
   138	const (
   139		TagArrayType              Tag = 0x01
   140		TagClassType              Tag = 0x02
   141		TagEntryPoint             Tag = 0x03
   142		TagEnumerationType        Tag = 0x04
   143		TagFormalParameter        Tag = 0x05
   144		TagImportedDeclaration    Tag = 0x08
   145		TagLabel                  Tag = 0x0A
   146		TagLexDwarfBlock          Tag = 0x0B
   147		TagMember                 Tag = 0x0D
   148		TagPointerType            Tag = 0x0F
   149		TagReferenceType          Tag = 0x10
   150		TagCompileUnit            Tag = 0x11
   151		TagStringType             Tag = 0x12
   152		TagStructType             Tag = 0x13
   153		TagSubroutineType         Tag = 0x15
   154		TagTypedef                Tag = 0x16
   155		TagUnionType              Tag = 0x17
   156		TagUnspecifiedParameters  Tag = 0x18
   157		TagVariant                Tag = 0x19
   158		TagCommonDwarfBlock       Tag = 0x1A
   159		TagCommonInclusion        Tag = 0x1B
   160		TagInheritance            Tag = 0x1C
   161		TagInlinedSubroutine      Tag = 0x1D
   162		TagModule                 Tag = 0x1E
   163		TagPtrToMemberType        Tag = 0x1F
   164		TagSetType                Tag = 0x20
   165		TagSubrangeType           Tag = 0x21
   166		TagWithStmt               Tag = 0x22
   167		TagAccessDeclaration      Tag = 0x23
   168		TagBaseType               Tag = 0x24
   169		TagCatchDwarfBlock        Tag = 0x25
   170		TagConstType              Tag = 0x26
   171		TagConstant               Tag = 0x27
   172		TagEnumerator             Tag = 0x28
   173		TagFileType               Tag = 0x29
   174		TagFriend                 Tag = 0x2A
   175		TagNamelist               Tag = 0x2B
   176		TagNamelistItem           Tag = 0x2C
   177		TagPackedType             Tag = 0x2D
   178		TagSubprogram             Tag = 0x2E
   179		TagTemplateTypeParameter  Tag = 0x2F
   180		TagTemplateValueParameter Tag = 0x30
   181		TagThrownType             Tag = 0x31
   182		TagTryDwarfBlock          Tag = 0x32
   183		TagVariantPart            Tag = 0x33
   184		TagVariable               Tag = 0x34
   185		TagVolatileType           Tag = 0x35
   186		// The following are new in DWARF 3.
   187		TagDwarfProcedure  Tag = 0x36
   188		TagRestrictType    Tag = 0x37
   189		TagInterfaceType   Tag = 0x38
   190		TagNamespace       Tag = 0x39
   191		TagImportedModule  Tag = 0x3A
   192		TagUnspecifiedType Tag = 0x3B
   193		TagPartialUnit     Tag = 0x3C
   194		TagImportedUnit    Tag = 0x3D
   195		TagMutableType     Tag = 0x3E // Later removed from DWARF.
   196		TagCondition       Tag = 0x3F
   197		TagSharedType      Tag = 0x40
   198		// The following are new in DWARF 4.
   199		TagTypeUnit            Tag = 0x41
   200		TagRvalueReferenceType Tag = 0x42
   201		TagTemplateAlias       Tag = 0x43
   202	)
   203	
   204	func (t Tag) GoString() string {
   205		if t <= TagTemplateAlias {
   206			return "dwarf.Tag" + t.String()
   207		}
   208		return "dwarf." + t.String()
   209	}
   210	
   211	// Location expression operators.
   212	// The debug info encodes value locations like 8(R3)
   213	// as a sequence of these op codes.
   214	// This package does not implement full expressions;
   215	// the opPlusUconst operator is expected by the type parser.
   216	const (
   217		opAddr       = 0x03 /* 1 op, const addr */
   218		opDeref      = 0x06
   219		opConst1u    = 0x08 /* 1 op, 1 byte const */
   220		opConst1s    = 0x09 /*	" signed */
   221		opConst2u    = 0x0A /* 1 op, 2 byte const  */
   222		opConst2s    = 0x0B /*	" signed */
   223		opConst4u    = 0x0C /* 1 op, 4 byte const */
   224		opConst4s    = 0x0D /*	" signed */
   225		opConst8u    = 0x0E /* 1 op, 8 byte const */
   226		opConst8s    = 0x0F /*	" signed */
   227		opConstu     = 0x10 /* 1 op, LEB128 const */
   228		opConsts     = 0x11 /*	" signed */
   229		opDup        = 0x12
   230		opDrop       = 0x13
   231		opOver       = 0x14
   232		opPick       = 0x15 /* 1 op, 1 byte stack index */
   233		opSwap       = 0x16
   234		opRot        = 0x17
   235		opXderef     = 0x18
   236		opAbs        = 0x19
   237		opAnd        = 0x1A
   238		opDiv        = 0x1B
   239		opMinus      = 0x1C
   240		opMod        = 0x1D
   241		opMul        = 0x1E
   242		opNeg        = 0x1F
   243		opNot        = 0x20
   244		opOr         = 0x21
   245		opPlus       = 0x22
   246		opPlusUconst = 0x23 /* 1 op, ULEB128 addend */
   247		opShl        = 0x24
   248		opShr        = 0x25
   249		opShra       = 0x26
   250		opXor        = 0x27
   251		opSkip       = 0x2F /* 1 op, signed 2-byte constant */
   252		opBra        = 0x28 /* 1 op, signed 2-byte constant */
   253		opEq         = 0x29
   254		opGe         = 0x2A
   255		opGt         = 0x2B
   256		opLe         = 0x2C
   257		opLt         = 0x2D
   258		opNe         = 0x2E
   259		opLit0       = 0x30
   260		/* OpLitN = OpLit0 + N for N = 0..31 */
   261		opReg0 = 0x50
   262		/* OpRegN = OpReg0 + N for N = 0..31 */
   263		opBreg0 = 0x70 /* 1 op, signed LEB128 constant */
   264		/* OpBregN = OpBreg0 + N for N = 0..31 */
   265		opRegx       = 0x90 /* 1 op, ULEB128 register */
   266		opFbreg      = 0x91 /* 1 op, SLEB128 offset */
   267		opBregx      = 0x92 /* 2 op, ULEB128 reg; SLEB128 off */
   268		opPiece      = 0x93 /* 1 op, ULEB128 size of piece */
   269		opDerefSize  = 0x94 /* 1-byte size of data retrieved */
   270		opXderefSize = 0x95 /* 1-byte size of data retrieved */
   271		opNop        = 0x96
   272		/* next four new in Dwarf v3 */
   273		opPushObjAddr = 0x97
   274		opCall2       = 0x98 /* 2-byte offset of DIE */
   275		opCall4       = 0x99 /* 4-byte offset of DIE */
   276		opCallRef     = 0x9A /* 4- or 8- byte offset of DIE */
   277		/* 0xE0-0xFF reserved for user-specific */
   278	)
   279	
   280	// Basic type encodings -- the value for AttrEncoding in a TagBaseType Entry.
   281	const (
   282		encAddress        = 0x01
   283		encBoolean        = 0x02
   284		encComplexFloat   = 0x03
   285		encFloat          = 0x04
   286		encSigned         = 0x05
   287		encSignedChar     = 0x06
   288		encUnsigned       = 0x07
   289		encUnsignedChar   = 0x08
   290		encImaginaryFloat = 0x09
   291	)
   292	
   293	// Statement program standard opcode encodings.
   294	const (
   295		lnsCopy           = 1
   296		lnsAdvancePC      = 2
   297		lnsAdvanceLine    = 3
   298		lnsSetFile        = 4
   299		lnsSetColumn      = 5
   300		lnsNegateStmt     = 6
   301		lnsSetBasicBlock  = 7
   302		lnsConstAddPC     = 8
   303		lnsFixedAdvancePC = 9
   304	
   305		// DWARF 3
   306		lnsSetPrologueEnd   = 10
   307		lnsSetEpilogueBegin = 11
   308		lnsSetISA           = 12
   309	)
   310	
   311	// Statement program extended opcode encodings.
   312	const (
   313		lneEndSequence = 1
   314		lneSetAddress  = 2
   315		lneDefineFile  = 3
   316	
   317		// DWARF 4
   318		lneSetDiscriminator = 4
   319	)
   320	

View as plain text