-ggdb is helpful to allow you to get debugging symbols in a
gdb debugging session. Basically, you can run the process under
gdb and follow control flow that way. If you are going to proceed this way, you will probably want to use a pcap file loaded with the packets you want to trace to simplify the process.
printf approach is applicable in either context but takes much more time.
I'd suggest that you use the
gdb method if you have a choice between the two.