This question was asked to me in an interview.
they asked me how to generate a core dump file with which i can debug. then i said that with -g flag in
-g
core file is generated on Segmentation Fault or such exceptions. gdb source.cc core is one way to look into the core file. Backtrace and investigating every frame is a start at looking into the core. -g adds debugging symbols in the binary.
gdb source.cc core