2010-06-11 Michael Snyder <msnyder@vmware.com>
[deliverable/binutils-gdb.git] / gdb / coffread.c
index 58f53375319e927f223f03534206e3b25635bc6c..52417b22f4279a55e0c5194bdfd48599816f23a1 100644 (file)
@@ -1,7 +1,7 @@
 /* Read coff symbol tables and convert to internal format, for GDB.
    Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
-   Free Software Foundation, Inc.
+   1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009,
+   2010 Free Software Foundation, Inc.
    Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu).
 
    This file is part of GDB.
@@ -45,6 +45,8 @@
 
 #include "coff-pe-read.h"
 
+#include "psymtab.h"
+
 extern void _initialize_coffread (void);
 
 struct coff_symfile_info
@@ -258,6 +260,7 @@ static void
 find_targ_sec (bfd *abfd, asection *sect, void *obj)
 {
   struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj;
+
   if (sect->target_index == args->targ_index)
     *args->resultp = sect;
 }
@@ -280,6 +283,7 @@ static int
 cs_to_section (struct coff_symbol *cs, struct objfile *objfile)
 {
   asection *sect = cs_to_bfd_section (cs, objfile);
+
   if (sect == NULL)
     return SECT_OFF_TEXT (objfile);
   return sect->index;
@@ -402,9 +406,6 @@ coff_end_symtab (struct objfile *objfile)
 
   symtab = end_symtab (current_source_end_addr, objfile, SECT_OFF_TEXT (objfile));
 
-  if (symtab != NULL)
-    free_named_symtabs (symtab->filename);
-
   /* Reinitialize for beginning of new file. */
   last_source_file = NULL;
 }
@@ -415,6 +416,7 @@ record_minimal_symbol (struct coff_symbol *cs, CORE_ADDR address,
                       struct objfile *objfile)
 {
   struct bfd_section *bfd_section;
+
   /* We don't want TDESC entry points in the minimal symbol table */
   if (cs->c_name[0] == '@')
     return NULL;
@@ -514,8 +516,6 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags)
   int stringtab_offset;
   struct cleanup *back_to, *cleanup_minimal_symbols;
   int stabstrsize;
-  int len;
-  char * target;
   
   info = (struct coff_symfile_info *) objfile->deprecated_sym_private;
   dbxinfo = objfile->deprecated_sym_stab_info;
@@ -647,6 +647,7 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags)
       if (debugfile)
        {
          bfd *abfd = symfile_bfd_open (debugfile);
+
          symbol_file_add_separate (abfd, symfile_flags, objfile);
          xfree (debugfile);
        }
@@ -782,6 +783,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
        {
          /* Record all functions -- external and static -- in minsyms. */
          int section = cs_to_section (cs, objfile);
+
          tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
          record_minimal_symbol (cs, tmpaddr, mst_text, section, objfile);
 
@@ -887,6 +889,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
                /* This is a common symbol.  See if the target
                   environment knows where it has been relocated to.  */
                CORE_ADDR reladdr;
+
                if (target_lookup_symbol (cs->c_name, &reladdr))
                  {
                    /* Error in lookup; ignore symbol.  */
@@ -911,6 +914,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
            else
              {
                asection *bfd_section = cs_to_bfd_section (cs, objfile);
+
                sec = cs_to_section (cs, objfile);
                tmpaddr = cs->c_value;
                /* Statics in a PE file also get relocated */
@@ -952,6 +956,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
            if (SDB_TYPE (cs->c_type))
              {
                struct symbol *sym;
+
                sym = process_coff_symbol
                  (cs, &main_aux, objfile);
                SYMBOL_VALUE (sym) = tmpaddr;
@@ -1500,8 +1505,8 @@ process_coff_symbol (struct coff_symbol *cs,
                     struct objfile *objfile)
 {
   struct symbol *sym
-  = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
-                                    sizeof (struct symbol));
+    = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
+                                      sizeof (struct symbol));
   char *name;
 
   memset (sym, 0, sizeof (struct symbol));
@@ -2101,6 +2106,7 @@ coff_read_enum_type (int index, int length, int lastsym,
       for (; j < syms->nsyms; j++, n++)
        {
          struct symbol *xsym = syms->symbol[j];
+
          SYMBOL_TYPE (xsym) = type;
          TYPE_FIELD_NAME (type, n) = SYMBOL_LINKAGE_NAME (xsym);
          SET_FIELD_BITPOS (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym));
@@ -2131,6 +2137,8 @@ static struct sym_fns coff_sym_fns =
   default_symfile_segments,    /* sym_segments: Get segment information from
                                   a file.  */
   NULL,                         /* sym_read_linetable  */
+  default_symfile_relocate,    /* sym_relocate: Relocate a debug section.  */
+  &psym_functions,
   NULL                         /* next: pointer to next struct sym_fns */
 };
 
This page took 0.025092 seconds and 4 git commands to generate.