browserdebug

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package browserdebug converts standards-based WebAssembly DWARF into the compact query index used by LLGo's Chrome Language Extension. DWARF remains the source of truth; the index is generated for a debug session and is not a compiler-owned replacement debug format.

Index

Constants

View Source
const IndexVersion = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressRange

type AddressRange struct {
	Start uint64 `json:"start"`
	End   uint64 `json:"end"`
}

type Bundle

type Bundle struct {
	Index       Index
	MainPath    string
	SymbolsPath string
	SourceFiles map[string]string
	// contains filtered or unexported fields
}

Bundle retains the index and the local files needed to serve a browser session. SourceFiles is keyed by Source.ID.

func Load

func Load(mainPath string, mappings []PathMapping, sourceRoots ...string) (*Bundle, error)

Load reads an embedded or external LLGo WebAssembly artifact and builds its browser query index. External sidecars must carry the same standard build_id as the main module. Sources are exposed only within the module directory, explicit mapping destinations, or sourceRoots supplied by a trusted build.

func (*Bundle) ReadSource

func (b *Bundle) ReadSource(id string) ([]byte, error)

ReadSource reads an indexed source within its trusted filesystem root. Root.ReadFile also prevents a symlink replacement after indexing from redirecting an HTTP request outside that root.

type Constant

type Constant struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
}

type EnumValue

type EnumValue struct {
	Name  string `json:"name"`
	Value int64  `json:"value"`
}

type Function

type Function struct {
	Name   string         `json:"name"`
	Ranges []AddressRange `json:"ranges"`
}

type Index

type Index struct {
	Contract    string      `json:"contract"`
	Version     int         `json:"version"`
	BuildID     string      `json:"build_id"`
	Artifact    string      `json:"artifact"`
	Record      Record      `json:"record"`
	Sources     []Source    `json:"sources"`
	Lines       []LineRange `json:"lines"`
	Functions   []Function  `json:"functions"`
	Variables   []Variable  `json:"variables"`
	Types       []Type      `json:"types"`
	Diagnostics []string    `json:"diagnostics,omitempty"`
}

Index is the transport-neutral state consumed by the browser extension.

type LineRange

type LineRange struct {
	Source string `json:"source"`
	Line   int    `json:"line"`
	Column int    `json:"column"`
	Start  uint64 `json:"start"`
	End    uint64 `json:"end"`
}

type Location

type Location struct {
	Start      uint64 `json:"start,omitempty"`
	End        uint64 `json:"end,omitempty"`
	Expression string `json:"expression"`
}

type MissingSymbolsError

type MissingSymbolsError struct {
	URL  string
	Path string
	Err  error
}

MissingSymbolsError reports an unavailable external_debug_info target.

func (*MissingSymbolsError) Error

func (e *MissingSymbolsError) Error() string

func (*MissingSymbolsError) Unwrap

func (e *MissingSymbolsError) Unwrap() error

type PathMapping

type PathMapping struct {
	From string
	To   string
}

PathMapping maps a source prefix recorded by the compiler to a local source prefix. The longest matching From prefix wins.

func ParsePathMapping

func ParsePathMapping(value string) (PathMapping, error)

ParsePathMapping parses the debugger spelling FROM=TO.

type Record

type Record struct {
	RecordVersion        uint8              `json:"record_version"`
	SchemaVersion        uint8              `json:"schema_version"`
	RuntimeLayoutVersion uint8              `json:"runtime_layout_version"`
	LLGoABIVersion       uint8              `json:"llgo_abi_version"`
	PointerSize          uint8              `json:"pointer_size"`
	ByteOrder            debugabi.ByteOrder `json:"byte_order"`
}

type Source

type Source struct {
	ID    string `json:"id"`
	Path  string `json:"path"`
	URL   string `json:"url"`
	Local bool   `json:"local"`
}

type Type

type Type struct {
	ID       string      `json:"id"`
	Name     string      `json:"name"`
	Kind     string      `json:"kind"`
	Size     int64       `json:"size"`
	Signed   bool        `json:"signed,omitempty"`
	Elem     string      `json:"elem,omitempty"`
	Count    int64       `json:"count,omitempty"`
	Fields   []TypeField `json:"fields,omitempty"`
	Enum     []EnumValue `json:"enum,omitempty"`
	Complete bool        `json:"complete"`
}

type TypeField

type TypeField struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Offset int64  `json:"offset"`
}

type Variable

type Variable struct {
	Name      string         `json:"name"`
	Scope     string         `json:"scope"`
	Type      string         `json:"type"`
	Ranges    []AddressRange `json:"ranges,omitempty"`
	Locations []Location     `json:"locations,omitempty"`
	FrameBase []Location     `json:"frame_base,omitempty"`
	Constant  *Constant      `json:"constant,omitempty"`
	Depth     int            `json:"depth"`
}

Jump to

Keyboard shortcuts

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