This custom section is created to provide mapping of the local (or remote) file paths to network resources. Currently we can have DWARF sections inside the binary WebAssembly file, however debugger, in most of the cases, cannot retrive local files -- this file paths needs to be mapped to some networks server location.
The custom section has the following format:
Field | Type | Description |
---|---|---|
Custom Section ID | varuint32 | 0 |
Custom Section Size | varuint32 | size of the section (including name) |
Section Name Len | varuint32 | len("sourceURLPrefixes") |
Section Name | bytes | "sourceURLPrefixes" |
JSON Len | varuint32 | len(JSON) |
JSON | bytes | utf-8 encoded JSON |
The JSON is an array of pairs (array). The first item of the pair is the prefix to be replaced, and the second is the prefix that will be used as the replacement, e.g.
[
["/Users/yury/example_com/", "http://example.com/"],
["/usr/lib/libx/", "http://example.org/libx/"],
]
If the consumer find the file path that starts with "/Users/yury/example_com/", this path needs to the changed to start with "http://example.com/".
Hmmm, is this from the point of view of an online IDE/debugger?
Curious, as I'm following along with this stuff from a Go perspective (cheering you on mostly 😉), and the use case I'm thinking of is for debuggers in desktop IDE's (eg GoLand in my case, but there are several others).
They'd have access to local files wouldn't they?.