From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5898 invoked by alias); 19 May 2006 05:11:53 -0000 Received: (qmail 5888 invoked by uid 22791); 19 May 2006 05:11:52 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 19 May 2006 05:11:47 +0000 Received: from kahikatea.snap.net.nz (p421-tnt1.snap.net.nz [202.124.111.167]) by viper.snap.net.nz (Postfix) with ESMTP id E3F3375808D; Fri, 19 May 2006 17:11:45 +1200 (NZST) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id 225E41D3550; Fri, 19 May 2006 17:11:17 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17517.21363.892697.745703@kahikatea.snap.net.nz> Date: Fri, 19 May 2006 07:41:00 -0000 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com, Subject: Re: [PATCH] -var-update In-Reply-To: <20060517014309.GA20934@nevyn.them.org> References: <17497.14121.225320.477428@farnswood.snap.net.nz> <200605041100.09748.ghost@cs.msu.su> <17497.43822.261192.673547@farnswood.snap.net.nz> <200605041610.16153.ghost@cs.msu.su> <17503.15435.371371.707494@farnswood.snap.net.nz> <20060515164605.GF28924@nevyn.them.org> <17514.26047.918241.942848@farnswood.snap.net.nz> <20060517004527.GA19347@nevyn.them.org> <17515.52645.132594.285414@kahikatea.snap.net.nz> <20060517014309.GA20934@nevyn.them.org> X-Mailer: VM 7.19 under Emacs 22.0.50.12 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00408.txt.bz2 > I do not quite understand why coerce_array is used; I suspect the > contents of an array are checked via the children instead of the > parent. coerce_array happens to also call coerce_ref. Maybe it's historical, as varobj_update used value_equal previously and this uses coerce_array. Anyway here's a patch that actually seems to work. I've taken code from c_val_print. Maybe there should be more checks and I've not tested varobj_set_value (-var-assign) yet, but I thought I'd sound out the genaral approcah first. -- Nick http://www.inet.net.nz/~nickrob *** varobj.c 19 May 2006 11:37:28 +1200 1.60 --- varobj.c 19 May 2006 16:27:29 +1200 *************** varobj_create (char *objname, *** 517,522 **** --- 517,532 ---- var->type = value_type (var->value); + if (TYPE_CODE (var->type) == TYPE_CODE_REF) + { + var->value = value_at (TYPE_TARGET_TYPE (var->type), + unpack_pointer + (lookup_pointer_type (builtin_type_void), + value_contents_all (var->value) + + value_embedded_offset (var->value))); + release_value (var->value); + } + /* Set language info */ lang = variable_language (var); var->root->lang = languages[lang]; *************** varobj_set_value (struct varobj *var, ch *** 825,830 **** --- 835,847 ---- return 0; } + if (TYPE_CODE (var->type) == TYPE_CODE_REF) + value = value_at (TYPE_TARGET_TYPE (var->type), + unpack_pointer + (lookup_pointer_type (builtin_type_void), + value_contents_all (value) + + value_embedded_offset (value))); + if (!my_value_equal (var->value, value, &error)) var->updated = 1; if (!gdb_value_assign (var->value, value, &val)) *************** c_value_of_root (struct varobj **var_han *** 1915,1920 **** --- 1932,1944 ---- else var->error = 1; + if (TYPE_CODE (var->type) == TYPE_CODE_REF) + new_val = value_at (TYPE_TARGET_TYPE (var->type), + unpack_pointer + (lookup_pointer_type (builtin_type_void), + value_contents_all (new_val) + + value_embedded_offset (new_val))); + release_value (new_val); return new_val; }