> 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>. Okay, thanks. Please excuse the newbie question, and which should get me in the right direction. I would, however, like to determine which formats would be supported by an installed GCC. I suppose I could determine those by using a configure script and finding out which debug options don't generate errors, but it would be much better, ISTM, to do that at run time. I would like to support things like stack traces in a system independent manner. GDB does not provide a run-time library with that API, however. I guess I should find the bfd plugins useful for that, or add that to my wish list. :_ Thanks again, Robert -- Ctalk Home Page: http://www.ctalklang.org/