Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Aug 2003 16:47:23 -0700
From:      Tim Kientzle <kientzle@acm.org>
To:        Pav Lucistnik <pav@oook.cz>
Cc:        hackers@freebsd.org
Subject:   Re: gcc weirdness
Message-ID:  <3F4FE60B.1050002@acm.org>
In-Reply-To: <1062195438.641.18.camel@hood.oook.cz>
References:  <1062195438.641.18.camel@hood.oook.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
Pav Lucistnik wrote:
> 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.

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.

Tim



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