From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3307 invoked by alias); 29 Jan 2008 19:20:54 -0000 Received: (qmail 3296 invoked by uid 22791); 29 Jan 2008 19:20:53 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 29 Jan 2008 19:20:27 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 0427298151; Tue, 29 Jan 2008 19:20:26 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id D6C849811F; Tue, 29 Jan 2008 19:20:25 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1JJw0O-00036u-Vd; Tue, 29 Jan 2008 14:20:24 -0500 Date: Tue, 29 Jan 2008 19:21:00 -0000 From: Daniel Jacobowitz To: Nick Roberts Cc: Aleksandar Ristovski , gdb-patches@sourceware.org, Ryan Mansfield Subject: Re: [patch] Fix for varobj.c assertions. Message-ID: <20080129192024.GB9019@caradoc.them.org> Mail-Followup-To: Nick Roberts , Aleksandar Ristovski , gdb-patches@sourceware.org, Ryan Mansfield References: <2F6320727174C448A52CEB63D85D11F40AB0@nova.ott.qnx.com> <18317.12654.364705.470631@kahikatea.snap.net.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18317.12654.364705.470631@kahikatea.snap.net.nz> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-01/txt/msg00712.txt.bz2 On Wed, Jan 16, 2008 at 11:19:26AM +1300, Nick Roberts wrote: > Maybe it cures the symptom and not the cause. We really need to know what is > happening here. In your oringinal report the failed assertion occurred in > my_value_equal but that function has gone now. Presumably it now occurs in > install_new_value, but at which line? > > When there is no problem, presumably *value (in adjust_value_for_child_access) > or value (in c_describe_child) are null. How do they become non null for > inaccessible memory in the failing case? I can reproduce this too. With GDB 6.7.1: ~"/tmp/buildd/gdb-6.7.1/gdb/varobj.c:2011: internal-error: value_struct_element_index: Assertion `TYPE_CODE (type) == TYPE_CODE_STRUCT || TYPE_CODE (type) == TYPE_CODE_UNION' failed.\n" ~"A problem internal to GDB has been detected,\n" ~"further debugging may prove unreliable.\n" ~"Quit this debugging session? (y or n) " With HEAD it's on line 2008, but otherwise the same. type is a pointer type, "B *". *value was a B * value; indirecting it failed because the pointer hasn't been initialized yet at the start of main. When gdb_value_ind returns zero, it has not changed *result. So we go ahead as if *result was set. Aleksandar's change to c_describe_child is safe but not necessary, because *cvalue will already be NULL if gdb_value_ind fails. The change to adjust_value_for_child_access is right, and fixes the bug. And the change to cplus_describe_child is definitely right (*whoops*). So I've checked in the patch. -- Daniel Jacobowitz CodeSourcery