HOW TO DEBUG LKCP
----------------

There are many ways you can help debug lkcp, but here's a short list.

1) You can debug using the native function call logger:

I added a macro helper to write the file, function, and line to a file (/tmp/lkcp.log). This 
is helpful to figure what or where things went wrong.

To use this feature, LKCP has to be compiled with the -DDEBUG flag to gcc in the Makefile. A sample 
output to the call logger looks as such:

bash-3.00$ cat /tmp/lkcp.log 
Entering acknowledge.c(SCL: 13): draw_acknowledge
Exiting acknowledge.c(SCL: 49): draw_acknowledge
Entering acknowledge.c(SCL: 54): kill_acknowledge
Exiting acknowledge.c(SCL: 59): kill_acknowledge
Entering acknowledge.c(SCL: 13): draw_acknowledge
Exiting acknowledge.c(SCL: 49): draw_acknowledge
Entering acknowledge.c(SCL: 54): kill_acknowledge
Exiting acknowledge.c(SCL: 59): kill_acknowledge
Entering acknowledge.c(SCL: 13): draw_acknowledge
Exiting acknowledge.c(SCL: 49): draw_acknowledge
Entering acknowledge.c(SCL: 54): kill_acknowledge
Exiting acknowledge.c(SCL: 59): kill_acknowledge

I use this type of debugging to know more or less *where* the problem happened.

2) You can run lkcp under gdb as such:

youssef@stratus:~/FreeSoftware/lkcp/src$ gdb -q ./lkcp
(gdb)

and then type "run". If the program exits abnormally, you can type "bt" to get the
stack traced.

3) You can run lkcp under valgrind as such:

valgrind -v --tool=memcheck --log-file=/home/youssef/FreeSoftware/lkcp/debug/valgrin.txt \
--pointercheck=yes --leak-check=yes --show-reachable=yes \
/home/youssef/FreeSoftware/lkcp/src/lkcp

You have to change the "--tool" argument accordingly. This will run lkcp rather slow but will 
write a log in debug/ that details leaks/memory checks/etc..

4) You can run splint to check the code statically.

splint -warnposix *.c *.h >>../debug/splint.log
