mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 12:03:41 +08:00
[gdb/build] Return const reference in target_read_auxv
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.
This commit is contained in:
parent
2b9ed6db3f
commit
9246b7bd6d
@ -244,7 +244,7 @@ arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv,
|
||||
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,
|
||||
|
@ -354,7 +354,7 @@ invalidate_auxv_cache (void)
|
||||
|
||||
/* See auxv.h. */
|
||||
|
||||
gdb::optional<gdb::byte_vector>
|
||||
const gdb::optional<gdb::byte_vector> &
|
||||
target_read_auxv ()
|
||||
{
|
||||
inferior *inf = current_inferior ();
|
||||
@ -410,7 +410,7 @@ target_auxv_search (const gdb::byte_vector &auxv, target_ops *ops,
|
||||
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;
|
||||
@ -564,7 +564,7 @@ fprint_target_auxv (struct ui_file *file)
|
||||
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;
|
||||
|
@ -48,7 +48,7 @@ extern int svr4_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr,
|
||||
|
||||
/* 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. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user