aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode/debug.h
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-10-25 12:37:25 +0200
committerBad Diode <bd@badd10de.dev>2021-10-25 12:37:25 +0200
commitb9644b4ccda5abee01fd0704ddc42b08b68e5b5d (patch)
treeed7d94f6f6ca242574234305c8574797cc6d22b0 /src/bytecode/debug.h
parente2c284b57641b5feec9a8d04313b0cd6d556e860 (diff)
downloadbdl-b9644b4ccda5abee01fd0704ddc42b08b68e5b5d.tar.gz
bdl-b9644b4ccda5abee01fd0704ddc42b08b68e5b5d.zip
Change chunk to store a name
Diffstat (limited to 'src/bytecode/debug.h')
-rwxr-xr-xsrc/bytecode/debug.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bytecode/debug.h b/src/bytecode/debug.h
index 7673703..534ff80 100755
--- a/src/bytecode/debug.h
+++ b/src/bytecode/debug.h
@@ -4,7 +4,7 @@
4#include "chunk.h" 4#include "chunk.h"
5#include "objects.h" 5#include "objects.h"
6 6
7void disassemble_chunk(Chunk *chunk, const char *name); 7void disassemble_chunk(Chunk *chunk);
8size_t disassemble_instruction(Chunk *chunk, size_t offset); 8size_t disassemble_instruction(Chunk *chunk, size_t offset);
9 9
10static const char* ops_str[] = { 10static const char* ops_str[] = {
@@ -41,8 +41,8 @@ static const char* ops_str[] = {
41}; 41};
42 42
43void 43void
44disassemble_chunk(Chunk *chunk, const char *name) { 44disassemble_chunk(Chunk *chunk) {
45 printf("== %s ==\n", name); 45 printf("===== %.*s =====\n", (int)array_size(chunk->name), chunk->name);
46 printf("code:\n"); 46 printf("code:\n");
47 size_t offset = 0; 47 size_t offset = 0;
48 while (offset < array_size(chunk->code)) { 48 while (offset < array_size(chunk->code)) {
@@ -56,6 +56,7 @@ disassemble_chunk(Chunk *chunk, const char *name) {
56 printf("\n"); 56 printf("\n");
57 offset++; 57 offset++;
58 } 58 }
59 printf("\n");
59} 60}
60 61
61size_t 62size_t