so typically I run gdb like:
gdb --with-args ./mycmd arg1 arg2
break <function name> # set a breakpoint
break <filename>:<function name>:<line_nr> # set a breakpoint
run # starts the program
<breakpoint hit>
bt # print the backtrace
frame <number> # select which frame to inspect
list # show the source code around the breakpoint
print <var name> # with pointers, structs, and unions you can also cast, dereference, etc using (*, &, ->, (struct type *), etc)
info locals # print all local variables
step
<repeate any/all of the above>