dwtest

Imports

Imports #

"debug/dwarf"
"errors"
"fmt"
"os"

Structs

Examiner struct #

type Examiner struct {
dies []*dwarf.Entry
idxByOffset map[dwarf.Offset]int
kids map[int][]int
parent map[int]int
byname map[string][]int
}

Functions

Children method #

Returns a list of child entries for a die with ID 'idx'

func (ex *Examiner) Children(idx int) []*dwarf.Entry

DIEs method #

func (ex *Examiner) DIEs() []*dwarf.Entry

DumpEntry method #

For debugging new tests

func (ex *Examiner) DumpEntry(idx int, dumpKids bool, ilevel int)

EntryFromOffset method #

Given a DIE offset, return the previously read dwarf.Entry, or nil

func (ex *Examiner) EntryFromOffset(off dwarf.Offset) *dwarf.Entry

FileRef method #

FileRef takes a given DIE by index and a numeric file reference (presumably from a decl_file or call_file attribute), looks up the reference in the .debug_line file table, and returns the proper string for it. We need to know which DIE is making the reference so as to find the right compilation unit.

func (ex *Examiner) FileRef(dw *dwarf.Data, dieIdx int, fileRef int64) (string, error)

IdxFromOffset method #

Return the ID that Examiner uses to refer to the DIE at offset off

func (ex *Examiner) IdxFromOffset(off dwarf.Offset) int

Named method #

Return a list of all DIEs with name 'name'. When searching for DIEs by name, keep in mind that the returned results will include child DIEs such as params/variables. For example, asking for all DIEs named "p" for even a small program will give you 400-500 entries.

func (ex *Examiner) Named(name string) []*dwarf.Entry

Parent method #

Returns parent DIE for DIE 'idx', or nil if the DIE is top level

func (ex *Examiner) Parent(idx int) *dwarf.Entry

ParentCU method #

ParentCU returns the enclosing compilation unit DIE for the DIE with a given index, or nil if for some reason we can't establish a parent.

func (ex *Examiner) ParentCU(idx int) *dwarf.Entry

Populate method #

Populate the Examiner using the DIEs read from rdr.

func (ex *Examiner) Populate(rdr *dwarf.Reader) error

entryFromIdx method #

Return the dwarf.Entry pointer for the DIE with id 'idx'

func (ex *Examiner) entryFromIdx(idx int) *dwarf.Entry

indent function #

func indent(ilevel int)

Generated with Arrow