Minor formatting changes:
[deliverable/binutils-gdb.git] / gdb / ada-lang.c
index c043a88f6cef2a47a99abc4e84f05287e93d33bf..9eee22c44acec4e0ab71ce64b300b20cc533cdb1 100644 (file)
@@ -83,9 +83,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 struct string_vector
 {
-  char **array;  /* The vector itself.  */
-  int index;     /* Index of the next available element in the array.  */
-  size_t size;      /* The number of entries allocated in the array.  */
+  char **array; /* The vector itself.  */
+  int index;    /* Index of the next available element in the array.  */
+  size_t size;  /* The number of entries allocated in the array.  */
 };
 
 static struct string_vector xnew_string_vector (int initial_size);
@@ -142,27 +142,27 @@ static struct value *make_array_descriptor (struct type *, struct value *,
                                             CORE_ADDR *);
 
 static void ada_add_block_symbols (struct obstack *,
-                                  struct block *, const char *,
+                                   struct block *, const char *,
                                    domain_enum, struct objfile *,
-                                  struct symtab *, int);
+                                   struct symtab *, int);
 
 static int is_nonfunction (struct ada_symbol_info *, int);
 
-static void add_defn_to_vec (struct obstack *, struct symbol *, struct block *,
-                            struct symtab *);
+static void add_defn_to_vec (struct obstack *, struct symbol *,
+                             struct block *, struct symtab *);
 
 static int num_defns_collected (struct obstack *);
 
 static struct ada_symbol_info *defns_collected (struct obstack *, int);
 
 static struct partial_symbol *ada_lookup_partial_symbol (struct partial_symtab
-                                                        *, const char *, int,
-                                                        domain_enum, int);
+                                                         *, const char *, int,
+                                                         domain_enum, int);
 
 static struct symtab *symtab_for_sym (struct symbol *);
 
 static struct value *resolve_subexp (struct expression **, int *, int,
-                                    struct type *);
+                                     struct type *);
 
 static void replace_operator_with_call (struct expression **, int, int, int,
                                         struct symbol *, struct block *);
@@ -182,7 +182,7 @@ static int scalar_type_p (struct type *);
 static int discrete_type_p (struct type *);
 
 static struct type *ada_lookup_struct_elt_type (struct type *, char *,
-                                               int, int, int *);
+                                                int, int, int *);
 
 static char *extended_canonical_line_spec (struct symtab_and_line,
                                            const char *);
@@ -230,13 +230,12 @@ static int is_name_suffix (const char *);
 
 static int wild_match (const char *, int, const char *);
 
-static struct symtabs_and_lines 
+static struct symtabs_and_lines
 find_sal_from_funcs_and_line (const char *, int,
-                             struct ada_symbol_info *, int);
+                              struct ada_symbol_info *, int);
 
-static int find_line_in_linetable (struct linetable *, int, 
-                                  struct ada_symbol_info *,
-                                  int, int *);
+static int find_line_in_linetable (struct linetable *, int,
+                                   struct ada_symbol_info *, int, int *);
 
 static int find_next_line_in_linetable (struct linetable *, int, int, int);
 
@@ -255,17 +254,14 @@ static struct value *value_val_atr (struct type *, struct value *);
 static struct symbol *standard_lookup (const char *, const struct block *,
                                        domain_enum);
 
-extern void symtab_symbol_info (char *regexp, domain_enum kind,
-                                int from_tty);
-
 static struct value *ada_search_struct_field (char *, struct value *, int,
                                               struct type *);
 
 static struct value *ada_value_primitive_field (struct value *, int, int,
                                                 struct type *);
 
-static int find_struct_field (char *, struct type *, int, 
-                             struct type **, int *, int *, int *);
+static int find_struct_field (char *, struct type *, int,
+                              struct type **, int *, int *, int *);
 
 static struct value *ada_to_fixed_value_create (struct type *, CORE_ADDR,
                                                 struct value *);
@@ -284,10 +280,10 @@ static int ada_is_direct_array_type (struct type *);
 
 static void error_breakpoint_runtime_sym_not_found (const char *err_desc);
 
-static int is_runtime_sym_defined  (const char *name, int allow_tramp);
-
+static int is_runtime_sym_defined (const char *name, int allow_tramp);
 \f
 
+
 /* Maximum-sized dynamic type.  */
 static unsigned int varsize_limit;
 
@@ -301,7 +297,7 @@ static char *ada_completer_word_break_characters =
 #endif
 
 /* The name of the symbol to use to get the name of the main subprogram.  */
-static const char ADA_MAIN_PROGRAM_SYMBOL_NAME[] 
+static const char ADA_MAIN_PROGRAM_SYMBOL_NAME[]
   = "__gnat_ada_main_program_name";
 
 /* The name of the runtime function called when an exception is raised.  */
@@ -356,7 +352,7 @@ static struct string_vector
 xnew_string_vector (int initial_size)
 {
   struct string_vector result;
-  
+
   result.array = (char **) xmalloc ((initial_size + 1) * sizeof (char *));
   result.index = 0;
   result.size = initial_size;
@@ -387,10 +383,10 @@ ada_unqualified_name (const char *decoded_name)
   const char *result = strrchr (decoded_name, '.');
 
   if (result != NULL)
-    result++; /* Skip the dot...  */
+    result++;                   /* Skip the dot...  */
   else
     result = decoded_name;
-    
+
   return result;
 }
 
@@ -477,7 +473,8 @@ field_name_match (const char *field_name, const char *target)
     (strncmp (field_name, target, len) == 0
      && (field_name[len] == '\0'
          || (strncmp (field_name + len, "___", 3) == 0
-             && strcmp (field_name + strlen (field_name) - 6, "___XVN") != 0)));
+             && strcmp (field_name + strlen (field_name) - 6,
+                        "___XVN") != 0)));
 }
 
 
@@ -577,8 +574,8 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
       VALUE_BITSIZE (result) = VALUE_BITSIZE (val);
       VALUE_BITPOS (result) = VALUE_BITPOS (val);
       VALUE_ADDRESS (result) = VALUE_ADDRESS (val) + VALUE_OFFSET (val);
-      if (VALUE_LAZY (val) ||
-          TYPE_LENGTH (type) > TYPE_LENGTH (VALUE_TYPE (val)))
+      if (VALUE_LAZY (val)
+          || TYPE_LENGTH (type) > TYPE_LENGTH (VALUE_TYPE (val)))
         VALUE_LAZY (result) = 1;
       else
         memcpy (VALUE_CONTENTS_RAW (result), VALUE_CONTENTS (val),
@@ -626,47 +623,69 @@ ada_translate_error_message (const char *string)
     return string;
 }
 
+/* Note: would have used MAX_OF_TYPE and MIN_OF_TYPE macros from
+   gdbtypes.h, but some of the necessary definitions in that file
+   seem to have gone missing. */
+
+/* Maximum value of a SIZE-byte signed integer type. */
 static LONGEST
-MAX_OF_SIZE (int size) 
+max_of_size (int size)
 {
-  LONGEST top_bit = (LONGEST) 1 << (size*8-2);
-  return top_bit | (top_bit-1);
+  LONGEST top_bit = (LONGEST) 1 << (size * 8 - 2);
+  return top_bit | (top_bit - 1);
 }
 
+/* Minimum value of a SIZE-byte signed integer type. */
 static LONGEST
-MIN_OF_SIZE (int size)
+min_of_size (int size)
 {
-  return - MAX_OF_SIZE (size) - 1;
+  return -max_of_size (size) - 1;
 }
 
+/* Maximum value of a SIZE-byte unsigned integer type. */
 static ULONGEST
-UMAX_OF_SIZE (int size)
+umax_of_size (int size)
 {
-  ULONGEST top_bit = (ULONGEST) 1 << (size*8-1);
-  return top_bit | (top_bit-1);
+  ULONGEST top_bit = (ULONGEST) 1 << (size * 8 - 1);
+  return top_bit | (top_bit - 1);
 }
 
-static ULONGEST
-UMIN_OF_SIZE (int size)
+/* Maximum value of integral type T, as a signed quantity. */
+static LONGEST
+max_of_type (struct type *t)
 {
-  return 0;
+  if (TYPE_UNSIGNED (t))
+    return (LONGEST) umax_of_size (TYPE_LENGTH (t));
+  else
+    return max_of_size (TYPE_LENGTH (t));
+}
+
+/* Minimum value of integral type T, as a signed quantity. */
+static LONGEST
+min_of_type (struct type *t)
+{
+  if (TYPE_UNSIGNED (t)) 
+    return 0;
+  else
+    return min_of_size (TYPE_LENGTH (t));
 }
 
 /* The largest value in the domain of TYPE, a discrete type, as an integer.  */
 static struct value *
 discrete_type_high_bound (struct type *type)
 {
-  switch (TYPE_CODE (type)) 
+  switch (TYPE_CODE (type))
     {
     case TYPE_CODE_RANGE:
       return value_from_longest (TYPE_TARGET_TYPE (type),
-                                TYPE_HIGH_BOUND (type));
+                                 TYPE_HIGH_BOUND (type));
     case TYPE_CODE_ENUM:
-      return 
-       value_from_longest (type, 
-                           TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type)-1));
-    case TYPE_CODE_INT:        
-      return value_from_longest (type, MAX_OF_TYPE (type));
+      return
+        value_from_longest (type,
+                            TYPE_FIELD_BITPOS (type,
+                                               TYPE_NFIELDS (type) - 1));
+    case TYPE_CODE_INT:
+      return value_from_longest (type, max_of_type (type));
     default:
       error ("Unexpected type in discrete_type_high_bound.");
     }
@@ -676,37 +695,36 @@ discrete_type_high_bound (struct type *type)
 static struct value *
 discrete_type_low_bound (struct type *type)
 {
-  switch (TYPE_CODE (type)) 
+  switch (TYPE_CODE (type))
     {
     case TYPE_CODE_RANGE:
       return value_from_longest (TYPE_TARGET_TYPE (type),
-                                TYPE_LOW_BOUND (type));
+                                 TYPE_LOW_BOUND (type));
     case TYPE_CODE_ENUM:
-      return value_from_longest (type, TYPE_FIELD_BITPOS (type, 0)); 
-    case TYPE_CODE_INT:        
-      return value_from_longest (type, MIN_OF_TYPE (type));
+      return value_from_longest (type, TYPE_FIELD_BITPOS (type, 0));
+    case TYPE_CODE_INT:
+      return value_from_longest (type, min_of_type (type));
     default:
       error ("Unexpected type in discrete_type_low_bound.");
     }
 }
 
 /* The identity on non-range types.  For range types, the underlying
-   non-range scalar type.  */  
+   non-range scalar type.  */
 
 static struct type *
 base_type (struct type *type)
 {
   while (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE)
     {
-      if (type == TYPE_TARGET_TYPE (type) 
-         || TYPE_TARGET_TYPE (type) == NULL)   
-       return type;
+      if (type == TYPE_TARGET_TYPE (type) || TYPE_TARGET_TYPE (type) == NULL)
+        return type;
       type = TYPE_TARGET_TYPE (type);
     }
   return type;
 }
-
 \f
+
                                 /* Language Selection */
 
 /* If the main program is in Ada, return language_ada, otherwise return LANG
@@ -735,6 +753,7 @@ ada_main_name (void)
   struct minimal_symbol *msym;
   CORE_ADDR main_program_name_addr;
   static char main_program_name[1024];
+
   /* For Ada, the name of the main procedure is stored in a specific
      string constant, generated by the binder.  Look for that symbol,
      extract its address, and then read that string.  If we didn't find
@@ -852,10 +871,9 @@ ada_encode (const char *decoded)
           const struct ada_opname_map *mapping;
 
           for (mapping = ada_opname_table;
-               mapping->encoded != NULL &&
-               strncmp (mapping->decoded, p,
-                        strlen (mapping->decoded)) != 0;
-               mapping += 1)
+               mapping->encoded != NULL
+               && strncmp (mapping->decoded, p,
+                           strlen (mapping->decoded)) != 0; mapping += 1)
             ;
           if (mapping->encoded == NULL)
             error ("invalid Ada operator name: %s", p);
@@ -965,7 +983,7 @@ ada_decode (const char *encoded)
 
   if (len0 > 3 && strncmp (encoded + len0 - 3, "TKB", 3) == 0)
     len0 -= 3;
-      
+
   if (len0 > 1 && strncmp (encoded + len0 - 1, "B", 1) == 0)
     len0 -= 1;
 
@@ -997,8 +1015,8 @@ ada_decode (const char *encoded)
           for (k = 0; ada_opname_table[k].encoded != NULL; k += 1)
             {
               int op_len = strlen (ada_opname_table[k].encoded);
-              if (strncmp (ada_opname_table[k].encoded + 1, encoded + i + 1,
-                           op_len - 1) == 0
+              if ((strncmp (ada_opname_table[k].encoded + 1, encoded + i + 1,
+                            op_len - 1) == 0)
                   && !isalnum (encoded[i + op_len]))
                 {
                   strcpy (decoded + j, ada_opname_table[k].decoded);
@@ -1076,51 +1094,52 @@ static struct htab *decoded_names_store;
    The GSYMBOL parameter is "mutable" in the C++ sense: logically
    const, but nevertheless modified to a semantically equivalent form
    when a decoded name is cached in it.
-*/ 
+*/
 
-char *ada_decode_symbol (const struct general_symbol_info *gsymbol)
+char *
+ada_decode_symbol (const struct general_symbol_info *gsymbol)
 {
-  char **resultp = 
+  char **resultp =
     (char **) &gsymbol->language_specific.cplus_specific.demangled_name;
   if (*resultp == NULL)
     {
       const char *decoded = ada_decode (gsymbol->name);
       if (gsymbol->bfd_section != NULL)
-       {
-         bfd *obfd = gsymbol->bfd_section->owner;
-         if (obfd != NULL)
-           {
-             struct objfile *objf;
-             ALL_OBJFILES (objf)
-               {
-                 if (obfd == objf->obfd)
-                   {
-                     *resultp = obsavestring (decoded, strlen (decoded), 
-                                              &objf->objfile_obstack);
-                     break;
-                   }
-               }
-           }
-       }
+        {
+          bfd *obfd = gsymbol->bfd_section->owner;
+          if (obfd != NULL)
+            {
+              struct objfile *objf;
+              ALL_OBJFILES (objf)
+              {
+                if (obfd == objf->obfd)
+                  {
+                    *resultp = obsavestring (decoded, strlen (decoded),
+                                             &objf->objfile_obstack);
+                    break;
+                  }
+              }
+            }
+        }
       /* Sometimes, we can't find a corresponding objfile, in which
-        case, we put the result on the heap.  Since we only decode
-        when needed, we hope this usually does not cause a
-        significant memory leak (FIXME).  */
+         case, we put the result on the heap.  Since we only decode
+         when needed, we hope this usually does not cause a
+         significant memory leak (FIXME).  */
       if (*resultp == NULL)
-       {
-         char **slot = 
-           (char **) htab_find_slot (decoded_names_store, 
-                                    decoded, INSERT);
-         if (*slot == NULL) 
-           *slot = xstrdup (decoded);
-         *resultp = *slot;
-       }
+        {
+          char **slot = (char **) htab_find_slot (decoded_names_store,
+                                                  decoded, INSERT);
+          if (*slot == NULL)
+            *slot = xstrdup (decoded);
+          *resultp = *slot;
+        }
     }
 
   return *resultp;
 }
-       
-char *ada_la_decode (const char *encoded, int options)
+
+char *
+ada_la_decode (const char *encoded, int options)
 {
   return xstrdup (ada_decode (encoded));
 }
@@ -1197,9 +1216,9 @@ desc_base_type (struct type *type)
   if (type == NULL)
     return NULL;
   CHECK_TYPEDEF (type);
-  if (type != NULL &&
-      (TYPE_CODE (type) == TYPE_CODE_PTR
-       || TYPE_CODE (type) == TYPE_CODE_REF))
+  if (type != NULL
+      && (TYPE_CODE (type) == TYPE_CODE_PTR
+          || TYPE_CODE (type) == TYPE_CODE_REF))
     return check_typedef (TYPE_TARGET_TYPE (type));
   else
     return type;
@@ -1261,7 +1280,7 @@ is_thick_pntr (struct type *type)
 
 /* If TYPE is the type of an array descriptor (fat or thin pointer) or a
    pointer to one, the type of its bounds data; otherwise, NULL.  */
-  
+
 static struct type *
 desc_bounds_type (struct type *type)
 {
@@ -1433,7 +1452,7 @@ desc_bound_bitpos (struct type *type, int i, int which)
    of the Ith lower bound stored in it, if WHICH is 0, and the Ith upper
    bound, if WHICH is 1.  The first bound is I=1.  */
 
-  static int
+static int
 desc_bound_bitsize (struct type *type, int i, int which)
 {
   type = desc_base_type (type);
@@ -1475,14 +1494,14 @@ desc_arity (struct type *type)
    an array descriptor type (representing an unconstrained array
    type).  */
 
-static int 
-ada_is_direct_array_type (struct type *type) 
+static int
+ada_is_direct_array_type (struct type *type)
 {
   if (type == NULL)
     return 0;
   CHECK_TYPEDEF (type);
   return (TYPE_CODE (type) == TYPE_CODE_ARRAY
-         || ada_is_array_descriptor_type (type));
+          || ada_is_array_descriptor_type (type));
 }
 
 /* Non-zero iff TYPE is a simple array type or pointer to one.  */
@@ -1513,8 +1532,7 @@ ada_is_array_descriptor_type (struct type *type)
     && ((TYPE_CODE (data_type) == TYPE_CODE_PTR
          && TYPE_TARGET_TYPE (data_type) != NULL
          && TYPE_CODE (TYPE_TARGET_TYPE (data_type)) == TYPE_CODE_ARRAY)
-        ||
-        TYPE_CODE (data_type) == TYPE_CODE_ARRAY)
+        || TYPE_CODE (data_type) == TYPE_CODE_ARRAY)
     && desc_arity (desc_bounds_type (type)) > 0;
 }
 
@@ -1922,8 +1940,8 @@ ada_value_primitive_packed_val (struct value *obj, char *valaddr, long offset,
   else if (BITS_BIG_ENDIAN)
     {
       src = len - 1;
-      if (has_negatives (type) &&
-          ((bytes[0] << bit_offset) & (1 << (HOST_CHAR_BIT - 1))))
+      if (has_negatives (type)
+          && ((bytes[0] << bit_offset) & (1 << (HOST_CHAR_BIT - 1))))
         sign = ~0;
 
       unusedLS =
@@ -2174,6 +2192,37 @@ ada_value_ptr_subscript (struct value *arr, struct type *type, int arity,
   return value_ind (arr);
 }
 
+/* Given that ARRAY_PTR is a pointer or reference to an array of type TYPE (the
+   actual type of ARRAY_PTR is ignored), returns a reference to
+   the Ada slice of HIGH-LOW+1 elements starting at index LOW.  The lower
+   bound of this array is LOW, as per Ada rules. */
+static struct value *
+ada_value_slice_ptr (struct value *array_ptr, struct type *type,
+                     int low, int high)
+{
+  CORE_ADDR base = value_as_address (array_ptr)
+    + ((low - TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type)))
+       * TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
+  struct type *index_type =
+    create_range_type (NULL, TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (type)),
+                       low, high);
+  struct type *slice_type =
+    create_array_type (NULL, TYPE_TARGET_TYPE (type), index_type);
+  return value_from_pointer (lookup_reference_type (slice_type), base);
+}
+
+
+static struct value *
+ada_value_slice (struct value *array, int low, int high)
+{
+  struct type *type = VALUE_TYPE (array);
+  struct type *index_type =
+    create_range_type (NULL, TYPE_INDEX_TYPE (type), low, high);
+  struct type *slice_type =
+    create_array_type (NULL, TYPE_TARGET_TYPE (type), index_type);
+  return value_cast (slice_type, value_slice (array, low, high - low + 1));
+}
+
 /* If type is a record type in the form of a standard GNAT array
    descriptor, returns the number of dimensions for type.  If arr is a
    simple array, returns the number of "array of"s that prefix its
@@ -2269,10 +2318,9 @@ ada_index_type (struct type *type, int n)
       result_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0));
       /* FIXME: The stabs type r(0,0);bound;bound in an array type
          has a target type of TYPE_CODE_UNDEF.  We compensate here, but
-        perhaps stabsread.c would make more sense.  */
-      if (result_type == NULL 
-         || TYPE_CODE (result_type) == TYPE_CODE_UNDEF)
-       result_type = builtin_type_int;
+         perhaps stabsread.c would make more sense.  */
+      if (result_type == NULL || TYPE_CODE (result_type) == TYPE_CODE_UNDEF)
+        result_type = builtin_type_int;
 
       return result_type;
     }
