When your program runs, do the first instruction. If it is causing segmentation fault, put a while true or cin in the start of main loop, execute it. So it will be caught up in the while loop or may be waiting for the input. When it happens, run the first instruction to get the name of your executable.
First open a terminal and then type:
ps ax | grep <name of your executable>
This would list the complete path to the executable with any arguments present.
/<path to executable>/<name of the executable> --<arguments>
Next to debug using GDB, open a terminal and then type.
gdb --args "<result you got after step 1>"
that is:
gdb --args "/<path to executable>/<name of the executable> --<arguments>"
Once, gdb opens, type hit enter to start, you can increment through the steps by pressing "r" and hitting enter.