aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-10-10 15:59:57 +0000
committerSimon Marchi <simon.marchi@efficios.com>2023-10-19 10:57:51 -0400
commitae19ef71d2248d588a9f3a5545e1882f696cb86e (patch)
tree005120469daa8efe7db9cdbe54901b2dd921929a
parent25b5a04e858ae7c0dd859c082b35f63d9ee50feb (diff)
downloadgdb-ae19ef71d2248d588a9f3a5545e1882f696cb86e.zip
gdb-ae19ef71d2248d588a9f3a5545e1882f696cb86e.tar.gz
gdb-ae19ef71d2248d588a9f3a5545e1882f696cb86e.tar.bz2
gdb: make so_list::sections not a pointer
Make the field a vector directly, instead of a pointer to a vector. This was needed when so_list had to be a trivial type, which is not the case anymore. Change-Id: I79a8378ce0d0d1e2206ca08a273ebf332cb3ba14 Approved-By: Pedro Alves <pedro@palves.net> Reviewed-By: Reviewed-By: Lancelot Six <lancelot.six@amd.com>
-rw-r--r--gdb/solib.c18
-rw-r--r--gdb/solist.h2
2 files changed, 7 insertions, 13 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index fda76a8..db21a51 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -592,11 +592,9 @@ solib_map_sections (so_list &so)
error (_("Shared library file name is too long."));
strcpy (so.so_name, bfd_get_filename (so.abfd));
- if (so.sections == nullptr)
- so.sections = new std::vector<target_section>;
- *so.sections = build_section_table (so.abfd);
+ so.sections = build_section_table (so.abfd);
- for (target_section &p : *so.sections)
+ for (target_section &p : so.sections)
{
/* Relocate the section binding addresses as recorded in the shared
object's file by the base address to which the object was actually
@@ -618,7 +616,7 @@ solib_map_sections (so_list &so)
section tables. Do this immediately after mapping the object so
that later nodes in the list can query this object, as is needed
in solib-osf.c. */
- current_program_space->add_target_sections (&so, *so.sections);
+ current_program_space->add_target_sections (&so, so.sections);
return 1;
}
@@ -630,8 +628,7 @@ so_list::clear ()
{
const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
- delete this->sections;
- this->sections = nullptr;
+ this->sections.clear ();
gdb_bfd_unref (this->abfd);
this->abfd = nullptr;
@@ -708,7 +705,7 @@ solib_read_symbols (so_list &so, symfile_add_flags flags)
if (so.objfile == NULL)
{
section_addr_info sap
- = build_section_addr_info_from_section_table (*so.sections);
+ = build_section_addr_info_from_section_table (so.sections);
gdb_bfd_ref_ptr tmp_bfd
(gdb_bfd_ref_ptr::new_reference (so.abfd));
so.objfile = symbol_file_add_from_bfd (tmp_bfd, so.so_name,
@@ -1168,10 +1165,7 @@ bool
solib_contains_address_p (const so_list &solib,
CORE_ADDR address)
{
- if (solib.sections == nullptr)
- return false;
-
- for (target_section &p : *solib.sections)
+ for (const target_section &p : solib.sections)
if (p.addr <= address && address < p.endaddr)
return true;
diff --git a/gdb/solist.h b/gdb/solist.h
index ca12fd5..51b985d 100644
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -84,7 +84,7 @@ struct so_list
the file cannot be found or after the command "nosharedlibrary". */
struct objfile *objfile = nullptr;
- std::vector<target_section> *sections = nullptr;
+ std::vector<target_section> sections;
/* Record the range of addresses belonging to this shared library.
There may not be just one (e.g. if two segments are relocated