This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hi Joel.

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.
That is, pass down a value to get_frame_register_bytes (renaming
it along the way) instead of a buffer, and have it do basically
the same, but filling the value contents instead of writting to the buffer,
and have it mark the value pieces that are unavailable instead of
bailing out with error.  (May need to pass two different offsets
to it, one of register offset, other for value embedded offset,
not sure).  We could then reimplement get_frame_register_bytes as a
wrapper for the new  function as an interim until we get rid of
get_frame_register_bytes completely.  Something like:

int
get_frame_register_bytes (*type, regnum, offset, len, *myaddr,
                          *optimizedp, *unavailablep)
{
  val = allocate_value (type);
  read_frame_register_value?(v, frame, regnum, offset, len,
                             val_contents_all_raw (val));
  if (value_optimized_out (val))
    *optimizedp = 1;
  if (value_bytes_available (val, offset, len))
    *unavailablep = 1;
  if (!*optimizedp && !*unavailablep)
    {
      memcpy (myaddr, val_contents_all_raw (val) + offset, len);
      return 1;
    }
   return 0;
}

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]