github.com/spotify/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/src/pkg/debug/dwarf/const.go (about) 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 import "strconv" 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 var attrNames = [...]string{ 90 AttrSibling: "Sibling", 91 AttrLocation: "Location", 92 AttrName: "Name", 93 AttrOrdering: "Ordering", 94 AttrByteSize: "ByteSize", 95 AttrBitOffset: "BitOffset", 96 AttrBitSize: "BitSize", 97 AttrStmtList: "StmtList", 98 AttrLowpc: "Lowpc", 99 AttrHighpc: "Highpc", 100 AttrLanguage: "Language", 101 AttrDiscr: "Discr", 102 AttrDiscrValue: "DiscrValue", 103 AttrVisibility: "Visibility", 104 AttrImport: "Import", 105 AttrStringLength: "StringLength", 106 AttrCommonRef: "CommonRef", 107 AttrCompDir: "CompDir", 108 AttrConstValue: "ConstValue", 109 AttrContainingType: "ContainingType", 110 AttrDefaultValue: "DefaultValue", 111 AttrInline: "Inline", 112 AttrIsOptional: "IsOptional", 113 AttrLowerBound: "LowerBound", 114 AttrProducer: "Producer", 115 AttrPrototyped: "Prototyped", 116 AttrReturnAddr: "ReturnAddr", 117 AttrStartScope: "StartScope", 118 AttrStrideSize: "StrideSize", 119 AttrUpperBound: "UpperBound", 120 AttrAbstractOrigin: "AbstractOrigin", 121 AttrAccessibility: "Accessibility", 122 AttrAddrClass: "AddrClass", 123 AttrArtificial: "Artificial", 124 AttrBaseTypes: "BaseTypes", 125 AttrCalling: "Calling", 126 AttrCount: "Count", 127 AttrDataMemberLoc: "DataMemberLoc", 128 AttrDeclColumn: "DeclColumn", 129 AttrDeclFile: "DeclFile", 130 AttrDeclLine: "DeclLine", 131 AttrDeclaration: "Declaration", 132 AttrDiscrList: "DiscrList", 133 AttrEncoding: "Encoding", 134 AttrExternal: "External", 135 AttrFrameBase: "FrameBase", 136 AttrFriend: "Friend", 137 AttrIdentifierCase: "IdentifierCase", 138 AttrMacroInfo: "MacroInfo", 139 AttrNamelistItem: "NamelistItem", 140 AttrPriority: "Priority", 141 AttrSegment: "Segment", 142 AttrSpecification: "Specification", 143 AttrStaticLink: "StaticLink", 144 AttrType: "Type", 145 AttrUseLocation: "UseLocation", 146 AttrVarParam: "VarParam", 147 AttrVirtuality: "Virtuality", 148 AttrVtableElemLoc: "VtableElemLoc", 149 AttrAllocated: "Allocated", 150 AttrAssociated: "Associated", 151 AttrDataLocation: "DataLocation", 152 AttrStride: "Stride", 153 AttrEntrypc: "Entrypc", 154 AttrUseUTF8: "UseUTF8", 155 AttrExtension: "Extension", 156 AttrRanges: "Ranges", 157 AttrTrampoline: "Trampoline", 158 AttrCallColumn: "CallColumn", 159 AttrCallFile: "CallFile", 160 AttrCallLine: "CallLine", 161 AttrDescription: "Description", 162 } 163 164 func (a Attr) String() string { 165 if int(a) < len(attrNames) { 166 s := attrNames[a] 167 if s != "" { 168 return s 169 } 170 } 171 return strconv.Itoa(int(a)) 172 } 173 174 func (a Attr) GoString() string { 175 if int(a) < len(attrNames) { 176 s := attrNames[a] 177 if s != "" { 178 return "dwarf.Attr" + s 179 } 180 } 181 return "dwarf.Attr(" + strconv.FormatInt(int64(a), 10) + ")" 182 } 183 184 // A format is a DWARF data encoding format. 185 type format uint32 186 187 const ( 188 // value formats 189 formAddr format = 0x01 190 formDwarfBlock2 format = 0x03 191 formDwarfBlock4 format = 0x04 192 formData2 format = 0x05 193 formData4 format = 0x06 194 formData8 format = 0x07 195 formString format = 0x08 196 formDwarfBlock format = 0x09 197 formDwarfBlock1 format = 0x0A 198 formData1 format = 0x0B 199 formFlag format = 0x0C 200 formSdata format = 0x0D 201 formStrp format = 0x0E 202 formUdata format = 0x0F 203 formRefAddr format = 0x10 204 formRef1 format = 0x11 205 formRef2 format = 0x12 206 formRef4 format = 0x13 207 formRef8 format = 0x14 208 formRefUdata format = 0x15 209 formIndirect format = 0x16 210 formSecOffset format = 0x17 211 formExprloc format = 0x18 212 formFlagPresent format = 0x19 213 formRefSig8 format = 0x20 214 ) 215 216 // A Tag is the classification (the type) of an Entry. 217 type Tag uint32 218 219 const ( 220 TagArrayType Tag = 0x01 221 TagClassType Tag = 0x02 222 TagEntryPoint Tag = 0x03 223 TagEnumerationType Tag = 0x04 224 TagFormalParameter Tag = 0x05 225 TagImportedDeclaration Tag = 0x08 226 TagLabel Tag = 0x0A 227 TagLexDwarfBlock Tag = 0x0B 228 TagMember Tag = 0x0D 229 TagPointerType Tag = 0x0F 230 TagReferenceType Tag = 0x10 231 TagCompileUnit Tag = 0x11 232 TagStringType Tag = 0x12 233 TagStructType Tag = 0x13 234 TagSubroutineType Tag = 0x15 235 TagTypedef Tag = 0x16 236 TagUnionType Tag = 0x17 237 TagUnspecifiedParameters Tag = 0x18 238 TagVariant Tag = 0x19 239 TagCommonDwarfBlock Tag = 0x1A 240 TagCommonInclusion Tag = 0x1B 241 TagInheritance Tag = 0x1C 242 TagInlinedSubroutine Tag = 0x1D 243 TagModule Tag = 0x1E 244 TagPtrToMemberType Tag = 0x1F 245 TagSetType Tag = 0x20 246 TagSubrangeType Tag = 0x21 247 TagWithStmt Tag = 0x22 248 TagAccessDeclaration Tag = 0x23 249 TagBaseType Tag = 0x24 250 TagCatchDwarfBlock Tag = 0x25 251 TagConstType Tag = 0x26 252 TagConstant Tag = 0x27 253 TagEnumerator Tag = 0x28 254 TagFileType Tag = 0x29 255 TagFriend Tag = 0x2A 256 TagNamelist Tag = 0x2B 257 TagNamelistItem Tag = 0x2C 258 TagPackedType Tag = 0x2D 259 TagSubprogram Tag = 0x2E 260 TagTemplateTypeParameter Tag = 0x2F 261 TagTemplateValueParameter Tag = 0x30 262 TagThrownType Tag = 0x31 263 TagTryDwarfBlock Tag = 0x32 264 TagVariantPart Tag = 0x33 265 TagVariable Tag = 0x34 266 TagVolatileType Tag = 0x35 267 TagDwarfProcedure Tag = 0x36 268 TagRestrictType Tag = 0x37 269 TagInterfaceType Tag = 0x38 270 TagNamespace Tag = 0x39 271 TagImportedModule Tag = 0x3A 272 TagUnspecifiedType Tag = 0x3B 273 TagPartialUnit Tag = 0x3C 274 TagImportedUnit Tag = 0x3D 275 TagMutableType Tag = 0x3E 276 ) 277 278 var tagNames = [...]string{ 279 TagArrayType: "ArrayType", 280 TagClassType: "ClassType", 281 TagEntryPoint: "EntryPoint", 282 TagEnumerationType: "EnumerationType", 283 TagFormalParameter: "FormalParameter", 284 TagImportedDeclaration: "ImportedDeclaration", 285 TagLabel: "Label", 286 TagLexDwarfBlock: "LexDwarfBlock", 287 TagMember: "Member", 288 TagPointerType: "PointerType", 289 TagReferenceType: "ReferenceType", 290 TagCompileUnit: "CompileUnit", 291 TagStringType: "StringType", 292 TagStructType: "StructType", 293 TagSubroutineType: "SubroutineType", 294 TagTypedef: "Typedef", 295 TagUnionType: "UnionType", 296 TagUnspecifiedParameters: "UnspecifiedParameters", 297 TagVariant: "Variant", 298 TagCommonDwarfBlock: "CommonDwarfBlock", 299 TagCommonInclusion: "CommonInclusion", 300 TagInheritance: "Inheritance", 301 TagInlinedSubroutine: "InlinedSubroutine", 302 TagModule: "Module", 303 TagPtrToMemberType: "PtrToMemberType", 304 TagSetType: "SetType", 305 TagSubrangeType: "SubrangeType", 306 TagWithStmt: "WithStmt", 307 TagAccessDeclaration: "AccessDeclaration", 308 TagBaseType: "BaseType", 309 TagCatchDwarfBlock: "CatchDwarfBlock", 310 TagConstType: "ConstType", 311 TagConstant: "Constant", 312 TagEnumerator: "Enumerator", 313 TagFileType: "FileType", 314 TagFriend: "Friend", 315 TagNamelist: "Namelist", 316 TagNamelistItem: "NamelistItem", 317 TagPackedType: "PackedType", 318 TagSubprogram: "Subprogram", 319 TagTemplateTypeParameter: "TemplateTypeParameter", 320 TagTemplateValueParameter: "TemplateValueParameter", 321 TagThrownType: "ThrownType", 322 TagTryDwarfBlock: "TryDwarfBlock", 323 TagVariantPart: "VariantPart", 324 TagVariable: "Variable", 325 TagVolatileType: "VolatileType", 326 TagDwarfProcedure: "DwarfProcedure", 327 TagRestrictType: "RestrictType", 328 TagInterfaceType: "InterfaceType", 329 TagNamespace: "Namespace", 330 TagImportedModule: "ImportedModule", 331 TagUnspecifiedType: "UnspecifiedType", 332 TagPartialUnit: "PartialUnit", 333 TagImportedUnit: "ImportedUnit", 334 TagMutableType: "MutableType", 335 } 336 337 func (t Tag) String() string { 338 if int(t) < len(tagNames) { 339 s := tagNames[t] 340 if s != "" { 341 return s 342 } 343 } 344 return strconv.Itoa(int(t)) 345 } 346 347 func (t Tag) GoString() string { 348 if int(t) < len(tagNames) { 349 s := tagNames[t] 350 if s != "" { 351 return "dwarf.Tag" + s 352 } 353 } 354 return "dwarf.Tag(" + strconv.FormatInt(int64(t), 10) + ")" 355 } 356 357 // Location expression operators. 358 // The debug info encodes value locations like 8(R3) 359 // as a sequence of these op codes. 360 // This package does not implement full expressions; 361 // the opPlusUconst operator is expected by the type parser. 362 const ( 363 opAddr = 0x03 /* 1 op, const addr */ 364 opDeref = 0x06 365 opConst1u = 0x08 /* 1 op, 1 byte const */ 366 opConst1s = 0x09 /* " signed */ 367 opConst2u = 0x0A /* 1 op, 2 byte const */ 368 opConst2s = 0x0B /* " signed */ 369 opConst4u = 0x0C /* 1 op, 4 byte const */ 370 opConst4s = 0x0D /* " signed */ 371 opConst8u = 0x0E /* 1 op, 8 byte const */ 372 opConst8s = 0x0F /* " signed */ 373 opConstu = 0x10 /* 1 op, LEB128 const */ 374 opConsts = 0x11 /* " signed */ 375 opDup = 0x12 376 opDrop = 0x13 377 opOver = 0x14 378 opPick = 0x15 /* 1 op, 1 byte stack index */ 379 opSwap = 0x16 380 opRot = 0x17 381 opXderef = 0x18 382 opAbs = 0x19 383 opAnd = 0x1A 384 opDiv = 0x1B 385 opMinus = 0x1C 386 opMod = 0x1D 387 opMul = 0x1E 388 opNeg = 0x1F 389 opNot = 0x20 390 opOr = 0x21 391 opPlus = 0x22 392 opPlusUconst = 0x23 /* 1 op, ULEB128 addend */ 393 opShl = 0x24 394 opShr = 0x25 395 opShra = 0x26 396 opXor = 0x27 397 opSkip = 0x2F /* 1 op, signed 2-byte constant */ 398 opBra = 0x28 /* 1 op, signed 2-byte constant */ 399 opEq = 0x29 400 opGe = 0x2A 401 opGt = 0x2B 402 opLe = 0x2C 403 opLt = 0x2D 404 opNe = 0x2E 405 opLit0 = 0x30 406 /* OpLitN = OpLit0 + N for N = 0..31 */ 407 opReg0 = 0x50 408 /* OpRegN = OpReg0 + N for N = 0..31 */ 409 opBreg0 = 0x70 /* 1 op, signed LEB128 constant */ 410 /* OpBregN = OpBreg0 + N for N = 0..31 */ 411 opRegx = 0x90 /* 1 op, ULEB128 register */ 412 opFbreg = 0x91 /* 1 op, SLEB128 offset */ 413 opBregx = 0x92 /* 2 op, ULEB128 reg; SLEB128 off */ 414 opPiece = 0x93 /* 1 op, ULEB128 size of piece */ 415 opDerefSize = 0x94 /* 1-byte size of data retrieved */ 416 opXderefSize = 0x95 /* 1-byte size of data retrieved */ 417 opNop = 0x96 418 /* next four new in Dwarf v3 */ 419 opPushObjAddr = 0x97 420 opCall2 = 0x98 /* 2-byte offset of DIE */ 421 opCall4 = 0x99 /* 4-byte offset of DIE */ 422 opCallRef = 0x9A /* 4- or 8- byte offset of DIE */ 423 /* 0xE0-0xFF reserved for user-specific */ 424 ) 425 426 // Basic type encodings -- the value for AttrEncoding in a TagBaseType Entry. 427 const ( 428 encAddress = 0x01 429 encBoolean = 0x02 430 encComplexFloat = 0x03 431 encFloat = 0x04 432 encSigned = 0x05 433 encSignedChar = 0x06 434 encUnsigned = 0x07 435 encUnsignedChar = 0x08 436 encImaginaryFloat = 0x09 437 )