From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 29 17:02:39 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 789BA16A4C2 for ; Fri, 29 Aug 2003 17:02:39 -0700 (PDT) Received: from hood.oook.cz (hood.oook.cz [212.27.205.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id CA20743FDF for ; Fri, 29 Aug 2003 17:02:36 -0700 (PDT) (envelope-from pav@oook.cz) Received: from hood.oook.cz (localhost.oook.cz [127.0.0.1]) by hood.oook.cz (8.12.9/8.12.9) with ESMTP id h7U02WXd009417; Sat, 30 Aug 2003 02:02:33 +0200 (CEST) (envelope-from pav@oook.cz) Received: (from pav@localhost) by hood.oook.cz (8.12.9/8.12.9/Submit) id h7U02WfJ009416; Sat, 30 Aug 2003 02:02:32 +0200 (CEST) X-Authentication-Warning: hood.oook.cz: pav set sender to pav@oook.cz using -f From: Pav Lucistnik To: kientzle@acm.org In-Reply-To: <3F4FE60B.1050002@acm.org> References: <1062195438.641.18.camel@hood.oook.cz> <3F4FE60B.1050002@acm.org> Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: quoted-printable Message-Id: <1062201750.641.21.camel@hood.oook.cz> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Sat, 30 Aug 2003 02:02:31 +0200 cc: hackers@freebsd.org Subject: Re: gcc weirdness X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Aug 2003 00:02:39 -0000 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 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