@@ -7512,45 +7512,48 @@ cutu_reader::open_dwo_file (dwarf2_per_bfd *per_bfd, const char *file_name,
75127512 size of each of the DWO debugging sections we are interested in. */
75137513
75147514void
7515- cutu_reader::locate_dwo_sections (struct objfile *objfile, bfd *abfd,
7516- asection *sectp, dwo_sections *dwo_sections)
7515+ cutu_reader::locate_dwo_sections (objfile *objfile, dwo_file &dwo_file)
75177516{
75187517 const struct dwop_section_names *names = &dwop_section_names;
7519-
7520- struct dwarf2_section_info *dw_sect = nullptr;
7521-
7522- if (names->abbrev_dwo.matches (sectp->name))
7523- dw_sect = &dwo_sections->abbrev;
7524- else if (names->info_dwo.matches (sectp->name))
7525- dw_sect = &dwo_sections->infos.emplace_back (dwarf2_section_info {});
7526- else if (names->line_dwo.matches (sectp->name))
7527- dw_sect = &dwo_sections->line;
7528- else if (names->loc_dwo.matches (sectp->name))
7529- dw_sect = &dwo_sections->loc;
7530- else if (names->loclists_dwo.matches (sectp->name))
7531- dw_sect = &dwo_sections->loclists;
7532- else if (names->macinfo_dwo.matches (sectp->name))
7533- dw_sect = &dwo_sections->macinfo;
7534- else if (names->macro_dwo.matches (sectp->name))
7535- dw_sect = &dwo_sections->macro;
7536- else if (names->rnglists_dwo.matches (sectp->name))
7537- dw_sect = &dwo_sections->rnglists;
7538- else if (names->str_dwo.matches (sectp->name))
7539- dw_sect = &dwo_sections->str;
7540- else if (names->str_offsets_dwo.matches (sectp->name))
7541- dw_sect = &dwo_sections->str_offsets;
7542- else if (names->types_dwo.matches (sectp->name))
7543- dw_sect = &dwo_sections->types.emplace_back (dwarf2_section_info {});
7544-
7545- if (dw_sect != nullptr)
7546- {
7547- /* Make sure we don't overwrite a section info that has been filled in
7518+ dwo_sections &dwo_sections = dwo_file.sections;
7519+
7520+ for (asection *sec : gdb_bfd_sections (dwo_file.dbfd))
7521+ {
7522+ struct dwarf2_section_info *dw_sect = nullptr;
7523+
7524+ if (names->abbrev_dwo.matches (sec->name))
7525+ dw_sect = &dwo_sections.abbrev;
7526+ else if (names->info_dwo.matches (sec->name))
7527+ dw_sect = &dwo_sections.infos.emplace_back (dwarf2_section_info {});
7528+ else if (names->line_dwo.matches (sec->name))
7529+ dw_sect = &dwo_sections.line;
7530+ else if (names->loc_dwo.matches (sec->name))
7531+ dw_sect = &dwo_sections.loc;
7532+ else if (names->loclists_dwo.matches (sec->name))
7533+ dw_sect = &dwo_sections.loclists;
7534+ else if (names->macinfo_dwo.matches (sec->name))
7535+ dw_sect = &dwo_sections.macinfo;
7536+ else if (names->macro_dwo.matches (sec->name))
7537+ dw_sect = &dwo_sections.macro;
7538+ else if (names->rnglists_dwo.matches (sec->name))
7539+ dw_sect = &dwo_sections.rnglists;
7540+ else if (names->str_dwo.matches (sec->name))
7541+ dw_sect = &dwo_sections.str;
7542+ else if (names->str_offsets_dwo.matches (sec->name))
7543+ dw_sect = &dwo_sections.str_offsets;
7544+ else if (names->types_dwo.matches (sec->name))
7545+ dw_sect = &dwo_sections.types.emplace_back (dwarf2_section_info {});
7546+
7547+ if (dw_sect != nullptr)
7548+ {
7549+ /* Make sure we don't overwrite a section info that has been filled in
75487550 already. */
7549- gdb_assert (!dw_sect->readin);
7551+ gdb_assert (!dw_sect->readin);
75507552
7551- dw_sect->s.section = sectp;
7552- dw_sect->size = bfd_section_size (sectp);
7553- dw_sect->read (objfile);
7553+ dw_sect->s.section = sec;
7554+ dw_sect->size = bfd_section_size (sec);
7555+ dw_sect->read (objfile);
7556+ }
75547557 }
75557558}
75567559
@@ -7578,9 +7581,7 @@ cutu_reader::open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name,
75787581 dwo_file->comp_dir = comp_dir;
75797582 dwo_file->dbfd = std::move (dbfd);
75807583
7581- for (asection *sec : gdb_bfd_sections (dwo_file->dbfd))
7582- this->locate_dwo_sections (per_objfile->objfile, dwo_file->dbfd.get (), sec,
7583- &dwo_file->sections);
7584+ this->locate_dwo_sections (per_objfile->objfile, *dwo_file);
75847585
75857586 /* There is normally just one .debug_info.dwo section in a DWO file. But when
75867587 building with -fdebug-types-section, gcc produces multiple .debug_info.dwo
0 commit comments