+2020-05-19 Simon Marchi <simon.marchi@efficios.com>
+
+ * symfile.h (struct symfile_segment_data)
+ <~symfile_segment_data>: Remove.
+ <segment_info>: Change to std::vector.
+ * symfile.c (default_symfile_segments): Update.
+ * elfread.c (elf_symfile_segments): Update.
+
2020-05-19 Simon Marchi <simon.marchi@efficios.com>
* symfile.h (struct symfile_segment_data) <struct segment>: New.
data->segments.emplace_back (segments[i]->p_vaddr, segments[i]->p_memsz);
num_sections = bfd_count_sections (abfd);
- data->segment_info = XCNEWVEC (int, num_sections);
+
+ /* All elements are initialized to 0 (map to no segment). */
+ data->segment_info.resize (num_sections);
for (i = 0, sect = abfd->sections; sect != NULL; i++, sect = sect->next)
{
symfile_segment_data_up data (new symfile_segment_data);
num_sections = bfd_count_sections (abfd);
- data->segment_info = XCNEWVEC (int, num_sections);
+
+ /* All elements are initialized to 0 (map to no segment). */
+ data->segment_info.resize (num_sections);
for (i = 0, sect = abfd->sections; sect != NULL; i++, sect = sect->next)
{
CORE_ADDR size;
};
- ~symfile_segment_data ()
- {
- xfree (this->segment_info);
- }
-
/* The segments present in this file. If there are
two, the text segment is the first one and the data segment
is the second one. */
/* This is an array of entries recording which segment contains each BFD
section. SEGMENT_INFO[I] is S+1 if the I'th BFD section belongs to segment
S, or zero if it is not in any segment. */
- int *segment_info = nullptr;
+ std::vector<int> segment_info;
};
using symfile_segment_data_up = std::unique_ptr<symfile_segment_data>;