From: Dale Weiler Date: Sun, 1 Dec 2013 15:59:22 +0000 (-0500) Subject: Initial setup for ast driven debugging X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fgraphitemaster%2Fast-driven-debug;p=xonotic%2Fgmqcc.git Initial setup for ast driven debugging --- diff --git a/debug.c b/debug.c new file mode 100644 index 0000000..c7d6198 --- /dev/null +++ b/debug.c @@ -0,0 +1,18 @@ +#include "ast.h" + +#if 0 +static void debug_traverse(ast_function *fun) { + ast_node *at; + size_t depth; + ast_iterator iter; + ast_iterator_begin(&iter, (ast_node*)fun); + + for (at = (ast_node*)fun; at; at = ast_iterator_next(&iter)) { + for (depth = vec_size(iter.path); depth; --depth) + con_out("> "); + con_out("ast_%s (%p)\n", ast_node_type_name[at->nodetype], at); + } + + ast_iterator_delete(&iter); +} +#endif diff --git a/include.mk b/include.mk index 2bc2a83..d97747b 100644 --- a/include.mk +++ b/include.mk @@ -17,7 +17,7 @@ LIBS += -lm COMMON = ansi.o util.o stat.o fs.o opts.o conout.o #objects -OBJ_C = $(COMMON) main.o lexer.o parser.o code.o ast.o ir.o ftepp.o utf8.o correct.o fold.o intrin.o +OBJ_C = $(COMMON) main.o lexer.o parser.o code.o ast.o ir.o ftepp.o utf8.o correct.o fold.o intrin.o debug.o OBJ_P = $(COMMON) pak.o OBJ_T = $(COMMON) test.o OBJ_X = $(COMMON) exec.o