[13/13] gdb: remove a use of alloca from symfile.c
Commit Message
Remove a use of alloca from symfile.c and replace it with
gdb::byte_vector.
There is another use of alloca in this file, but this is for a type
other than gdb_byte, so will need something other than
gdb::byte_vector.
There should be no user visible changes after this commit.
---
gdb/symfile.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
@@ -3429,13 +3429,12 @@ static void
read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr,
int len, int size, enum bfd_endian byte_order)
{
- /* FIXME (alloca): Not safe if array is very large. */
- gdb_byte *buf = (gdb_byte *) alloca (len * size);
- int i;
+ gdb::byte_vector buf (len * size);
- read_memory (memaddr, buf, len * size);
- for (i = 0; i < len; i++)
- myaddr[i] = extract_unsigned_integer (size * i + buf, size, byte_order);
+ read_memory (memaddr, buf.data (), len * size);
+ for (int i = 0; i < len; i++)
+ myaddr[i] = extract_unsigned_integer (size * i + buf.data (), size,
+ byte_order);
}
/* Find and grab a copy of the target _ovly_table