Robert Kiesling wrote: > How does GCC select which debugging format to use? Pointers to some > info documents would be useful, or some specification of which format > gets used - is that system dependent, or simply which format provides > the most information? There don't seem to be any actual info > documents about the formats, only info files about the bfd interfaces. > If there aren't any actual info documents about these formats, some > pointers to the relevant source code would be very helpful. The default debugging format is defined by the target. For example, look at gcc/config.gcc and you'll see that many targets list tm-dwarf2.h in their tm_file list, and tm-dwarf2.h contains /* Enable Dwarf2 debugging and make it the default */ #define DWARF2_DEBUGGING_INFO 1 #undef PREFERRED_DEBUGGING_TYPE #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG This is just a shortcut for the common case, but each target can define this however it wants: $ egrep 'define.*PREFERRED_DEBUGGING_TYPE' config/*.h config/chorus.h:#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG config/darwin.h:#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG config/darwin9.h:#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG config/dbx.h:#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG config/dbxcoff.h:#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG config/elfos.h:#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG config/interix.h:#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG config/lynx.h:# define PREFERRED_DEBUGGING_TYPE DBX_DEBUG config/ptx4.h:#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG config/sol2.h:#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG config/tm-dwarf2.h:#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG config/vx-common.h:#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG The debugging format also depends on things outside of the control of gcc, such as the assembler. For example on PE platforms like Cygwin and MinGW the default debugging format is stabs, however the GNU PE assembler supports Dwarf-2 as well so on those platforms you get stabs with -g but you can also use -gdwarf-2 to get Dwarf-2 debug info. See also <http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#index-g-352>. Brian