@@ -2405,8 +2453,11 @@ ada_array_length (struct value *arr, int n)
 static struct value *
 empty_array (struct type *arr_type, int low)
 {
-  return allocate_value (create_range_type (NULL, TYPE_INDEX_TYPE (arr_type),
-                                            low, low - 1));
+  struct type *index_type =
+    create_range_type (NULL, TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (arr_type)),
+                       low, low - 1);
+  struct type *elt_type = ada_array_element_type (arr_type, 1);
+  return allocate_value (create_array_type (NULL, elt_type, index_type));
 }
 \f
 
@@ -2457,7 +2508,7 @@ resolve (struct expression **expp, int void_context_p)
 
 static struct value *
 resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
-               struct type *context_type)
+                struct type *context_type)
 {
   int pc = *pos;
   int i;
@@ -2475,8 +2526,8 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
     {
     case OP_FUNCALL:
       if (exp->elts[pc + 3].opcode == OP_VAR_VALUE
-         && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
-       *pos += 7;
+          && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
+        *pos += 7;
       else
         {
           *pos += 3;
@@ -2602,7 +2653,8 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
 
     case OP_STRING:
       (*pos) += 3 
-       + BYTES_TO_EXP_ELEM (longest_to_int (exp->elts[pc + 1].longconst) + 1);
+        + BYTES_TO_EXP_ELEM (longest_to_int (exp->elts[pc + 1].longconst) 
+                             + 1);
       break;
 
     case TERNOP_SLICE:
@@ -2620,8 +2672,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
       error ("Unexpected operator during name resolution");
     }
 
-  argvec =
-    (struct value * *) alloca (sizeof (struct value *) * (nargs + 1));
+  argvec = (struct value * *) alloca (sizeof (struct value *) * (nargs + 1));
   for (i = 0; i < nargs; i += 1)
     argvec[i] = resolve_subexp (expp, pos, 1, NULL);
   argvec[i] = NULL;
@@ -2635,121 +2686,121 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
 
     case OP_VAR_VALUE:
       if (SYMBOL_DOMAIN (exp->elts[pc + 2].symbol) == UNDEF_DOMAIN)
-       {
-         struct ada_symbol_info *candidates;
-         int n_candidates;
-
-         n_candidates =
-           ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME (exp->elts[pc + 2]
-                                                        .symbol),
-                                   exp->elts[pc + 1].block,
-                                   VAR_DOMAIN, &candidates);
-
-         if (n_candidates > 1)
-           {
-             /* Types tend to get re-introduced locally, so if there
-                are any local symbols that are not types, first filter
-                out all types.  */
-             int j;
-             for (j = 0; j < n_candidates; j += 1)
-               switch (SYMBOL_CLASS (candidates[j].sym))
-                 {
-                 case LOC_REGISTER:
-                 case LOC_ARG:
-                 case LOC_REF_ARG:
-                 case LOC_REGPARM:
-                 case LOC_REGPARM_ADDR:
-                 case LOC_LOCAL:
-                 case LOC_LOCAL_ARG:
-                 case LOC_BASEREG:
-                 case LOC_BASEREG_ARG:
-                 case LOC_COMPUTED:
-                 case LOC_COMPUTED_ARG:
-                   goto FoundNonType;
-                 default:
-                   break;
-                 }
-           FoundNonType:
-             if (j < n_candidates)
-               {
-                 j = 0;
-                 while (j < n_candidates)
-                   {
-                     if (SYMBOL_CLASS (candidates[j].sym) == LOC_TYPEDEF)
-                       {
-                         candidates[j] = candidates[n_candidates - 1];
-                         n_candidates -= 1;
-                       }
-                     else
-                       j += 1;
-                   }
-               }
-           }
-
-         if (n_candidates == 0)
-           error ("No definition found for %s",
-                  SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol));
-         else if (n_candidates == 1)
-           i = 0;
-         else if (deprocedure_p
-                  && !is_nonfunction (candidates, n_candidates))
-           {
-             i = ada_resolve_function (candidates, n_candidates, NULL, 0,
-                                       SYMBOL_LINKAGE_NAME (exp->elts[pc + 2]
-                                                            .symbol),
-                                       context_type);
-             if (i < 0)
-               error ("Could not find a match for %s",
-                      SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol));
-           }
-         else
-           {
-             printf_filtered ("Multiple matches for %s\n",
-                              SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol));
-             user_select_syms (candidates, n_candidates, 1);
-             i = 0;
-           }
-
-         exp->elts[pc + 1].block = candidates[i].block;
-         exp->elts[pc + 2].symbol = candidates[i].sym;
-         if (innermost_block == NULL ||
-             contained_in (candidates[i].block, innermost_block))
-           innermost_block = candidates[i].block;
-       }
+        {
+          struct ada_symbol_info *candidates;
+          int n_candidates;
 
-      if (deprocedure_p 
-         && (TYPE_CODE (SYMBOL_TYPE (exp->elts[pc + 2].symbol)) 
-             == TYPE_CODE_FUNC))
-       {
-         replace_operator_with_call (expp, pc, 0, 0,
-                                     exp->elts[pc + 2].symbol,
-                                     exp->elts[pc + 1].block);
-         exp = *expp;
-       }
+          n_candidates =
+            ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME
+                                    (exp->elts[pc + 2].symbol),
+                                    exp->elts[pc + 1].block, VAR_DOMAIN,
+                                    &candidates);
+
+          if (n_candidates > 1)
+            {
+              /* Types tend to get re-introduced locally, so if there
+                 are any local symbols that are not types, first filter
+                 out all types.  */
+              int j;
+              for (j = 0; j < n_candidates; j += 1)
+                switch (SYMBOL_CLASS (candidates[j].sym))
+                  {
+                  case LOC_REGISTER:
+                  case LOC_ARG:
+                  case LOC_REF_ARG:
+                  case LOC_REGPARM:
+                  case LOC_REGPARM_ADDR:
+                  case LOC_LOCAL:
+                  case LOC_LOCAL_ARG:
+                  case LOC_BASEREG:
+                  case LOC_BASEREG_ARG:
+                  case LOC_COMPUTED:
+                  case LOC_COMPUTED_ARG:
+                    goto FoundNonType;
+                  default:
+                    break;
+                  }
+            FoundNonType:
+              if (j < n_candidates)
+                {
+                  j = 0;
+                  while (j < n_candidates)
+                    {
+                      if (SYMBOL_CLASS (candidates[j].sym) == LOC_TYPEDEF)
+                        {
+                          candidates[j] = candidates[n_candidates - 1];
+                          n_candidates -= 1;
+                        }
+                      else
+                        j += 1;
+                    }
+                }
+            }
+
+          if (n_candidates == 0)
+            error ("No definition found for %s",
+                   SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol));
+          else if (n_candidates == 1)
+            i = 0;
+          else if (deprocedure_p
+                   && !is_nonfunction (candidates, n_candidates))
+            {
+              i = ada_resolve_function
+                (candidates, n_candidates, NULL, 0,
+                 SYMBOL_LINKAGE_NAME (exp->elts[pc + 2].symbol),
+                 context_type);
+              if (i < 0)
+                error ("Could not find a match for %s",
+                       SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol));
+            }
+          else
+            {
+              printf_filtered ("Multiple matches for %s\n",
+                               SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol));
+              user_select_syms (candidates, n_candidates, 1);
+              i = 0;
+            }
+
+          exp->elts[pc + 1].block = candidates[i].block;
+          exp->elts[pc + 2].symbol = candidates[i].sym;
+          if (innermost_block == NULL
+              || contained_in (candidates[i].block, innermost_block))
+            innermost_block = candidates[i].block;
+        }
+
+      if (deprocedure_p
+          && (TYPE_CODE (SYMBOL_TYPE (exp->elts[pc + 2].symbol))
+              == TYPE_CODE_FUNC))
+        {
+          replace_operator_with_call (expp, pc, 0, 0,
+                                      exp->elts[pc + 2].symbol,
+                                      exp->elts[pc + 1].block);
+          exp = *expp;
+        }
       break;
 
     case OP_FUNCALL:
       {
         if (exp->elts[pc + 3].opcode == OP_VAR_VALUE
-           && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
+            && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
           {
             struct ada_symbol_info *candidates;
             int n_candidates;
 
             n_candidates =
-             ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME (exp->elts[pc + 5]
-                                                          .symbol),
-                                     exp->elts[pc + 4].block,
-                                     VAR_DOMAIN, &candidates);
+              ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME
+                                      (exp->elts[pc + 5].symbol),
+                                      exp->elts[pc + 4].block, VAR_DOMAIN,
+                                      &candidates);
             if (n_candidates == 1)
               i = 0;
             else
               {
-                i = ada_resolve_function (candidates, n_candidates, 
-                                         argvec, nargs,
-                                          SYMBOL_LINKAGE_NAME (exp->elts[pc+5]
-                                                              .symbol),
-                                          context_type);
+                i = ada_resolve_function
+                  (candidates, n_candidates,
+                   argvec, nargs,
+                   SYMBOL_LINKAGE_NAME (exp->elts[pc + 5].symbol),
+                   context_type);
                 if (i < 0)
                   error ("Could not find a match for %s",
                          SYMBOL_PRINT_NAME (exp->elts[pc + 5].symbol));
@@ -2757,8 +2808,8 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
 
             exp->elts[pc + 4].block = candidates[i].block;
             exp->elts[pc + 5].symbol = candidates[i].sym;
-            if (innermost_block == NULL ||
-                contained_in (candidates[i].block, innermost_block))
+            if (innermost_block == NULL
+                || contained_in (candidates[i].block, innermost_block))
               innermost_block = candidates[i].block;
           }
       }
@@ -2794,12 +2845,12 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
                                     (struct block *) NULL, VAR_DOMAIN,
                                     &candidates);
           i = ada_resolve_function (candidates, n_candidates, argvec, nargs,
-                                   ada_decoded_op_name (op), NULL);
+                                    ada_decoded_op_name (op), NULL);
           if (i < 0)
             break;
 
-          replace_operator_with_call (expp, pc, nargs, 1, 
-                                     candidates[i].sym, candidates[i].block);
+          replace_operator_with_call (expp, pc, nargs, 1,
+                                      candidates[i].sym, candidates[i].block);
           exp = *expp;
         }
       break;
@@ -2843,8 +2894,8 @@ ada_type_match (struct type *ftype, struct type *atype, int may_deref)
         return ada_type_match (TYPE_TARGET_TYPE (ftype),
                                TYPE_TARGET_TYPE (atype), 0);
       else
-        return (may_deref &&
-                ada_type_match (TYPE_TARGET_TYPE (ftype), atype, 0));
+        return (may_deref
+                && ada_type_match (TYPE_TARGET_TYPE (ftype), atype, 0));
     case TYPE_CODE_INT:
     case TYPE_CODE_ENUM:
     case TYPE_CODE_RANGE:
@@ -2887,8 +2938,8 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
   int i;
   struct type *func_type = SYMBOL_TYPE (func);
 
-  if (SYMBOL_CLASS (func) == LOC_CONST &&
-      TYPE_CODE (func_type) == TYPE_CODE_ENUM)
+  if (SYMBOL_CLASS (func) == LOC_CONST
+      && TYPE_CODE (func_type) == TYPE_CODE_ENUM)
     return (n_actuals == 0);
   else if (func_type == NULL || TYPE_CODE (func_type) != TYPE_CODE_FUNC)
     return 0;
@@ -2899,15 +2950,15 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
   for (i = 0; i < n_actuals; i += 1)
     {
       if (actuals[i] == NULL)
-       return 0;
-      else     
-       {
-         struct type *ftype = check_typedef (TYPE_FIELD_TYPE (func_type, i));
-         struct type *atype = check_typedef (VALUE_TYPE (actuals[i]));
+        return 0;
+      else
+        {
+          struct type *ftype = check_typedef (TYPE_FIELD_TYPE (func_type, i));
+          struct type *atype = check_typedef (VALUE_TYPE (actuals[i]));
 
-         if (!ada_type_match (ftype, atype, 1))
-           return 0;
-       }
+          if (!ada_type_match (ftype, atype, 1))
+            return 0;
+        }
     }
   return 1;
 }
@@ -3096,13 +3147,13 @@ user_select_syms (struct ada_symbol_info *syms, int nsyms, int max_results)
 
       if (SYMBOL_CLASS (syms[i].sym) == LOC_BLOCK)
         {
-          struct symtab_and_line sal = find_function_start_sal (syms[i].sym, 1);
-          printf_unfiltered ("[%d] %s at %s:%d\n",
-                             i + first_choice,
+          struct symtab_and_line sal =
+            find_function_start_sal (syms[i].sym, 1);
+          printf_unfiltered ("[%d] %s at %s:%d\n", i + first_choice,
                              SYMBOL_PRINT_NAME (syms[i].sym),
-                             sal.symtab == NULL
-                             ? "<no source file available>"
-                             : sal.symtab->filename, sal.line);
+                             (sal.symtab == NULL
+                              ? "<no source file available>"
+                              : sal.symtab->filename), sal.line);
           continue;
         }
       else
@@ -3118,11 +3169,12 @@ user_select_syms (struct ada_symbol_info *syms, int nsyms, int max_results)
                                i + first_choice,
                                SYMBOL_PRINT_NAME (syms[i].sym),
                                symtab->filename, SYMBOL_LINE (syms[i].sym));
-          else if (is_enumeral && TYPE_NAME (SYMBOL_TYPE (syms[i].sym)) != NULL)
+          else if (is_enumeral
+                   && TYPE_NAME (SYMBOL_TYPE (syms[i].sym)) != NULL)
             {
               printf_unfiltered ("[%d] ", i + first_choice);
-              ada_print_type (SYMBOL_TYPE (syms[i].sym), NULL, 
-                             gdb_stdout, -1, 0);
+              ada_print_type (SYMBOL_TYPE (syms[i].sym), NULL,
+                              gdb_stdout, -1, 0);
               printf_unfiltered ("'(%s) (enumeral)\n",
                                  SYMBOL_PRINT_NAME (syms[i].sym));
             }
