From 62c1391238df9a0b6938f329191bea4effdd5750 Mon Sep 17 00:00:00 2001 From: karim hamidou Date: Tue, 14 May 2013 12:01:25 +0200 Subject: [PATCH] peppering the code with printfs --- Makefile | 2 +- interp.c | 1 + list.c | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4564f90..8088926 100644 --- 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) diff --git a/interp.c b/interp.c index 316fdda..603fc08 100644 --- 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 8a6de08..51f6764 100644 --- 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); } - } /* -- 2.43.0