This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: difference between -g, -ggdb and -ggdb3
- From: "John (Eljay) Love-Jensen" <eljay at adobe dot com>
- To: lehe <timlee126 at yahoo dot com>, GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 18 Feb 2009 08:43:44 -0800
- Subject: Re: difference between -g, -ggdb and -ggdb3
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