@@ -3189,7 +3241,7 @@ get_selections (int *choices, int n_choices, int max_results,
     error_no_arg ("one or more choice numbers");
 
   n_chosen = 0;
-  
+
   /* Set choices[0 .. n_chosen-1] to the users' choices in ascending
      order, as given in args.  Choices are validated.  */
   while (1)
@@ -3373,7 +3425,7 @@ discrete_type_p (struct type *type)
 static int
 possible_user_operator_p (enum exp_opcode op, struct value *args[])
 {
-  struct type *type0 = 
+  struct type *type0 =
     (args[0] == NULL) ? NULL : check_typedef (VALUE_TYPE (args[0]));
   struct type *type1 =
     (args[1] == NULL) ? NULL : check_typedef (VALUE_TYPE (args[1]));
@@ -3408,13 +3460,14 @@ possible_user_operator_p (enum exp_opcode op, struct value *args[])
       return (!(scalar_type_p (type0) && scalar_type_p (type1)));
 
     case BINOP_CONCAT:
-      return ((TYPE_CODE (type0) != TYPE_CODE_ARRAY &&
-               (TYPE_CODE (type0) != TYPE_CODE_PTR ||
-                TYPE_CODE (TYPE_TARGET_TYPE (type0))
-                != TYPE_CODE_ARRAY))
-              || (TYPE_CODE (type1) != TYPE_CODE_ARRAY &&
-                  (TYPE_CODE (type1) != TYPE_CODE_PTR ||
-                   TYPE_CODE (TYPE_TARGET_TYPE (type1)) != TYPE_CODE_ARRAY)));
+      return
+        ((TYPE_CODE (type0) != TYPE_CODE_ARRAY
+          && (TYPE_CODE (type0) != TYPE_CODE_PTR
+              || TYPE_CODE (TYPE_TARGET_TYPE (type0)) != TYPE_CODE_ARRAY))
+         || (TYPE_CODE (type1) != TYPE_CODE_ARRAY
+             && (TYPE_CODE (type1) != TYPE_CODE_PTR
+                 || (TYPE_CODE (TYPE_TARGET_TYPE (type1)) 
+                    != TYPE_CODE_ARRAY))));
 
     case BINOP_EXP:
       return (!(numeric_type_p (type0) && integer_type_p (type1)));
@@ -3504,24 +3557,36 @@ ada_simple_renamed_entity (struct symbol *sym)
 static struct value *
 ensure_lval (struct value *val, CORE_ADDR *sp)
 {
-  CORE_ADDR old_sp = *sp;
-
-  if (VALUE_LVAL (val))
-    return val;
+  if (! VALUE_LVAL (val))
+    {
+      int len = TYPE_LENGTH (check_typedef (VALUE_TYPE (val)));
 
-  if (DEPRECATED_STACK_ALIGN_P ())
-    *sp = push_bytes (*sp, VALUE_CONTENTS_RAW (val),
-                      DEPRECATED_STACK_ALIGN 
-                     (TYPE_LENGTH (check_typedef (VALUE_TYPE (val)))));
-  else
-    *sp = push_bytes (*sp, VALUE_CONTENTS_RAW (val),
-                      TYPE_LENGTH (check_typedef (VALUE_TYPE (val))));
+      /* The following is taken from the structure-return code in
+        call_function_by_hand. FIXME: Therefore, some refactoring seems 
+        indicated. */
+      if (INNER_THAN (1, 2))
+       {
+         /* Stack grows downward.  Align SP and VALUE_ADDRESS (val) after
+            reserving sufficient space. */
+         *sp -= len;
+         if (gdbarch_frame_align_p (current_gdbarch))
+           *sp = gdbarch_frame_align (current_gdbarch, *sp);
+         VALUE_ADDRESS (val) = *sp;
+       }
+      else
+       {
+         /* Stack grows upward.  Align the frame, allocate space, and
+            then again, re-align the frame. */
+         if (gdbarch_frame_align_p (current_gdbarch))
+           *sp = gdbarch_frame_align (current_gdbarch, *sp);
+         VALUE_ADDRESS (val) = *sp;
+         *sp += len;
+         if (gdbarch_frame_align_p (current_gdbarch))
+           *sp = gdbarch_frame_align (current_gdbarch, *sp);
+       }
 
-  VALUE_LVAL (val) = lval_memory;
-  if (INNER_THAN (1, 2))
-    VALUE_ADDRESS (val) = *sp;
-  else
-    VALUE_ADDRESS (val) = old_sp;
+      write_memory (VALUE_ADDRESS (val), VALUE_CONTENTS_RAW (val), len);
+    }
 
   return val;
 }
@@ -3604,9 +3669,9 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp)
   bounds = ensure_lval (bounds, sp);
 
   modify_general_field (VALUE_CONTENTS (descriptor),
-                       VALUE_ADDRESS (ensure_lval (arr, sp)),
-                       fat_pntr_data_bitpos (desc_type),
-                       fat_pntr_data_bitsize (desc_type));
+                        VALUE_ADDRESS (ensure_lval (arr, sp)),
+                        fat_pntr_data_bitpos (desc_type),
+                        fat_pntr_data_bitsize (desc_type));
 
   modify_general_field (VALUE_CONTENTS (descriptor),
                         VALUE_ADDRESS (bounds),
@@ -3645,7 +3710,7 @@ ada_convert_actuals (struct value *func, int nargs, struct value *args[],
       convert_actual (args[i], TYPE_FIELD_TYPE (VALUE_TYPE (func), i), sp);
 }
 \f
-                               /* Experimental Symbol Cache Module */
+                                /* Experimental Symbol Cache Module */
 
 /* This module may well have been OBE, due to improvements in the 
    symbol-table module.  So until proven otherwise, it is disabled in
@@ -3664,7 +3729,8 @@ ada_convert_actuals (struct value *func, int nargs, struct value *args[],
 
 #define HASH_SIZE 1009
 
-struct cache_entry {
+struct cache_entry
+{
   const char *name;
   domain_enum namespace;
   struct symbol *sym;
@@ -3695,7 +3761,7 @@ find_entry (const char *name, domain_enum namespace)
   for (e = &cache[h]; *e != NULL; e = &(*e)->next)
     {
       if (namespace == (*e)->namespace && strcmp (name, (*e)->name) == 0)
-       return e;
+        return e;
     }
   return NULL;
 }
@@ -3708,8 +3774,8 @@ find_entry (const char *name, domain_enum namespace)
 
 static int
 lookup_cached_symbol (const char *name, domain_enum namespace,
-                     struct symbol **sym, struct block **block,
-                     struct symtab **symtab)
+                      struct symbol **sym, struct block **block,
+                      struct symtab **symtab)
 {
   struct cache_entry **e = find_entry (name, namespace);
   if (e == NULL)
@@ -3728,12 +3794,12 @@ lookup_cached_symbol (const char *name, domain_enum namespace,
 
 static void
 cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
-             struct block *block, struct symtab *symtab)
+              struct block *block, struct symtab *symtab)
 {
   int h = msymbol_hash (name) % HASH_SIZE;
   char *copy;
   struct cache_entry *e =
-    (struct cache_entry *) obstack_alloc(&cache_space, sizeof (*e));
+    (struct cache_entry *) obstack_alloc (&cache_space, sizeof (*e));
   e->next = cache[h];
   cache[h] = e;
   e->name = copy = obstack_alloc (&cache_space, strlen (name) + 1);
@@ -3747,18 +3813,18 @@ cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
 #else
 static int
 lookup_cached_symbol (const char *name, domain_enum namespace,
-                     struct symbol **sym, struct block **block,
-                     struct symtab **symtab)
+                      struct symbol **sym, struct block **block,
+                      struct symtab **symtab)
 {
   return 0;
 }
 
 static void
 cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
-             struct block *block, struct symtab *symtab)
+              struct block *block, struct symtab *symtab)
 {
 }
-#endif   /* GNAT_GDB */
+#endif /* GNAT_GDB */
 \f
                                 /* Symbol Lookup */
 
@@ -3774,7 +3840,8 @@ standard_lookup (const char *name, const struct block *block,
 
   if (lookup_cached_symbol (name, domain, &sym, NULL, NULL))
     return sym;
-  sym = lookup_symbol_in_language (name, block, domain, language_c, 0, &symtab);
+  sym =
+    lookup_symbol_in_language (name, block, domain, language_c, 0, &symtab);
   cache_symbol (name, domain, sym, block_found, symtab);
   return sym;
 }
@@ -3858,10 +3925,9 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1)
    records in OBSTACKP.  Do nothing if SYM is a duplicate.  */
 
 static void
-add_defn_to_vec (struct obstack *obstackp, 
-                struct symbol *sym, 
-                struct block *block, 
-                struct symtab *symtab)
+add_defn_to_vec (struct obstack *obstackp,
+                 struct symbol *sym,
+                 struct block *block, struct symtab *symtab)
 {
   int i;
   size_t tmp;
@@ -3877,9 +3943,9 @@ add_defn_to_vec (struct obstack *obstackp,
         {
           prevDefns[i].sym = sym;
           prevDefns[i].block = block;
-         prevDefns[i].symtab = symtab;
+          prevDefns[i].symtab = symtab;
           return;
-       }
+        }
     }
 
   {
@@ -3895,8 +3961,8 @@ add_defn_to_vec (struct obstack *obstackp,
 /* Number of ada_symbol_info structures currently collected in 
    current vector in *OBSTACKP.  */
 
-static int 
-num_defns_collected (struct obstack *obstackp) 
+static int
+num_defns_collected (struct obstack *obstackp)
 {
   return obstack_object_size (obstackp) / sizeof (struct ada_symbol_info);
 }
@@ -3905,7 +3971,7 @@ num_defns_collected (struct obstack *obstackp)
    vector in *OBSTACKP.  If FINISH, close off the vector and return
    its final address.  */
 
-static struct ada_symbol_info * 
+static struct ada_symbol_info *
 defns_collected (struct obstack *obstackp, int finish)
 {
   if (finish)
@@ -3942,8 +4008,8 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
         {
           struct partial_symbol *psym = start[i];
 
-          if (SYMBOL_DOMAIN (psym) == namespace &&
-              wild_match (name, name_len, SYMBOL_LINKAGE_NAME (psym)))
+          if (SYMBOL_DOMAIN (psym) == namespace
+              && wild_match (name, name_len, SYMBOL_LINKAGE_NAME (psym)))
             return psym;
         }
       return NULL;
@@ -3987,7 +4053,7 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
                 }
               else if (cmp == 0
                        && is_name_suffix (SYMBOL_LINKAGE_NAME (psym)
-                                         + name_len))
+                                          + name_len))
                 return psym;
             }
           i += 1;
@@ -4029,7 +4095,7 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
                   cmp = strncmp ("_ada_", SYMBOL_LINKAGE_NAME (psym), 5);
                   if (cmp == 0)
                     cmp = strncmp (name, SYMBOL_LINKAGE_NAME (psym) + 5,
-                                  name_len);
+                                   name_len);
                 }
 
               if (cmp < 0)
@@ -4039,7 +4105,7 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
                 }
               else if (cmp == 0
                        && is_name_suffix (SYMBOL_LINKAGE_NAME (psym)
-                                         + name_len + 5))
+                                          + name_len + 5))
                 return psym;
             }
           i += 1;
@@ -4071,12 +4137,12 @@ symtab_for_sym (struct symbol *sym)
       case LOC_LABEL:
       case LOC_BLOCK:
       case LOC_CONST_BYTES:
-       b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
-       ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym)
-         return s;
-       b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
-       ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym)
-         return s;
+        b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
+        ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym)
+          return s;
+        b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
+        ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym)
+          return s;
         break;
       default:
         break;
@@ -4095,14 +4161,14 @@ symtab_for_sym (struct symbol *sym)
       case LOC_BASEREG_ARG:
       case LOC_COMPUTED:
       case LOC_COMPUTED_ARG:
-       for (j = FIRST_LOCAL_BLOCK;
-            j < BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (s)); j += 1)
-         {
-           b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), j);
-           ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym)
-             return s;
-         }
-       break;
+        for (j = FIRST_LOCAL_BLOCK;
+             j < BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (s)); j += 1)
+          {
+            b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), j);
+            ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym)
+              return s;
+          }
+        break;
       default:
         break;
       }
@@ -4145,7 +4211,7 @@ ada_lookup_simple_minsym (const char *name)
 
 static struct minimal_symbol *
 ada_lookup_minimal_symbol (const char *name, const char *sfile,
-                          struct objfile *objf)
+                           struct objfile *objf)
 {
   return ada_lookup_simple_minsym (ada_encode (name));
 }
@@ -4158,7 +4224,7 @@ ada_lookup_minimal_symbol (const char *name, const char *sfile,
 
 static void
 add_symbols_from_enclosing_procs (struct obstack *obstackp,
-                                 const char *name, domain_enum namespace,
+                                  const char *name, domain_enum namespace,
                                   int wild_match)
 {
 #ifdef HAVE_ADD_SYMBOLS_FROM_ENCLOSING_PROCS
@@ -4173,7 +4239,7 @@ add_symbols_from_enclosing_procs (struct obstack *obstackp,
   struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
   struct frame_info *frame;
 
-  if (! target_has_stack)
+  if (!target_has_stack)
     return;
 
   if (static_link == NULL)
@@ -4191,39 +4257,38 @@ add_symbols_from_enclosing_procs (struct obstack *obstackp,
     }
 
   frame = get_selected_frame ();
-  if (frame == NULL
-      || inside_main_func (get_frame_address_in_block (frame)))
+  if (frame == NULL || inside_main_func (get_frame_address_in_block (frame)))
     return;
 
   target_link_val = read_var_value (static_link, frame);
   while (target_link_val != NULL
-        && num_defns_collected (obstackp) == 0 
-        && frame_relative_level (frame) <= MAX_ENCLOSING_FRAME_LEVELS)
+         && num_defns_collected (obstackp) == 0
+         && frame_relative_level (frame) <= MAX_ENCLOSING_FRAME_LEVELS)
     {
       CORE_ADDR target_link = value_as_address (target_link_val);
 
       frame = get_prev_frame (frame);
       if (frame == NULL)
-       break;
+        break;
 
       if (get_frame_locals_address (frame) == target_link)
-       {
-         struct block *block;
-      
-         QUIT;
-
-         block = get_frame_block (frame, 0);
-         while (block != NULL && block_function (block) != NULL 
-                && num_defns_collected (obstackp) == 0)
-           {
-             QUIT;
-
-             ada_add_block_symbols (obstackp, block, name, namespace,
-                                    NULL, NULL, wild_match);
-             
-             block = BLOCK_SUPERBLOCK (block);
-           }
-       }
+        {
+          struct block *block;
+
+          QUIT;
+
+          block = get_frame_block (frame, 0);
+          while (block != NULL && block_function (block) != NULL
+                 && num_defns_collected (obstackp) == 0)
+            {
+              QUIT;
+
+              ada_add_block_symbols (obstackp, block, name, namespace,
+                                     NULL, NULL, wild_match);
+
+              block = BLOCK_SUPERBLOCK (block);
+            }
+        }
     }
 
   do_cleanups (old_chain);
@@ -4232,7 +4297,8 @@ add_symbols_from_enclosing_procs (struct obstack *obstackp,
 
 /* FIXME: The next two routines belong in symtab.c */
 
-static void restore_language (void* lang)
+static void
+restore_language (void *lang)
 {
   set_language ((enum language) lang);
 }
@@ -4242,11 +4308,11 @@ static void restore_language (void* lang)
 
 struct symbol *
 lookup_symbol_in_language (const char *name, const struct block *block,
-                          domain_enum domain, enum language lang,
-                          int *is_a_field_of_this, struct symtab **symtab)
+                           domain_enum domain, enum language lang,
+                           int *is_a_field_of_this, struct symtab **symtab)
 {
-  struct cleanup *old_chain 
-    = make_cleanup (restore_language, (void*) current_language->la_language);
+  struct cleanup *old_chain
+    = make_cleanup (restore_language, (void *) current_language->la_language);
   struct symbol *result;
   set_language (lang);
   result = lookup_symbol (name, block, domain, is_a_field_of_this, symtab);
@@ -4288,14 +4354,14 @@ remove_extra_symbols (struct ada_symbol_info *syms, int nsyms)
               if (i != j
                   && SYMBOL_LINKAGE_NAME (syms[j].sym) != NULL
                   && strcmp (SYMBOL_LINKAGE_NAME (syms[i].sym),
-                            SYMBOL_LINKAGE_NAME (syms[j].sym)) == 0
+                             SYMBOL_LINKAGE_NAME (syms[j].sym)) == 0
                   && SYMBOL_CLASS (syms[i].sym) == SYMBOL_CLASS (syms[j].sym)
                   && SYMBOL_VALUE_ADDRESS (syms[i].sym)
                   == SYMBOL_VALUE_ADDRESS (syms[j].sym))
                 {
                   int k;
                   for (k = i + 1; k < nsyms; k += 1)
-                   syms[k - 1] = syms[k];
+                    syms[k - 1] = syms[k];
                   nsyms -= 1;
                   goto NextSymbol;
                 }
@@ -4320,7 +4386,7 @@ xget_renaming_scope (struct type *renaming_type)
      <scope>__<rename>___<XR extension>. 
      So, to extract the scope, we search for the "___XR" extension,
      and then backtrack until we find the first "__".  */
-     
+
   const char *name = type_name_no_tag (renaming_type);
   char *suffix = strstr (name, "___XR");
   char *last;
@@ -4333,7 +4399,7 @@ xget_renaming_scope (struct type *renaming_type)
   for (last = suffix - 3; last > name; last--)
     if (last[0] == '_' && last[1] == '_')
       break;
-  
+
   /* Make a copy of scope and return it.  */
 
   scope_len = last - name;
@@ -4357,7 +4423,7 @@ is_package_name (const char *name)
      small complication with library-level functions (see below).  */
 
   char *fun_name;
-  
+
   /* If it is a function that has not been defined at library level,
      then we should be able to look it up in the symbols.  */
   if (standard_lookup (name, NULL, VAR_DOMAIN) != NULL)
@@ -4371,8 +4437,7 @@ is_package_name (const char *name)
   if (strstr (name, "__") != NULL)
     return 0;
 
-  fun_name = (char *) alloca (strlen (name) + 5 + 1);
-  xasprintf (&fun_name, "_ada_%s", name);
+  fun_name = xstrprintf ("_ada_%s", name);
 
   return (standard_lookup (fun_name, NULL, VAR_DOMAIN) == NULL);
 }
@@ -4393,7 +4458,7 @@ renaming_is_visible (const struct symbol *sym, char *function_name)
 
   /* Check that the rename is in the current function scope by checking
      that its name starts with SCOPE.  */
-     
+
   /* If the function name starts with "_ada_", it means that it is
      a library-level function.  Strip this prefix before doing the
      comparison, as the encoding for the renaming does not contain
@@ -4436,8 +4501,7 @@ renaming_is_visible (const struct symbol *sym, char *function_name)
 
 static int
 remove_out_of_scope_renamings (struct ada_symbol_info *syms,
-                               int nsyms,
-                               struct block *current_block)
+                               int nsyms, struct block *current_block)
 {
   struct symbol *current_function;
   char *current_function_name;
@@ -4445,10 +4509,10 @@ remove_out_of_scope_renamings (struct ada_symbol_info *syms,
 
   /* Extract the function name associated to CURRENT_BLOCK.
      Abort if unable to do so.  */
-   
+
   if (current_block == NULL)
     return nsyms;
-  
+
   current_function = block_function (current_block);
   if (current_function == NULL)
     return nsyms;
@@ -4469,7 +4533,7 @@ remove_out_of_scope_renamings (struct ada_symbol_info *syms,
         {
           int j;
           for (j = i + 1; j < nsyms; j++)
-           syms[j - 1] = syms[j];
+            syms[j - 1] = syms[j];
           nsyms -= 1;
         }
       else
@@ -4495,8 +4559,8 @@ remove_out_of_scope_renamings (struct ada_symbol_info *syms,
 
 int
 ada_lookup_symbol_list (const char *name0, const struct block *block0,
-                        domain_enum namespace, 
-                       struct ada_symbol_info **results)
+                        domain_enum namespace,
+                        struct ada_symbol_info **results)
 {
   struct symbol *sym;
   struct symtab *s;
@@ -4520,9 +4584,9 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0,
 
   wild_match = (strstr (name0, "__") == NULL);
   name = name0;
-  block = (struct block *) block0; /* FIXME: No cast ought to be
-                                    needed, but adding const will
-                                    have a cascade effect.  */
+  block = (struct block *) block0;      /* FIXME: No cast ought to be
+                                           needed, but adding const will
+                                           have a cascade effect.  */
   if (strncmp (name0, "standard__", sizeof ("standard__") - 1) == 0)
     {
       wild_match = 0;
@@ -4534,12 +4598,12 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0,
   while (block != NULL)
     {
       block_depth += 1;
-      ada_add_block_symbols (&symbol_list_obstack, block, name, 
-                            namespace, NULL, NULL, wild_match);
+      ada_add_block_symbols (&symbol_list_obstack, block, name,
+                             namespace, NULL, NULL, wild_match);
 
       /* If we found a non-function match, assume that's the one.  */
       if (is_nonfunction (defns_collected (&symbol_list_obstack, 0),
-                         num_defns_collected (&symbol_list_obstack)))
+                          num_defns_collected (&symbol_list_obstack)))
         goto done;
 
       block = BLOCK_SUPERBLOCK (block);
@@ -4549,7 +4613,7 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0,
      enclosing subprogram.  */
   if (num_defns_collected (&symbol_list_obstack) == 0 && block_depth > 2)
     add_symbols_from_enclosing_procs (&symbol_list_obstack,
-                                     name, namespace, wild_match);
+                                      name, namespace, wild_match);
 
   /* If we found ANY matches among non-global symbols, we're done.  */
 
@@ -4574,8 +4638,8 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0,
       continue;
     bv = BLOCKVECTOR (s);
     block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-    ada_add_block_symbols (&symbol_list_obstack, block, name, namespace, 
-                          objfile, s, wild_match);
+    ada_add_block_symbols (&symbol_list_obstack, block, name, namespace,
+                           objfile, s, wild_match);
   }
 
   if (namespace == VAR_DOMAIN)
@@ -4599,7 +4663,7 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0,
                     ada_add_block_symbols (&symbol_list_obstack, block,
                                            SYMBOL_LINKAGE_NAME (msymbol),
                                            namespace, objfile, s, wild_match);
-                                          
+
                     if (num_defns_collected (&symbol_list_obstack) == ndefns0)
                       {
                         block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
@@ -4626,7 +4690,7 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0,
         bv = BLOCKVECTOR (s);
         block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
         ada_add_block_symbols (&symbol_list_obstack, block, name,
-                              namespace, objfile, s, wild_match);
+                               namespace, objfile, s, wild_match);
       }
   }
 
@@ -4644,8 +4708,8 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0,
           continue;
         bv = BLOCKVECTOR (s);
         block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-        ada_add_block_symbols (&symbol_list_obstack, block, name, namespace, 
-                              objfile, s, wild_match);
+        ada_add_block_symbols (&symbol_list_obstack, block, name, namespace,
+                               objfile, s, wild_match);
       }
 
       ALL_PSYMTABS (objfile, ps)
