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 gcc
we can do it.
then they have asked me what exactly does that -g
flag do to the compiler.
i said (probably a wrong answer) that it will open up all the symbols in the core file which can be used for debugging.
can anyone tell me what exactly does it do?
The gcc -g flag tells gcc to generate and embed debug information.
ulimit -c
is used to enable core file generation. You can have either of these without the other.