-g vs -g3 -ggdb3

John Carter john.carter@tait.co.nz
Wed May 23 22:00:00 GMT 2007


Here's the FM That I Read....

`-gLEVEL'
`-ggdbLEVEL'
`-gstabsLEVEL'
`-gcoffLEVEL'
`-gxcoffLEVEL'
`-gvmsLEVEL'
      Request debugging information and also use LEVEL to specify how
      much information.  The default level is 2.

      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.

      Level 3 includes extra information, such as all the macro
      definitions present in the program.  Some debuggers support macro
      expansion when you use `-g3'.

      `-gdwarf-2' does not accept a concatenated debug level, because
      GCC used to support an option `-gdwarf' that meant to generate
      debug information in version 1 of the DWARF format (which is very
      different from version 2), and it would have been too confusing.
      That debug format is long obsolete, but the option cannot be
      changed now.  Instead use an additional `-gLEVEL' option to change
      the debug level for DWARF2.

Someone recommended we use -g3 -ggdb3 when debugging with gdb. It
seems to bloat the ELF files hugely. Three questions...

Q1 Which is the best setting to use with gdb (under linux)?

Q2 Is there anyway to decrease the bloat?

Q3 Do we need to say -g3 -ggdb3 or is -ggdb3 sufficient?


Thanks,

John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter@tait.co.nz
New Zealand



More information about the Gcc-help mailing list