@@ -4659,8 +4723,8 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0,
             if (!s->primary)
               continue;
             block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-            ada_add_block_symbols (&symbol_list_obstack, block, name, 
-                                  namespace, objfile, s, wild_match);
+            ada_add_block_symbols (&symbol_list_obstack, block, name,
+                                   namespace, objfile, s, wild_match);
           }
       }
     }
@@ -4675,8 +4739,8 @@ done:
     cache_symbol (name0, namespace, NULL, NULL, NULL);
 
   if (ndefns == 1 && cacheIfUnique)
-    cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block, 
-                 (*results)[0].symtab);
+    cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block,
+                  (*results)[0].symtab);
 
   ndefns = remove_out_of_scope_renamings (*results, ndefns,
                                           (struct block *) block0);
@@ -4696,7 +4760,7 @@ done:
 struct symbol *
 ada_lookup_symbol (const char *name, const struct block *block0,
                    domain_enum namespace, int *is_a_field_of_this,
-                  struct symtab **symtab)
+                   struct symtab **symtab)
 {
   struct ada_symbol_info *candidates;
   int n_candidates;
@@ -4712,46 +4776,45 @@ ada_lookup_symbol (const char *name, const struct block *block0,
   if (is_a_field_of_this != NULL)
     *is_a_field_of_this = 0;
 
-  if (symtab != NULL) 
+  if (symtab != NULL)
     {
       *symtab = candidates[0].symtab;
-      if (*symtab == NULL && candidates[0].block != NULL) 
-       {
-         struct objfile *objfile;
-         struct symtab *s;
-         struct block *b;
-         struct blockvector *bv;
-
-         /* Search the list of symtabs for one which contains the
-            address of the start of this block.  */
-         ALL_SYMTABS (objfile, s)
-           {
-             bv = BLOCKVECTOR (s);
-             b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-             if (BLOCK_START (b) <= BLOCK_START (candidates[0].block)
-                 && BLOCK_END (b) > BLOCK_START (candidates[0].block))
-               {
-                 *symtab = s;
-                 return fixup_symbol_section (candidates[0].sym, objfile);
-               }
-             return fixup_symbol_section (candidates[0].sym, NULL);
-           }
-       }
-    }  
+      if (*symtab == NULL && candidates[0].block != NULL)
+        {
+          struct objfile *objfile;
+          struct symtab *s;
+          struct block *b;
+          struct blockvector *bv;
+
+          /* Search the list of symtabs for one which contains the
+             address of the start of this block.  */
+          ALL_SYMTABS (objfile, s)
+          {
+            bv = BLOCKVECTOR (s);
+            b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+            if (BLOCK_START (b) <= BLOCK_START (candidates[0].block)
+                && BLOCK_END (b) > BLOCK_START (candidates[0].block))
+              {
+                *symtab = s;
+                return fixup_symbol_section (candidates[0].sym, objfile);
+              }
+            return fixup_symbol_section (candidates[0].sym, NULL);
+          }
+        }
+    }
   return candidates[0].sym;
 }
 
 static struct symbol *
 ada_lookup_symbol_nonlocal (const char *name,
-                           const char *linkage_name,
-                           const struct block *block,
-                           const domain_enum domain,
-                           struct symtab **symtab)
+                            const char *linkage_name,
+                            const struct block *block,
+                            const domain_enum domain, struct symtab **symtab)
 {
   if (linkage_name == NULL)
     linkage_name = name;
-  return  ada_lookup_symbol (linkage_name, block_static_block (block), domain,
-                            NULL, symtab);
+  return ada_lookup_symbol (linkage_name, block_static_block (block), domain,
+                            NULL, symtab);
 }
 
 
@@ -4760,7 +4823,8 @@ ada_lookup_symbol_nonlocal (const char *name,
    names (e.g., XVE) are not included here.  Currently, the possible suffixes
    are given by either of the regular expression:
 
-   (__[0-9]+)?\.[0-9]+  [nested subprogram suffix, on platforms such as Linux]
+   (__[0-9]+)?\.[0-9]+  [nested subprogram suffix, on platforms such 
+                         as GNU/Linux]
    ___[0-9]+            [nested subprogram suffix, on platforms such as HP/UX]
    (X[nb]*)?((\$|__)[0-9](_?[0-9]+)|___(LJM|X([FDBUP].*|R[^T]?)))?$
  */
@@ -4829,8 +4893,8 @@ is_name_suffix (const char *str)
             return 1;
           if (str[3] != 'X')
             return 0;
-          if (str[4] == 'F' || str[4] == 'D' || str[4] == 'B' ||
-              str[4] == 'U' || str[4] == 'P')
+          if (str[4] == 'F' || str[4] == 'D' || str[4] == 'B'
+              || str[4] == 'U' || str[4] == 'P')
             return 1;
           if (str[4] == 'R' && str[5] != 'T')
             return 1;
@@ -4903,7 +4967,7 @@ wild_match (const char *patn0, int patn_len, const char *name0)
      Ada programs.  A corollary is that the symbol names in the dwarf-2
      data should match the names found in the symbol table.  I therefore
      consider this issue as a compiler defect.
-     
+
      Until the compiler is properly fixed, we work-around the problem
      by ignoring such suffixes during the match.  We do so by making
      a copy of PATN0 and NAME0, and then by stripping such a suffix
@@ -4979,7 +5043,7 @@ wild_match (const char *patn0, int patn_len, const char *name0)
 
 static void
 ada_add_block_symbols (struct obstack *obstackp,
-                      struct block *block, const char *name,
+                       struct block *block, const char *name,
                        domain_enum domain, struct objfile *objfile,
                        struct symtab *symtab, int wild)
 {
@@ -4997,73 +5061,73 @@ ada_add_block_symbols (struct obstack *obstackp,
     {
       struct symbol *sym;
       ALL_BLOCK_SYMBOLS (block, iter, sym)
-        {
-          if (SYMBOL_DOMAIN (sym) == domain &&
-              wild_match (name, name_len, SYMBOL_LINKAGE_NAME (sym)))
-            {
-              switch (SYMBOL_CLASS (sym))
-                {
-                case LOC_ARG:
-                case LOC_LOCAL_ARG:
-                case LOC_REF_ARG:
-                case LOC_REGPARM:
-                case LOC_REGPARM_ADDR:
-                case LOC_BASEREG_ARG:
-               case LOC_COMPUTED_ARG:
-                  arg_sym = sym;
-                  break;
-                case LOC_UNRESOLVED:
-                  continue;
-                default:
-                  found_sym = 1;
-                  add_defn_to_vec (obstackp, 
-                                  fixup_symbol_section (sym, objfile),
-                                   block, symtab);
-                  break;
-                }
-            }
-        }
+      {
+        if (SYMBOL_DOMAIN (sym) == domain
+            && wild_match (name, name_len, SYMBOL_LINKAGE_NAME (sym)))
+          {
+            switch (SYMBOL_CLASS (sym))
+              {
+              case LOC_ARG:
+              case LOC_LOCAL_ARG:
+              case LOC_REF_ARG:
+              case LOC_REGPARM:
+              case LOC_REGPARM_ADDR:
+              case LOC_BASEREG_ARG:
+              case LOC_COMPUTED_ARG:
+                arg_sym = sym;
+                break;
+              case LOC_UNRESOLVED:
+                continue;
+              default:
+                found_sym = 1;
+                add_defn_to_vec (obstackp,
+                                 fixup_symbol_section (sym, objfile),
+                                 block, symtab);
+                break;
+              }
+          }
+      }
     }
   else
     {
       ALL_BLOCK_SYMBOLS (block, iter, sym)
-       {
-         if (SYMBOL_DOMAIN (sym) == domain)
-           {
-             int cmp = strncmp (name, SYMBOL_LINKAGE_NAME (sym), name_len);
-             if (cmp == 0
-                 && is_name_suffix (SYMBOL_LINKAGE_NAME (sym) + name_len))
-               {
-                 switch (SYMBOL_CLASS (sym))
-                   {
-                   case LOC_ARG:
-                   case LOC_LOCAL_ARG:
-                   case LOC_REF_ARG:
-                   case LOC_REGPARM:
-                   case LOC_REGPARM_ADDR:
-                   case LOC_BASEREG_ARG:
-                   case LOC_COMPUTED_ARG:
-                     arg_sym = sym;
-                     break;
-                   case LOC_UNRESOLVED:
-                     break;
-                   default:
-                     found_sym = 1;
-                     add_defn_to_vec (obstackp,
-                                      fixup_symbol_section (sym, objfile),
-                                      block, symtab);
-                     break;
-                   }
-               }
-           }
-       }
+      {
+        if (SYMBOL_DOMAIN (sym) == domain)
+          {
+            int cmp = strncmp (name, SYMBOL_LINKAGE_NAME (sym), name_len);
+            if (cmp == 0
+                && is_name_suffix (SYMBOL_LINKAGE_NAME (sym) + name_len))
+              {
+                switch (SYMBOL_CLASS (sym))
+                  {
+                  case LOC_ARG:
+                  case LOC_LOCAL_ARG:
+                  case LOC_REF_ARG:
+                  case LOC_REGPARM:
+                  case LOC_REGPARM_ADDR:
+                  case LOC_BASEREG_ARG:
+                  case LOC_COMPUTED_ARG:
+                    arg_sym = sym;
+                    break;
+                  case LOC_UNRESOLVED:
+                    break;
+                  default:
+                    found_sym = 1;
+                    add_defn_to_vec (obstackp,
+                                     fixup_symbol_section (sym, objfile),
+                                     block, symtab);
+                    break;
+                  }
+              }
+          }
+      }
     }
 
   if (!found_sym && arg_sym != NULL)
     {
-      add_defn_to_vec (obstackp, 
-                      fixup_symbol_section (arg_sym, objfile),
-                      block, symtab);
+      add_defn_to_vec (obstackp,
+                       fixup_symbol_section (arg_sym, objfile),
+                       block, symtab);
     }
 
   if (!wild)
@@ -5072,62 +5136,62 @@ ada_add_block_symbols (struct obstack *obstackp,
       found_sym = 0;
 
       ALL_BLOCK_SYMBOLS (block, iter, sym)
-         {
-           if (SYMBOL_DOMAIN (sym) == domain)
-             {
-               int cmp;
-
-               cmp = (int) '_' - (int) SYMBOL_LINKAGE_NAME (sym)[0];
-               if (cmp == 0)
-                 {
-                   cmp = strncmp ("_ada_", SYMBOL_LINKAGE_NAME (sym), 5);
-                   if (cmp == 0)
-                     cmp = strncmp (name, SYMBOL_LINKAGE_NAME (sym) + 5,
-                                    name_len);
-                 }
-
-               if (cmp == 0
-                   && is_name_suffix (SYMBOL_LINKAGE_NAME (sym) + name_len + 5))
-                 {
-                   switch (SYMBOL_CLASS (sym))
-                     {
-                     case LOC_ARG:
-                     case LOC_LOCAL_ARG:
-                     case LOC_REF_ARG:
-                     case LOC_REGPARM:
-                     case LOC_REGPARM_ADDR:
-                     case LOC_BASEREG_ARG:
-                     case LOC_COMPUTED_ARG:
-                       arg_sym = sym;
-                       break;
-                     case LOC_UNRESOLVED:
-                       break;
-                     default:
-                       found_sym = 1;
-                       add_defn_to_vec (obstackp,
-                                        fixup_symbol_section (sym, objfile),
-                                        block, symtab);
-                       break;
-                     }
-                 }
-             }
-         end_loop2: ;
-         }
+      {
+        if (SYMBOL_DOMAIN (sym) == domain)
+          {
+            int cmp;
+
+            cmp = (int) '_' - (int) SYMBOL_LINKAGE_NAME (sym)[0];
+            if (cmp == 0)
+              {
+                cmp = strncmp ("_ada_", SYMBOL_LINKAGE_NAME (sym), 5);
+                if (cmp == 0)
+                  cmp = strncmp (name, SYMBOL_LINKAGE_NAME (sym) + 5,
+                                 name_len);
+              }
+
+            if (cmp == 0
+                && is_name_suffix (SYMBOL_LINKAGE_NAME (sym) + name_len + 5))
+              {
+                switch (SYMBOL_CLASS (sym))
+                  {
+                  case LOC_ARG:
+                  case LOC_LOCAL_ARG:
+                  case LOC_REF_ARG:
+                  case LOC_REGPARM:
+                  case LOC_REGPARM_ADDR:
+                  case LOC_BASEREG_ARG:
+                  case LOC_COMPUTED_ARG:
+                    arg_sym = sym;
+                    break;
+                  case LOC_UNRESOLVED:
+                    break;
+                  default:
+                    found_sym = 1;
+                    add_defn_to_vec (obstackp,
+                                     fixup_symbol_section (sym, objfile),
+                                     block, symtab);
+                    break;
+                  }
+              }
+          }
+      end_loop2:;
+      }
 
       /* NOTE: This really shouldn't be needed for _ada_ symbols.
          They aren't parameters, right?  */
       if (!found_sym && arg_sym != NULL)
         {
           add_defn_to_vec (obstackp,
-                          fixup_symbol_section (arg_sym, objfile),
-                          block, symtab);
+                           fixup_symbol_section (arg_sym, objfile),
+                           block, symtab);
         }
     }
 }
 \f
 #ifdef GNAT_GDB
 
-                               /* Symbol Completion */
+                                /* Symbol Completion */
 
 /* If SYM_NAME is a completion candidate for TEXT, return this symbol
    name in a form that's appropriate for the completion.  The result
@@ -5139,7 +5203,7 @@ ada_add_block_symbols (struct obstack *obstackp,
    in its encoded form.  */
 
 static const char *
-symbol_completion_match (const char *sym_name, 
+symbol_completion_match (const char *sym_name,
                          const char *text, int text_len,
                          int wild_match, int encoded)
 {
@@ -5167,9 +5231,9 @@ symbol_completion_match (const char *sym_name,
          is not a suitable completion.  */
       const char *sym_name_copy = sym_name;
       int has_angle_bracket;
-      
+
       sym_name = ada_decode (sym_name);
-      has_angle_bracket = (sym_name [0] == '<');
+      has_angle_bracket = (sym_name[0] == '<');
       match = (has_angle_bracket == verbatim_match);
       sym_name = sym_name_copy;
     }
@@ -5229,7 +5293,7 @@ symbol_completion_match (const char *sym_name,
    ENCODED should be set if TEXT represents a symbol name in its
    encoded formed (in which case the completion should also be
    encoded).  */
-   
+
 static void
 symbol_completion_add (struct string_vector *sv,
                        const char *sym_name,
@@ -5320,35 +5384,33 @@ ada_make_symbol_completion_list (const char *text0, const char *word)
 
   /* First, look at the partial symtab symbols.  */
   ALL_PSYMTABS (objfile, ps)
-    {
-      struct partial_symbol **psym;
+  {
+    struct partial_symbol **psym;
 
-      /* If the psymtab's been read in we'll get it when we search
-         through the blockvector.  */
-      if (ps->readin)
-        continue;
+    /* If the psymtab's been read in we'll get it when we search
+       through the blockvector.  */
+    if (ps->readin)
+      continue;
 
-      for (psym = objfile->global_psymbols.list + ps->globals_offset;
-           psym < (objfile->global_psymbols.list + ps->globals_offset
-                + ps->n_global_syms);
-           psym++)
-        {
-          QUIT;
-          symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
-                                 text, text_len, text0, word,
-                                 wild_match, encoded);
-        }
+    for (psym = objfile->global_psymbols.list + ps->globals_offset;
+         psym < (objfile->global_psymbols.list + ps->globals_offset
+                 + ps->n_global_syms); psym++)
+      {
+        QUIT;
+        symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
+                               text, text_len, text0, word,
+                               wild_match, encoded);
+      }
 
-      for (psym = objfile->static_psymbols.list + ps->statics_offset;
-           psym < (objfile->static_psymbols.list + ps->statics_offset
-                + ps->n_static_syms);
-           psym++)
-        {
-          QUIT;
-          symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
-                                 text, text_len, text0, word,
-                                 wild_match, encoded);
-        }
+    for (psym = objfile->static_psymbols.list + ps->statics_offset;
+         psym < (objfile->static_psymbols.list + ps->statics_offset
+                 + ps->n_static_syms); psym++)
+      {
+        QUIT;
+        symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
+                               text, text_len, text0, word,
+                               wild_match, encoded);
+      }
   }
 
   /* At this point scan through the misc symbol vectors and add each
@@ -5360,8 +5422,7 @@ ada_make_symbol_completion_list (const char *text0, const char *word)
   {
     QUIT;
     symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (msymbol),
-                           text, text_len, text0, word,
-                           wild_match, encoded);
+                           text, text_len, text0, word, wild_match, encoded);
   }
 
   /* Search upwards from currently selected frame (so that we can
@@ -5370,14 +5431,14 @@ ada_make_symbol_completion_list (const char *text0, const char *word)
   for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
     {
       if (!BLOCK_SUPERBLOCK (b))
-       surrounding_static_block = b;           /* For elmin of dups */
+        surrounding_static_block = b;   /* For elmin of dups */
 
       ALL_BLOCK_SYMBOLS (b, iter, sym)
-       {
-          symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
-                                 text, text_len, text0, word,
-                                 wild_match, encoded);
-       }
+      {
+        symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+                               text, text_len, text0, word,
+                               wild_match, encoded);
+      }
     }
 
   /* Go through the symtabs and check the externs and statics for
@@ -5388,11 +5449,11 @@ ada_make_symbol_completion_list (const char *text0, const char *word)
     QUIT;
     b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
     ALL_BLOCK_SYMBOLS (b, iter, sym)
-      {
-        symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
-                               text, text_len, text0, word,
-                               wild_match, encoded);
-      }
+    {
+      symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+                             text, text_len, text0, word,
+                             wild_match, encoded);
+    }
   }
 
   ALL_SYMTABS (objfile, s)
@@ -5403,11 +5464,11 @@ ada_make_symbol_completion_list (const char *text0, const char *word)
     if (b == surrounding_static_block)
       continue;
     ALL_BLOCK_SYMBOLS (b, iter, sym)
-      {
-        symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
-                               text, text_len, text0, word,
-                               wild_match, encoded);
-      }
+    {
+      symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+                             text, text_len, text0, word,
+                             wild_match, encoded);
+    }
   }
 
   /* Append the closing NULL entry.  */
@@ -5416,14 +5477,11 @@ ada_make_symbol_completion_list (const char *text0, const char *word)
   return (result.array);
 }
 
-#endif /* GNAT_GDB */
+#endif /* GNAT_GDB */
 \f
 #ifdef GNAT_GDB
                                 /* Breakpoint-related */
 
-/* Import message from symtab.c.  */
-extern char no_symtab_msg[];
-
 /* Assuming that LINE is pointing at the beginning of an argument to
    'break', return a pointer to the delimiter for the initial segment
    of that name.  This is the first ':', ' ', or end of LINE.  */
@@ -5497,7 +5555,7 @@ ada_finish_decode_line_1 (char **spec, struct symtab *file_table,
   char *lower_name;
   char *unquoted_name;
 
-  if (file_table == NULL) 
+  if (file_table == NULL)
     block = block_static_block (get_selected_block (0));
   else
     block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (file_table), STATIC_BLOCK);
