Article View: gnu.gdb.bug
Article #567problems debugging structs passed as parameters with GDB 4.6
From: Joe Wells
Date: Thu, 17 Dec 1992 00:13
Date: Thu, 17 Dec 1992 00:13
56 lines
1828 bytes
1828 bytes
I am having problems debugging structs passed as parameters with GDB 4.6.
I am using a Sun 4/280 running SunOS 4.1.1. I am compiling my code with
GCC 2.2.2. The main thing is that GDB shows the wrong values for the
struct contents, but there are other anomalies, such as segmentation
faults when I call functions in the program being debugged that take
structs as arguments. Enclosed below is some trivial test code that
triggers the problem.
Is this a known problem? I've looked in both the GDB and GCC source
distributions to see if it is documented. Is there a workaround? Is this
an incompatibility with GCC 2.2.2? Help!
If you reply to this message, please send a copy to my address by e-mail.
--
Desperately yours,
Joe Wells <jbw@cs.bu.edu>
Member of the League for Programming Freedom --- send e-mail for details
----------------------------------------------------------------------
typedef struct {unsigned char _[8];} ID;
struct foo {
long a;
long b;
};
bar (struct foo y)
{
printf ("%ld,%ld\n", y.a,y.b);
}
baz (ID w)
{
int i;
for (i = 0; i < 8; i++)
printf ("%c\n", w._[i]);
}
main ()
{
struct foo x;
ID z;
x.a = 1;
x.b = 2;
z._[0]='a';
z._[1]='b';
z._[2]='c';
z._[3]='d';
z._[4]='e';
z._[5]='f';
z._[6]='g';
z._[7]='h';
bar (x);
baz (z);
}
----------------------------------------------------------------------
Technical Details
Message-ID:
<9212171013.AA24611@csd.bu.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.bu.edu!jbwShow Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.bu.edu!jbw From: jbw@cs.bu.edu (Joe Wells) Subject: problems debugging structs passed as parameters with GDB 4.6 Message-ID: <9212171013.AA24611@csd.bu.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 17 Dec 1992 00:13:34 GMT Approved: bug-gdb@prep.ai.mit.edu Lines: 57