Re: [PATCH v3 08/16] [gdb/aarch64] sve: Fix signal frame z/v register restore

Thiago Jung Bauermann via Gdb-patches
2023-07-27T21:52:52Z

Luis Machado via Gdb-patches <gdb-patches@sourceware.org> writes:

> + if (tdep->has_sve ())
> + {
> + /* If SVE is supported for this target, zero out the Z
> + registers then copy the first 16 bytes of each of the V
> + registers to the associated Z register. Otherwise the Z
> + registers will contain uninitialized data. */
> + std::vector<gdb_byte> z_buffer (tdep->vq * 16);
> +
> + /* We have already handled the endianness swap above, so we don't need
> + to worry about it here. */
> + memcpy (z_buffer.data (), buf, V_REGISTER_SIZE);
> + trad_frame_set_reg_value_bytes (cache,
> + AARCH64_SVE_Z0_REGNUM + i,
> + {z_buffer.data (),
> + z_buffer.size ()});

There's an array_view constructor for contiguous containers including
std::vector, so you can simply pass z_buffer here.

--
Thiago