jon.recoil.org

Module Bytesections

module Name : sig ... end

Recording sections written to a bytecode executable file

type toc_writer

Start recording sections from the current position in out_channel

Record the current position in the out_channel as the end of the section with the given name.

val write_toc_and_trailer : Bytesections.toc_writer -> unit

Write the table of contents and the standard trailer for bytecode executable files

Reading sections from a bytecode executable file

type section_entry = {
  1. name : Bytesections.Name.t;
    (*

    name of the section.

    *)
  2. pos : int;
    (*

    byte offset at which the section starts.

    *)
  3. len : int;
    (*

    length of the section.

    *)
}
type section_table
exception Bad_magic_number

Read the table of sections from a bytecode executable. Raise Bad_magic_number if magic number doesn't match

Position the input channel at the beginning of the section named "name", and return the length of that section. Raise Not_found if no such section exists.

val read_section_string : Bytesections.section_table -> Stdlib.in_channel -> Bytesections.Name.t -> string

Return the contents of a section, as a string.

Return the contents of a section, as marshalled data.

Returns all section_entry from a section_table in increasing position order.

val pos_first_section : Bytesections.section_table -> int

Return the position of the beginning of the first section