aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorThiago Jung Bauermann <thiago.bauermann@linaro.org>2024-08-22 19:42:45 -0300
committerThiago Jung Bauermann <thiago.bauermann@linaro.org>2025-01-09 22:47:21 -0300
commitad59259604f008e20490f9c82cf287d5a601a66c (patch)
tree4e99f99c286fa94b1eefe8effdcb5ebc2dbc7bbf /gdb/python
parent1f493519f703220bc072538ce3586f7363eba904 (diff)
downloadbinutils-ad59259604f008e20490f9c82cf287d5a601a66c.zip
binutils-ad59259604f008e20490f9c82cf287d5a601a66c.tar.gz
binutils-ad59259604f008e20490f9c82cf287d5a601a66c.tar.bz2
GDB: trad-frame: Store length of value_bytes in trad_frame_saved_reg
The goal is to ensure that it is available in frame_unwind_got_bytes () to make sure that the provided buf isn't larger than the size of the register being provisioned. In the process, regcache's cached_reg_t::data also needed to be converted to a gdb::byte_vector, so that the register contents' size can be tracked. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-unwind.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index 68deaf9..c1a01bf 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -812,7 +812,7 @@ pyuw_prev_register (const frame_info_ptr &this_frame, void **cache_ptr,
for (; reg_info < reg_info_end; ++reg_info)
{
if (regnum == reg_info->num)
- return frame_unwind_got_bytes (this_frame, regnum, reg_info->data.get ());
+ return frame_unwind_got_bytes (this_frame, regnum, reg_info->data);
}
return frame_unwind_got_optimized (this_frame, regnum);
@@ -936,8 +936,9 @@ pyuw_sniffer (const struct frame_unwind *self, const frame_info_ptr &this_frame,
cached_reg_t *cached = new (&cached_frame->reg[i]) cached_reg_t ();
cached->num = reg->number;
- cached->data.reset ((gdb_byte *) xmalloc (data_size));
- memcpy (cached->data.get (), value->contents ().data (), data_size);
+ cached->data.resize (data_size);
+ gdb::array_view<const gdb_byte> contents = value->contents ();
+ cached->data.assign (contents.begin (), contents.end ());
}
}