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: [unavailable values part 1, 13/17] value unavailable-ness propagation


On Mon, 07 Feb 2011 15:33:53 +0100, Pedro Alves wrote:
> +/* Copy LENGTH bytes of SRC value's contents starting at SRC_OFFSET,
> +   into DST value's contents, starting at DST_OFFSET.  If unavailable
> +   contents are being copied from SRC, the corresponding DST contents
> +   are marked unavailable accordingly.  Neither DST nor SRC may be
> +   lazy values.  */

/* DST_OFFSET and SRC_OFFSET should include possible EMBEDDED_OFFSET,
   respectively.  */

The overwritten DST range gets unavailability only ORed in, not replaced.
AFAICS it does not affect any current callers of it.

As clearing the unavailability is currently not easy I would prefer at least
  gdb_assert (value_bytes_available (dst, dst_offset, length));
(or at least a fat function comment warning)


> +
> +void
> +value_contents_copy_raw (struct value *dst, int dst_offset,
> +			 struct value *src, int src_offset, int length)
> +{
> +  range_s *r;
> +  int i;
> +
> +  /* A lazy DST would make that this copy operation useless, since as
> +     soon as DST's contents were un-lazied (by a later value_contents
> +     call, say), the contents would be overwritten.  A lazy SRC would
> +     mean we'd be copying garbage.  */
> +  gdb_assert (!dst->lazy && !src->lazy);
> +
> +  /* Copy the data.  */
> +  memcpy (value_contents_all_raw (dst) + dst_offset,
> +	  value_contents_all_raw (src) + src_offset,
> +	  length);
> +
> +  /* Copy the meta-data, adjusted.  */
> +  for (i = 0; VEC_iterate (range_s, src->unavailable, i, r); i++)
> +    {
> +      ULONGEST h, l;
> +
> +      l = max (r->offset, src_offset);
> +      h = min (r->offset + r->length, src_offset + length);
> +
> +      if (l < h)
> +	mark_value_bytes_unavailable (dst,
> +				      dst_offset + (l - src_offset),
> +				      h - l);
> +    }
> +}


Thanks,
Jan


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