Concrete difference between -g and -ggdb

Ian Lance Taylor iant@google.com
Tue May 1 17:07:00 GMT 2012


Martin Olsson <mnemo@minimum.se> writes:

> gcc docs say that -g gives "system's native format" and -ggdb gives
> dbg info "for use by GDB":
> http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html
>
> ...what does this mean in more concrete terms? What command or
> functionality in gdb, that I normally cannot use, am I able to use
> after building with -ggdb ?

Unfortunately the docs in this area should be updated.  Currently the
default for most systems is DWARF, and when using DWARF -ggdb doesn't
make any difference.  At least not as far as I can tell.

The -ggdb option makes a difference when using STABS debug info.  There
it makes a range of improvements, should as recording const/volatile
qualifiers, the directory where a source file is found rather than just
the file name, supporting non-standard integer type sizes, supporting
boolean types, etc.

Also it's worth noting that -g defaults to -ggdb anyhow on most systems,
including all GNU/Linux systems.

Ian



More information about the Gcc-help mailing list