[PATCH] Make target_read_alloc & al return vectors

Simon Marchi simon.marchi@polymtl.ca
Sat Apr 7 17:21:00 GMT 2018


On 2018-03-22 00:03, Simon Marchi wrote:
> This patch started by changing target_read_alloc_1 to return a
> byte_vector, to avoid manual memory management (in target_read_alloc_1
> and in the callers).  To communicate failures to the callers, it
> actually returns a gdb::optional<gdb::byte_vector>.
> 
> Adjusting target_read_stralloc was a bit more tricky, since it wants to
> return a buffer of char, and not gdb_byte.  Since you can't just cast a
> gdb::byte_vector into a gdb::def_vector<char>, I made
> target_read_alloc_1 templated, so both versions (that return vectors of
> gdb_byte and char) are generated.  Since target_read_stralloc now
> returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, 
> a
> few callers need to be adjusted.

I pushed this patch.

Simon



More information about the Gdb-patches mailing list