diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 118f17588a8..c2340e694c2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2019-02-25 Jordan Rupprecht + + * dwarf2read.c (open_and_init_dwp_file): Call + elf_numsections instead of bfd_count_sections to initialize + dwp_file->num_sections. + 2019-02-25 Tom Tromey * solib-darwin.c (darwin_get_dyld_bfd): Don't release dyld_bfd. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 98f46e04162..2908a233fe4 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -13230,8 +13230,7 @@ open_and_init_dwp_file (struct dwarf2_per_objfile *dwarf2_per_objfile) std::unique_ptr dwp_file (new struct dwp_file (name, std::move (dbfd))); - /* +1: section 0 is unused */ - dwp_file->num_sections = bfd_count_sections (dwp_file->dbfd) + 1; + dwp_file->num_sections = elf_numsections (dwp_file->dbfd); dwp_file->elf_sections = OBSTACK_CALLOC (&objfile->objfile_obstack, dwp_file->num_sections, asection *);