Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Aug 2003 02:02:31 +0200
From:      Pav Lucistnik <pav@oook.cz>
To:        kientzle@acm.org
Cc:        hackers@freebsd.org
Subject:   Re: gcc weirdness
Message-ID:  <1062201750.641.21.camel@hood.oook.cz>
In-Reply-To: <3F4FE60B.1050002@acm.org>
References:  <1062195438.641.18.camel@hood.oook.cz> <3F4FE60B.1050002@acm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
V so, 30. 08. 2003 v 01:47, Tim Kientzle p=ED=B9e:

> > What am I missing here?
> >=20
> > Let we have a function called popup(). Inside this function there is
> > this code:
> >=20
> > list =3D get_children(ds, x, TYPE_ELEMENT);
> >=20
> > gdb shows these values:
> >=20
> > (gdb) print ds
> > $46 =3D (Type *) 0x1
> >=20
> > (gdb) print x
> > $47 =3D 0x86adb80
> >=20
> > So far, everything is fine. Now, let step down one frame in gdb:
> >=20
> > (gdb) down
> > #5 0x0808b807 in get_children(ds=3D0x86adb80, node=3D0x1, tag_type=3DTY=
PE_E...
> >=20
> > In the source, there is a
> >=20
> > GList* get_children (Type* ds, PtrNode node, enum Types tag_type) {
> >=20
> > Do you see ds and node values swapped? The program crashes because of
> > this swapping. What is wrong? I use gcc-3.3.1 on today's -CURRENT.

> First, try putting printf() statements at the beginning of
> get_children and just before the corresponding call to see
> if that's really what's going on.

Yes, printf gives out same (correct) values. And, now it crashes in
different part of get_children.

> I presume you're seeing this while debugging a core dump after
> a crash?  The crash may have mangled the stack, in which case,
> gdb may not be correctly identifying the function arguments.

So it is a memory corruption? Is there a good way how to debug such bugs?

Thanks for help so far.

--=20
Pav Lucistnik <pav@oook.cz>
What do we know about love? Love is like a pear. Pear is sweet and have
a specific shape. Try to exactly define the shape of a pear.
  -- Marigold: 50 Years Of Poetry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1062201750.641.21.camel>