debug

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DW_Location_Global = 1
View Source
const DW_Location_Global_i32 = 3
View Source
const DW_Location_Local = 0

DW_OP_WASM_location types

View Source
const DW_Location_Stack = 2 // 0 = bottom of the stack
View Source
const DW_OP_GNU_const_type = 0xf4
View Source
const DW_OP_GNU_convert = 0xf7
View Source
const DW_OP_GNU_deref_type = 0xf6
View Source
const DW_OP_GNU_entry_value = 0xf3
View Source
const DW_OP_GNU_implicit_pointer = 0xf2
View Source
const DW_OP_GNU_parameter_ref = 0xfa
View Source
const DW_OP_GNU_push_tls_address = 0xe0
View Source
const DW_OP_GNU_regval_type = 0xf5
View Source
const DW_OP_WASM_location = 0xed
View Source
const DW_OP_abs = 0x19
View Source
const DW_OP_addr = 0x03
View Source
const DW_OP_addrx = 0xa1
View Source
const DW_OP_and = 0x1a
View Source
const DW_OP_bit_piece = 0x9d
View Source
const DW_OP_bra = 0x28
View Source
const DW_OP_bregx = 0x92
View Source
const DW_OP_call2 = 0x98
View Source
const DW_OP_call4 = 0x99
View Source
const DW_OP_call_frame_cfa = 0x9c
View Source
const DW_OP_call_ref = 0x9a
View Source
const DW_OP_const1s = 0x09
View Source
const DW_OP_const1u = 0x08
View Source
const DW_OP_const2s = 0x0b
View Source
const DW_OP_const2u = 0x0a
View Source
const DW_OP_const4s = 0x0d
View Source
const DW_OP_const4u = 0x0c
View Source
const DW_OP_const8s = 0x0f
View Source
const DW_OP_const8u = 0x0e
View Source
const DW_OP_const_type = 0xa4
View Source
const DW_OP_consts = 0x11
View Source
const DW_OP_constu = 0x10
View Source
const DW_OP_constx = 0xa2
View Source
const DW_OP_convert = 0xa8
View Source
const DW_OP_deref = 0x06
View Source
const DW_OP_deref_size = 0x94
View Source
const DW_OP_deref_type = 0xa6
View Source
const DW_OP_div = 0x1b
View Source
const DW_OP_drop = 0x13
View Source
const DW_OP_dup = 0x12
View Source
const DW_OP_entry_value = 0xa3
View Source
const DW_OP_eq = 0x29
View Source
const DW_OP_fbreg = 0x91
View Source
const DW_OP_form_tls_address = 0x9b
View Source
const DW_OP_ge = 0x2a
View Source
const DW_OP_gt = 0x2b
View Source
const DW_OP_hi_user = 0xff
View Source
const DW_OP_implicit_pointer = 0xa0
View Source
const DW_OP_implicit_value = 0x9e
View Source
const DW_OP_le = 0x2c
View Source
const DW_OP_lo_user = 0xe0
View Source
const DW_OP_lt = 0x2d
View Source
const DW_OP_minus = 0x1c
View Source
const DW_OP_mod = 0x1d
View Source
const DW_OP_mul = 0x1e
View Source
const DW_OP_ne = 0x2e
View Source
const DW_OP_neg = 0x1f
View Source
const DW_OP_nop = 0x96
View Source
const DW_OP_not = 0x20
View Source
const DW_OP_or = 0x21
View Source
const DW_OP_over = 0x14
View Source
const DW_OP_pick = 0x15
View Source
const DW_OP_piece = 0x93
View Source
const DW_OP_plus = 0x22
View Source
const DW_OP_plus_uconst = 0x23
View Source
const DW_OP_push_object_address = 0x97
View Source
const DW_OP_regval_type = 0xa5
View Source
const DW_OP_regx = 0x90
View Source
const DW_OP_reinterpret = 0xa9
View Source
const DW_OP_rot = 0x17
View Source
const DW_OP_shl = 0x24
View Source
const DW_OP_shr = 0x25
View Source
const DW_OP_shra = 0x26
View Source
const DW_OP_skip = 0x2f
View Source
const DW_OP_stack_value = 0x9f
View Source
const DW_OP_swap = 0x16
View Source
const DW_OP_xderef = 0x18
View Source
const DW_OP_xderef_size = 0x95
View Source
const DW_OP_xderef_type = 0xa7
View Source
const DW_OP_xor = 0x27

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomSectionProvider

type CustomSectionProvider interface {
	GetCustomSectionData(name string) []byte
}

