about summary refs log tree commit diff stats
path: root/shell/trace.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-05-06 21:24:34 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-05-06 21:38:02 -0700
commita1cfadc749e91abde00e56859b3d5122205a6ca4 (patch)
treedc8267cfc041b0ba5c4823ba79c3243a87630538 /shell/trace.mu
parentf882130c863d7ed05483a7ecc5e31a399aca241b (diff)
downloadmu-a1cfadc749e91abde00e56859b3d5122205a6ca4.tar.gz
first passing test for macroexpand
In the process I spent a long time tracking down a stray TODO in 108write.subx
that I thought would abort but didn't since the switch to baremetal.

Then after I reintroduced that assertion I had to go track down a bunch
of buffer sizes. Stream sizes continue to be a huge mess.
Diffstat (limited to 'shell/trace.mu')
-rw-r--r--shell/trace.mu33
1 files changed, 32 insertions, 1 deletions
diff --git a/shell/trace.mu b/shell/trace.mu
index 12285704..dfe82638 100644
--- a/shell/trace.mu
+++ b/shell/trace.mu
@@ -300,9 +300,40 @@ fn dump-trace _self: (addr trace) {
     $dump-trace:iter: {
       var offset/ebx: (offset trace-line) <- compute-offset trace, i
       var curr/ebx: (addr trace-line) <- index trace, offset
+      y <- render-trace-line 0/screen, curr, 0, y, 0x80/width, 0x30/height, 7/fg, 0/bg
+    }
+    i <- increment
+    loop
+  }
+}
+
+fn dump-trace-with-label _self: (addr trace), label: (addr array byte) {
+  var already-hiding-lines?: boolean
+  var y/ecx: int <- copy 0
+  var self/esi: (addr trace) <- copy _self
+  compare self, 0
+  {
+    break-if-!=
+    return
+  }
+  var trace-ah/eax: (addr handle array trace-line) <- get self, data
+  var _trace/eax: (addr array trace-line) <- lookup *trace-ah
+  var trace/edi: (addr array trace-line) <- copy _trace
+  var i/edx: int <- copy 0
+  var max-addr/ebx: (addr int) <- get self, first-free
+  var max/ebx: int <- copy *max-addr
+  $dump-trace:loop: {
+    compare i, max
+    break-if->=
+    $dump-trace:iter: {
+      var offset/ebx: (offset trace-line) <- compute-offset trace, i
+      var curr/ebx: (addr trace-line) <- index trace, offset
       var curr-label-ah/eax: (addr handle array byte) <- get curr, label
       var curr-label/eax: (addr array byte) <- lookup *curr-label-ah
-      y <- render-trace-line 0/screen, curr, 0, y, 0x80/width, 0x30/height, 7/fg, 0xc5/bg=blue-bg
+      var show?/eax: boolean <- string-equal? curr-label, label
+      compare show?, 0/false
+      break-if-=
+      y <- render-trace-line 0/screen, curr, 0, y, 0x80/width, 0x30/height, 7/fg, 0/bg
     }
     i <- increment
     loop