From 6be2a9ab1fba5f876c8cb2566280c5e4e6959d6e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 29 Oct 2020 15:04:33 -0600 Subject: Add target_section constructor This adds a constructor to target_section, simplifying the code that creates instances of this. gdb/ChangeLog 2020-10-29 Tom Tromey * target-section.h (struct target_section): Add constructor. * exec.c (build_section_table, add_target_sections_of_objfile): Update. * corelow.c (core_target::build_file_mappings): Update. --- gdb/exec.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'gdb/exec.c') diff --git a/gdb/exec.c b/gdb/exec.c index f95fdce67f8..9bdd87d0eaa 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -598,12 +598,9 @@ build_section_table (struct bfd *some_bfd) if (!(aflag & SEC_ALLOC)) continue; - table.emplace_back (); - target_section § = table.back (); - sect.owner = NULL; - sect.the_bfd_section = asect; - sect.addr = bfd_section_vma (asect); - sect.endaddr = sect.addr + bfd_section_size (asect); + table.emplace_back (bfd_section_vma (asect), + bfd_section_vma (asect) + bfd_section_size (asect), + asect); } return table; @@ -662,12 +659,9 @@ add_target_sections_of_objfile (struct objfile *objfile) if (bfd_section_size (osect->the_bfd_section) == 0) continue; - table->emplace_back (); - target_section &ts = table->back (); - ts.addr = obj_section_addr (osect); - ts.endaddr = obj_section_endaddr (osect); - ts.the_bfd_section = osect->the_bfd_section; - ts.owner = (void *) objfile; + table->emplace_back (obj_section_addr (osect), + obj_section_endaddr (osect), + osect->the_bfd_section, (void *) objfile); } } -- cgit v1.2.1