about summary refs log tree commit diff stats
path: root/debug_translate
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-09-07 10:14:35 -0700
committerKartik Agaram <vc@akkartik.com>2019-09-07 10:14:35 -0700
commit571bf69fbc3bdfc82d2fa86391deb0d3b3b67560 (patch)
tree77c17ef134ae8cd5247c5f404efcdba60802c992 /debug_translate
parent1fafe7afe3fcd1ba67f9d6c42db710e0536e7258 (diff)
downloadmu-571bf69fbc3bdfc82d2fa86391deb0d3b3b67560.tar.gz
5635
Diffstat (limited to 'debug_translate')
-rwxr-xr-xdebug_translate26
1 files changed, 26 insertions, 0 deletions
diff --git a/debug_translate b/debug_translate
new file mode 100755
index 00000000..39075aac
--- /dev/null
+++ b/debug_translate
@@ -0,0 +1,26 @@
+#!/bin/sh
+# Translate SubX files with debug information.
+#
+# Mu's core tooling has a gap:
+#   1. 'translate' can generate debug information, but syntax sugar passes
+#   (sigils and calls) have no C++ versions and take several minutes to run
+#   emulated.
+#   2. 'ntranslate' is fast, but you get no trace for runs and zero error-checking
+#   on the code emitted by sigils and calls. Which could still be buggy.
+#
+# This script is a hack to get the best of both worlds. We run natively what
+# we must, and leverage as much debug information as possible. This arrangement
+# is snappy but requires Linux just like 'ntranslate'. You also are on your
+# own to mentally map desugared instructions in traces and error messages back
+# to the original sources.
+
+set -e
+
+echo "  calls"
+cat $*          |apps/calls           > a.calls
+echo "  sigils"
+cat a.calls     |apps/sigils          > a.sigils
+
+subx --debug translate a.sigils -o a.elf
+
+chmod +x a.elf