     pad = (4 - (offset + 14) % 4) % 4
     r.iseq = {number_of_opcodes: n, padding_bytes: pad, opcodes: []}
     i = 14 + pad
-    while n > 0
+    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)
-      c1 = c1.replace("\t", " ") + "                                        "
-      r.iseq.opcodes.push("#{c1.substring(0, 20)}# #{c2}")
+      [c0,c1] = c1.split("\t")
+      r.iseq.opcodes.push(sprintf("%-11s %-11s # %s", c0, c1 or "", c2))
       i += 4
-      n -= 1
     n = _bin_to_u32_be(h.subarray(i, i + 4))
     i += 4
     r.pool = {length_of_pool: n, values: []}
-    while n > 0
-      n -= 1
+    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: []}
-    while n > 0
+    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(String.fromCharCode.apply(null, h.subarray(i, i + len)))
+        r.syms.symbols.push(_stringize(h.subarray(i, i + len)))
         i += (len + 1)
-      n -= 1
-    n = 0
-    while n < r.number_of_child_ireps
-      @_loadIrepRecord(r["child_#{n}"] = {}, h.subarray(i), offset + i)
-      n += 1
-    return
+    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

    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))

      r = {}
      m = []
      i = 0
      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
