This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/408: [DWARF2] : Alignment breaks displaying floating point value
- From: pavenis at latnet dot lv
- To: gdb-gnats at sources dot redhat dot com
- Date: 8 Mar 2002 15:32:01 -0000
- Subject: gdb/408: [DWARF2] : Alignment breaks displaying floating point value
- Reply-to: pavenis at latnet dot lv
>Number: 408
>Category: gdb
>Synopsis: [DWARF2] : Alignment breaks displaying floating point value
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 08 07:38:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Andris Pavenis
>Release: gdb-5.1.1, gdb 20020227 snapshot (current)
>Organization:
>Environment:
ix86-linux-gnu, i586-pc-msdosdjgpp
>Description:
Structure members alignment breaks DWARF-2 breaks
displaying floating point values in GDB.
Initially noticed with gcc-3.1 20020307 (prerelease) and
gdb-5.1.1 build for target i586-pc-msdosdjgpp.
Reproduced also with gcc-3.0.4 and gdb-5.1.1 for ix86-linux-gnu.
GDB seems to incorrectly display double member if it
(or some earlier double member) is padded due to alignment.
In test example wrong values are displayed for structure members c, f, g
I'm getting the same also with GDB 20020227 snapshot and GCC-3.0.4
for i586-pc-msdosdjgpp
Andris
-----------------------------------------------
Compiler command line (I used gcc-3.0.4):
gcc-3.0.4 -gdwarf-2 align1.c -o align1
---------------- align1.c --------------------
#include <stdio.h>
struct foo { double a;
int b;
double c;
int d, e;
double f, g; };
int main (void)
{
struct foo bar = { 1.0, 2, 3.0, 4, 5, 6.0, 7.0 };
printf ("%.2f %d %2f\n",bar.a,bar.b,bar.c);
return 0;
}
------------------ results from gdb-5.1.1 ---------------
andris@hal:~/tests/debug$ gdb align1
GNU gdb 5.1.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-slackware-linux"...
(gdb) tb main
Breakpoint 1 at 0x804846b: file align1.c, line 11.
(gdb) r
Starting program: /home/andris/tests/debug/align1
main () at align1.c:11
11 struct foo bar = { 1.0, 2, 3.0, 4, 5, 6.0, 7.0 };
(gdb) n
12 printf ("%.2f %d %2f\n",bar.a,bar.b,bar.c);
(gdb) p bar
$1 = {a = 1, b = 2, c = 9.0187411442917342e-314, d = 4, e = 5,
f = 5.3127604580929853e-315, g = 2.4130875643605169e+185}
(gdb)
>How-To-Repeat:
Compile included test example and try displaying
contents of structure 'bar'
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: