wasmdebug

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 7 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 wasmdebug implements the WebAssembly tool-conventions packaging for embedded and external DWARF custom sections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildID

func BuildID(module []byte) ([]byte, bool, error)

BuildID returns the unique WebAssembly tool-conventions build_id, if present. Build IDs are arbitrary bytes and are not interpreted as UTF-8.

func DWARFSections

func DWARFSections(module []byte) (map[string][]byte, error)

DWARFSections returns the unique embedded DWARF custom sections keyed by their standard section names. Returned contents do not alias module.

func DebuggerRecord

func DebuggerRecord(module []byte) (debugabi.Record, bool, error)

DebuggerRecord returns the unique LLGo debugger ABI record, if present.

func EnsureBuildID

func EnsureBuildID(module []byte) ([]byte, []byte, error)

EnsureBuildID preserves an existing valid build ID or installs a deterministic SHA-256 ID over the complete module without a build_id section. Calling it before externalization gives the main module and DWARF sidecar the same identity for stale-sidecar checks.

func ExternalURL

func ExternalURL(module []byte) (string, bool, error)

ExternalURL returns the external_debug_info URL, if present.

func Externalize

func Externalize(module []byte, url string) ([]byte, error)

Externalize removes embedded DWARF custom sections and appends the standard external_debug_info URL record. The original module is suitable for use as the sidecar because the convention permits it to retain code and data.

func FunctionNames added in v1.0.9

func FunctionNames(module []byte) (map[uint32]string, error)

FunctionNames reads the optional tool-conventions function name map. A nil map means no function names are available, not that all functions are dead.

func FunctionNamesComplete added in v1.0.9

func FunctionNamesComplete(module []byte, names map[uint32]string) (bool, error)

FunctionNamesComplete proves that every imported and defined function has a nonempty name. Optional sparse maps cannot establish that a PCLN symbol died. Import types this reader does not understand conservatively disable pruning.

func FunctionTable added in v1.0.9

func FunctionTable(module []byte) (map[uint32]uint32, error)

FunctionTable reads the initial function indices in the module's ordinary indirect-call table. Unsupported element encodings disable this optional debugger view rather than guessing a mapping. LLGo's static browser links use active function-index segments with constant offsets in table zero. The result maps table indices to function indices.

func HasDWARF

func HasDWARF(module []byte) (bool, error)

HasDWARF reports whether module contains at least one DWARF custom section.

func RefreshBuildID

func RefreshBuildID(module []byte) ([]byte, []byte, error)

RefreshBuildID computes a content identity after debugger metadata is added. It validates an existing ID, then hashes every section except build_id so repeated packaging is deterministic and ABI edits invalidate old sidecars. Call it before externalization to give both artifacts the same identity.

func SetBuildID

func SetBuildID(module, id []byte) ([]byte, error)

SetBuildID replaces the WebAssembly tool-conventions build_id section.

func SetDebuggerRecord

func SetDebuggerRecord(module []byte, record debugabi.Record) ([]byte, error)

SetDebuggerRecord replaces the LLGo debugger ABI custom section with the canonical encoding of record. Other custom and standard sections retain their original bytes and order.

func SourceMappingURL added in v1.0.9

func SourceMappingURL(module []byte) (string, error)

SourceMappingURL reads the optional debugger URL without interpreting it as a filesystem path. The accompanying local map is supplied by the linker.

func StripMetadata added in v1.0.9

func StripMetadata(module []byte, all bool) ([]byte, error)

StripMetadata removes optional debugger metadata without touching code/data, runtime PCLN, external DWARF references, build identity or unknown extensions. all additionally removes producer metadata. target_features is retained so consumers can validate the module's required capabilities.

func StripNames added in v1.0.9

func StripNames(module []byte) ([]byte, error)

StripNames implements -s -w=0: remove names while preserving DWARF and maps.

func TargetFeatures added in v1.0.9

func TargetFeatures(module []byte) ([]string, error)

TargetFeatures reads required/used features from the tool-conventions target_features custom section. Disallowed features ('-') are not required.

Types

This section is empty.

Jump to

Keyboard shortcuts

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