Have not used gdb for a while but I think a good gdb tip is that you can evaluate functions with the print p command:
> p myfunction()
> p myfunction()
> break my_file.c:123 if my_function() == 0x5
i.e. please stop at `my_file.c` line 123 but when `my_function()` is returning the value 0x5. GDB will handle calling the function and checking its value every time you get there.