type abbrev … type afield … type abbrevTable … // parseAbbrev returns the abbreviation table that starts at byte off // in the .debug_abbrev section. func (d *Data) parseAbbrev(off uint64, vers int) (abbrevTable, error) { … } var attrIsExprloc … var attrPtrClass … // formToClass returns the DWARF 4 Class for the given form. If the // DWARF version is less then 4, it will disambiguate some forms // depending on the attribute. func formToClass(form format, attr Attr, vers int, b *buf) Class { … } type Entry … type Field … type Class … const ClassUnknown … const ClassAddress … const ClassBlock … const ClassConstant … const ClassExprLoc … const ClassFlag … const ClassLinePtr … const ClassLocListPtr … const ClassMacPtr … const ClassRangeListPtr … const ClassReference … const ClassReferenceSig … const ClassString … const ClassReferenceAlt … const ClassStringAlt … const ClassAddrPtr … const ClassLocList … const ClassRngList … const ClassRngListsPtr … const ClassStrOffsetsPtr … func (i Class) GoString() string { … } // 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) func (e *Entry) Val(a Attr) any { … } // AttrField returns the [Field] associated with attribute [Attr] in // [Entry], or nil if there is no such attribute. func (e *Entry) AttrField(a Attr) *Field { … } type Offset … // Entry reads a single entry from buf, decoding // according to the given abbreviation table. func (b *buf) entry(cu *Entry, atab abbrevTable, ubase Offset, vers int) *Entry { … } type Reader … // Reader returns a new Reader for [Data]. // The reader is positioned at byte offset 0 in the DWARF “info” section. func (d *Data) Reader() *Reader { … } // AddressSize returns the size in bytes of addresses in the current compilation // unit. func (r *Reader) AddressSize() int { … } // ByteOrder returns the byte order in the current compilation unit. func (r *Reader) ByteOrder() binary.ByteOrder { … } // Seek positions the [Reader] at offset off in the encoded entry stream. // Offset 0 can be used to denote the first entry. func (r *Reader) Seek(off Offset) { … } // maybeNextUnit advances to the next unit if this one is finished. func (r *Reader) maybeNextUnit() { … } // nextUnit advances to the next unit. func (r *Reader) nextUnit() { … } // 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]. func (r *Reader) Next() (*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. func (r *Reader) SkipChildren() { … } // clone returns a copy of the reader. This is used by the typeReader // interface. func (r *Reader) clone() typeReader { … } // offset returns the current buffer offset. This is used by the // typeReader interface. func (r *Reader) offset() 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. func (r *Reader) SeekPC(pc uint64) (*Entry, 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. func (d *Data) Ranges(e *Entry) ([][2]uint64, error) { … } // baseAddressForEntry returns the initial base address to be used when // looking up the range list of entry e. // DWARF specifies that this should be the lowpc attribute of the enclosing // compilation unit, however comments in gdb/dwarf2read.c say that some // versions of GCC use the entrypc attribute, so we check that too. func (d *Data) baseAddressForEntry(e *Entry) (*Entry, uint64, error) { … } func (d *Data) dwarf2Ranges(u *unit, base uint64, ranges int64, ret [][2]uint64) ([][2]uint64, error) { … } // dwarf5Ranges interprets a debug_rnglists sequence, see DWARFv5 section // 2.17.3 (page 53). func (d *Data) dwarf5Ranges(u *unit, cu *Entry, base uint64, ranges int64, ret [][2]uint64) ([][2]uint64, error) { … } // debugAddr returns the address at idx in debug_addr func (d *Data) debugAddr(format dataFormat, addrBase, idx uint64) (uint64, error) { … }