Subject: bin/25094: gcc generates wrong debugging symbols per default
To: None <>
From: None <>
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
>Originator:     Jan Schaumann
>Release:        NetBSD 1.6ZK
System: NetBSD 1.6ZK NetBSD 1.6ZK (BOCK.current) #0: Tue Mar 9 11:41:58 EST 2004 i386
Architecture: i386
Machine: i386

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}

Now using '-gstabs' or '-gstabs+' or '-gstabs3', it will behave

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,
Nathan Williams' response to my mail.  I'm not sure if this is port-specific.

See above.
Dunno.  Tell gcc to use stabs per default?