In target_read_auxv we return a copy of an object:
...
gdb::optional<gdb::byte_vector>
target_read_auxv ()
{
...
return info->data;
}
...
Return a const reference instead, saving a copy.
This is exposed by using std::pmr::polymorphic_allocator instead of
std::allocator in default_init_allocator.
Tested on x86_64-linux.
const struct target_desc *
arm_fbsd_read_description_auxv (bool tls)
{
- gdb::optional<gdb::byte_vector> auxv = target_read_auxv ();
+ const gdb::optional<gdb::byte_vector> &auxv = target_read_auxv ();
return arm_fbsd_read_description_auxv (auxv,
current_inferior ()->top_target (),
current_inferior ()->gdbarch,
/* See auxv.h. */
-gdb::optional<gdb::byte_vector>
+const gdb::optional<gdb::byte_vector> &
target_read_auxv ()
{
inferior *inf = current_inferior ();
int
target_auxv_search (CORE_ADDR match, CORE_ADDR *valp)
{
- gdb::optional<gdb::byte_vector> auxv = target_read_auxv ();
+ const gdb::optional<gdb::byte_vector> &auxv = target_read_auxv ();
if (!auxv.has_value ())
return -1;
struct gdbarch *gdbarch = target_gdbarch ();
CORE_ADDR type, val;
int ents = 0;
- gdb::optional<gdb::byte_vector> auxv = target_read_auxv ();
+ const gdb::optional<gdb::byte_vector> &auxv = target_read_auxv ();
if (!auxv.has_value ())
return -1;
/* Read auxv data from the current inferior's target stack. */
-extern gdb::optional<gdb::byte_vector> target_read_auxv ();
+extern const gdb::optional<gdb::byte_vector> &target_read_auxv ();
/* Read auxv data from OPS. */