X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fsolib-target.c;h=e90107e578256f3ea5a9969e9855f6b5c5e00036;hb=456e800a63def18484f69a51f59c2338a5cc4568;hp=51cb6ca1552905804e8fbd9a5043262ed5b2ab90;hpb=776489e0a79a14cb3f1138d4e4158ab9a8c7ecf3;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 51cb6ca155..e90107e578 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -1,6 +1,6 @@ /* Definitions for targets which report shared library events. - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -23,7 +23,6 @@ #include "symtab.h" #include "symfile.h" #include "target.h" -#include "vec.h" #include "solib-target.h" #include @@ -47,7 +46,7 @@ struct lm_info_target : public lm_info_base /* The cached offsets for each section of this shared library, determined from SEGMENT_BASES, or SECTION_BASES. */ - section_offsets *offsets = NULL; + gdb::unique_xmalloc_ptr offsets; }; typedef std::vector> lm_info_vector; @@ -310,9 +309,8 @@ solib_target_relocate_section_addresses (struct so_list *so, { int num_sections = gdb_bfd_count_sections (so->abfd); - li->offsets - = ((struct section_offsets *) - xzalloc (SIZEOF_N_SECTION_OFFSETS (num_sections))); + li->offsets.reset ((struct section_offsets *) + xzalloc (SIZEOF_N_SECTION_OFFSETS (num_sections))); if (!li->section_bases.empty ()) { @@ -323,7 +321,7 @@ solib_target_relocate_section_addresses (struct so_list *so, for (i = 0, sect = so->abfd->sections; sect != NULL; i++, sect = sect->next) - if ((bfd_get_section_flags (so->abfd, sect) & SEC_ALLOC)) + if ((bfd_section_flags (sect) & SEC_ALLOC)) num_alloc_sections++; if (num_alloc_sections != li->section_bases.size ()) @@ -341,14 +339,14 @@ Could not relocate shared library \"%s\": wrong number of ALLOC sections"), sect != NULL; i++, sect = sect->next) { - if (!(bfd_get_section_flags (so->abfd, sect) & SEC_ALLOC)) + if (!(bfd_section_flags (sect) & SEC_ALLOC)) continue; - if (bfd_section_size (so->abfd, sect) > 0) + if (bfd_section_size (sect) > 0) { CORE_ADDR low, high; low = li->section_bases[i]; - high = low + bfd_section_size (so->abfd, sect) - 1; + high = low + bfd_section_size (sect) - 1; if (low < so->addr_low) so->addr_low = low; @@ -378,7 +376,8 @@ Could not relocate shared library \"%s\": no segments"), so->so_name); ULONGEST orig_delta; int i; - if (!symfile_map_offsets_to_segments (so->abfd, data, li->offsets, + if (!symfile_map_offsets_to_segments (so->abfd, data, + li->offsets.get (), li->segment_bases.size (), li->segment_bases.data ())) warning (_("\