From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 29 17:25:44 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 844F716A4BF for ; Fri, 29 Aug 2003 17:25:44 -0700 (PDT) Received: from kientzle.com (h-66-166-149-50.SNVACAID.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id D2CEA43FBF for ; Fri, 29 Aug 2003 17:25:43 -0700 (PDT) (envelope-from kientzle@acm.org) Received: from acm.org (big.x.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id h7U0PhsE070466; Fri, 29 Aug 2003 17:25:43 -0700 (PDT) (envelope-from kientzle@acm.org) Message-ID: <3F4FEF37.7070303@acm.org> Date: Fri, 29 Aug 2003 17:26:31 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030524 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Pav Lucistnik References: <1062195438.641.18.camel@hood.oook.cz> <3F4FE60B.1050002@acm.org> <1062201750.641.21.camel@hood.oook.cz> In-Reply-To: <1062201750.641.21.camel@hood.oook.cz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit cc: hackers@freebsd.org Subject: Re: gcc weirdness X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: kientzle@acm.org 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:25:44 -0000 Pav Lucistnik wrote: > V so, 30. 08. 2003 v 01:47, Tim Kientzle píše: > > >>>What am I missing here? >>> >>>Let we have a function called popup(). Inside this function there is >>>this code: >>> >>>list = get_children(ds, x, TYPE_ELEMENT); >>> >>>gdb shows these values: >>> >>>(gdb) print ds >>>$46 = (Type *) 0x1 >>> >>>(gdb) print x >>>$47 = 0x86adb80 >>> >>>So far, everything is fine. Now, let step down one frame in gdb: >>> >>>(gdb) down >>>#5 0x0808b807 in get_children(ds=0x86adb80, node=0x1, tag_type=TYPE_E... >>> >>>In the source, there is a >>> >>>GList* get_children (Type* ds, PtrNode node, enum Types tag_type) { >>> >>>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. > You have an error in your program. Run the program under gdb and step carefully through get_children to try to figure out what is wrong. Tim