views:

31

answers:

1

By default, gcc will add symbol table to the executable, so gdb will get a readable stack trace.

Documentation for -ggdb1 option in gcc man page says:

Level 1 produces minimal information, enough for making backtraces in parts of the program that you don't plan to debug. This includes descriptions of functions and external variables, but no information about local variables and no line numbers.

...which looks to me the same as just calling gcc without any debug-related arguments. But there are clearly extra symbols emitted (.debug_frame, .debug_str, .debug_loc).

So what exactly is the difference, and is there any benefit of compiling with -ggdb1 as opposed to simply not stripping the executable?

A: 

Find dwarfdump utility (part of libdwarf) and see what debug info is emitted in those sections. Than decide for yourself whether there is any difference between compiling with level 1 debug info and not stripping the executable. The DWARF specification is also freely available.

zvrba