From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18472 invoked by alias); 9 Jul 2002 22:21:41 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18373 invoked from network); 9 Jul 2002 22:21:40 -0000 Received: from unknown (HELO zwingli.cygnus.com) (208.245.165.35) by sources.redhat.com with SMTP; 9 Jul 2002 22:21:40 -0000 Received: by zwingli.cygnus.com (Postfix, from userid 442) id C382C5EA11; Tue, 9 Jul 2002 17:21:39 -0500 (EST) To: Daniel Berlin Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA]: LOC_COMPUTED + abstracted dwarf2 evaluator, again References: From: Jim Blandy Date: Tue, 09 Jul 2002 15:47:00 -0000 In-Reply-To: Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-07/txt/msg00169.txt.bz2 Daniel Berlin writes: > > > + if (ctx->in_reg) > > > + { > > > + store_typed_address (VALUE_CONTENTS_RAW (retval), > > > + SYMBOL_TYPE (var), dwarf_expr_fetch (ctx, 0)); > > > + VALUE_LVAL (retval) = not_lval; > > > + } > > > + else > > > + { > > > + result = dwarf_expr_fetch (ctx, 0); > > > + VALUE_LAZY (retval) = 1; > > > + VALUE_ADDRESS (retval) = result; > > > + } > > > > This looks wrong. If evaluating the Dwarf location expression yields > > an `in_reg' result, shouldn't the value be an lval_register, with its > > the address set to the register number? > > This doesn't work, in reality. > > IIRC, you run into problems dereferencing the value, because it > thinks it *only* lives in a register (IE it's not really a memory > location), regardless of what you tell it. > > I may be misremembering the exact reason why, but I know things don't work > if you do this, even though it would seem to make sense (I had originally > written it to do what you suggest). The `in_reg' case needs to call value_from_register, not explicitly set the value's `lval' and `address' fields, as I implied. Calling value_from_register will take care of finding registers that have been spilled to the stack.