about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-07-22 19:57:10 -0700
committerKartik Agaram <vc@akkartik.com>2019-07-22 19:57:10 -0700
commitc4ccc215cf213cf134d34bebee334b9a32a75967 (patch)
tree3086bc4616af34d867d6d75610c4866439d122e1
parent8c19b906e316ef84149d6cec234d3a467d3a68fe (diff)
downloadmu-c4ccc215cf213cf134d34bebee334b9a32a75967.tar.gz
5453
All that debugging and it turns out the bug is on the C++ side!
-rwxr-xr-xsubx/apps/surveybin43682 -> 43841 bytes
-rw-r--r--subx/apps/survey.subx120
2 files changed, 107 insertions, 13 deletions
diff --git a/subx/apps/survey b/subx/apps/survey
index 45d83aa6..6a32a1e1 100755
--- a/subx/apps/survey
+++ b/subx/apps/survey
Binary files differdiff --git a/subx/apps/survey.subx b/subx/apps/survey.subx
index 42c11351..b3881eba 100644
--- a/subx/apps/survey.subx
+++ b/subx/apps/survey.subx
@@ -1467,19 +1467,111 @@ compute-addresses:  # segments : (address stream {string, segment-info}), labels
 $compute-addresses:segment-loop:
     # if (srow >= max) break
     39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           1/r32/ECX   .               .                 # compare EAX with ECX
-    73/jump-if-greater-or-equal-unsigned  $compute-addresses:segment-break/disp8
+    0f 83/jump-if-greater-or-equal-unsigned  $compute-addresses:segment-break/disp32
     # srow->file-offset += starting-offset
     01/add                          1/mod/*+disp8   0/rm32/EAX    .           .             .           7/r32/EDI   8/disp8         .                 # add EDI to *(EAX+8)
     # clear last 12 bits of srow->address for p_align=0x1000
     # . EDX = srow->address
     8b/copy                         1/mod/*+disp8   0/rm32/EAX    .           .             .           2/r32/EDX   4/disp8         .                 # copy *(EAX+4) to EDX
+    # . print-int32-buffered(Stderr, EDX)
+    # . . push args
+    52/push-EDX
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  print-int32-buffered/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # . write-buffered(Stderr, "\n")
+    # . . push args
+    68/push  Newline/imm32
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  write-buffered/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # . flush(Stderr)
+    # . . push args
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  flush/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
     # . EDX &= 0xfffff000
     81          4/subop/and         3/mod/direct    2/rm32/EDX    .           .             .           .           .               0xfffff000/imm32  # bitwise and of EDX
+    # . print-int32-buffered(Stderr, EDX)
+    # . . push args
+    52/push-EDX
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  print-int32-buffered/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # . write-buffered(Stderr, "\n")
+    # . . push args
+    68/push  Newline/imm32
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  write-buffered/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # . flush(Stderr)
+    # . . push args
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  flush/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
     # update last 12 bits from srow->file-offset
     # . EBX = srow->file-offset
     8b/copy                         1/mod/*+disp8   0/rm32/EAX    .           .             .           3/r32/EBX   8/disp8         .                 # copy *(EAX+8) to EBX
+    # . print-int32-buffered(Stderr, EBX)
+    # . . push args
+    53/push-EBX
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  print-int32-buffered/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # . write-buffered(Stderr, "\n")
+    # . . push args
+    68/push  Newline/imm32
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  write-buffered/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # . flush(Stderr)
+    # . . push args
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  flush/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
     # . EBX &= 0xfff
     81          4/subop/and         3/mod/direct    3/rm32/EBX    .           .             .           .           .               0x00000fff/imm32  # bitwise and of EBX
+    # . print-int32-buffered(Stderr, EBX)
+    # . . push args
+    53/push-EBX
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  print-int32-buffered/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # . write-buffered(Stderr, "\n")
+    # . . push args
+    68/push  Newline/imm32
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  write-buffered/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # . flush(Stderr)
+    # . . push args
+    68/push  Stderr/imm32
+    # . . call
+    e8/call  flush/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
     # . srow->address = EDX | EBX
     09/or                           3/mod/direct    2/rm32/EDX    .           .             .           3/r32/EBX   .               .                 # EDX = bitwise OR with EBX
     89/copy                         1/mod/*+disp8   0/rm32/EAX    .           .             .           2/r32/EDX   4/disp8         .                 # copy EDX to *(EAX+4)
@@ -1506,21 +1598,23 @@ $compute-addresses:segment-loop:
     e8/call  flush/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
-    # trace-sssns("segment " srow " starts at address " srow->address ".")
-    # . . push args
-    68/push  "."/imm32
-    52/push-EDX
-    68/push  "' starts at address "/imm32
-    ff          6/subop/push        0/mod/indirect  0/rm32/EAX    .           .             .           .           .               .                 # push *EAX
-    68/push  "segment '"/imm32
-    # . . call
-    e8/call  trace-sssns/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0x14/imm32        # add to ESP
+#?     # trace-sssns("segment " srow " starts at address " srow->address ".")
+#?     # . . push args
+#?     68/push  "."/imm32
+#?     52/push-EDX
+#?     68/push  "' starts at address "/imm32
+#?     ff          6/subop/push        0/mod/indirect  0/rm32/EAX    .           .             .           .           .               .                 # push *EAX
+#?     68/push  "segment '"/imm32
+#?     # . . call
+#?     e8/call  trace-sssns/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0x14/imm32        # add to ESP
     # srow += 16  # size of row
     05/add-to-EAX  0x10/imm32
-    eb/jump  $compute-addresses:segment-loop/disp8
+    e9/jump  $compute-addresses:segment-loop/disp32
 $compute-addresses:segment-break:
+    b8/copy-to-EAX  1/imm32/exit
+    cd/syscall  0x80/imm8
 #?     # dump *Trace-stream {{{
 #?     # . write(2/stderr, "^")
 #?     # . . push args