From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32725 invoked by alias); 21 May 2006 05:22:44 -0000 Received: (qmail 32714 invoked by uid 22791); 21 May 2006 05:22:43 -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; Sun, 21 May 2006 05:22:39 +0000 Received: from kahikatea.snap.net.nz (p202-124-112-123.snap.net.nz [202.124.112.123]) by viper.snap.net.nz (Postfix) with ESMTP id 4EF41753EA3; Sun, 21 May 2006 17:22:37 +1200 (NZST) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id 5472C1D3550; Sun, 21 May 2006 17:22:12 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17519.63746.390090.274345@kahikatea.snap.net.nz> Date: Sun, 21 May 2006 23:04:00 -0000 To: Daniel Jacobowitz Cc: Vladimir Prus , gdb-patches@sources.redhat.com Subject: Re: [PATCH] -var-update In-Reply-To: <20060521021243.GB9432@nevyn.them.org> References: <17518.39336.538984.261434@kahikatea.snap.net.nz> <20060520144015.GA32035@nevyn.them.org> <17519.38740.887319.134411@kahikatea.snap.net.nz> <20060521021243.GB9432@nevyn.them.org> X-Mailer: VM 7.19 under Emacs 22.0.50.13 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/msg00438.txt.bz2 > If you take a look at the code you're patching, there should be a > nearby call to value_fetch_lazy or gdb_value_fetch_lazy in each case. > You want to be calling coerce_ref before you do that. OK. Perhaps I called it after value_fetch_lazy. > Try calling coerce_ref in here: > > if (gdb_evaluate_expression (var->root->exp, &var->value)) > { > /* no error */ > > /* HERE */ > > release_value (var->value); > if (value_lazy (var->value)) > gdb_value_fetch_lazy (var->value); > } > else > var->value = evaluate_type (var->root->exp); I've tried to follow this suggestion in the patch below, which acts slightly differently to the previous patch. Itjust returns the actual value in the value field instead of the address and value (which is what -stack-list-locals does). This is because the previously execution went through case TYPE_CODE_REF in c-val-print, while now it goes through TYPE_CODE_INT say (for a variable referencing an integer) because of the call to coerce_ref. I'm not sure which is preferable. Now the change occurs earlier in varobj_create, I'm not sure what happens when gdb_evaluate_expression returns 0 (or why it would return 0). -- Nick http://www.inet.net.nz/~nickrob *** varobj.c 19 May 2006 11:37:28 +1200 1.60 --- varobj.c 21 May 2006 16:06:23 +1200 *************** varobj_create (char *objname, *** 502,513 **** select_frame (fi); } ! /* We definitively need to catch errors here. If evaluate_expression succeeds we got the value we wanted. But if it fails, we still go on with a call to evaluate_type() */ if (gdb_evaluate_expression (var->root->exp, &var->value)) { /* no error */ release_value (var->value); if (value_lazy (var->value)) gdb_value_fetch_lazy (var->value); --- 502,514 ---- select_frame (fi); } ! /* We definitely need to catch errors here. If evaluate_expression succeeds we got the value we wanted. But if it fails, we still go on with a call to evaluate_type() */ if (gdb_evaluate_expression (var->root->exp, &var->value)) { /* no error */ + var->value = coerce_ref (var->value); release_value (var->value); if (value_lazy (var->value)) gdb_value_fetch_lazy (var->value); *************** varobj_set_value (struct varobj *var, ch *** 820,825 **** --- 821,830 ---- exp = parse_exp_1 (&s, 0, 0); if (!gdb_evaluate_expression (exp, &value)) { + value = coerce_ref (value); + if (value_lazy (value)) + gdb_value_fetch_lazy (value); + /* We cannot proceed without a valid expression. */ xfree (exp); return 0; *************** c_value_of_root (struct varobj **var_han *** 1898,1903 **** --- 1903,1909 ---- go on */ if (gdb_evaluate_expression (var->root->exp, &new_val)) { + new_val = coerce_ref (new_val); if (value_lazy (new_val)) { /* We need to catch errors because if