Change section_offsets to a std::vector
[deliverable/binutils-gdb.git] / gdb / coff-pe-read.c
index 06da8411ff1fa3f0b95997c01f82324ff8ca6eec..b7f7b81ca88251e5b6dce444527b286abe5509f3 100644 (file)
@@ -2,7 +2,7 @@
    convert to internal format, for GDB. Used as a last resort if no
    debugging symbols recognized.
 
-   Copyright (C) 2003-2019 Free Software Foundation, Inc.
+   Copyright (C) 2003-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 
 #include "defs.h"
 
-/* Standard C includes.  */
-#include <ctype.h>
+#include "coff-pe-read.h"
 
-/* Local non-gdb includes.  */
 #include "bfd.h"
-#include "coff-pe-read.h"
-#include "coff/internal.h"
+#include "gdbtypes.h"
+
 #include "command.h"
-#include "common/common-utils.h"
 #include "gdbcmd.h"
-#include "gdbtypes.h"
-#include "objfiles.h"
-#include "symfile.h"
 #include "symtab.h"
+#include "symfile.h"
+#include "objfiles.h"
+#include "gdbsupport/common-utils.h"
+#include "coff/internal.h"
+
+#include <ctype.h>
 
 /* Internal section information */
 
@@ -136,7 +136,7 @@ get_section_vmas (bfd *abfd, asection *sectp, void *context)
          bfd_get_section_vma() within memory.  Store the offset.  */
 
       sections[sectix].vma_offset
-       = bfd_get_section_vma (abfd, sectp) - sections[sectix].rva_start;
+       = bfd_section_vma (sectp) - sections[sectix].rva_start;
     }
 }
 \f
@@ -266,7 +266,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
      really be relocated properly, but nevertheless we make a stab at
      it, choosing an approach consistent with the history of this
      code.  */
-  baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
+  baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
 
   reader.record_with_info (qualified_name.c_str (), vma - baseaddr, msymtype,
                           section);
@@ -441,6 +441,12 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
        }
     }
 
+  if (expptr == 0)
+    {
+      /* no section contains export table rva */
+      return;
+    }
+
   export_rva = export_opthdrrva;
   export_size = export_opthdrsize;
 
@@ -541,7 +547,7 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
 
 
       /* Pointer to the function address vector.  */
-      /* This is relatived to ordinal value. */
+      /* This is relative to ordinal value. */
       unsigned long func_rva = pe_as32 (erva + exp_funcbase +
                                         ordinal * 4);
 
@@ -614,7 +620,7 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
 /* Extract from ABFD the offset of the .text section.
    This offset is mainly related to the offset within the file.
    The value was previously expected to be 0x1000 for all files,
-   but some Windows OS core DLLs seem to use 0x10000 section alignement
+   but some Windows OS core DLLs seem to use 0x10000 section alignment
    which modified the return value of that function.
    Still return default 0x1000 value if ABFD is NULL or
    if '.text' section is not found, but that should not happen...  */
This page took 0.024313 seconds and 4 git commands to generate.