[06/13] gdb: remove a use of alloca from elfread.c
Commit Message
This removes one of the uses of alloca from elfread.c and replaces it
with gdb::byte_vector. There are other uses of alloca in this file,
but they all deal with types other than gdb_byte and so will require
replacing with something other than gdb::byte_vector.
There should be no user visible changes in this commit.
---
gdb/elfread.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
@@ -839,7 +839,6 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
size_t ptr_size = ptr_type->length ();
CORE_ADDR pointer_address, addr;
asection *plt;
- gdb_byte *buf = (gdb_byte *) alloca (ptr_size);
bound_minimal_symbol msym;
msym = lookup_minimal_symbol (name_got_plt, NULL, objfile);
@@ -855,9 +854,11 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
if (msym.minsym->size () != ptr_size)
return 0;
- if (target_read_memory (pointer_address, buf, ptr_size) != 0)
+
+ gdb::byte_vector buf (ptr_size);
+ if (target_read_memory (pointer_address, buf.data (), ptr_size) != 0)
return 0;
- addr = extract_typed_address (buf, ptr_type);
+ addr = extract_typed_address (buf.data (), ptr_type);
addr = gdbarch_convert_from_func_ptr_addr
(gdbarch, addr, current_inferior ()->top_target ());
addr = gdbarch_addr_bits_remove (gdbarch, addr);