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: RFC: partially available registers


Tom Tromey wrote:

> FWIW, I was mostly following the existing code and existing gdbarch
> methods, like gdbarch_value_from_register.

This looks good to me, thanks.

> I think a decent project would be to consolidate this new method,
> gdbarch_convert_register, and gdbarch_value_from_register into a single
> approach.

Agreed.  I actually had a patchset a while ago that would get rid of
gdbarch_convert_register, but that was never quite completed ...
I'll have to see to get this done at some point.

>        int len = TYPE_LENGTH (type);
> +      struct value *v2;
>  
>        /* Construct the value.  */
>        v = gdbarch_value_from_register (gdbarch, type, regnum, frame);
>  
>        /* Get the data.  */
> -      ok = get_frame_register_bytes (frame, regnum, value_offset (v), len,
> -				     value_contents_raw (v),
> -				     &optim, &unavail);
> -    }
> +      v2 = get_frame_register_value (frame, regnum);
>  
> -  if (!ok)
> -    {
> -      if (optim)
> -	set_value_optimized_out (v, 1);
> -      if (unavail)
> -	mark_value_bytes_unavailable (v, 0, TYPE_LENGTH (type));
> +      value_contents_copy (v, value_offset (v), v2, 0, len);

This still looks wrong, I think.  It should be:

    value_contents_copy (v, 0, v2, value_offset (v), len);

(v2 is the full register.  value_offset (v) specifies at which byte of
that full register contents the contents of v start ...)

The rest looks good to me.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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