Getting started with GDB – Starting GDB

To start GDB, in the terminal,

gdb <executable name>

For the above example with a program named main, the command becomes

gdb main

Setting Breakpoints

You’ll probably want you program to stop at some point so that you can review the condition of your program. The line at which you want the program to temporarily stop is called the breakpoint.

break <source code line number>

Running your program

To run your program, the command is, as you guessed,

run

Opening a core

gdb -c coreFile pathToExecutable  

if you want to reproduce, please indicate the source:
Getting started with GDB – Starting GDB - CodeDay