From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32209 invoked by alias); 9 Jul 2002 21:03:48 -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 32198 invoked from network); 9 Jul 2002 21:03:47 -0000 Received: from unknown (HELO www.dberlin.org) (138.88.46.115) by sources.redhat.com with SMTP; 9 Jul 2002 21:03:47 -0000 Received: by www.dberlin.org (Postfix, from userid 503) id 5B4BA181BE80; Tue, 9 Jul 2002 17:03:47 -0400 (EDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by www.dberlin.org (Postfix) with ESMTP id B6FA218003C1; Tue, 9 Jul 2002 17:03:41 -0400 (EDT) Date: Tue, 09 Jul 2002 14:08:00 -0000 From: Daniel Berlin To: Jim Blandy Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA]: LOC_COMPUTED + abstracted dwarf2 evaluator, again In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-1.6 required=5.0 tests=IN_REP_TO,NO_MX_FOR_FROM,AWL version=2.31 X-Spam-Level: X-SW-Source: 2002-07/txt/msg00160.txt.bz2 On 9 Jul 2002, Jim Blandy wrote: > > Daniel Berlin writes: > > + /* Evaluate a location description, given in THEBLOCK, in the > > + context of frame FRAME. */ > > + static struct value * > > + evaluate_loc_desc (struct symbol *var, struct frame_info *frame, > > + struct dwarf_block *theblock, struct type *type) > > + { > > + CORE_ADDR result; > > + struct value * retval; > > + struct dwarf_expr_baton *baton = xmalloc (sizeof (struct dwarf_expr_baton)); > > + struct dwarf_expr_context *ctx; > > + > > + retval = allocate_value(type); > > + baton->var = var; > > + baton->frame = frame; > > + > > + VALUE_LVAL (retval) = lval_memory; > > + VALUE_BFD_SECTION (retval) = SYMBOL_BFD_SECTION (var); > > + > > + ctx = new_dwarf_expr_context (); > > + ctx->read_reg_baton = baton; > > + ctx->read_reg = dwarf_expr_read_reg; > > + ctx->read_mem_baton = baton; > > + ctx->read_mem = dwarf_expr_read_mem; > > + ctx->get_frame_base_baton = baton; > > + ctx->get_frame_base = dwarf_expr_frame_base; > > + ctx->error = error; > > + > > + dwarf_expr_eval (ctx, theblock->data, theblock->size); > > + > > + 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). > > I think the evaluator is confused in this regard, too; see my upcoming > post about that. > >