[RFA/RFC] Restore old handling of multi-register variables

Joel Brobecker brobecker@adacore.com
Sat Oct 22 14:48:00 GMT 2011


Hi Pedro,

> This is a bit a step backwards in that it doesn't allow
> marking parts of the value as unavailable when the type
> is longer than one register.  get_frame_register_value
> was invented to allow for partially available registers.
> 
> > --- a/gdb/findvar.c
> > +++ b/gdb/findvar.c
> > @@ -668,9 +668,35 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
> >        v = gdbarch_value_from_register (gdbarch, type, regnum, frame);
> >  
> >        /* Get the data.  */
> > -      v2 = get_frame_register_value (frame, regnum);
> > +      if (len > register_size (gdbarch, regnum))
> > +       {
> 
> I'd rather we get rid of get_frame_register_bytes.

Purely in terms of solving the AVR problem, what do you think
of the attached patch? Does it look correct to you?

I tested it on AVR as well as x86_64-linux, and it seems to work.

Going beyond that, the new function doesn't provide the extended
interface that you suggest. Doing so seems to be complicating
the implementation more than it's worth. I think that what we
should do, we want to eliminate get_frame_register_value, is look
at the current uses and try to eliminate them.

The biggest culprit is the register_to_value gdbarch method (11
hits). But there is only one location where it's actually called,
and it is.... value_from_register! (just above the section of code
that we're improving). I think it would be easy to change the
profile of that method to return a value. Then the register_to_value
implementations could use get_frame_register_value instead.

Other two uses that are different:
  - dwarf2loc.c: For DW_OP_piece (read/write) support;
  - spu-tdep.c: We just read the contents of a single register
    (get_frame_register_value + extract_unsigned_integer,
    so it should be easy to replace them with something else.

Thanks,
-- 
Joel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multi-register-value.diff
Type: text/x-diff
Size: 2807 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20111022/a1a3f0fa/attachment.bin>


More information about the Gdb-patches mailing list