Re: difference between -g, -ggdb and -ggdb3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi lehe,

> I was wondering what the difference between -g, -ggdb and -ggdb3 as option for
gcc?

-g produces debugging information in the OS¹s native format (stabs, COFF,
XCOFF, or DWARF 2).

-ggdb produces debugging information specifically intended for gdb.

-ggdb3 produces extra debugging information, for example: including macro
definitions.  -ggdb by itself without specifying the level defaults to
-ggdb2 (i.e., gdb for level 2).

It is *possible* (I've heard) that the -ggdb can produce debugging
information that can confuse other debuggers if you are not using gdb.  I
only use gdb, so I cannot confirm or refute that rumor.

So...

If you use gdb, use -ggdb (same as -ggdb2), or -ggdb1 (to help reduce the
debug footprint), or -ggdb3 (for additional debugging info).

If you do not use gdb...

Use -g and keep in mind that gdb works with the OS's native format too.

I use -g even though I use gdb exclusively when I use gcc/g++.  I could use
-ggdb ... but I forget to type those extra three characters.

HTH,
--Eljay



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux