       r = {}
       m = []
       i = 0
-      [r.rite_binary_header, i] = @_loadRiteBinaryHeader(arrayBuf, i)
+      ctx = {}
+      [r.rite_binary_header, i] = @_loadRiteBinaryHeader(ctx, arrayBuf, i)
       if r.rite_binary_header.binary_identify == "RITE" and
          r.rite_binary_header.binary_version == "0003"
         s = 0

    offset += r.section_size
    return [r, offset]

  _loadIrepRecord: (r, h, offset) ->
    r.record_size = _bin_to_u32_be(h.subarray(0, 4))
    r.number_of_locals = _bin_to_u16_be(h.subarray(4, 6))
    r.number_of_regs = _bin_to_u16_be(h.subarray(6, 8))

    pad = (4 - (offset + 14) % 4) % 4
    r.iseq = {number_of_opcodes: n, padding_bytes: pad, opcodes: []}
    i = 14 + pad
    for n in [0...(r.iseq.number_of_opcodes)] by 1
      c = _bin_to_u32_be(h.subarray(i, i + 4))
      [c1,c2] = @_decodeRiteInst(c)
      [c0,c1] = c1.split("\t")
      r.iseq.opcodes.push(sprintf("%-11s %-11s # %s", c0, c1 or "", c2))
      i += 4
    n = _bin_to_u32_be(h.subarray(i, i + 4))
    i += 4
    r.pool = {length_of_pool: n, values: []}
    for n in [0...(r.pool.length_of_pool)] by 1
      null  # FIXME
    n = _bin_to_u32_be(h.subarray(i, i + 4))
    i += 4
    r.syms = {number_of_syms: n, symbols: []}
    for n in [0...(r.syms.number_of_syms)] by 1
      len = _bin_to_u16_be(h.subarray(i, i + 2))
      i += 2
      if len == 0xffff
        r.syms.symbols.push(null)
      else
        r.syms.symbols.push(_stringize(h.subarray(i, i + len)))
        i += (len + 1)
    for n in [0...(r.number_of_child_ireps)] by 1
      i += @_loadIrepRecord(ctx, r["child_#{n}"] = {}, h.subarray(i), offset + i)
    return i

  _loadDebugRecord: (ctx, r, h) ->
    r.file_count = _bin_to_u16_be(h.subarray(4, 6))
    r.files = {}
    i = 6
    for n in [0...(r.file_count)] by 1
      m = ctx.last_dbg?.filenames[_bin_to_u16_be(h.subarray(i + 4, i + 6))]
      m or= "file_##{n}"
      f = r.files[m] = {
        start_pos: _bin_to_u32_be(h.subarray(i, i + 4))
      }
      i += 6
      f.line_entry_count = _bin_to_u32_be(h.subarray(i, i + 4))
      t = h[i + 4]
      f.line_type = ["mrb_debug_line_ary", "mrb_debug_line_flat_map"][t] or "unknown"
      i += 5
      if t == 0
        f.lines = []
        for x in [0...(f.line_entry_count)] by 1
          f.lines.push(_bin_to_u16_be(h.subarray(i, i + 2)))
          i += 2
      if t == 1
        f.lines = []
        for x in [0...(f.line_entry_count)] by 1
          f.lines.push({
            start_pos: _bin_to_u32_be(h.subarray(i, i + 4))
            line: _bin_to_u16_be(h.subarray(i + 4, i + 6))
          })
          i += 6
    for n in [0...(r.__irep?.number_of_child_ireps or 0)] by 1
      k = "child_#{n}"
      i += @_loadDebugRecord(ctx, r[k] = {__irep: r.__irep[k]}, h.subarray(i))
    delete r.__irep
    return i

  _decodeRiteInst: (code) ->
    op = (code) & 0x7f
