+2020-01-13 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * corelow.c (core_target::get_core_register_section): Use
+ std::vector instead of alloca.
+
2020-01-13 Simon Marchi <simon.marchi@efficios.com>
* warning.m4: Add -Wmissing-declarations to build_warnings.
{
struct bfd_section *section;
bfd_size_type size;
- char *contents;
bool variable_size_section = (regset != NULL
&& regset->flags & REGSET_VARIABLE_SIZE);
section_name.c_str ());
}
- contents = (char *) alloca (size);
- if (! bfd_get_section_contents (core_bfd, section, contents,
- (file_ptr) 0, size))
+ std::vector<char> contents (size);
+ if (!bfd_get_section_contents (core_bfd, section, contents.data (),
+ (file_ptr) 0, size))
{
warning (_("Couldn't read %s registers from `%s' section in core file."),
human_name, section_name.c_str ());
if (regset != NULL)
{
- regset->supply_regset (regset, regcache, -1, contents, size);
+ regset->supply_regset (regset, regcache, -1, contents.data (), size);
return;
}
gdb_assert (m_core_vec != nullptr);
- m_core_vec->core_read_registers (regcache, contents, size, which,
+ m_core_vec->core_read_registers (regcache, contents.data (), size, which,
(CORE_ADDR) bfd_section_vma (section));
}