This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Best set of gcc options for debugging
- From: Phil Edwards <phil at codesourcery dot com>
- To: "Aaron W. LaFramboise" <aaronavay62 at aaronwl dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 8 Jul 2004 18:27:59 -0400
- Subject: Re: Best set of gcc options for debugging
- References: <40EDB55A.3050708@aaronwl.com>
- Reply-to: gcc at gcc dot gnu dot org
On Thu, Jul 08, 2004 at 03:58:02PM -0500, Aaron W. LaFramboise wrote:
> Recently, I've been having a lot of frustration using gdb with gcc 3.4.1
> (and even more so on 3.5) with stabs.
stabs has a set of problems associated with it that are probably never
going to be solved, just because of the limitations with the stabs format.
I strongly advise you to configure using --with-dwarf2 if your target
supports it at all. If it supports multiple debug formats and stabs is
merely the default, try one of the -gdwarf2 flags.
> What is the story with -g3? Does this actually do anything useful?
Well, under DWARF, it makes cpp macros visible to the debugger, so
things like
(gdb) p _NDEBUG
and
(gdb) p DECL_WHATSIS (decl)
work. I forget what else it turns on.
--
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
- Brian W. Kernighan, in a plea for clear, straightforward code