X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fsolib-target.c;h=93d95fdda6525228df8d35a40d3ccf91d6640b97;hb=d11a9fabab657e592df9167535bc46804937cf18;hp=3fd180850c14cf0ae8fc151b94966772c4968a8d;hpb=fd3619828e94a24a92cddec42cbc0ab33352eeb4;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 3fd180850c..93d95fdda6 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 "gdbsupport/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; + section_offsets offsets; }; typedef std::vector> lm_info_vector; @@ -306,13 +305,11 @@ solib_target_relocate_section_addresses (struct so_list *so, /* Build the offset table only once per object file. We can not do it any earlier, since we need to open the file first. */ - if (li->offsets == NULL) + if (li->offsets.empty ()) { int num_sections = gdb_bfd_count_sections (so->abfd); - li->offsets - = ((struct section_offsets *) - xzalloc (SIZEOF_N_SECTION_OFFSETS (num_sections))); + li->offsets.assign (num_sections, 0); if (!li->section_bases.empty ()) { @@ -357,7 +354,7 @@ Could not relocate shared library \"%s\": wrong number of ALLOC sections"), gdb_assert (so->addr_low <= so->addr_high); found_range = 1; } - li->offsets->offsets[i] = li->section_bases[bases_index]; + li->offsets[i] = li->section_bases[bases_index]; bases_index++; } if (!found_range) @@ -378,7 +375,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, li->segment_bases.size (), li->segment_bases.data ())) warning (_("\ @@ -415,9 +413,8 @@ Could not relocate shared library \"%s\": bad offsets"), so->so_name); } } - offset = li->offsets->offsets[gdb_bfd_section_index - (sec->the_bfd_section->owner, - sec->the_bfd_section)]; + offset = li->offsets[gdb_bfd_section_index (sec->the_bfd_section->owner, + sec->the_bfd_section)]; sec->addr += offset; sec->endaddr += offset; } @@ -441,8 +438,9 @@ solib_target_in_dynsym_resolve_code (CORE_ADDR pc) struct target_so_ops solib_target_so_ops; +void _initialize_solib_target (); void -_initialize_solib_target (void) +_initialize_solib_target () { solib_target_so_ops.relocate_section_addresses = solib_target_relocate_section_addresses;