Mavkit_smart_rollup_wasm_debugger_lib.Custom_section
This files implements the parsing of custom subsection, especially the `name` custom section (see https://webassembly.github.io/spec/core/appendix/custom.html#name-section).
The `name` section has the following format: h
len
vec_len:n
(index
name_len
name
)^n where
h
is a tag encoded in a single byte (`1` for the functions subsection)len
is a variable-length unsigned 32bits integer (`vu32`), which is the length of the subsectionvec_len
(`vu32`) encoding the number of values in the vector then for each value of the vector:index
(`vu32`) encoding the function representationname_len
(`vu32`) encoding the length in bytes of the namename
(`utf8`) bytes of length `name_len` encoding an utf8 representation of the symbolparse_subsection_header bytes index
reads the tag for the subsection and its length, and returns the next index to continue reading. Returns `None` if there are not at least 2 bytes to read.
get_function_name_section_indexes bytes
returns the starting index of the `functions` subsection and its length.
val parse_nameassoc :
Mavryk_base.TzPervasives.String.t ->
int ->
(int32 * string) * int
parse_nameassoc bytes index
parses a `(index, name)` encoded value and returns the index to continue the reading.
module FuncMap : sig ... end
val parse_vec :
string ->
int ->
(string -> int -> 'a * int) ->
'b Mavryk_base.TzPervasives.Seq.t
parse_vec bytes start parse_value
parses an encoded vector and its values with parse_value
.
val parse_function_subsection :
Mavryk_base.TzPervasives.String.t ->
string FuncMap.t
parse_function_subsection bytes
parse and returns the `functions` subsection, as described by the reference documentation.
val pp_function_subsection :
Stdlib.Format.formatter ->
string FuncMap.t ->
unit
pp_function_subsection ppf map
pretty-prints the parsed functions subsection.
val parse_custom_sections : string -> string -> string FuncMap.t Lwt.t