gcc -g :what will happen

2020-05-11 11:40发布

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?

标签: c++ c gcc gdb
7条回答
萌系小妹纸
2楼-- · 2020-05-11 12:13

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.

查看更多
登录 后发表回答