In which phase of compilation process are the debug symbols actually generated.
If I compile a object file with -g option, than does it makes imperative that whatever object file may be built into (shared lib, static lib, executable), the output will always have debug symbols in it ? if don't specify the -g during linking, will the output binary will have debug symbols or not ?
.symtab
section, which includes the information about functions and global variables that are defined and referenced in the program. However, unlike the symbol table insider a compiler, the .symtab
symbol table does not contain entries for local variables.-g
enables use of extra debugging information, e.g. line number. As David pointed out, the default behavior depends on compiler and platforms.