* alpha-tdep.c (alpha_register_virtual_type): Use alpha-specific
[binutils-gdb.git] / binutils / stabs.c
index 1ff4f6f60d220903a26be3495a4bcf53b62459bf..91eff59ffacef349d5253b2cb7ec6a9d20d4ad82 100644 (file)
@@ -1,5 +1,5 @@
 /* stabs.c -- Parse stabs debugging information
-   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
 #include "debug.h"
 #include "budbg.h"
 #include "filenames.h"
-
-/* Meaningless definition needs by aout64.h.  FIXME.  */
-#define BYTES_IN_WORD 4
-
 #include "aout/aout64.h"
 #include "aout/stab_gnu.h"
 
@@ -176,8 +172,8 @@ static debug_type parse_stab_sun_floating_type
 static debug_type parse_stab_enum_type
   PARAMS ((PTR, const char **));
 static debug_type parse_stab_struct_type
-  PARAMS ((PTR, struct stab_handle *, const char *, const char **, bfd_boolean,
-          const int *));
+  PARAMS ((PTR, struct stab_handle *, const char *, const char **,
+          bfd_boolean, const int *));
 static bfd_boolean parse_stab_baseclasses
   PARAMS ((PTR, struct stab_handle *, const char **, debug_baseclass **));
 static bfd_boolean parse_stab_struct_fields
@@ -222,7 +218,8 @@ static debug_type stab_find_tagged_type
   PARAMS ((PTR, struct stab_handle *, const char *, int,
           enum debug_type_kind));
 static debug_type *stab_demangle_argtypes
-  PARAMS ((PTR, struct stab_handle *, const char *, bfd_boolean *, unsigned int));
+  PARAMS ((PTR, struct stab_handle *, const char *, bfd_boolean *,
+          unsigned int));
 
 /* Save a string in memory.  */
 
@@ -268,7 +265,6 @@ parse_number (pp, poverflow)
 
   /* Note that even though strtoul overflowed, it should have set *pp
      to the end of the number, which is where we want it.  */
-
   if (sizeof (bfd_vma) > sizeof (unsigned long))
     {
       const char *p;
@@ -279,7 +275,6 @@ parse_number (pp, poverflow)
       bfd_vma v;
 
       /* Our own version of strtoul, for a bfd_vma.  */
-
       p = orig;
 
       neg = FALSE;
@@ -345,7 +340,6 @@ parse_number (pp, poverflow)
 
   /* If we get here, the number is too large to represent in a
      bfd_vma.  */
-
   if (poverflow != NULL)
     *poverflow = TRUE;
   else
@@ -610,7 +604,8 @@ parse_stab (dhandle, handle, type, desc, value, string)
 
     case N_SLINE:
       if (! debug_record_line (dhandle, desc,
-                              value + info->function_start_offset))
+                              value + (info->within_function
+                                       ? info->function_start_offset : 0)))
        return FALSE;
       break;
 
@@ -963,7 +958,6 @@ parse_stab_string (dhandle, info, stabtype, desc, value, string)
         address on a big endian machine if it is smaller than an int.
         We have no way to do that, since we don't really know much
         about the target.  */
-
       break;
 
     case 'P':
@@ -1004,11 +998,10 @@ parse_stab_string (dhandle, info, stabtype, desc, value, string)
 
       /* FIXME: At this point gdb checks to combine pairs of 'p' and
         'r' stabs into a single 'P' stab.  */
-
       break;
 
     case 'S':
-      /* Static symbol at top level of file */
+      /* Static symbol at top level of file */
       dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
                               (debug_type **) NULL);
       if (dtype == DEBUG_TYPE_NULL)
@@ -1205,11 +1198,9 @@ parse_stab_type (dhandle, info, typename, pp, slotp)
        return DEBUG_TYPE_NULL;
 
       if (**pp != '=')
-       {
-         /* Type is not being defined here.  Either it already
-            exists, or this is a forward reference to it.  */
-         return stab_find_type (dhandle, info, typenums);
-       }
+       /* Type is not being defined here.  Either it already
+          exists, or this is a forward reference to it.  */
+       return stab_find_type (dhandle, info, typenums);
 
       /* Only set the slot if the type is being defined.  This means
          that the mapping from type numbers to types will only record
@@ -1237,10 +1228,8 @@ parse_stab_type (dhandle, info, typename, pp, slotp)
          const char *attr;
 
          if (ISDIGIT (*p) || *p == '(' || *p == '-')
-           {
-             /* Member type.  */
-             break;
-           }
+           /* Member type.  */
+           break;
 
          /* Type attributes.  */
          attr = p;
@@ -1287,7 +1276,6 @@ parse_stab_type (dhandle, info, typename, pp, slotp)
        const char *q1, *q2, *p;
 
        /* A cross reference to another type.  */
-
        switch (**pp)
          {
          case 's':
@@ -1368,7 +1356,6 @@ parse_stab_type (dhandle, info, typename, pp, slotp)
        int xtypenums[2];
 
        /* This type is defined as another type.  */
-
        (*pp)--;
        hold = *pp;
 
@@ -1751,8 +1738,8 @@ parse_stab_range_type (dhandle, info, typename, pp, typenums)
     {
       /* gcc will emit range stabs for long long types.  Handle this
          as a special case.  FIXME: This needs to be more general.  */
-#define LLLOW  "01000000000000000000000;"
-#define LLHIGH "0777777777777777777777;"
+#define LLLOW   "01000000000000000000000;"
+#define LLHIGH   "0777777777777777777777;"
 #define ULLHIGH "01777777777777777777777;"
       if (index_type == DEBUG_TYPE_NULL)
        {