Section B
Jiin Joo Ong
jiinjoo@andrew.cmu.edu
Office Hours: Tuesdays 8:00pm - 9:00pm, WeH 3108 (Try the
5th floor clusters if you can't find me there.)
Example Makefile
CC = gcc CFLAGS = -O2 LDFLAGS = -lpthread -L/usr/X11R6/lib -lX11 OBJS = proxy.o csapp.o display.o TEAM = NOBODY VERSION = 1 INDIR = /afs/cs/academic/class/15213-f02/L7/handin all: proxy csapp.o: csapp.c $(CC) $(CFLAGS) -c csapp.c proxy.o: proxy.c $(CC) $(CFLAGS) -c proxy.c display.o: display.c $(CC) $(CFLAGS) -I/usr/X11R6/include -c display.c proxy: $(OBJS) # This will make your proxy, run it (and the webserver) $(CC) $(LDFLAGS) $(OBJS) -o proxy ./tiny/tiny 8000 ./proxy 8001 handin: cp proxy.c $(INDIR)/$(TEAM)-$(VERSION)-proxy.c cp csapp.c $(INDIR)/$(TEAM)-$(VERSION)-csapp.c cp csapp.h $(INDIR)/$(TEAM)-$(VERSION)-csapp.h clean: rm -f *~ csapp.o proxy proxy.o display.o core
Code for TracePrintf
void TracePrintf(int level, const char *format, ...) { va_list argp; if (level <= tracelevel) { va_start(argp, format); vfprintf(stdout, format, argp); va_end(argp); fflush(stdout); } }
You should set the tracelevel for tracing localized bugs to a higher number and the tracelevel for tracing gloabl bugs / bugs accross threads lower. Similarly, you should set the tracelevel for "following" the code higher and the tracelevel for errors lower. The closer to 0 the more important the print statement is.