about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-22 10:13:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-22 10:13:19 -0700
commit2ff86d91628328793e584d9980748ea1c917ad57 (patch)
tree322b90a5fd4e9127d6ce8e55c2dc542e7c4fc7fb
parent8a66b599401904b7fb01e747469c31d2a97928d7 (diff)
downloadmu-2ff86d91628328793e584d9980748ea1c917ad57.tar.gz
better error message on trace overflow
-rw-r--r--shell/trace.mu9
1 files changed, 8 insertions, 1 deletions
diff --git a/shell/trace.mu b/shell/trace.mu
index 8585fe49..51c7feb6 100644
--- a/shell/trace.mu
+++ b/shell/trace.mu
@@ -100,8 +100,15 @@ fn trace _self: (addr trace), label: (addr array byte), message: (addr stream by
   var depth/ecx: (addr int) <- get self, curr-depth
   rewind-stream message
   {
-    compare *index-addr, 0x7ffe/lines
+    compare *index-addr, 0x7fff/lines
     break-if-<
+    clear-stream message
+    write message, "No space left in trace\n"
+    write message, "Please either:\n"
+    write message, "  - find a smaller sub-computation to test,\n"
+    write message, "  - allocate more space to the trace in initialize-sandbox\n"
+    write message, "    (shell/sandbox.mu), or\n"
+    write message, "  - move the computation to 'main' and run it using ctrl-s"
     initialize-trace-line 0/depth, "error", message, dest
     increment *index-addr
     return