import "debug/dwarf"
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
buf.go class_string.go const.go entry.go line.go open.go type.go typeunit.go unit.go
ErrUnknownPC is the error returned by LineReader.ScanPC when the seek PC is not covered by any entry in the line table.
An AddrType represents a machine address type.
An ArrayType represents a fixed size array type.
An Attr identifies the attribute type in a DWARF Entry's Field.
A BasicType holds fields common to all basic types.
A BoolType represents a boolean type.
A CharType represents a signed character type.
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.
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.
A ComplexType represents a complex floating point type.
Data represents the DWARF debugging information loaded from an executable file (for example, an ELF or Mach-O executable).
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.
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.
A DotDotDotType represents the variadic ... function parameter.
An entry is a sequence of attribute/value pairs.
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)
An EnumType represents an enumerated type. The only indication of its native integer type is its ByteSize (inside CommonType).
An EnumValue represents a single enumeration value.
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.
A FloatType represents a floating point type.
A FuncType represents a function type.
An IntType represents a signed integer type.
A LineEntry is a row in a DWARF line table.
A LineFile is a source file referenced by a DWARF line table entry.
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 its EndSequence field set.
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 Tell.
The argument pos must have been returned by a call to 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.
A LineReaderPos represents a position in a line table.
An Offset represents the location of an Entry within the DWARF info. (See Reader.Seek.)
A PtrType represents a pointer type.
A QualType represents a type that has the C/C++ "const", "restrict", or "volatile" qualifier.
A Reader allows reading Entry structures from a DWARF “info” section. The Entry structures are arranged in a tree. The Reader's 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.
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 Next. If that Entry did not have children or Next has not been called, SkipChildren is a no-op.
A StructField represents a field in a struct, union, or C++ class type.
A StructType represents a struct, union, or C++ class type.
A Tag is the classification (the type) of an Entry.
A Type conventionally represents a pointer to any of the specific Type structures (CharType, StructType, etc.).
A TypedefType represents a named type.
A UcharType represents an unsigned character type.
A UintType represents an unsigned integer type.
An UnspecifiedType represents an implicit, unknown, ambiguous or nonexistent type.
A VoidType represents the C void type.