type DwarfLocations

type DwarfLocations struct {
	// contains filtered or unexported fields
}

func NewDwarfLocations

func NewDwarfLocations(d []byte) *DwarfLocations

func (*DwarfLocations) ReadLocation

func (dl *DwarfLocations) ReadLocation(p uint64) []*LocationData

type FunctionFinder

type FunctionFinder interface {
	FindFunction(uint64) int
}

type GlobalNameData

type GlobalNameData struct {
	Name    string
	Address uint64
	Size    uint64
	Type    string
}

type LineInfo

type LineInfo struct {
	Filename   string
	Linenumber int
	Column     int
}

type LocalNameData

type LocalNameData struct {
	StartPC uint64
	EndPC   uint64
	Index   int
	VarName string
	VarType string
}

type LocationData

type LocationData struct {
	StartAddress uint32
	EndAddress   uint32
	Expression   []byte
}

func (*LocationData) ExtractWasmLocations

func (ld *LocationData) ExtractWasmLocations() []*WasmLocation

func (*LocationData) GetAddress

func (ld *LocationData) GetAddress() (uint32, error)

type WasmDebug

type WasmDebug struct {
	// These come from the 'name' custom section
	FunctionNames map[int]string
	GlobalNames   map[int]string
	DataNames     map[int]string

	// dwarf debugging data
	DwarfLoc    *DwarfLocations
	DwarfData   *dwarf.Data
	LineNumbers map[uint64]LineInfo
	// debug info derived from dwarf
	FunctionDebug     map[int]string
	FunctionSignature map[int]string
	LocalNames        []*LocalNameData

	GlobalAddresses map[string]*GlobalNameData
}

func NewEmpty

func NewEmpty() *WasmDebug

func (*WasmDebug) GetDataIdentifier

func (wd *WasmDebug) GetDataIdentifier(did int) string

func (*WasmDebug) GetFunctionDebug

func (wd *WasmDebug) GetFunctionDebug(fid int) string

func (*WasmDebug) GetFunctionIdentifier

func (wd *WasmDebug) GetFunctionIdentifier(fid int, defaultEmpty bool) string

func (*WasmDebug) GetFunctionSignature

func (wd *WasmDebug) GetFunctionSignature(fid int) string

func (*WasmDebug) GetGlobalIdentifier

func (wd *WasmDebug) GetGlobalIdentifier(gid int, defaultEmpty bool) string

func (*WasmDebug) GetLineNumberBefore

func (wd *WasmDebug) GetLineNumberBefore(start uint64, codePC uint64) string

func (*WasmDebug) GetLineNumberInfo

func (wd *WasmDebug) GetLineNumberInfo(pc uint64) string

func (*WasmDebug) GetLineNumberRange

func (wd *WasmDebug) GetLineNumberRange(start uint64, end uint64) string

func (*WasmDebug) GetLocalVarName

func (wd *WasmDebug) GetLocalVarName(pc uint64, index int) string

func (*WasmDebug) GetLocalVarType

func (wd *WasmDebug) GetLocalVarType(pc uint64, index int) string

func (*WasmDebug) LookupDataId

func (wd *WasmDebug) LookupDataId(n string) int

func (*WasmDebug) LookupFunctionID

func (wd *WasmDebug) LookupFunctionID(n string) int

func (*WasmDebug) LookupGlobalID

func (wd *WasmDebug) LookupGlobalID(n string) int

func (*WasmDebug) ParseDwarf

func (wd *WasmDebug) ParseDwarf(wf CustomSectionProvider) error

func (*WasmDebug) ParseDwarfGlobals

func (wd *WasmDebug) ParseDwarfGlobals()

func (*WasmDebug) ParseDwarfLineNumbers

func (wd *WasmDebug) ParseDwarfLineNumbers() error

func (*WasmDebug) ParseDwarfVariables

func (wd *WasmDebug) ParseDwarfVariables(wf FunctionFinder) error

func (*WasmDebug) ParseNameSectionData

func (wd *WasmDebug) ParseNameSectionData(nameData []byte)

*

  • Parse the custom name section from a wasm file *

func (*WasmDebug) RenumberFunctions

func (wd *WasmDebug) RenumberFunctions(remap map[int]int)

Renumber functions using a remap

func (*WasmDebug) SetFunctionSignature

func (wd *WasmDebug) SetFunctionSignature(fid int, de string)

type WasmLocation

type WasmLocation struct {
	IsLocal  bool
	IsGlobal bool
	IsStack  bool
	Index    uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL