Documentation ¶
Index ¶
- func FormatEntryInfo(entry *dwarf.Entry) string
- func GetArrayRanges(r *dwarf.Reader, entry *dwarf.Entry) ([]int, error)
- func GetBitSize(entry *dwarf.Entry) (int, error)
- func GetCUs(r *dwarf.Reader) ([]*dwarf.Entry, error)
- func GetChildren(r *dwarf.Reader, f func(*dwarf.Entry) bool) ([]*dwarf.Entry, error)
- func GetEntry(r *dwarf.Reader, name string) (*dwarf.Entry, *dwarf.Entry, error)
- func GetLocation(entry *dwarf.Entry) ([]uint8, error)
- func GetReader[T DebugFile](fh T) (*dwarf.Reader, error)
- func GetTypeEntry(reader *dwarf.Reader, entry *dwarf.Entry) (*dwarf.Entry, error)
- func HasAttr(entry *dwarf.Entry, attr dwarf.Attr) bool
- func ListAllAttributes(entry *dwarf.Entry)
- func ParseLocation(location []uint8) int
- func ResolveTypeEntry(reader *dwarf.Reader, entry *dwarf.Entry) (*dwarf.Entry, error)
- type DebugFile
- type Proxy
- type TypeDefProxy
- type VariableProxy
- func (p *VariableProxy) Get() ([]byte, error)
- func (p VariableProxy) GetChild(childName string) (*TypeDefProxy, error)
- func (p *VariableProxy) GetField(field string) (int, error)
- func (p *VariableProxy) GoString() string
- func (p *VariableProxy) Init(reader *dwarf.Reader, entry *dwarf.Entry) error
- func (p VariableProxy) ListChildren() []string
- func (p VariableProxy) Name() string
- func (p *VariableProxy) Read() error
- func (p *VariableProxy) Set(value []byte) error
- func (p *VariableProxy) SetClient(c client.Client)
- func (p *VariableProxy) SetField(field string, value int) error
- func (p *VariableProxy) Write() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatEntryInfo ¶
Formats key information about this entry as a string; strives to be easily readable.
func GetArrayRanges ¶
Returns a slice with en entry for the range of each array dimension
Scalar types will have range []int{0}. The length of the return defines the dimension of the array.
func GetBitSize ¶
Finds the size of the type defined by this entry, in bits
func GetChildren ¶
Return a slice of all child entries of the current entry filteed by a passed function
TODO: this doesn't seem to work yet
func GetEntry ¶
Searches for an entry matching a requested name
TODO: this many return values seems like a bad idea
func GetLocation ¶
Returns the location of an entry in memory
func GetTypeEntry ¶
Returns the entry defining the type for a given entry. Returns self if no such entry can be found. Leaves the reader at the new entry.
func ListAllAttributes ¶
Prints each attribute for this entry.
func ParseLocation ¶
Translates a DW_AT_locationn attribute into an address
Types ¶
type Proxy ¶
type Proxy interface { Name() string ListChildren() []string GetChild(childName string) (*TypeDefProxy, error) }
type TypeDefProxy ¶
type TypeDefProxy struct {
// contains filtered or unexported fields
}
A TypedefProxy is an outward-facing representation of a typedef representing what a user may care about without any DWARF implementation information. This proxy represents the key information required to understand the layout of a particular type and then read or create variables of this type idiomatically from within a target language (most immediately relevant is Go but this should be generic enough to apply to other languages through Go bindings or a socket server using json or rpc).
All relevant DWARF parsing is handled when this proxy is created and no intermediate DWARF data is included here. The proxy should be ready to hand off as-is to a user.
func NewTypeDefProxy ¶
Construct a new TypeDefProxy
func (TypeDefProxy) GetChild ¶
func (p TypeDefProxy) GetChild(childName string) (*TypeDefProxy, error)
Returns the TypeDefProxy for a member of this TypeDef by name
func (*TypeDefProxy) GoString ¶
func (p *TypeDefProxy) GoString() string
func (TypeDefProxy) ListChildren ¶
func (p TypeDefProxy) ListChildren() []string
Retuns a slice of strings containing the name of each member of this TypeDef
func (TypeDefProxy) Name ¶
func (p TypeDefProxy) Name() string
type VariableProxy ¶
type VariableProxy struct { Type TypeDefProxy Address int // contains filtered or unexported fields }
Represents a variable and facilitates interacting with that variable. For our purposes, a variable is an object of known Type located at a known address, whose value we can find by reading a known size from that address. Alternatively, we can set the value of this variables, or its members if it is a struct, and then write those values back to memory.
Data is stored internally as bytes and parse into fields on demand.
Writing data to memory is handled elsewhere; this proxy instructs a client which addresses to read and provides a writeable stream of bytes to allow the client to write the variable back to memory.
func NewVariableProxy ¶
Construct a new VariableProxy for a variable known to the DWARF debug info.
To create a variable from scratch , use *some other method*
func (*VariableProxy) Get ¶
func (p *VariableProxy) Get() ([]byte, error)
Return the value of the entire variable
In the case of a multi-field struct, this is most useful to enable the client to write the entire variable back to memory.
func (VariableProxy) GetChild ¶
func (p VariableProxy) GetChild(childName string) (*TypeDefProxy, error)
TODO: change the child hierarchy to use ordered maps not slices for lookup speed?
func (*VariableProxy) GetField ¶
func (p *VariableProxy) GetField(field string) (int, error)
Return the value of a single field within this variable Typically this will be used for a struct or class
NOTE: at present, fields must be byte-aligned
func (*VariableProxy) GoString ¶
func (p *VariableProxy) GoString() string
func (VariableProxy) ListChildren ¶
func (p VariableProxy) ListChildren() []string
Retuns a slice of strings containing the name of each member of this TypeDef
func (VariableProxy) Name ¶
func (p VariableProxy) Name() string
func (*VariableProxy) Read ¶
func (p *VariableProxy) Read() error
func (*VariableProxy) Set ¶
func (p *VariableProxy) Set(value []byte) error
Set the value of this entire variable
In the case of a multi-field struct, this is most useful for initializing our proxy of a variable by having the client read the entire variable out of memory. Once the proxy is poplulated, we can access fields as required.
func (*VariableProxy) SetClient ¶
func (p *VariableProxy) SetClient(c client.Client)
func (*VariableProxy) SetField ¶
func (p *VariableProxy) SetField(field string, value int) error
Set the value of a single field within this variable Typically this will be used for a struct or class
NOTE: at present, fields must be byte-aligned
func (*VariableProxy) Write ¶
func (p *VariableProxy) Write() error