aboutsummaryrefslogtreecommitdiff
path: root/dbg.d
diff options
context:
space:
mode:
Diffstat (limited to 'dbg.d')
-rw-r--r--dbg.d16
1 files changed, 16 insertions, 0 deletions
diff --git a/dbg.d b/dbg.d
index defa8ef..b32c431 100644
--- a/dbg.d
+++ b/dbg.d
@@ -80,6 +80,10 @@ string printableValue(Value val) {
}
}
+string printableFunction(Function func) {
+ return format("%s", func);
+}
+
string atomAsString(Atom a) {
return printableValue(a.value);
}
@@ -110,6 +114,18 @@ int simpleInstruction(string message, int offset) {
return offset + 1;
}
+void disassembleChunk(Chunk chunk, string name) {
+ writefln("== %s ==", name);
+ int cnt = 0;
+ while(true) {
+ if (cnt >= chunk.code.length) {
+ break;
+ }
+ cnt = disassemble(chunk, cnt);
+ }
+
+}
+
int disassemble(Chunk chunk, int offset) {
writef("%04d %4d ", offset, chunk.lines[offset]);