GDB should be a very useful tool for debugging server. The waiting is the hardest part. Remember server will be waiting for input from a browser/curl to process something or waiting for gdb to continue processing. If it seems to be doing nothing, it probably is waiting. BTW the way to use gdb on a program that requires arguments is something like this:
user@ide50:~/workspace/2016/pset6 $ gdb ./server
Reading symbols from ./server...done.
(gdb) break parse
Breakpoint 1 at 0x402569: file server.c, line 710.
(gdb) run ./public
ie include the arguments at the run command in gdb (instead of the command line call to gdb).
Since you are not specific about errors, a cursory read of your code indicates:
- You might want to rethink your load function. It will not work on php files > 512 bytes. More info here.
- You might want to rethink your indexes function. I can't say, at a glance, whether or not it will work. I can say that it is far more complicated than it needs to be which translates to more places bugs can get a foothold. More info here. (sp. response to original question)
- parse has a memory leak.
With practice, patience and perseverance, gdb will help you get to the goal.