Documentation
¶
Overview ¶
Package wasmdebug implements the WebAssembly tool-conventions packaging for embedded and external DWARF custom sections.
Index ¶
- func BuildID(module []byte) ([]byte, bool, error)
- func DWARFSections(module []byte) (map[string][]byte, error)
- func DebuggerRecord(module []byte) (debugabi.Record, bool, error)
- func EnsureBuildID(module []byte) ([]byte, []byte, error)
- func ExternalURL(module []byte) (string, bool, error)
- func Externalize(module []byte, url string) ([]byte, error)
- func FunctionNames(module []byte) (map[uint32]string, error)
- func FunctionNamesComplete(module []byte, names map[uint32]string) (bool, error)
- func FunctionTable(module []byte) (map[uint32]uint32, error)
- func HasDWARF(module []byte) (bool, error)
- func PCLNIdentityPlaceholder() [32]byte
- func RefreshBuildID(module []byte) ([]byte, []byte, error)
- func ReplaceData(module []byte, symbol string, expected, replacement []byte) ([]byte, error)
- func SetBuildID(module, id []byte) ([]byte, error)
- func SetDebuggerRecord(module []byte, record debugabi.Record) ([]byte, error)
- func SourceMappingURL(module []byte) (string, error)
- func StripMetadata(module []byte, all bool) ([]byte, error)
- func StripNames(module []byte) ([]byte, error)
- func TargetFeatures(module []byte) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildID ¶
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 ¶
DWARFSections returns the unique embedded DWARF custom sections keyed by their standard section names. Returned contents do not alias module.
func DebuggerRecord ¶
DebuggerRecord returns the unique LLGo debugger ABI record, if present.
func EnsureBuildID ¶
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 ¶
ExternalURL returns the external_debug_info URL, if present.
func Externalize ¶
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
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
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
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 PCLNIdentityPlaceholder ¶ added in v1.0.10
func PCLNIdentityPlaceholder() [32]byte
func RefreshBuildID ¶
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 ReplaceData ¶ added in v1.0.10
ReplaceData changes one compiler-reserved initialized linear-memory slot. It never rewrites code, offsets, or section sizes, preserving final DWARF.
func SetBuildID ¶
SetBuildID replaces the WebAssembly tool-conventions build_id section.
func SetDebuggerRecord ¶
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
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
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
StripNames implements -s -w=0: remove names while preserving DWARF and maps.
func TargetFeatures ¶ added in v1.0.9
TargetFeatures reads required/used features from the tool-conventions target_features custom section. Disallowed features ('-') are not required.
Types ¶
This section is empty.