]> oss.titaniummirror.com Git - msp430-binutils.git/blobdiff - binutils/stabs.c
Imported binutils-2.20
[msp430-binutils.git] / binutils / stabs.c
index ea0a61e411890378de2fa39f115846dd7bc95956..ed9992ee164494df1a0673f22f4c8164e5d24672 100644 (file)
@@ -1,6 +1,6 @@
 /* stabs.c -- Parse stabs debugging information
    Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-   2006, 2007 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2008  Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
@@ -1105,6 +1105,26 @@ parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype,
        return FALSE;
       break;
 
+    case 'Y':
+      /* SUNPro C++ Namespace =Yn0.  */
+      /* Skip the namespace mapping, as it is not used now.  */
+      if (*(++p) == 'n' && *(++p) == '0')
+       {
+         /* =Yn0name; */
+         while (*p != ';')
+           ++p;
+         ++p;
+         return TRUE;
+       }
+      /* TODO SUNPro C++ support:
+         Support default arguments after F,P parameters
+         Ya = Anonymous unions
+         YM,YD = Pointers to class members
+         YT,YI = Templates
+         YR = Run-time type information (RTTI)  */
+
+      /* Fall through.  */
+
     default:
       bad_stab (string);
       return FALSE;
@@ -1122,7 +1142,7 @@ parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype,
    store the slot used if the type is being defined.  */
 
 static debug_type
-parse_stab_type (void *dhandle, struct stab_handle *info, const char *typename, const char **pp, debug_type **slotp)
+parse_stab_type (void *dhandle, struct stab_handle *info, const char *type_name, const char **pp, debug_type **slotp)
 {
   const char *orig;
   int typenums[2];
@@ -1286,9 +1306,9 @@ parse_stab_type (void *dhandle, struct stab_handle *info, const char *typename,
               fleep:T20=xsfleep:
           which define structures in terms of themselves.  We need to
           tell the caller to avoid building a circular structure.  */
-       if (typename != NULL
-           && strncmp (typename, *pp, p - *pp) == 0
-           && typename[p - *pp] == '\0')
+       if (type_name != NULL
+           && strncmp (type_name, *pp, p - *pp) == 0
+           && type_name[p - *pp] == '\0')
          info->self_crossref = TRUE;
 
        dtype = stab_find_tagged_type (dhandle, info, *pp, p - *pp, code);
@@ -1519,7 +1539,7 @@ parse_stab_type (void *dhandle, struct stab_handle *info, const char *typename,
 
     case 'r':
       /* Range type.  */
-      dtype = parse_stab_range_type (dhandle, info, typename, pp, typenums);
+      dtype = parse_stab_range_type (dhandle, info, type_name, pp, typenums);
       break;
 
     case 'b':
@@ -1541,7 +1561,7 @@ parse_stab_type (void *dhandle, struct stab_handle *info, const char *typename,
     case 's':
     case 'u':
       /* Struct or union type.  */
-      dtype = parse_stab_struct_type (dhandle, info, typename, pp,
+      dtype = parse_stab_struct_type (dhandle, info, type_name, pp,
                                      descriptor == 's', typenums);
       break;
 
@@ -1631,7 +1651,7 @@ parse_stab_type_number (const char **pp, int *typenums)
 /* Parse a range type.  */
 
 static debug_type
-parse_stab_range_type (void *dhandle, struct stab_handle *info, const char *typename, const char **pp, const int *typenums)
+parse_stab_range_type (void *dhandle, struct stab_handle *info, const char *type_name, const char **pp, const int *typenums)
 {
   const char *orig;
   int rangenums[2];
@@ -1730,11 +1750,11 @@ parse_stab_range_type (void *dhandle, struct stab_handle *info, const char *type
                 long long int:t6=r1;0;-1;
                 long long unsigned int:t7=r1;0;-1;
             We hack here to handle this reasonably.  */
-         if (typename != NULL)
+         if (type_name != NULL)
            {
-             if (strcmp (typename, "long long int") == 0)
+             if (strcmp (type_name, "long long int") == 0)
                return debug_make_int_type (dhandle, 8, FALSE);
-             else if (strcmp (typename, "long long unsigned int") == 0)
+             else if (strcmp (type_name, "long long unsigned int") == 0)
                return debug_make_int_type (dhandle, 8, TRUE);
            }
          /* FIXME: The size here really depends upon the target.  */
@@ -1837,11 +1857,13 @@ parse_stab_sun_builtin_type (void *dhandle, const char **pp)
     }
   ++*pp;
 
-  /* For some odd reason, all forms of char put a c here.  This is strange
-     because no other type has this honor.  We can safely ignore this because
-     we actually determine 'char'acterness by the number of bits specified in
-     the descriptor.  */
-  if (**pp == 'c')
+  /* OpenSolaris source code indicates that one of "cbv" characters
+     can come next and specify the intrinsic 'iformat' encoding.
+     'c' is character encoding, 'b' is boolean encoding, and 'v' is
+     varargs encoding.  This field can be safely ignored because
+     the type of the field is determined from the bitwidth extracted
+     below.  */
+  if (**pp == 'c' || **pp == 'b' || **pp == 'v')
     ++*pp;
 
   /* The first number appears to be the number of bytes occupied
@@ -2095,7 +2117,7 @@ parse_stab_baseclasses (void *dhandle, struct stab_handle *info,
 
   for (i = 0; i < c; i++)
     {
-      bfd_boolean virtual;
+      bfd_boolean is_virtual;
       enum debug_visibility visibility;
       bfd_vma bitpos;
       debug_type type;
@@ -2103,14 +2125,14 @@ parse_stab_baseclasses (void *dhandle, struct stab_handle *info,
       switch (**pp)
        {
        case '0':
-         virtual = FALSE;
+         is_virtual = FALSE;
          break;
        case '1':
-         virtual = TRUE;
+         is_virtual = TRUE;
          break;
        default:
          warn_stab (orig, _("unknown virtual character for baseclass"));
-         virtual = FALSE;
+         is_virtual = FALSE;
          break;
        }
       ++*pp;
@@ -2149,7 +2171,7 @@ parse_stab_baseclasses (void *dhandle, struct stab_handle *info,
       if (type == DEBUG_TYPE_NULL)
        return FALSE;
 
-      classes[i] = debug_make_baseclass (dhandle, type, bitpos, virtual,
+      classes[i] = debug_make_baseclass (dhandle, type, bitpos, is_virtual,
                                         visibility);
       if (classes[i] == DEBUG_BASECLASS_NULL)
        return FALSE;
@@ -2274,7 +2296,7 @@ parse_stab_cpp_abbrev (void *dhandle, struct stab_handle *info,
   int cpp_abbrev;
   debug_type context;
   const char *name;
-  const char *typename;
+  const char *type_name;
   debug_type type;
   bfd_vma bitpos;
 
@@ -2310,13 +2332,13 @@ parse_stab_cpp_abbrev (void *dhandle, struct stab_handle *info,
       break;
     case 'b':
       /* $vb -- a virtual bsomethingorother */
-      typename = debug_get_type_name (dhandle, context);
-      if (typename == NULL)
+      type_name = debug_get_type_name (dhandle, context);
+      if (type_name == NULL)
        {
          warn_stab (orig, _("unnamed $vb type"));
-         typename = "FOO";
+         type_name = "FOO";
        }
-      name = concat ("_vb$", typename, (const char *) NULL);
+      name = concat ("_vb$", type_name, (const char *) NULL);
       break;
     default:
       warn_stab (orig, _("unrecognized C++ abbreviation"));