@@ -5515,8 +5573,8 @@ ada_finish_decode_line_1 (char **spec, struct symtab *file_table,
     {
       if (is_quoted)
         *spec = skip_quoted (*spec);
-      while (**spec != '\000' &&
-             !strchr (ada_completer_word_break_characters, **spec))
+      while (**spec != '\000'
+             && !strchr (ada_completer_word_break_characters, **spec))
         *spec += 1;
     }
   len = *spec - name;
@@ -5596,7 +5654,9 @@ ada_finish_decode_line_1 (char **spec, struct symtab *file_table,
           val.section = SYMBOL_BFD_SECTION (msymbol);
           if (funfirstline)
             {
-              val.pc += DEPRECATED_FUNCTION_START_OFFSET;
+              val.pc = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+                                                          val.pc,
+                                                          &current_target);
               SKIP_PROLOGUE (val.pc);
             }
           selected.sals = (struct symtab_and_line *)
@@ -5606,8 +5666,8 @@ ada_finish_decode_line_1 (char **spec, struct symtab *file_table,
           return selected;
         }
 
-      if (!have_full_symbols () &&
-          !have_partial_symbols () && !have_minimal_symbols ())
+      if (!have_full_symbols ()
+          && !have_partial_symbols () && !have_minimal_symbols ())
         error ("No symbol table is loaded.  Use the \"file\" command.");
 
       error ("Function \"%s\" not defined.", unquoted_name);
@@ -5625,8 +5685,7 @@ ada_finish_decode_line_1 (char **spec, struct symtab *file_table,
     }
   else
     {
-      selected.nelts =
-        user_select_syms (symbols, n_matches, n_matches);
+      selected.nelts = user_select_syms (symbols, n_matches, n_matches);
     }
 
   selected.sals = (struct symtab_and_line *)
@@ -5638,13 +5697,13 @@ ada_finish_decode_line_1 (char **spec, struct symtab *file_table,
   while (i < selected.nelts)
     {
       if (SYMBOL_CLASS (symbols[i].sym) == LOC_BLOCK)
-        selected.sals[i] 
-         = find_function_start_sal (symbols[i].sym, funfirstline);
+        selected.sals[i]
+          = find_function_start_sal (symbols[i].sym, funfirstline);
       else if (SYMBOL_LINE (symbols[i].sym) != 0)
         {
-          selected.sals[i].symtab = 
-           symbols[i].symtab 
-           ? symbols[i].symtab : symtab_for_sym (symbols[i].sym);
+          selected.sals[i].symtab =
+            symbols[i].symtab
+            ? symbols[i].symtab : symtab_for_sym (symbols[i].sym);
           selected.sals[i].line = SYMBOL_LINE (symbols[i].sym);
         }
       else if (line_num >= 0)
@@ -5747,7 +5806,8 @@ done:
 
 static int
 find_line_in_linetable (struct linetable *linetable, int line_num,
-                        struct ada_symbol_info *symbols, int nsyms, int *exactp)
+                        struct ada_symbol_info *symbols, int nsyms,
+                        int *exactp)
 {
   int i, len, best_index, best;
 
@@ -5762,8 +5822,8 @@ find_line_in_linetable (struct linetable *linetable, int line_num,
 
       for (k = 0; k < nsyms; k += 1)
         {
-          if (symbols[k].sym != NULL 
-             && SYMBOL_CLASS (symbols[k].sym) == LOC_BLOCK
+          if (symbols[k].sym != NULL
+              && SYMBOL_CLASS (symbols[k].sym) == LOC_BLOCK
               && item->pc >= BLOCK_START (SYMBOL_BLOCK_VALUE (symbols[k].sym))
               && item->pc < BLOCK_END (SYMBOL_BLOCK_VALUE (symbols[k].sym)))
             goto candidate;
@@ -5959,8 +6019,7 @@ read_all_symtabs (const char *filename)
 
 struct symtabs_and_lines
 ada_sals_for_line (const char *filename, int line_num,
-                   int funfirstline, char ***canonical,
-                   int one_location_only)
+                   int funfirstline, char ***canonical, int one_location_only)
 {
   struct symtabs_and_lines result;
   struct objfile *objfile;
@@ -6121,6 +6180,20 @@ extended_canonical_line_spec (struct symtab_and_line sal, const char *name)
   return r;
 }
 
+\f
+                               /* Exception-related */
+
+int
+ada_is_exception_sym (struct symbol *sym)
+{
+  char *type_name = type_name_no_tag (SYMBOL_TYPE (sym));
+
+  return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
+          && SYMBOL_CLASS (sym) != LOC_BLOCK
+          && SYMBOL_CLASS (sym) != LOC_CONST
+          && type_name != NULL && strcmp (type_name, "exception") == 0);
+}
+
 /* Return type of Ada breakpoint associated with bp_stat:
    0 if not an Ada-specific breakpoint, 1 for break on specific exception,
    2 for break on unhandled exception, 3 for assert.  */
@@ -6128,8 +6201,8 @@ extended_canonical_line_spec (struct symtab_and_line sal, const char *name)
 static int
 ada_exception_breakpoint_type (bpstat bs)
 {
-  return ((! bs || ! bs->breakpoint_at) ? 0
-         : bs->breakpoint_at->break_on_exception);
+  return ((!bs || !bs->breakpoint_at) ? 0
+          : bs->breakpoint_at->break_on_exception);
 }
 
 /* True iff FRAME is very likely to be that of a function that is
@@ -6147,22 +6220,22 @@ is_known_support_routine (struct frame_info *frame)
      a signal_handler_caller or a dummy frame, then the next frame was
      not entered as the result of a call, and we want to get the line
      containing frame->pc.  */
-  const int pc_is_after_call = 
+  const int pc_is_after_call =
     next_frame != NULL
     && get_frame_type (next_frame) != SIGTRAMP_FRAME
     && get_frame_type (next_frame) != DUMMY_FRAME;
-  struct symtab_and_line sal 
+  struct symtab_and_line sal
     = find_pc_line (get_frame_pc (frame), pc_is_after_call);
   char *func_name;
   int i;
   struct stat st;
 
   /* The heuristic:
-       1. The symtab is null (indicating no debugging symbols)
-       2. The symtab's filename does not exist.
-       3. The object file's name is one of the standard libraries.
-       4. The symtab's file name has the form of an Ada library source file.
-       5. The function at frame's PC has a GNAT-compiler-generated name.  */
+     1. The symtab is null (indicating no debugging symbols)
+     2. The symtab's filename does not exist.
+     3. The object file's name is one of the standard libraries.
+     4. The symtab's file name has the form of an Ada library source file.
+     5. The function at frame's PC has a GNAT-compiler-generated name.  */
 
   if (sal.symtab == NULL)
     return 1;
@@ -6266,26 +6339,25 @@ ada_adjust_exception_stop (bpstat bs)
          without checking the name of their associated function.  */
       for (frame_level = 0; frame_level < 2; frame_level += 1)
         if (fi != NULL)
-         fi = get_prev_frame (fi);
+          fi = get_prev_frame (fi);
       while (fi != NULL)
         {
           const char *func_name = function_name_from_pc (get_frame_pc (fi));
           if (func_name != NULL
               && strcmp (func_name, process_raise_exception_name) == 0)
-            break;  /* We found the frame we were looking for...  */
+            break;              /* We found the frame we were looking for...  */
           fi = get_prev_frame (fi);
         }
       if (fi == NULL)
-       break;
+        break;
       select_frame (fi);
       break;
     }
 
-    addr = parse_and_eval_address ("e.full_name");
+  addr = parse_and_eval_address ("e.full_name");
 
   if (addr != 0)
-    read_memory (addr, last_exception_name,
-                sizeof (last_exception_name) - 1);
+    read_memory (addr, last_exception_name, sizeof (last_exception_name) - 1);
   last_exception_name[sizeof (last_exception_name) - 1] = '\0';
   ada_find_printable_frame (get_selected_frame ());
 }
@@ -6332,7 +6404,7 @@ ada_print_exception_breakpoint_nontask (struct breakpoint *b)
 {
   if (b->break_on_exception == 1)
     {
-      if (b->cond_string)  /* the breakpoint is on a specific exception.  */
+      if (b->cond_string)       /* the breakpoint is on a specific exception.  */
         {
           char *exception_name = exception_name_from_cond (b->cond_string);
 
@@ -6373,25 +6445,6 @@ ada_print_exception_breakpoint_task (struct breakpoint *b)
     }
 }
 
-int
-ada_is_exception_sym (struct symbol *sym)
-{
-  char *type_name = type_name_no_tag (SYMBOL_TYPE (sym));
-
-  return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
-          && SYMBOL_CLASS (sym) != LOC_BLOCK
-          && SYMBOL_CLASS (sym) != LOC_CONST
-          && type_name != NULL && strcmp (type_name, "exception") == 0);
-}
-
-int
-ada_maybe_exception_partial_symbol (struct partial_symbol *sym)
-{
-  return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
-          && SYMBOL_CLASS (sym) != LOC_BLOCK
-          && SYMBOL_CLASS (sym) != LOC_CONST);
-}
-
 /* Cause the appropriate error if no appropriate runtime symbol is
    found to set a breakpoint, using ERR_DESC to describe the
    breakpoint.  */
@@ -6411,7 +6464,8 @@ error_breakpoint_runtime_sym_not_found (const char *err_desc)
      in a shared library.  */
 
   if (ptid_get_pid (inferior_ptid) == 0)
-    error ("Unable to break on %s. Try to start the program first.", err_desc);
+    error ("Unable to break on %s. Try to start the program first.",
+           err_desc);
 
   /* At this point, we know that we are debugging an Ada program and
      that the inferior has been started, but we still are not able to
@@ -6428,13 +6482,13 @@ error_breakpoint_runtime_sym_not_found (const char *err_desc)
    the test.  */
 
 static int
-is_runtime_sym_defined  (const char *name, int allow_tramp)
+is_runtime_sym_defined (const char *name, int allow_tramp)
 {
   struct minimal_symbol *msym;
 
   msym = lookup_minimal_symbol (name, NULL, NULL);
   return (msym != NULL && msym->type != mst_unknown
-         && (allow_tramp || msym->type != mst_solib_trampoline));
+          && (allow_tramp || msym->type != mst_solib_trampoline));
 }
 
 /* If ARG points to an Ada exception or assert breakpoint, rewrite
@@ -6455,7 +6509,7 @@ ada_breakpoint_rewrite (char *arg, int *break_on_exceptionp)
       char *tok, *end_tok;
       int toklen;
       int has_exception_propagation =
-       is_runtime_sym_defined (raise_sym_name, 1);
+        is_runtime_sym_defined (raise_sym_name, 1);
 
       *break_on_exceptionp = 1;
 
@@ -6474,27 +6528,27 @@ ada_breakpoint_rewrite (char *arg, int *break_on_exceptionp)
       make_cleanup (xfree, arg);
       if (toklen == 0)
         {
-         if (has_exception_propagation)
-           sprintf (arg, "'%s'", raise_sym_name);
-         else
-           error_breakpoint_runtime_sym_not_found ("exception");
+          if (has_exception_propagation)
+            sprintf (arg, "'%s'", raise_sym_name);
+          else
+            error_breakpoint_runtime_sym_not_found ("exception");
         }
       else if (strncmp (tok, "unhandled", toklen) == 0)
         {
-         if (is_runtime_sym_defined (raise_unhandled_sym_name, 1))
-           sprintf (arg, "'%s'", raise_unhandled_sym_name);
-         else
-           error_breakpoint_runtime_sym_not_found ("exception");
+          if (is_runtime_sym_defined (raise_unhandled_sym_name, 1))
+            sprintf (arg, "'%s'", raise_unhandled_sym_name);
+          else
+            error_breakpoint_runtime_sym_not_found ("exception");
 
-         *break_on_exceptionp = 2;
+          *break_on_exceptionp = 2;
         }
       else
         {
-         if (is_runtime_sym_defined (raise_sym_name, 0))
-           sprintf (arg, "'%s' if long_integer(e) = long_integer(&%.*s)",
-                    raise_sym_name, toklen, tok);
-         else
-           error_breakpoint_runtime_sym_not_found ("specific exception");
+          if (is_runtime_sym_defined (raise_sym_name, 0))
+            sprintf (arg, "'%s' if long_integer(e) = long_integer(&%.*s)",
+                     raise_sym_name, toklen, tok);
+          else
+            error_breakpoint_runtime_sym_not_found ("specific exception");
         }
     }
   else if (current_language->la_language == language_ada
@@ -6504,7 +6558,7 @@ ada_breakpoint_rewrite (char *arg, int *break_on_exceptionp)
       char *tok = arg + 6;
 
       if (!is_runtime_sym_defined (raise_assert_sym_name, 1))
-       error_breakpoint_runtime_sym_not_found ("failed assertion");
+        error_breakpoint_runtime_sym_not_found ("failed assertion");
 
       *break_on_exceptionp = 3;
 
@@ -6515,7 +6569,7 @@ ada_breakpoint_rewrite (char *arg, int *break_on_exceptionp)
     }
   return arg;
 }
-#endif
+#endif /* GNAT_GDB */
 \f
                                 /* Field Access */
 
@@ -6549,13 +6603,14 @@ ada_is_tagged_type (struct type *type, int refok)
 int
 ada_is_tag_type (struct type *type)
 {
-  if (type  == NULL || TYPE_CODE (type) != TYPE_CODE_PTR)
+  if (type == NULL || TYPE_CODE (type) != TYPE_CODE_PTR)
     return 0;
-  else {
-    const char *name = ada_type_name (TYPE_TARGET_TYPE (type));
-    return (name != NULL 
-           && strcmp (name, "ada__tags__dispatch_table") == 0);
-  }
+  else
+    {
+      const char *name = ada_type_name (TYPE_TARGET_TYPE (type));
+      return (name != NULL
+              && strcmp (name, "ada__tags__dispatch_table") == 0);
+    }
 }
 
 /* The type of the tag on VAL.  */
@@ -6580,12 +6635,12 @@ ada_value_tag (struct value *val)
 
 static struct value *
 value_tag_from_contents_and_address (struct type *type, char *valaddr,
-                                    CORE_ADDR address)
+                                     CORE_ADDR address)
 {
   int tag_byte_offset, dummy1, dummy2;
   struct type *tag_type;
   if (find_struct_field ("_tag", type, 0, &tag_type, &tag_byte_offset,
-                        &dummy1, &dummy2))
+                         &dummy1, &dummy2))
     {
       char *valaddr1 = (valaddr == NULL) ? NULL : valaddr + tag_byte_offset;
       CORE_ADDR address1 = (address == 0) ? 0 : address + tag_byte_offset;
@@ -6604,7 +6659,8 @@ type_from_tag (struct value *tag)
   return NULL;
 }
 
-struct tag_args {
+struct tag_args
+{
   struct value *tag;
   char *name;
 };
@@ -6619,7 +6675,7 @@ ada_tag_name_1 (void *args0)
 {
   struct tag_args *args = (struct tag_args *) args0;
   static char name[1024];
-  charp;
+  char *p;
   struct value *val;
   args->name = NULL;
   val = ada_value_struct_elt (args->tag, "tsd", NULL);
@@ -6643,9 +6699,9 @@ const char *
 ada_tag_name (struct value *tag)
 {
   struct tag_args args;
-  if (! ada_is_tag_type (VALUE_TYPE (tag)))
+  if (!ada_is_tag_type (VALUE_TYPE (tag)))
     return NULL;
-  args.tag = tag; 
+  args.tag = tag;
   args.name = NULL;
   catch_errors (ada_tag_name_1, &args, NULL, RETURN_MASK_ALL);
   return args.name;
@@ -6710,8 +6766,8 @@ ada_is_variant_part (struct type *type, int field_num)
   struct type *field_type = TYPE_FIELD_TYPE (type, field_num);
   return (TYPE_CODE (field_type) == TYPE_CODE_UNION
           || (is_dynamic_field (type, field_num)
-              && TYPE_CODE (TYPE_TARGET_TYPE (field_type)) ==
-              TYPE_CODE_UNION));
+              && (TYPE_CODE (TYPE_TARGET_TYPE (field_type)) 
+                 == TYPE_CODE_UNION)));
 }
 
 /* Assuming that VAR_TYPE is a variant wrapper (type of the variant part)
@@ -6722,7 +6778,7 @@ struct type *
 ada_variant_discrim_type (struct type *var_type, struct type *outer_type)
 {
   char *name = ada_variant_discrim_name (var_type);
-  struct type *type = 
+  struct type *type =
     ada_lookup_struct_elt_type (outer_type, name, 1, 1, NULL);
   if (type == NULL)
     return builtin_type_int;
@@ -6779,7 +6835,7 @@ ada_variant_discrim_name (struct type *type0)
     {
       if (discrim_start == name + 1)
         return "";
-      if ((discrim_start > name + 3 
+      if ((discrim_start > name + 3
            && strncmp (discrim_start - 3, "___", 3) == 0)
           || discrim_start[-1] == '.')
         break;
@@ -6920,41 +6976,41 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
    Looks inside wrappers for the field.  Returns 0 if field not
    found. */
 static int
-find_struct_field (char *name, struct type *type, int offset, 
-                  struct type **field_type_p,
-                  int *byte_offset_p, int *bit_offset_p, int *bit_size_p)
+find_struct_field (char *name, struct type *type, int offset,
+                   struct type **field_type_p,
+                   int *byte_offset_p, int *bit_offset_p, int *bit_size_p)
 {
   int i;
 
   CHECK_TYPEDEF (type);
   *field_type_p = NULL;
   *byte_offset_p = *bit_offset_p = *bit_size_p = 0;
-  
+
   for (i = TYPE_NFIELDS (type) - 1; i >= 0; i -= 1)
     {
       int bit_pos = TYPE_FIELD_BITPOS (type, i);
       int fld_offset = offset + bit_pos / 8;
       char *t_field_name = TYPE_FIELD_NAME (type, i);
-      
+
       if (t_field_name == NULL)
         continue;
 
       else if (field_name_match (t_field_name, name))
-       {
-         int bit_size = TYPE_FIELD_BITSIZE (type, i);
-         *field_type_p = TYPE_FIELD_TYPE (type, i);
-         *byte_offset_p = fld_offset;
-         *bit_offset_p = bit_pos % 8;
-         *bit_size_p = bit_size;
-         return 1;
-       }
+        {
+          int bit_size = TYPE_FIELD_BITSIZE (type, i);
+          *field_type_p = TYPE_FIELD_TYPE (type, i);
+          *byte_offset_p = fld_offset;
+          *bit_offset_p = bit_pos % 8;
+          *bit_size_p = bit_size;
+          return 1;
+        }
       else if (ada_is_wrapper_field (type, i))
         {
-         if (find_struct_field (name, TYPE_FIELD_TYPE (type, i), fld_offset,
-                                field_type_p, byte_offset_p, bit_offset_p,
-                                bit_size_p))
-           return 1;
-       }
+          if (find_struct_field (name, TYPE_FIELD_TYPE (type, i), fld_offset,
+                                 field_type_p, byte_offset_p, bit_offset_p,
+                                 bit_size_p))
+            return 1;
+        }
       else if (ada_is_variant_part (type, i))
         {
           int j;
@@ -6962,12 +7018,12 @@ find_struct_field (char *name, struct type *type, int offset,
 
           for (j = TYPE_NFIELDS (field_type) - 1; j >= 0; j -= 1)
             {
-             if (find_struct_field (name, TYPE_FIELD_TYPE (field_type, j),
-                                    fld_offset 
-                                    + TYPE_FIELD_BITPOS (field_type, j)/8,
-                                    field_type_p, byte_offset_p, bit_offset_p,
-                                    bit_size_p))
-               return 1;
+              if (find_struct_field (name, TYPE_FIELD_TYPE (field_type, j),
+                                     fld_offset
+                                     + TYPE_FIELD_BITPOS (field_type, j) / 8,
+                                     field_type_p, byte_offset_p,
+                                     bit_offset_p, bit_size_p))
+                return 1;
             }
         }
     }
@@ -7001,10 +7057,10 @@ ada_search_struct_field (char *name, struct value *arg, int offset,
 
       else if (ada_is_wrapper_field (type, i))
         {
-          struct value *v = 
-           ada_search_struct_field (name, arg,
-                                    offset + TYPE_FIELD_BITPOS (type, i) / 8,
-                                    TYPE_FIELD_TYPE (type, i));
+          struct value *v =     /* Do not let indent join lines here. */
+            ada_search_struct_field (name, arg,
+                                     offset + TYPE_FIELD_BITPOS (type, i) / 8,
+                                     TYPE_FIELD_TYPE (type, i));
           if (v != NULL)
             return v;
         }
@@ -7017,11 +7073,10 @@ ada_search_struct_field (char *name, struct value *arg, int offset,
 
           for (j = TYPE_NFIELDS (field_type) - 1; j >= 0; j -= 1)
             {
-              struct value *v = 
-               ada_search_struct_field (name, arg,
-                                        var_offset 
-                                        + TYPE_FIELD_BITPOS (field_type, j)/8,
-                                        TYPE_FIELD_TYPE (field_type, j));
+              struct value *v = ada_search_struct_field /* Force line break.  */
+                (name, arg,
+                 var_offset + TYPE_FIELD_BITPOS (field_type, j) / 8,
+                 TYPE_FIELD_TYPE (field_type, j));
               if (v != NULL)
                 return v;
             }
@@ -7059,47 +7114,47 @@ ada_value_struct_elt (struct value *arg, char *name, char *err)
     {
       t1 = TYPE_TARGET_TYPE (t);
       if (t1 == NULL)
-       {
-         if (err == NULL)
-           return NULL;
-         else
-           error ("Bad value type in a %s.", err);
-       }
+        {
+          if (err == NULL)
+            return NULL;
+          else
+            error ("Bad value type in a %s.", err);
+        }
       CHECK_TYPEDEF (t1);
       if (TYPE_CODE (t1) == TYPE_CODE_PTR)
-       {
-         COERCE_REF (arg);
-         t = t1;
-       }
+        {
+          COERCE_REF (arg);
+          t = t1;
+        }
     }
 
   while (TYPE_CODE (t) == TYPE_CODE_PTR)
     {
       t1 = TYPE_TARGET_TYPE (t);
       if (t1 == NULL)
-       {
-         if (err == NULL)
-           return NULL;
-         else
-           error ("Bad value type in a %s.", err);
-       }
+        {
+          if (err == NULL)
+            return NULL;
+          else
+            error ("Bad value type in a %s.", err);
+        }
       CHECK_TYPEDEF (t1);
       if (TYPE_CODE (t1) == TYPE_CODE_PTR)
-       {
-         arg = value_ind (arg);
-         t = t1;
-       }
+        {
+          arg = value_ind (arg);
+          t = t1;
+        }
       else
-       break;
+        break;
     }
 
   if (TYPE_CODE (t1) != TYPE_CODE_STRUCT && TYPE_CODE (t1) != TYPE_CODE_UNION)
     {
       if (err == NULL)
-       return NULL;
+        return NULL;
       else
-       error ("Attempt to extract a component of a value that is not a %s.",
-              err);
+        error ("Attempt to extract a component of a value that is not a %s.",
+               err);
     }
 
   if (t1 == t)
@@ -7110,28 +7165,29 @@ ada_value_struct_elt (struct value *arg, char *name, char *err)
       struct type *field_type;
       CORE_ADDR address;
 
-      if (TYPE_CODE (t) == TYPE_CODE_PTR) 
-       address = value_as_address (arg);
+      if (TYPE_CODE (t) == TYPE_CODE_PTR)
+        address = value_as_address (arg);
       else
-       address = unpack_pointer (t, VALUE_CONTENTS (arg));
+        address = unpack_pointer (t, VALUE_CONTENTS (arg));
 
       t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL, address, NULL);
-      if (find_struct_field (name, t1, 0, 
-                            &field_type, &byte_offset, &bit_offset, &bit_size))
-       {
-         if (bit_size != 0) 
-           {
-             arg = ada_value_ind (arg);
-             v = ada_value_primitive_packed_val (arg, NULL, byte_offset,
-                                                 bit_offset, bit_size, 
-                                                 field_type);
-           }
-         else
-           v = value_from_pointer (lookup_reference_type (field_type), 
-                                   address + byte_offset);
-       }
+      if (find_struct_field (name, t1, 0,
+                             &field_type, &byte_offset, &bit_offset,
+                             &bit_size))
+        {
+          if (bit_size != 0)
+            {
+              arg = ada_value_ind (arg);
+              v = ada_value_primitive_packed_val (arg, NULL, byte_offset,
+                                                  bit_offset, bit_size,
+                                                  field_type);
+            }
+          else
+            v = value_from_pointer (lookup_reference_type (field_type),
+                                    address + byte_offset);
+        }
     }
-                                    
+
   if (v == NULL && err != NULL)
     error ("There is no member named %s.", name);
 
@@ -7156,41 +7212,41 @@ ada_value_struct_elt (struct value *arg, char *name, char *err)
    TYPE is not a type of the right kind.  */
 
 static struct type *
-ada_lookup_struct_elt_type (struct type *type, char *name, int refok, 
-                           int noerr, int *dispp)
+ada_lookup_struct_elt_type (struct type *type, char *name, int refok,
+                            int noerr, int *dispp)
 {
   int i;
 
   if (name == NULL)
     goto BadName;
 
-  if (refok && type != NULL) 
+  if (refok && type != NULL)
     while (1)
       {
-       CHECK_TYPEDEF (type);
-       if (TYPE_CODE (type) != TYPE_CODE_PTR
-           && TYPE_CODE (type) != TYPE_CODE_REF)
-         break;
-       type = TYPE_TARGET_TYPE (type);
+        CHECK_TYPEDEF (type);
+        if (TYPE_CODE (type) != TYPE_CODE_PTR
+            && TYPE_CODE (type) != TYPE_CODE_REF)
+          break;
+        type = TYPE_TARGET_TYPE (type);
       }
 
-  if (type == NULL 
-      || (TYPE_CODE (type) != TYPE_CODE_STRUCT &&
-         TYPE_CODE (type) != TYPE_CODE_UNION))
+  if (type == NULL
+      || (TYPE_CODE (type) != TYPE_CODE_STRUCT
+          && TYPE_CODE (type) != TYPE_CODE_UNION))
     {
       if (noerr)
-       return NULL;
+        return NULL;
       else
-       {
-         target_terminal_ours ();
-         gdb_flush (gdb_stdout);
-         fprintf_unfiltered (gdb_stderr, "Type ");
-         if (type == NULL)
-           fprintf_unfiltered (gdb_stderr, "(null)");
-         else
-           type_print (type, "", gdb_stderr, -1);
-         error (" is not a structure or union type");
-       }
+        {
+          target_terminal_ours ();
+          gdb_flush (gdb_stdout);
+          fprintf_unfiltered (gdb_stderr, "Type ");
+          if (type == NULL)
+            fprintf_unfiltered (gdb_stderr, "(null)");
+          else
+            type_print (type, "", gdb_stderr, -1);
+          error (" is not a structure or union type");
+        }
     }
 
   type = to_static_fixed_type (type);
@@ -7438,10 +7494,8 @@ ada_find_renaming_symbol (const char *name, struct block *block)
          the associated renaming symbol.  */
       char *function_name = SYMBOL_LINKAGE_NAME (function_sym);
       const int function_name_len = strlen (function_name);
-      const int rename_len = function_name_len
-                             + 2  /*  "__" */
-                             + strlen (name)
-                             + 6  /* "___XR\0" */;
+      const int rename_len = function_name_len + 2      /*  "__" */
+        + strlen (name) + 6 /* "___XR\0" */ ;
 
       /* Library-level functions are a special case, as GNAT adds
          a ``_ada_'' prefix to the function name to avoid namespace
@@ -7639,7 +7693,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, char *valaddr,
   else
     {
       nfields = 0;
-      while (nfields < TYPE_NFIELDS (type) 
+      while (nfields < TYPE_NFIELDS (type)
              && !ada_is_variant_part (type, nfields)
              && !is_dynamic_field (type, nfields))
         nfields++;
@@ -7662,9 +7716,8 @@ ada_template_to_fixed_record_type_1 (struct type *type, char *valaddr,
 
   for (f = 0; f < nfields; f += 1)
     {
-      off =
-        align_value (off,
-                     field_alignment (type, f)) + TYPE_FIELD_BITPOS (type, f);
+      off = align_value (off, field_alignment (type, f))
+       + TYPE_FIELD_BITPOS (type, f);
       TYPE_FIELD_BITPOS (rtype, f) = off;
       TYPE_FIELD_BITSIZE (rtype, f) = 0;
 
@@ -8056,17 +8109,17 @@ ada_to_fixed_type (struct type *type, char *valaddr,
       return type;
     case TYPE_CODE_STRUCT:
       {
-       struct type *static_type = to_static_fixed_type (type);
-       if (ada_is_tagged_type (static_type, 0))
-         { 
-           struct type *real_type = 
-             type_from_tag (value_tag_from_contents_and_address (static_type, 
-                                                                 valaddr,
-                                                                 address));
-           if (real_type != NULL)
-             type = real_type;
-         }
-       return to_fixed_record_type (type, valaddr, address, NULL);
+        struct type *static_type = to_static_fixed_type (type);
+        if (ada_is_tagged_type (static_type, 0))
+          {
+            struct type *real_type =
+              type_from_tag (value_tag_from_contents_and_address (static_type,
+                                                                  valaddr,
+                                                                  address));
+            if (real_type != NULL)
+              type = real_type;
+          }
+        return to_fixed_record_type (type, valaddr, address, NULL);
       }
     case TYPE_CODE_ARRAY:
       return to_fixed_array_type (type, dval, 1);
@@ -8205,7 +8258,8 @@ adjust_pc_past_prologue (CORE_ADDR *pc)
 
   if (func_sym)
     {
-      const struct symtab_and_line sal = find_function_start_sal (func_sym, 1);
+      const struct symtab_and_line sal =
+        find_function_start_sal (func_sym, 1);
 
       if (*pc <= sal.pc)
         *pc = sal.pc;
@@ -8342,7 +8396,8 @@ ada_is_string_type (struct type *type)
   CHECK_TYPEDEF (type);
   if (type != NULL
       && TYPE_CODE (type) != TYPE_CODE_PTR
-      && (ada_is_simple_array_type (type) || ada_is_array_descriptor_type (type))
+      && (ada_is_simple_array_type (type)
+          || ada_is_array_descriptor_type (type))
       && ada_array_arity (type) == 1)
     {
       struct type *elttype = ada_array_element_type (type, 1);
@@ -8432,14 +8487,15 @@ ada_enum_name (const char *name)
 
   /* First, unqualify the enumeration name:
      1. Search for the last '.' character.  If we find one, then skip
-        all the preceeding characters, the unqualified name starts
-        right after that dot.
+     all the preceeding characters, the unqualified name starts
+     right after that dot.
      2. Otherwise, we may be debugging on a target where the compiler
-        translates dots into "__".  Search forward for double underscores,
-        but stop searching when we hit an overloading suffix, which is
-        of the form "__" followed by digits.  */
+     translates dots into "__".  Search forward for double underscores,
+     but stop searching when we hit an overloading suffix, which is
+     of the form "__" followed by digits.  */
 
-  if ((tmp = strrchr (name, '.')) != NULL)
+  tmp = strrchr (name, '.');
+  if (tmp != NULL)
     name = tmp + 1;
   else
     {
@@ -8475,8 +8531,10 @@ ada_enum_name (const char *name)
     }
   else
     {
-      if ((tmp = strstr (name, "__")) != NULL
-          || (tmp = strstr (name, "$")) != NULL)
+      tmp = strstr (name, "__");
+      if (tmp == NULL)
+       tmp = strstr (name, "$");
+      if (tmp != NULL)
         {
           GROW_VECT (result, result_len, tmp - name + 1);
           strncpy (result, name, tmp - name);
@@ -8492,7 +8550,7 @@ static struct value *
 evaluate_subexp (struct type *expect_type, struct expression *exp, int *pos,
                  enum noside noside)
 {
-  return (*exp->language_defn->la_exp_desc->evaluate_exp) 
+  return (*exp->language_defn->la_exp_desc->evaluate_exp)
     (expect_type, exp, pos, noside);
 }
 
@@ -8613,10 +8671,11 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
   type1 = base_type (check_typedef (VALUE_TYPE (arg1)));
   type2 = base_type (check_typedef (VALUE_TYPE (arg2)));
 
-  if (TYPE_CODE (type1) != TYPE_CODE_INT || TYPE_CODE (type2) != TYPE_CODE_INT)
+  if (TYPE_CODE (type1) != TYPE_CODE_INT
+      || TYPE_CODE (type2) != TYPE_CODE_INT)
     return value_binop (arg1, arg2, op);
 
-  switch (op) 
+  switch (op)
     {
     case BINOP_MOD:
     case BINOP_DIV:
@@ -8638,13 +8697,13 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
     {
     case BINOP_DIV:
       v = v1 / v2;
-      if (! TRUNCATION_TOWARDS_ZERO && v1 * (v1%v2) < 0)
-       v += v > 0 ? -1 : 1;
+      if (!TRUNCATION_TOWARDS_ZERO && v1 * (v1 % v2) < 0)
+        v += v > 0 ? -1 : 1;
       break;
     case BINOP_REM:
       v = v1 % v2;
-      if (v*v1 < 0)
-       v -= v2;
+      if (v * v1 < 0)
+        v -= v2;
       break;
     default:
       /* Should not reach this point.  */
@@ -8653,29 +8712,28 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
 
   val = allocate_value (type1);
   store_unsigned_integer (VALUE_CONTENTS_RAW (val),
-                         TYPE_LENGTH (VALUE_TYPE (val)),
-                         v);
+                          TYPE_LENGTH (VALUE_TYPE (val)), v);
   return val;
 }
 
 static int
 ada_value_equal (struct value *arg1, struct value *arg2)
 {
-  if (ada_is_direct_array_type (VALUE_TYPE (arg1)) 
+  if (ada_is_direct_array_type (VALUE_TYPE (arg1))
       || ada_is_direct_array_type (VALUE_TYPE (arg2)))
     {
       arg1 = ada_coerce_to_simple_array (arg1);
       arg2 = ada_coerce_to_simple_array (arg2);
       if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_ARRAY
-         || TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_ARRAY)
-       error ("Attempt to compare array with non-array");
+          || TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_ARRAY)
+        error ("Attempt to compare array with non-array");
       /* FIXME: The following works only for types whose
-        representations use all bits (no padding or undefined bits)
-        and do not have user-defined equality.  */
-      return 
-       TYPE_LENGTH (VALUE_TYPE (arg1)) == TYPE_LENGTH (VALUE_TYPE (arg2))
-       && memcmp (VALUE_CONTENTS (arg1), VALUE_CONTENTS (arg2), 
-                  TYPE_LENGTH (VALUE_TYPE (arg1))) == 0;
+         representations use all bits (no padding or undefined bits)
+         and do not have user-defined equality.  */
+      return
+        TYPE_LENGTH (VALUE_TYPE (arg1)) == TYPE_LENGTH (VALUE_TYPE (arg2))
+        && memcmp (VALUE_CONTENTS (arg1), VALUE_CONTENTS (arg2),
+                   TYPE_LENGTH (VALUE_TYPE (arg1))) == 0;
     }
   return value_equal (arg1, arg2);
 }
@@ -8706,14 +8764,14 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
 
     case OP_STRING:
       {
-       struct value *result;
-       *pos -= 1;
-       result = evaluate_subexp_standard (expect_type, exp, pos, noside);
-       /* The result type will have code OP_STRING, bashed there from 
-          OP_ARRAY.  Bash it back.  */
-       if (TYPE_CODE (VALUE_TYPE (result)) == TYPE_CODE_STRING)
-         TYPE_CODE (VALUE_TYPE (result)) = TYPE_CODE_ARRAY;
-       return result;
+        struct value *result;
+        *pos -= 1;
+        result = evaluate_subexp_standard (expect_type, exp, pos, noside);
+        /* The result type will have code OP_STRING, bashed there from 
+           OP_ARRAY.  Bash it back.  */
+        if (TYPE_CODE (VALUE_TYPE (result)) == TYPE_CODE_STRING)
+          TYPE_CODE (VALUE_TYPE (result)) = TYPE_CODE_ARRAY;
+        return result;
       }
 
     case UNOP_CAST:
@@ -8757,12 +8815,12 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
         return arg1;
       if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
-       arg2 = cast_to_fixed (VALUE_TYPE (arg1), arg2);
+        arg2 = cast_to_fixed (VALUE_TYPE (arg1), arg2);
       else if (ada_is_fixed_point_type (VALUE_TYPE (arg2)))
-       error
-         ("Fixed-point values must be assigned to fixed-point variables");
+        error
+          ("Fixed-point values must be assigned to fixed-point variables");
       else
-       arg2 = coerce_for_assign (VALUE_TYPE (arg1), arg2);
+        arg2 = coerce_for_assign (VALUE_TYPE (arg1), arg2);
       return ada_value_assign (arg1, arg2);
 
     case BINOP_ADD:
@@ -8771,10 +8829,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       if (noside == EVAL_SKIP)
         goto nosideret;
       if ((ada_is_fixed_point_type (VALUE_TYPE (arg1))
-          || ada_is_fixed_point_type (VALUE_TYPE (arg2)))
-         && VALUE_TYPE (arg1) != VALUE_TYPE (arg2))
-       error
-         ("Operands of fixed-point addition must have the same type");
+           || ada_is_fixed_point_type (VALUE_TYPE (arg2)))
+          && VALUE_TYPE (arg1) != VALUE_TYPE (arg2))
+        error ("Operands of fixed-point addition must have the same type");
       return value_cast (VALUE_TYPE (arg1), value_add (arg1, arg2));
 
     case BINOP_SUB:
@@ -8783,10 +8840,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       if (noside == EVAL_SKIP)
         goto nosideret;
       if ((ada_is_fixed_point_type (VALUE_TYPE (arg1))
-          || ada_is_fixed_point_type (VALUE_TYPE (arg2)))
-         && VALUE_TYPE (arg1) != VALUE_TYPE (arg2))
-       error
-         ("Operands of fixed-point subtraction must have the same type");
+           || ada_is_fixed_point_type (VALUE_TYPE (arg2)))
+          && VALUE_TYPE (arg1) != VALUE_TYPE (arg2))
+        error ("Operands of fixed-point subtraction must have the same type");
       return value_cast (VALUE_TYPE (arg1), value_sub (arg1, arg2));
 
     case BINOP_MUL:
@@ -8796,7 +8852,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       if (noside == EVAL_SKIP)
         goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS
-              && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
+               && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
         return value_zero (VALUE_TYPE (arg1), not_lval);
       else
         {
@@ -8812,25 +8868,25 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
       arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
       if (noside == EVAL_SKIP)
-       goto nosideret;
+        goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS
-              && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
-       return value_zero (VALUE_TYPE (arg1), not_lval);
+               && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
+        return value_zero (VALUE_TYPE (arg1), not_lval);
       else
-       return ada_value_binop (arg1, arg2, op);
+        return ada_value_binop (arg1, arg2, op);
 
     case BINOP_EQUAL:
     case BINOP_NOTEQUAL:
       arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
       arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
       if (noside == EVAL_SKIP)
-       goto nosideret;
+        goto nosideret;
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
-       tem = 0;
+        tem = 0;
       else
-       tem = ada_value_equal (arg1, arg2);
+        tem = ada_value_equal (arg1, arg2);
       if (op == BINOP_NOTEQUAL)
-       tem = ! tem;
+        tem = !tem;
       return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem);
 
     case UNOP_NEG:
@@ -8850,9 +8906,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
           goto nosideret;
         }
       else if (SYMBOL_DOMAIN (exp->elts[pc + 2].symbol) == UNDEF_DOMAIN)
-       /* Only encountered when an unresolved symbol occurs in a
-          context other than a function call, in which case, it is
-          illegal.  */
+        /* Only encountered when an unresolved symbol occurs in a
+           context other than a function call, in which case, it is
+           illegal.  */
         error ("Unexpected unresolved symbol, %s, during evaluation",
                SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol));
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -8881,7 +8937,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
         (struct value **) alloca (sizeof (struct value *) * (nargs + 2));
 
       if (exp->elts[*pos].opcode == OP_VAR_VALUE
-         && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
+          && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
         error ("Unexpected unresolved symbol, %s, during evaluation",
                SYMBOL_PRINT_NAME (exp->elts[pc + 5].symbol));
       else
@@ -8897,8 +8953,8 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       if (ada_is_packed_array_type (desc_base_type (VALUE_TYPE (argvec[0]))))
         argvec[0] = ada_coerce_to_simple_array (argvec[0]);
       else if (TYPE_CODE (VALUE_TYPE (argvec[0])) == TYPE_CODE_REF
-          || (TYPE_CODE (VALUE_TYPE (argvec[0])) == TYPE_CODE_ARRAY
-              && VALUE_LVAL (argvec[0]) == lval_memory))
+               || (TYPE_CODE (VALUE_TYPE (argvec[0])) == TYPE_CODE_ARRAY
+                   && VALUE_LVAL (argvec[0]) == lval_memory))
         argvec[0] = value_addr (argvec[0]);
 
       type = check_typedef (VALUE_TYPE (argvec[0]));
@@ -8933,11 +8989,6 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
           {
             int arity;
 
-            /* Make sure to use the parallel ___XVS type if any.
-               Otherwise, we won't be able to find the array arity
-               and element type.  */
-            type = ada_get_base_type (type);
-
             arity = ada_array_arity (type);
             type = ada_array_element_type (type, nargs);
             if (type == NULL)
@@ -8992,14 +9043,6 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
         if (noside == EVAL_SKIP)
           goto nosideret;
 
-        /* If this is a reference type or a pointer type, and
-           the target type has an XVS parallel type, then get
-           the real target type.  */
-        if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_REF
-            || TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR)
-          TYPE_TARGET_TYPE (VALUE_TYPE (array)) =
-            ada_get_base_type (TYPE_TARGET_TYPE (VALUE_TYPE (array)));
-
         /* If this is a reference to an aligner type, then remove all
            the aligners.  */
         if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_REF
@@ -9007,8 +9050,8 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
           TYPE_TARGET_TYPE (VALUE_TYPE (array)) =
             ada_aligned_type (TYPE_TARGET_TYPE (VALUE_TYPE (array)));
 
-       if (ada_is_packed_array_type (VALUE_TYPE (array)))
-         error ("cannot slice a packed array");
+        if (ada_is_packed_array_type (VALUE_TYPE (array)))
+          error ("cannot slice a packed array");
 
         /* If this is a reference to an array or an array lvalue,
            convert to a pointer.  */
@@ -9017,26 +9060,16 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
                 && VALUE_LVAL (array) == lval_memory))
           array = value_addr (array);
 
-        if (noside == EVAL_AVOID_SIDE_EFFECTS &&
-            ada_is_array_descriptor_type (check_typedef (VALUE_TYPE (array))))
-          {
-            /* Try dereferencing the array, in case it is an access
-               to array.  */
-            struct type *arrType = ada_type_of_array (array, 0);
-            if (arrType != NULL)
-              array = value_at_lazy (arrType, 0, NULL);
-          }
+        if (noside == EVAL_AVOID_SIDE_EFFECTS
+            && ada_is_array_descriptor_type (check_typedef
+                                            (VALUE_TYPE (array))))
+          return empty_array (ada_type_of_array (array, 0), low_bound);
 
         array = ada_coerce_to_simple_array_ptr (array);
 
-        /* When EVAL_AVOID_SIDE_EFFECTS, we may get the bounds wrong,
-           but only in contexts where the value is not being requested
-           (FIXME?).  */
         if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR)
           {
-            if (noside == EVAL_AVOID_SIDE_EFFECTS)
-              return ada_value_ind (array);
-            else if (high_bound < low_bound)
+            if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS)
               return empty_array (TYPE_TARGET_TYPE (VALUE_TYPE (array)),
                                   low_bound);
             else
@@ -9044,15 +9077,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
                 struct type *arr_type0 =
                   to_fixed_array_type (TYPE_TARGET_TYPE (VALUE_TYPE (array)),
                                        NULL, 1);
-                struct value *item0 =
-                  ada_value_ptr_subscript (array, arr_type0, 1,
-                                           &low_bound_val);
-                struct value *slice =
-                  value_repeat (item0, high_bound - low_bound + 1);
-                struct type *arr_type1 = VALUE_TYPE (slice);
-                TYPE_LOW_BOUND (TYPE_INDEX_TYPE (arr_type1)) = low_bound;
-                TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (arr_type1)) += low_bound;
-                return slice;
+                return ada_value_slice_ptr (array, arr_type0,
+                                            (int) low_bound, 
+                                           (int) high_bound);
               }
           }
         else if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -9060,7 +9087,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
         else if (high_bound < low_bound)
           return empty_array (VALUE_TYPE (array), low_bound);
         else
-          return value_slice (array, low_bound, high_bound - low_bound + 1);
+          return ada_value_slice (array, (int) low_bound, (int) high_bound);
       }
 
     case UNOP_IN_RANGE:
@@ -9079,8 +9106,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
           return value_from_longest (builtin_type_int, (LONGEST) 1);
 
         case TYPE_CODE_RANGE:
-          arg2 = value_from_longest (builtin_type_int,
-                                     TYPE_LOW_BOUND (type));
+          arg2 = value_from_longest (builtin_type_int, TYPE_LOW_BOUND (type));
           arg3 = value_from_longest (builtin_type_int,
                                      TYPE_HIGH_BOUND (type));
           return
@@ -9136,126 +9162,126 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
     case OP_ATR_LAST:
     case OP_ATR_LENGTH:
       {
-       struct type *type_arg;
-       if (exp->elts[*pos].opcode == OP_TYPE)
-         {
-           evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
-           arg1 = NULL;
-           type_arg = exp->elts[pc + 2].type;
-         }
-       else
-         {
-           arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
-           type_arg = NULL;
-         }
-
-       if (exp->elts[*pos].opcode != OP_LONG)
-         error ("illegal operand to '%s", ada_attribute_name (op));
-       tem = longest_to_int (exp->elts[*pos + 2].longconst);
-       *pos += 4;
-
-       if (noside == EVAL_SKIP)
-         goto nosideret;
-
-       if (type_arg == NULL)
-         {
-           arg1 = ada_coerce_ref (arg1);
-
-           if (ada_is_packed_array_type (VALUE_TYPE (arg1)))
-             arg1 = ada_coerce_to_simple_array (arg1);
-
-           if (tem < 1 || tem > ada_array_arity (VALUE_TYPE (arg1)))
-             error ("invalid dimension number to '%s",
-                    ada_attribute_name (op));
-
-           if (noside == EVAL_AVOID_SIDE_EFFECTS)
-             {
-               type = ada_index_type (VALUE_TYPE (arg1), tem);
-               if (type == NULL)
-                 error
-                   ("attempt to take bound of something that is not an array");
-               return allocate_value (type);
-             }
-
-           switch (op)
-             {
-             default: /* Should never happen.  */
-               error ("unexpected attribute encountered");
-             case OP_ATR_FIRST:
-               return ada_array_bound (arg1, tem, 0);
-             case OP_ATR_LAST:
-               return ada_array_bound (arg1, tem, 1);
-             case OP_ATR_LENGTH:
-               return ada_array_length (arg1, tem);
-             }
-         }
-       else if (discrete_type_p (type_arg))
-         {
-           struct type *range_type;
-           char *name = ada_type_name (type_arg);
-           range_type = NULL;
-           if (name != NULL && TYPE_CODE (type_arg) != TYPE_CODE_ENUM)
-             range_type =
-               to_fixed_range_type (name, NULL, TYPE_OBJFILE (type_arg));
-           if (range_type == NULL)
-             range_type = type_arg;
-           switch (op)
-             {
-             default:
-               error ("unexpected attribute encountered");
-             case OP_ATR_FIRST:
-               return discrete_type_low_bound (range_type);
-             case OP_ATR_LAST:
-               return discrete_type_high_bound (range_type);
-             case OP_ATR_LENGTH:
-               error ("the 'length attribute applies only to array types");
-             }
-         }
-       else if (TYPE_CODE (type_arg) == TYPE_CODE_FLT)
-         error ("unimplemented type attribute");
-       else
-         {
-           LONGEST low, high;
-
-           if (ada_is_packed_array_type (type_arg))
-             type_arg = decode_packed_array_type (type_arg);
-
-           if (tem < 1 || tem > ada_array_arity (type_arg))
-             error ("invalid dimension number to '%s",
-                    ada_attribute_name (op));
-
-           type = ada_index_type (type_arg, tem);
-           if (type == NULL)
-             error ("attempt to take bound of something that is not an array");
-           if (noside == EVAL_AVOID_SIDE_EFFECTS)
-             return allocate_value (type);
-
-           switch (op)
-             {
-             default:
-               error ("unexpected attribute encountered");
-             case OP_ATR_FIRST:
-               low = ada_array_bound_from_type (type_arg, tem, 0, &type);
-               return value_from_longest (type, low);
-             case OP_ATR_LAST:
-               high =
-                 ada_array_bound_from_type (type_arg, tem, 1, &type);
-               return value_from_longest (type, high);
-             case OP_ATR_LENGTH:
-               low = ada_array_bound_from_type (type_arg, tem, 0, &type);
-               high = ada_array_bound_from_type (type_arg, tem, 1, NULL);
-               return value_from_longest (type, high - low + 1);
-             }
-         }
+        struct type *type_arg;
+        if (exp->elts[*pos].opcode == OP_TYPE)
+          {
+            evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
+            arg1 = NULL;
+            type_arg = exp->elts[pc + 2].type;
+          }
+        else
+          {
+            arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+            type_arg = NULL;
+          }
+
+        if (exp->elts[*pos].opcode != OP_LONG)
+          error ("illegal operand to '%s", ada_attribute_name (op));
+        tem = longest_to_int (exp->elts[*pos + 2].longconst);
+        *pos += 4;
+
+        if (noside == EVAL_SKIP)
+          goto nosideret;
+
+        if (type_arg == NULL)
+          {
+            arg1 = ada_coerce_ref (arg1);
+
+            if (ada_is_packed_array_type (VALUE_TYPE (arg1)))
+              arg1 = ada_coerce_to_simple_array (arg1);
+
+            if (tem < 1 || tem > ada_array_arity (VALUE_TYPE (arg1)))
+              error ("invalid dimension number to '%s",
+                     ada_attribute_name (op));
+
+            if (noside == EVAL_AVOID_SIDE_EFFECTS)
+              {
+                type = ada_index_type (VALUE_TYPE (arg1), tem);
+                if (type == NULL)
+                  error
+                    ("attempt to take bound of something that is not an array");
+                return allocate_value (type);
+              }
+
+            switch (op)
+              {
+              default:          /* Should never happen.  */
+                error ("unexpected attribute encountered");
+              case OP_ATR_FIRST:
+                return ada_array_bound (arg1, tem, 0);
+              case OP_ATR_LAST:
+                return ada_array_bound (arg1, tem, 1);
+              case OP_ATR_LENGTH:
+                return ada_array_length (arg1, tem);
+              }
+          }
+        else if (discrete_type_p (type_arg))
+          {
+            struct type *range_type;
+            char *name = ada_type_name (type_arg);
+            range_type = NULL;
+            if (name != NULL && TYPE_CODE (type_arg) != TYPE_CODE_ENUM)
+              range_type =
+                to_fixed_range_type (name, NULL, TYPE_OBJFILE (type_arg));
+            if (range_type == NULL)
+              range_type = type_arg;
+            switch (op)
+              {
+              default:
+                error ("unexpected attribute encountered");
+              case OP_ATR_FIRST:
+                return discrete_type_low_bound (range_type);
+              case OP_ATR_LAST:
+                return discrete_type_high_bound (range_type);
+              case OP_ATR_LENGTH:
+                error ("the 'length attribute applies only to array types");
+              }
+          }
+        else if (TYPE_CODE (type_arg) == TYPE_CODE_FLT)
+          error ("unimplemented type attribute");
+        else
+          {
+            LONGEST low, high;
+
+            if (ada_is_packed_array_type (type_arg))
+              type_arg = decode_packed_array_type (type_arg);
+
+            if (tem < 1 || tem > ada_array_arity (type_arg))
+              error ("invalid dimension number to '%s",
+                     ada_attribute_name (op));
+
+            type = ada_index_type (type_arg, tem);
+            if (type == NULL)
+              error
+                ("attempt to take bound of something that is not an array");
+            if (noside == EVAL_AVOID_SIDE_EFFECTS)
+              return allocate_value (type);
+
+            switch (op)
+              {
+              default:
+                error ("unexpected attribute encountered");
+              case OP_ATR_FIRST:
+                low = ada_array_bound_from_type (type_arg, tem, 0, &type);
+                return value_from_longest (type, low);
+              case OP_ATR_LAST:
+                high = ada_array_bound_from_type (type_arg, tem, 1, &type);
+                return value_from_longest (type, high);
+              case OP_ATR_LENGTH:
+                low = ada_array_bound_from_type (type_arg, tem, 0, &type);
+                high = ada_array_bound_from_type (type_arg, tem, 1, NULL);
+                return value_from_longest (type, high - low + 1);
+              }
+          }
       }
 
     case OP_ATR_TAG:
       arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
       if (noside == EVAL_SKIP)
-       goto nosideret;
+        goto nosideret;
 
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
-       return value_zero (ada_tag_type (arg1), not_lval);
+        return value_zero (ada_tag_type (arg1), not_lval);
 
       return ada_value_tag (arg1);
 
@@ -9265,26 +9291,26 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
       arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
       if (noside == EVAL_SKIP)
-       goto nosideret;
+        goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-       return value_zero (VALUE_TYPE (arg1), not_lval);
+        return value_zero (VALUE_TYPE (arg1), not_lval);
       else
-       return value_binop (arg1, arg2,
-                           op == OP_ATR_MIN ? BINOP_MIN : BINOP_MAX);
+        return value_binop (arg1, arg2,
+                            op == OP_ATR_MIN ? BINOP_MIN : BINOP_MAX);
 
     case OP_ATR_MODULUS:
       {
-       struct type *type_arg = exp->elts[pc + 2].type;
-       evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
+        struct type *type_arg = exp->elts[pc + 2].type;
+        evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
 
-       if (noside == EVAL_SKIP)
-         goto nosideret;
+        if (noside == EVAL_SKIP)
+          goto nosideret;
 
-       if (!ada_is_modular_type (type_arg))
-         error ("'modulus must be applied to modular type");
+        if (!ada_is_modular_type (type_arg))
+          error ("'modulus must be applied to modular type");
 
-       return value_from_longest (TYPE_TARGET_TYPE (type_arg),
-                                  ada_modulus (type_arg));
+        return value_from_longest (TYPE_TARGET_TYPE (type_arg),
+                                   ada_modulus (type_arg));
       }
 
 
@@ -9292,33 +9318,33 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
       arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
       if (noside == EVAL_SKIP)
-       goto nosideret;
+        goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-       return value_zero (builtin_type_ada_int, not_lval);
+        return value_zero (builtin_type_ada_int, not_lval);
       else
-       return value_pos_atr (arg1);
+        return value_pos_atr (arg1);
 
     case OP_ATR_SIZE:
       arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
       if (noside == EVAL_SKIP)
-       goto nosideret;
+        goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-       return value_zero (builtin_type_ada_int, not_lval);
+        return value_zero (builtin_type_ada_int, not_lval);
       else
-       return value_from_longest (builtin_type_ada_int,
-                                  TARGET_CHAR_BIT
-                                  * TYPE_LENGTH (VALUE_TYPE (arg1)));
+        return value_from_longest (builtin_type_ada_int,
+                                   TARGET_CHAR_BIT
+                                   * TYPE_LENGTH (VALUE_TYPE (arg1)));
 
     case OP_ATR_VAL:
       evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
       arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
       type = exp->elts[pc + 2].type;
       if (noside == EVAL_SKIP)
-       goto nosideret;
+        goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-       return value_zero (type, not_lval);
+        return value_zero (type, not_lval);
       else
-       return value_val_atr (type, arg1);
+        return value_val_atr (type, arg1);
 
     case BINOP_EXP:
       arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
@@ -9378,7 +9404,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
           else
             error ("Attempt to take contents of a non-pointer value.");
         }
-      arg1 = ada_coerce_ref (arg1);  /* FIXME: What is this for?? */
+      arg1 = ada_coerce_ref (arg1);     /* FIXME: What is this for?? */
       type = check_typedef (VALUE_TYPE (arg1));
 
       if (ada_is_array_descriptor_type (type))
@@ -9394,31 +9420,32 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       if (noside == EVAL_SKIP)
         goto nosideret;
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
-       {
-         struct type *type1 = VALUE_TYPE (arg1);
-         if (ada_is_tagged_type (type1, 1)) 
-           {
-             type = ada_lookup_struct_elt_type (type1, 
-                                                &exp->elts[pc + 2].string,
-                                                1, 1, NULL);
-             if (type == NULL)
-           /* In this case, we assume that the field COULD exist
-              in some extension of the type.  Return an object of 
-              "type" void, which will match any formal 
-              (see ada_type_match). */
-               return value_zero (builtin_type_void, lval_memory);
-           }
-         else
-           type = ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string,
-                                              1, 0, NULL);
-
-         return value_zero (ada_aligned_type (type), lval_memory);
-       }
+        {
+          struct type *type1 = VALUE_TYPE (arg1);
+          if (ada_is_tagged_type (type1, 1))
+            {
+              type = ada_lookup_struct_elt_type (type1,
+                                                 &exp->elts[pc + 2].string,
+                                                 1, 1, NULL);
+              if (type == NULL)
+                /* In this case, we assume that the field COULD exist
+                   in some extension of the type.  Return an object of 
+                   "type" void, which will match any formal 
+                   (see ada_type_match). */
+                return value_zero (builtin_type_void, lval_memory);
+            }
+          else
+            type =
+              ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string, 1,
+                                          0, NULL);
+
+          return value_zero (ada_aligned_type (type), lval_memory);
+        }
       else
-        return 
-         ada_to_fixed_value (unwrap_value 
-                             (ada_value_struct_elt
-                              (arg1, &exp->elts[pc + 2].string, "record")));
+        return
+          ada_to_fixed_value (unwrap_value
+                              (ada_value_struct_elt
+                               (arg1, &exp->elts[pc + 2].string, "record")));
     case OP_TYPE:
       /* The value is not supposed to be used.  This is here to make it
          easier to accommodate expressions that contain types.  */
@@ -9592,7 +9619,7 @@ ada_vax_float_print_function (struct type *type)
 
 static int
 scan_discrim_bound (char *str, int k, struct value *dval, LONGEST * px,
-                   int *pnew_k)
+                    int *pnew_k)
 {
   static char *bound_buffer = NULL;
   static size_t bound_buffer_len = 0;
@@ -9827,7 +9854,7 @@ ada_operator_length (struct expression *exp, int pc, int *oplenp, int *argsp)
 {
   switch (exp->elts[pc - 1].opcode)
     {
-    default: 
+    default:
       operator_length_standard (exp, pc, oplenp, argsp);
       break;
 
@@ -9843,7 +9870,7 @@ ada_op_name (enum exp_opcode opcode)
 {
   switch (opcode)
     {
-    default: 
+    default:
       return op_name_standard (opcode);
 #define OP_DEFN(op, len, args, binop) case op: return #op;
       ADA_OPERATORS;
@@ -9856,10 +9883,10 @@ ada_op_name (enum exp_opcode opcode)
    Ada-specific operators.  */
 
 static void
-ada_forward_operator_length (struct expression *exp, int pc, 
-                            int *oplenp, int *argsp)
+ada_forward_operator_length (struct expression *exp, int pc,
+                             int *oplenp, int *argsp)
 {
-  switch (exp->elts[pc].opcode) 
+  switch (exp->elts[pc].opcode)
     {
     default:
       *oplenp = *argsp = 0;
@@ -9878,12 +9905,12 @@ ada_dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
   int oplen, nargs;
   int pc = elt;
   int i;
-  
+
   ada_forward_operator_length (exp, elt, &oplen, &nargs);
 
-  switch (op) 
+  switch (op)
     {
-    /* Ada attributes ('Foo).  */
+      /* Ada attributes ('Foo).  */
     case OP_ATR_FIRST:
     case OP_ATR_LAST:
     case OP_ATR_LENGTH:
@@ -9924,9 +9951,9 @@ ada_dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
 
 /* The Ada extension of print_subexp (q.v.).  */
 
-static void 
-ada_print_subexp (struct expression *exp, int *pos, 
-                 struct ui_file *stream, enum precedence prec)
+static void
+ada_print_subexp (struct expression *exp, int *pos,
+                  struct ui_file *stream, enum precedence prec)
 {
   int oplen, nargs;
   int pc = *pos;
@@ -9952,21 +9979,22 @@ ada_print_subexp (struct expression *exp, int *pos,
       print_subexp (exp, pos, stream, PREC_SUFFIX);
       fputs_filtered ("'range", stream);
       if (exp->elts[pc + 1].longconst > 1)
-       fprintf_filtered (stream, "(%ld)", (long) exp->elts[pc + 1].longconst);
+        fprintf_filtered (stream, "(%ld)",
+                          (long) exp->elts[pc + 1].longconst);
       return;
 
     case TERNOP_IN_RANGE:
       *pos += oplen;
       if (prec >= PREC_EQUAL)
-       fputs_filtered ("(", stream);
+        fputs_filtered ("(", stream);
       print_subexp (exp, pos, stream, PREC_SUFFIX);
       fputs_filtered (" in ", stream);
       print_subexp (exp, pos, stream, PREC_EQUAL);
       fputs_filtered (" .. ", stream);
       print_subexp (exp, pos, stream, PREC_EQUAL);
       if (prec >= PREC_EQUAL)
-       fputs_filtered (")", stream);
-      return;      
+        fputs_filtered (")", stream);
+      return;
 
     case OP_ATR_FIRST:
     case OP_ATR_LAST:
@@ -9981,24 +10009,24 @@ ada_print_subexp (struct expression *exp, int *pos,
     case OP_ATR_VAL:
       *pos += oplen;
       if (exp->elts[*pos].opcode == OP_TYPE)
-       {
-         if (TYPE_CODE (exp->elts[*pos + 1].type) != TYPE_CODE_VOID)
-           LA_PRINT_TYPE (exp->elts[*pos + 1].type, "", stream, 0, 0);
-         *pos += 3;
-       }
+        {
+          if (TYPE_CODE (exp->elts[*pos + 1].type) != TYPE_CODE_VOID)
+            LA_PRINT_TYPE (exp->elts[*pos + 1].type, "", stream, 0, 0);
+          *pos += 3;
+        }
       else
-       print_subexp (exp, pos, stream, PREC_SUFFIX);
+        print_subexp (exp, pos, stream, PREC_SUFFIX);
       fprintf_filtered (stream, "'%s", ada_attribute_name (op));
       if (nargs > 1)
-       {
-         int tem;
-         for (tem = 1; tem < nargs; tem += 1)
-           {
-             fputs_filtered ( (tem == 1) ? " (" : ", ", stream);
-             print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
-           }
-         fputs_filtered (")", stream);
-       }
+        {
+          int tem;
+          for (tem = 1; tem < nargs; tem += 1)
+            {
+              fputs_filtered ((tem == 1) ? " (" : ", ", stream);
+              print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
+            }
+          fputs_filtered (")", stream);
+        }
       return;
 
     case UNOP_QUAL:
@@ -10056,191 +10084,7 @@ static const struct op_print ada_op_print_tab[] = {
   {NULL, 0, 0, 0}
 };
 \f
-                        /* Assorted Types and Interfaces */
-
-struct type *builtin_type_ada_int;
-struct type *builtin_type_ada_short;
-struct type *builtin_type_ada_long;
-struct type *builtin_type_ada_long_long;
-struct type *builtin_type_ada_char;
-struct type *builtin_type_ada_float;
-struct type *builtin_type_ada_double;
-struct type *builtin_type_ada_long_double;
-struct type *builtin_type_ada_natural;
-struct type *builtin_type_ada_positive;
-struct type *builtin_type_ada_system_address;
-
-struct type **const (ada_builtin_types[]) =
-{
-  &builtin_type_ada_int,
-  &builtin_type_ada_long,
-  &builtin_type_ada_short,
-  &builtin_type_ada_char,
-  &builtin_type_ada_float,
-  &builtin_type_ada_double,
-  &builtin_type_ada_long_long,
-  &builtin_type_ada_long_double,
-  &builtin_type_ada_natural, &builtin_type_ada_positive,
-  /* The following types are carried over from C for convenience.  */
-  &builtin_type_int,
-  &builtin_type_long,
-  &builtin_type_short,
-  &builtin_type_char,
-  &builtin_type_float,
-  &builtin_type_double,
-  &builtin_type_long_long,
-  &builtin_type_void,
-  &builtin_type_signed_char,
-  &builtin_type_unsigned_char,
-  &builtin_type_unsigned_short,
-  &builtin_type_unsigned_int,
-  &builtin_type_unsigned_long,
-  &builtin_type_unsigned_long_long,
-  &builtin_type_long_double,
-  &builtin_type_complex,
-  &builtin_type_double_complex,
-  0
-};
-
-/* Not really used, but needed in the ada_language_defn.  */
-
-static void
-emit_char (int c, struct ui_file *stream, int quoter)
-{
-  ada_emit_char (c, stream, quoter, 1);
-}
-
-static int
-parse ()
-{
-  warnings_issued = 0;
-  return ada_parse ();
-}
-
-static const struct exp_descriptor ada_exp_descriptor = 
-{
-  ada_print_subexp,
-  ada_operator_length,
-  ada_op_name,
-  ada_dump_subexp_body,
-  ada_evaluate_subexp
-};
-
-const struct language_defn ada_language_defn = {
-  "ada",                        /* Language name */
-  language_ada,
-  ada_builtin_types,
-  range_check_off,
-  type_check_off,
-  case_sensitive_on,            /* Yes, Ada is case-insensitive, but
-                                   that's not quite what this means.  */
-#ifdef GNAT_GDB
-  ada_lookup_symbol,
-  ada_lookup_minimal_symbol,
-#endif  /* GNAT_GDB */
-  &ada_exp_descriptor,
-  parse,
-  ada_error,
-  resolve,
-  ada_printchar,               /* Print a character constant */
-  ada_printstr,                        /* Function to print string constant */
-  emit_char,                   /* Function to print single char (not used) */
-  ada_create_fundamental_type, /* Create fundamental type in this language */
-  ada_print_type,              /* Print a type using appropriate syntax */
-  ada_val_print,               /* Print a value using appropriate syntax */
-  ada_value_print,             /* Print a top-level value */
-  NULL,                                /* Language specific skip_trampoline */
-  NULL,                                /* value_of_this */
-  ada_lookup_symbol_nonlocal,   /* Looking up non-local symbols.  */
-  basic_lookup_transparent_type,/* lookup_transparent_type */
-  ada_la_decode,               /* Language specific symbol demangler */
-  {"", "", "", ""},            /* Binary format info */
-#if 0
-  {"8#%lo#", "8#", "o", "#"},   /* Octal format info */
-  {"%ld", "", "d", ""},         /* Decimal format info */
-  {"16#%lx#", "16#", "x", "#"}, /* Hex format info */
-#else
-  /* Copied from c-lang.c.  */
-  {"0%lo", "0", "o", ""},       /* Octal format info */
-  {"%ld", "", "d", ""},         /* Decimal format info */
-  {"0x%lx", "0x", "x", ""},     /* Hex format info */
-#endif
-  ada_op_print_tab,             /* expression operators for printing */
-  0,                            /* c-style arrays */
-  1,                            /* String lower bound */
-  &builtin_type_ada_char,
-  ada_get_gdb_completer_word_break_characters,
-#ifdef GNAT_GDB
-  ada_translate_error_message,  /* Substitute Ada-specific terminology
-                                  in errors and warnings.  */
-#endif  /* GNAT_GDB */
-  LANG_MAGIC
-};
-
-static void
-build_ada_types (void) {
-  builtin_type_ada_int =
-    init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
-               0, "integer", (struct objfile *) NULL);
-  builtin_type_ada_long =
-    init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
-               0, "long_integer", (struct objfile *) NULL);
-  builtin_type_ada_short =
-    init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
-               0, "short_integer", (struct objfile *) NULL);
-  builtin_type_ada_char =
-    init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-               0, "character", (struct objfile *) NULL);
-  builtin_type_ada_float =
-    init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
-               0, "float", (struct objfile *) NULL);
-  builtin_type_ada_double =
-    init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
-               0, "long_float", (struct objfile *) NULL);
-  builtin_type_ada_long_long =
-    init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
-               0, "long_long_integer", (struct objfile *) NULL);
-  builtin_type_ada_long_double =
-    init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
-               0, "long_long_float", (struct objfile *) NULL);
-  builtin_type_ada_natural =
-    init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
-               0, "natural", (struct objfile *) NULL);
-  builtin_type_ada_positive =
-    init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
-               0, "positive", (struct objfile *) NULL);
-
-
-  builtin_type_ada_system_address =
-    lookup_pointer_type (init_type (TYPE_CODE_VOID, 1, 0, "void",
-                                    (struct objfile *) NULL));
-  TYPE_NAME (builtin_type_ada_system_address) = "system__address";
-}
-
-void
-_initialize_ada_language (void)
-{
-
-  build_ada_types ();
-  deprecated_register_gdbarch_swap (NULL, 0, build_ada_types);
-  add_language (&ada_language_defn);
-
-  varsize_limit = 65536;
-#ifdef GNAT_GDB
-  add_show_from_set
-    (add_set_cmd ("varsize-limit", class_support, var_uinteger,
-                  (char *) &varsize_limit,
-                  "Set maximum bytes in dynamic-sized object.",
-                  &setlist), &showlist);
-  obstack_init (&cache_space);
-#endif  /* GNAT_GDB */
-
-  obstack_init (&symbol_list_obstack);
-
-  decoded_names_store = htab_create_alloc_ex 
-    (256, htab_hash_string, (int (*) (const void *, const void *)) streq,
-     NULL, NULL, xmcalloc, xmfree);
-}
+                               /* Fundamental Ada Types */
 
 /* Create a fundamental Ada type using default reasonable for the current
    target machine.
@@ -10379,22 +10223,177 @@ ada_create_fundamental_type (struct objfile *objfile, int typeid)
   return (type);
 }
 
+struct type *builtin_type_ada_int;
+struct type *builtin_type_ada_short;
+struct type *builtin_type_ada_long;
+struct type *builtin_type_ada_long_long;
+struct type *builtin_type_ada_char;
+struct type *builtin_type_ada_float;
+struct type *builtin_type_ada_double;
+struct type *builtin_type_ada_long_double;
+struct type *builtin_type_ada_natural;
+struct type *builtin_type_ada_positive;
+struct type *builtin_type_ada_system_address;
+
+struct type **const (ada_builtin_types[]) =
+{
+  &builtin_type_ada_int,
+    &builtin_type_ada_long,
+    &builtin_type_ada_short,
+    &builtin_type_ada_char,
+    &builtin_type_ada_float,
+    &builtin_type_ada_double,
+    &builtin_type_ada_long_long,
+    &builtin_type_ada_long_double,
+    &builtin_type_ada_natural, &builtin_type_ada_positive,
+    /* The following types are carried over from C for convenience.  */
+&builtin_type_int,
+    &builtin_type_long,
+    &builtin_type_short,
+    &builtin_type_char,
+    &builtin_type_float,
+    &builtin_type_double,
+    &builtin_type_long_long,
+    &builtin_type_void,
+    &builtin_type_signed_char,
+    &builtin_type_unsigned_char,
+    &builtin_type_unsigned_short,
+    &builtin_type_unsigned_int,
+    &builtin_type_unsigned_long,
+    &builtin_type_unsigned_long_long,
+    &builtin_type_long_double,
+    &builtin_type_complex, &builtin_type_double_complex, 0};
+
+static void
+build_ada_types (struct gdbarch *current_gdbarch)
+{
+  builtin_type_ada_int =
+    init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+               0, "integer", (struct objfile *) NULL);
+  builtin_type_ada_long =
+    init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
+               0, "long_integer", (struct objfile *) NULL);
+  builtin_type_ada_short =
+    init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+               0, "short_integer", (struct objfile *) NULL);
+  builtin_type_ada_char =
+    init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+               0, "character", (struct objfile *) NULL);
+  builtin_type_ada_float =
+    init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+               0, "float", (struct objfile *) NULL);
+  builtin_type_ada_double =
+    init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+               0, "long_float", (struct objfile *) NULL);
+  builtin_type_ada_long_long =
+    init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+               0, "long_long_integer", (struct objfile *) NULL);
+  builtin_type_ada_long_double =
+    init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+               0, "long_long_float", (struct objfile *) NULL);
+  builtin_type_ada_natural =
+    init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+               0, "natural", (struct objfile *) NULL);
+  builtin_type_ada_positive =
+    init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+               0, "positive", (struct objfile *) NULL);
+
+
+  builtin_type_ada_system_address =
+    lookup_pointer_type (init_type (TYPE_CODE_VOID, 1, 0, "void",
+                                    (struct objfile *) NULL));
+  TYPE_NAME (builtin_type_ada_system_address) = "system__address";
+}
+
+\f
+                               /* Language vector */
+
+/* Not really used, but needed in the ada_language_defn.  */
+
+static void
+emit_char (int c, struct ui_file *stream, int quoter)
+{
+  ada_emit_char (c, stream, quoter, 1);
+}
+
+static int
+parse (void)
+{
+  warnings_issued = 0;
+  return ada_parse ();
+}
+
+static const struct exp_descriptor ada_exp_descriptor = {
+  ada_print_subexp,
+  ada_operator_length,
+  ada_op_name,
+  ada_dump_subexp_body,
+  ada_evaluate_subexp
+};
+
+const struct language_defn ada_language_defn = {
+  "ada",                        /* Language name */
+  language_ada,
+  ada_builtin_types,
+  range_check_off,
+  type_check_off,
+  case_sensitive_on,            /* Yes, Ada is case-insensitive, but
+                                   that's not quite what this means.  */
+#ifdef GNAT_GDB
+  ada_lookup_symbol,
+  ada_lookup_minimal_symbol,
+#endif /* GNAT_GDB */
+  array_row_major,
+  &ada_exp_descriptor,
+  parse,
+  ada_error,
+  resolve,
+  ada_printchar,                /* Print a character constant */
+  ada_printstr,                 /* Function to print string constant */
+  emit_char,                    /* Function to print single char (not used) */
+  ada_create_fundamental_type,  /* Create fundamental type in this language */
+  ada_print_type,               /* Print a type using appropriate syntax */
+  ada_val_print,                /* Print a value using appropriate syntax */
+  ada_value_print,              /* Print a top-level value */
+  NULL,                         /* Language specific skip_trampoline */
+  NULL,                         /* value_of_this */
+  ada_lookup_symbol_nonlocal,   /* Looking up non-local symbols.  */
+  basic_lookup_transparent_type,        /* lookup_transparent_type */
+  ada_la_decode,                /* Language specific symbol demangler */
+  NULL,                         /* Language specific class_name_from_physname */
+  ada_op_print_tab,             /* expression operators for printing */
+  0,                            /* c-style arrays */
+  1,                            /* String lower bound */
+  &builtin_type_ada_char,
+  ada_get_gdb_completer_word_break_characters,
+#ifdef GNAT_GDB
+  ada_translate_error_message,  /* Substitute Ada-specific terminology
+                                   in errors and warnings.  */
+#endif /* GNAT_GDB */
+  LANG_MAGIC
+};
+
 void
-ada_dump_symtab (struct symtab *s)
+_initialize_ada_language (void)
 {
-  int i;
-  fprintf (stderr, "New symtab: [\n");
-  fprintf (stderr, "  Name: %s/%s;\n",
-           s->dirname ? s->dirname : "?", s->filename ? s->filename : "?");
-  fprintf (stderr, "  Format: %s;\n", s->debugformat);
-  if (s->linetable != NULL)
-    {
-      fprintf (stderr, "  Line table (section %d):\n", s->block_line_section);
-      for (i = 0; i < s->linetable->nitems; i += 1)
-        {
-          struct linetable_entry *e = s->linetable->item + i;
-          fprintf (stderr, "    %4ld: %8lx\n", (long) e->line, (long) e->pc);
-        }
-    }
-  fprintf (stderr, "]\n");
+
+  build_ada_types (current_gdbarch);
+  gdbarch_data_register_post_init (build_ada_types);
+  add_language (&ada_language_defn);
+
+  varsize_limit = 65536;
+#ifdef GNAT_GDB
+  add_setshow_uinteger_cmd ("varsize-limit", class_support,
+                           &varsize_limit, "\
+Set the maximum number of bytes allowed in a dynamic-sized object.", "\
+Show the maximum number of bytes allowed in a dynamic-sized object.",
+                           NULL, NULL, &setlist, &showlist);
+  obstack_init (&cache_space);
+#endif /* GNAT_GDB */
+
+  obstack_init (&symbol_list_obstack);
+
+  decoded_names_store = htab_create_alloc
+    (256, htab_hash_string, (int (*)(const void *, const void *)) streq,
+     NULL, xcalloc, xfree);
 }
This page took 0.120926 seconds and 4 git commands to generate.