This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/213: Type confusion with excluded include files (stabs)
- To: gdb-gnats at sources dot redhat dot com
- Subject: gdb/213: Type confusion with excluded include files (stabs)
- From: mattias at virtutech dot se
- Date: 12 Sep 2001 12:40:45 -0000
- Cc: gustav at virtutech dot se
- Reply-To: mattias at virtutech dot se
>Number: 213
>Category: gdb
>Synopsis: Type confusion with excluded include files (stabs)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Sep 12 05:48:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: mattias@virtutech.se
>Release: gdb-5.0 (19991004)
>Organization:
>Environment:
i386-redhat-linux, sparc-sun-solaris2.7, and others
>Description:
gdb seems to assume that an include file that has been
excluded in the stabs as a duplicate by the linker always
contains the same types, as long as the
(file name, instance number) pairs are the same.
This is not always true as the following example shows:
--- file x.c:
struct Y { double zz; };
#include "x.h"
struct X a;
int main(void) { return 17; }
--- file y.c:
struct Y { int zz; };
#include "x.h"
struct X b;
--- file x.h:
struct X { struct Y *xx; };
Compiling the above with "gcc -g x.c y.c" (any half-recent
gcc release works), and then running gdb on the result,
yields:
(gdb) p sizeof *b.xx
$1 = 8
which is false (should be 4). Reversing the order of x.c
and y.c on the compiler line makes sizeof *a.xx yield 4,
because the "x.h" header is then excluded in x.c instead
of in y.c.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: