Subject: bin/25094: gcc generates wrong debugging symbols per default
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <jschauma@netmeister.org>
List: netbsd-bugs
Date: 04/07/2004 12:14:14
>Number: 25094
>Category: bin
>Synopsis: gcc generates wrong debugging symbols per default
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Apr 07 16:15:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Jan Schaumann
>Release: NetBSD 1.6ZK
>Organization:
>Environment:
System: NetBSD dogfish-head.cs.stevens-tech.edu 1.6ZK NetBSD 1.6ZK (BOCK.current) #0: Tue Mar 9 11:41:58 EST 2004 jschauma@doppelbock.hpcf.cs.stevens-tech.edu:/share/src/sys/arch/i386/compile/obj/BOCK.current i386
Architecture: i386
Machine: i386
>Description:
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.
This is not obvious to the end user and somewhat embarrasing if the system
ships with a compiler that produces output that the systems debugger can't
use. I'd say that shipping 2.0 with this would be a Bad Thing.
Also see http://mail-index.netbsd.org/current-users/2004/04/05/0018.html,
Nathan Williams' response to my mail. I'm not sure if this is port-specific.
>How-To-Repeat:
See above.
>Fix:
Dunno. Tell gcc to use stabs per default?
>Release-Note:
>Audit-Trail:
>Unformatted: