Subject: Re: gcc default debugging symobls
To: Jan Schaumann <jschauma@netmeister.org>
From: Bang Jun-Young <junyoung@NetBSD.org>
List: current-users
Date: 04/20/2004 02:50:01
Jan Schaumann wrote:
> Hi,
>
> Under i386, it appears that gcc if passed '-g' generates the wrong
> debugging symbols per default:
>
> #include <stdio.h>
>
> struct astruct {
>   unsigned char c;
>   double d;
> };
>
> int main() {
>
>         struct astruct x;
>
>         x.c = 'a';
>         x.d = 0.184;
>         printf("%f\n", x.d);
>         return 0;
> }
>
> When compiled with '-g', running it through gdb it will correctly print
> 0.184000, but if you break and inspect x, it will give:
>
> (gdb) p x
> $1 = {c = 97 'a', d = 5.2867121265460283e-315}
> (gdb)
>
> Now using '-gstabs' or '-gstabs+' or '-gstabs3', it will behave
> correctly.  So... what am I doing wrong, or why is gcc not creating the
> correct debugging symbols per default?

Probably that's not a NetBSD-specific problem. Quoting from a Dragon Fly 
mailing list:

Joerg Sonnenberger wrote:
> Hi all,
> like all readers of bugs@ know, gdb has currently problems with
> reading gcc3 output. One solution is updating gdb to version 6,
> an interims solution to specify "-gstabs" and thereforce force gcc
> 3.3 to generate the traditional stabs output.
>
> Is it prefered to keep the current status quo or is it better to
> (temporary) switch GCC 3 back to stabs output?
>
> Joerg

Jun-Young