diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index e2088f1..d590248 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1918,39 +1918,41 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) if (dwarf2_section_empty_p (info)) return; + else + { + abfd = sectp->owner; - abfd = sectp->owner; + /* If the section has relocations, we must read it ourselves. + Otherwise we attach it to the BFD. */ + if ((sectp->flags & SEC_RELOC) == 0) + { + const gdb_byte *bytes = gdb_bfd_map_section (sectp, &info->size); - /* If the section has relocations, we must read it ourselves. - Otherwise we attach it to the BFD. */ - if ((sectp->flags & SEC_RELOC) == 0) - { - const gdb_byte *bytes = gdb_bfd_map_section (sectp, &info->size); + /* We have to cast away const here for historical reasons. + Fixing dwarf2read to be const-correct would be quite nice. */ + info->buffer = (gdb_byte *) bytes; + return; + } - /* We have to cast away const here for historical reasons. - Fixing dwarf2read to be const-correct would be quite nice. */ - info->buffer = (gdb_byte *) bytes; - return; - } + buf = obstack_alloc (&objfile->objfile_obstack, info->size); + info->buffer = buf; - buf = obstack_alloc (&objfile->objfile_obstack, info->size); - info->buffer = buf; + /* When debugging .o files, we may need to apply relocations; see + http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html . + We never compress sections in .o files, so we only need to + try this when the section is not compressed. */ + retbuf = symfile_relocate_debug_section (objfile, sectp, buf); + if (retbuf != NULL) + { + info->buffer = retbuf; + return; + } - /* When debugging .o files, we may need to apply relocations; see - http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html . - We never compress sections in .o files, so we only need to - try this when the section is not compressed. */ - retbuf = symfile_relocate_debug_section (objfile, sectp, buf); - if (retbuf != NULL) - { - info->buffer = retbuf; - return; + if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 + || bfd_bread (buf, info->size, abfd) != info->size) + error (_("Dwarf Error: Can't read DWARF data from '%s'"), + bfd_get_filename (abfd)); } - - if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 - || bfd_bread (buf, info->size, abfd) != info->size) - error (_("Dwarf Error: Can't read DWARF data from '%s'"), - bfd_get_filename (abfd)); } /* A helper function that returns the size of a section in a safe way.