about summary refs log tree commit diff stats
path: root/shell
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-07-26 02:01:26 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-07-26 02:06:48 -0700
commit6a92f3b5353b758d9b95c612fbce345d73402c0b (patch)
treeaf58e784d5dc14d89f78a26c098f86e13b720bb8 /shell
parent6b57715502cf7460f89a09200c5db158283a7091 (diff)
downloadmu-6a92f3b5353b758d9b95c612fbce345d73402c0b.tar.gz
gracefully trace large arrays
Diffstat (limited to 'shell')
-rw-r--r--shell/print.mu8
1 files changed, 8 insertions, 0 deletions
diff --git a/shell/print.mu b/shell/print.mu
index f37c1ec4..4fbba0aa 100644
--- a/shell/print.mu
+++ b/shell/print.mu
@@ -131,6 +131,14 @@ fn print-cell _in: (addr handle cell), out: (addr stream byte), trace: (addr tra
     {
       compare i, max
       break-if->=
+      {
+        var available-space/eax: int <- space-remaining-in-stream out
+        compare available-space, 0x10
+        break-if->=
+        var dummy/eax: boolean <- try-write out, "..."
+        error trace, "print-cell: no space for array"
+        return
+      }
       write out " "
       var curr-ah/eax: (addr handle cell) <- index data, i
       print-cell curr-ah, out, trace