This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gdb/213: Type confusion with excluded include files (stabs)



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]