]> Git Repo - binutils.git/blobdiff - gdb/stabsread.c
* config/mips-gdb.exp, config/udi-gdb.exp, config/vx-gdb.exp,
[binutils.git] / gdb / stabsread.c
index 6c81c10ae7eb76d8fc28480515b97d45aa28d403..a1b1775af8b31f583088ca98c64131adbc3942ce 100644 (file)
@@ -33,6 +33,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "symfile.h"
 #include "objfiles.h"
 #include "aout/stab_gnu.h"     /* We always use GNU stabs, not native */
+#include "libaout.h"
+#include "aout/aout64.h"
+#include "gdb-stabs.h"
 #include "buildsym.h"
 #include "complaints.h"
 #include "demangle.h"
@@ -540,6 +543,19 @@ define_symbol (valu, string, desc, type, objfile)
     obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
   memset (sym, 0, sizeof (struct symbol));
 
+  switch (type & N_TYPE)
+    {
+    case N_TEXT:
+      SYMBOL_SECTION(sym) = SECT_OFF_TEXT;
+      break;
+    case N_DATA:
+      SYMBOL_SECTION(sym) = SECT_OFF_DATA;
+      break;
+    case N_BSS:
+      SYMBOL_SECTION(sym) = SECT_OFF_BSS;
+      break;
+    }
+
   if (processing_gcc_compilation)
     {
       /* GCC 2.x puts the line number in desc.  SunOS apparently puts in the
@@ -977,9 +993,11 @@ define_symbol (valu, string, desc, type, objfile)
          /* Sun cc uses a pair of symbols, one 'p' and one 'r' with the same
             name to represent an argument passed in a register.
             GCC uses 'P' for the same case.  So if we find such a symbol pair
-            we combine it into one 'P' symbol.
+            we combine it into one 'P' symbol.  For Sun cc we need to do this
+            regardless of REG_STRUCT_HAS_ADDR, because the compiler puts out
+            the 'p' symbol even if it never saves the argument onto the stack.
 
-            But we only do this in the REG_STRUCT_HAS_ADDR case, so that
+            On most machines, we want to preserve both symbols, so that
             we can still get information about what is going on with the
             stack (VAX for computing args_printed, using stack slots instead
             of saved registers in backtraces, etc.).
@@ -991,14 +1009,18 @@ define_symbol (valu, string, desc, type, objfile)
 
          if (local_symbols
              && local_symbols->nsyms > 0
+#ifndef USE_REGISTER_NOT_ARG
              && REG_STRUCT_HAS_ADDR (processing_gcc_compilation,
                                      SYMBOL_TYPE (sym))
              && (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
-                 || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION))
+                 || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)
+#endif
+             )
            {
              struct symbol *prev_sym;
              prev_sym = local_symbols->symbol[local_symbols->nsyms - 1];
-             if (SYMBOL_CLASS (prev_sym) == LOC_REF_ARG
+             if ((SYMBOL_CLASS (prev_sym) == LOC_REF_ARG
+                  || SYMBOL_CLASS (prev_sym) == LOC_ARG)
                  && STREQ (SYMBOL_NAME (prev_sym), SYMBOL_NAME(sym)))
                {
                  SYMBOL_CLASS (prev_sym) = LOC_REGPARM;
@@ -1053,7 +1075,13 @@ define_symbol (valu, string, desc, type, objfile)
 
       if (TYPE_NAME (SYMBOL_TYPE (sym)) == NULL)
        {
-         if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR
+         /* gcc-2.6 or later (when using -fvtable-thunks)
+            emits a unique named type for a vtable entry.
+            Some gdb code depends on that specific name. */
+         extern const char vtbl_ptr_name[];
+
+         if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR
+              && strcmp (SYMBOL_NAME (sym), vtbl_ptr_name))
              || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC)
            {
              /* If we are giving a name to a type such as "pointer to
@@ -1539,13 +1567,17 @@ read_type (pp, objfile)
     case 'f':                          /* Function returning another type */
       if (os9k_stabs && **pp == '(')
        {
-         /* Function prototype; skip it.
+         /* Function prototype; parse it.
             We must conditionalize this on os9k_stabs because otherwise
             it could be confused with a Sun-style (1,3) typenumber
             (I think).  */
-         while (**pp != ')')
-           ++*pp;
+         struct type *t;
          ++*pp;
+         while (**pp != ')')
+            {
+              t = read_type(pp, objfile);
+              if (**pp == ',') ++*pp;
+            }
        }
       type1 = read_type (pp, objfile);
       type = make_function_type (type1, dbx_lookup_type (typenums));
@@ -3816,6 +3848,8 @@ scan_file_globals (objfile)
                {
                  SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msymbol);
                }
+
+             SYMBOL_SECTION (sym) = SYMBOL_SECTION (msymbol);
              
              if (prev)
                {
This page took 0.029342 seconds and 4 git commands to generate.