This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA]: LOC_COMPUTED + abstracted dwarf2 evaluator, again
- From: Jim Blandy <jimb at redhat dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: gdb-patches at sources dot redhat dot com
- Date: 09 Jul 2002 17:21:39 -0500
- Subject: Re: [RFA]: LOC_COMPUTED + abstracted dwarf2 evaluator, again
- References: <Pine.LNX.4.44.0207091701280.21763-100000@dberlin.org>
Daniel Berlin <dberlin@dberlin.org> 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.