]> khamidou — GitHub mirrors - mojo.git/commitdiff
peppering the code with printfs
authorkarim hamidou <khamidou@gmail.com>
Tue, 14 May 2013 10:01:25 +0000 (12:01 +0200)
committerkarim hamidou <khamidou@gmail.com>
Tue, 14 May 2013 10:01:25 +0000 (12:01 +0200)
Makefile
interp.c
list.c

index 4564f90c95a2b9c6b2ed2865d806aaa1d63742ea..8088926d59ed77862470d34953854302b30afd98 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-CFLAGS=-c -g -Wall
+CFLAGS=-c -g3 -Wall
 OBJS=lex.yy.o object.o list.o error.o number.o main.o interp.o
 
 mojo: $(OBJS)
index 316fdda43aacd5f8fbee0f33292df447c0331d4e..603fc0808c58757a421b79f3416539b8fd0ca977 100644 (file)
--- a/interp.c
+++ b/interp.c
@@ -191,6 +191,7 @@ struct Object* execute_branch(struct Object *ast, struct Object *scope) {
 
         puts("freeing stuff");
         display_object(stack, 0);
+        printf(">>> stack  len : %d addr : %x\n", mojo_list_length(stack->value.l_value), stack->value.l_value);
         free_object(stack);
 
         return destObject;
diff --git a/list.c b/list.c
index 8a6de08e8fa75c6ae229fe32747c745ab3d5f248..51f676404c28a34c522884f8cb14e5e42c5aeb85 100644 (file)
--- a/list.c
+++ b/list.c
@@ -85,6 +85,8 @@ void mojo_list_free(struct mojo_list *list) {
     */
 
     struct mojo_list_elem *e;    
+    int count = 0;
+    printf(">>> list len : %d, addr: %x\n", mojo_list_length(list), list);
     while (e = (struct mojo_list_elem *) TAILQ_FIRST(&list->mojo_list_head)) {
         TAILQ_REMOVE(&list->mojo_list_head, e, mojo_lists);
 
@@ -92,8 +94,9 @@ void mojo_list_free(struct mojo_list *list) {
             free_object(e->obj);
 
         free(e);
+        count++;
+        printf("count : %d\n", count);
     }
-
 }
 
 /*