Fix indentation in print_thread_info_1
[deliverable/binutils-gdb.git] / gdb / ada-lang.c
index c34733e754f6fa2bf473317a35c14d132cf0b4ca..030c4aa131b5981f9931c3506eaa4b63b0ebd7f9 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "defs.h"
 #include <ctype.h>
-#include "demangle.h"
 #include "gdb_regex.h"
 #include "frame.h"
 #include "symtab.h"
@@ -30,7 +29,6 @@
 #include "parser-defs.h"
 #include "language.h"
 #include "varobj.h"
-#include "c-lang.h"
 #include "inferior.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "gdb_obstack.h"
 #include "ada-lang.h"
 #include "completer.h"
-#include <sys/stat.h>
 #include "ui-out.h"
 #include "block.h"
 #include "infcall.h"
-#include "dictionary.h"
 #include "annotate.h"
 #include "valprint.h"
 #include "source.h"
 #include "observable.h"
-#include "gdbsupport/vec.h"
 #include "stack.h"
-#include "gdbsupport/gdb_vecs.h"
 #include "typeprint.h"
 #include "namespace.h"
+#include "cli/cli-style.h"
 
-#include "psymtab.h"
 #include "value.h"
 #include "mi/mi-common.h"
 #include "arch-utils.h"
@@ -63,7 +57,6 @@
 #include "gdbsupport/function-view.h"
 #include "gdbsupport/byte-vector.h"
 #include <algorithm>
-#include <map>
 
 /* Define whether or not the C operator '/' truncates towards zero for
    differently signed operands (truncation direction is undefined in C).
@@ -534,7 +527,7 @@ ada_print_array_index (struct value *index_value, struct ui_file *stream,
 
 /* la_watch_location_expression for Ada.  */
 
-gdb::unique_xmalloc_ptr<char>
+static gdb::unique_xmalloc_ptr<char>
 ada_watch_location_expression (struct type *type, CORE_ADDR addr)
 {
   type = check_typedef (TYPE_TARGET_TYPE (check_typedef (type)));
@@ -543,11 +536,17 @@ ada_watch_location_expression (struct type *type, CORE_ADDR addr)
     (xstrprintf ("{%s} %s", name.c_str (), core_addr_to_string (addr)));
 }
 
+/* Assuming V points to an array of S objects,  make sure that it contains at
+   least M objects, updating V and S as necessary.  */
+
+#define GROW_VECT(v, s, m)                                    \
+   if ((s) < (m)) (v) = (char *) grow_vect (v, &(s), m, sizeof *(v));
+
 /* Assuming VECT points to an array of *SIZE objects of size
    ELEMENT_SIZE, grow it to contain at least MIN_SIZE objects,
    updating *SIZE as necessary and returning the (new) array.  */
 
-void *
+static void *
 grow_vect (void *vect, size_t *size, size_t min_size, int element_size)
 {
   if (*size < min_size)
@@ -825,7 +824,7 @@ get_base_type (struct type *type)
 
 /* Return a decoded version of the given VALUE.  This means returning
    a value whose type is obtained by applying all the GNAT-specific
-   encondings, making the resulting type a static but standard description
+   encodings, making the resulting type a static but standard description
    of the initial type.  */
 
 struct value *
@@ -869,7 +868,7 @@ ada_get_decoded_type (struct type *type)
 /* If the main program is in Ada, return language_ada, otherwise return LANG
    (the main program is in Ada iif the adainit symbol is found).  */
 
-enum language
+static enum language
 ada_update_initial_language (enum language lang)
 {
   if (lookup_minimal_symbol ("adainit", NULL, NULL).minsym != NULL)
@@ -1016,7 +1015,7 @@ ada_encode (const char *decoded)
    quotes, unfolded, but with the quotes stripped away.  Result good
    to next call.  */
 
-char *
+static char *
 ada_fold_name (const char *name)
 {
   static char *fold_buffer = NULL;
@@ -1105,22 +1104,16 @@ ada_remove_po_subprogram_suffix (const char *encoded, int *len)
 
 /* If ENCODED follows the GNAT entity encoding conventions, then return
    the decoded form of ENCODED.  Otherwise, return "<%s>" where "%s" is
-   replaced by ENCODED.
-
-   The resulting string is valid until the next call of ada_decode.
-   If the string is unchanged by decoding, the original string pointer
-   is returned.  */
+   replaced by ENCODED.  */
 
-const char *
+std::string
 ada_decode (const char *encoded)
 {
   int i, j;
   int len0;
   const char *p;
-  char *decoded;
   int at_start_name;
-  static char *decoding_buffer = NULL;
-  static size_t decoding_buffer_size = 0;
+  std::string decoded;
 
   /* With function descriptors on PPC64, the value of a symbol named
      ".FN", if it exists, is the entry point of the function "FN".  */
@@ -1179,8 +1172,7 @@ ada_decode (const char *encoded)
 
   /* Make decoded big enough for possible expansion by operator name.  */
 
-  GROW_VECT (decoding_buffer, decoding_buffer_size, 2 * len0 + 1);
-  decoded = decoding_buffer;
+  decoded.resize (2 * len0 + 1, 'X');
 
   /* Remove trailing __{digit}+ or trailing ${digit}+.  */
 
@@ -1217,7 +1209,7 @@ ada_decode (const char *encoded)
                             op_len - 1) == 0)
                   && !isalnum (encoded[i + op_len]))
                 {
-                  strcpy (decoded + j, ada_opname_table[k].decoded);
+                  strcpy (&decoded.front() + j, ada_opname_table[k].decoded);
                   at_start_name = 0;
                   i += op_len;
                   j += strlen (ada_opname_table[k].decoded);
@@ -1338,27 +1330,22 @@ ada_decode (const char *encoded)
           j += 1;
         }
     }
-  decoded[j] = '\000';
+  decoded.resize (j);
 
   /* Decoded names should never contain any uppercase character.
      Double-check this, and abort the decoding if we find one.  */
 
-  for (i = 0; decoded[i] != '\0'; i += 1)
+  for (i = 0; i < decoded.length(); ++i)
     if (isupper (decoded[i]) || decoded[i] == ' ')
       goto Suppress;
 
-  if (strcmp (decoded, encoded) == 0)
-    return encoded;
-  else
-    return decoded;
+  return decoded;
 
 Suppress:
-  GROW_VECT (decoding_buffer, decoding_buffer_size, strlen (encoded) + 3);
-  decoded = decoding_buffer;
   if (encoded[0] == '<')
-    strcpy (decoded, encoded);
+    decoded = encoded;
   else
-    xsnprintf (decoded, decoding_buffer_size, "<%s>", encoded);
+    decoded = '<' + std::string(encoded) + '>';
   return decoded;
 
 }
@@ -1389,13 +1376,13 @@ ada_decode_symbol (const struct general_symbol_info *arg)
 
   if (!gsymbol->ada_mangled)
     {
-      const char *decoded = ada_decode (gsymbol->name);
+      std::string decoded = ada_decode (gsymbol->name);
       struct obstack *obstack = gsymbol->language_specific.obstack;
 
       gsymbol->ada_mangled = 1;
 
       if (obstack != NULL)
-       *resultp = obstack_strdup (obstack, decoded);
+       *resultp = obstack_strdup (obstack, decoded.c_str ());
       else
         {
          /* Sometimes, we can't find a corresponding objfile, in
@@ -1404,10 +1391,10 @@ ada_decode_symbol (const struct general_symbol_info *arg)
             significant memory leak (FIXME).  */
 
           char **slot = (char **) htab_find_slot (decoded_names_store,
-                                                  decoded, INSERT);
+                                                  decoded.c_str (), INSERT);
 
           if (*slot == NULL)
-            *slot = xstrdup (decoded);
+            *slot = xstrdup (decoded.c_str ());
           *resultp = *slot;
         }
     }
@@ -1418,7 +1405,7 @@ ada_decode_symbol (const struct general_symbol_info *arg)
 static char *
 ada_la_decode (const char *encoded, int options)
 {
-  return xstrdup (ada_decode (encoded));
+  return xstrdup (ada_decode (encoded).c_str ());
 }
 
 /* Implement la_sniff_from_mangled_name for Ada.  */
@@ -1426,11 +1413,11 @@ ada_la_decode (const char *encoded, int options)
 static int
 ada_sniff_from_mangled_name (const char *mangled, char **out)
 {
-  const char *demangled = ada_decode (mangled);
+  std::string demangled = ada_decode (mangled);
 
   *out = NULL;
 
-  if (demangled != mangled && demangled != NULL && demangled[0] != '<')
+  if (demangled != mangled && demangled[0] != '<')
     {
       /* Set the gsymbol language to Ada, but still return 0.
         Two reasons for that:
@@ -1471,7 +1458,7 @@ ada_sniff_from_mangled_name (const char *mangled, char **out)
    Otherwise, do nothing.  This function also does nothing if
    INDEX_DESC_TYPE is NULL.
 
-   The GNAT encoding used to describle the array index type evolved a bit.
+   The GNAT encoding used to describe the array index type evolved a bit.
    Initially, the information would be provided through the name of each
    field of the structure type only, while the type of these fields was
    described as unspecified and irrelevant.  The debugger was then expected
@@ -1929,7 +1916,8 @@ ada_is_bogus_array_descriptor (struct type *type)
    the ARR denotes a null array descriptor and BOUNDS is non-zero,
    returns NULL.  The result is simply the type of ARR if ARR is not
    a descriptor.  */
-struct type *
+
+static struct type *
 ada_type_of_array (struct value *arr, int bounds)
 {
   if (ada_is_constrained_packed_array_type (value_type (arr)))
@@ -2269,7 +2257,7 @@ decode_constrained_packed_array (struct value *arr)
       return NULL;
     }
 
-  if (gdbarch_bits_big_endian (get_type_arch (value_type (arr)))
+  if (type_byte_order (value_type (arr)) == BFD_ENDIAN_BIG
       && ada_is_modular_type (value_type (arr)))
     {
        /* This is a (right-justified) modular type representing a packed
@@ -2511,7 +2499,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
   const gdb_byte *src;                /* First byte containing data to unpack */
   gdb_byte *unpacked;
   const int is_scalar = is_scalar_type (type);
-  const int is_big_endian = gdbarch_bits_big_endian (get_type_arch (type));
+  const int is_big_endian = type_byte_order (type) == BFD_ENDIAN_BIG;
   gdb::byte_vector staging;
 
   type = ada_check_typedef (type);
@@ -2657,7 +2645,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
       if (from_size == 0)
        from_size = TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT;
 
-      const int is_big_endian = gdbarch_bits_big_endian (get_type_arch (type));
+      const int is_big_endian = type_byte_order (type) == BFD_ENDIAN_BIG;
       ULONGEST from_offset = 0;
       if (is_big_endian && is_scalar_type (value_type (fromval)))
        from_offset = from_size - bits;
@@ -2706,7 +2694,7 @@ value_assign_to_component (struct value *container, struct value *component,
   else
     bits = value_bitsize (component);
 
-  if (gdbarch_bits_big_endian (get_type_arch (value_type (container))))
+  if (type_byte_order (value_type (container)) == BFD_ENDIAN_BIG)
     {
       int src_offset;
 
@@ -3159,887 +3147,886 @@ ada_decoded_op_name (enum exp_opcode op)
   error (_("Could not find operator name for opcode"));
 }
 
+/* Returns true (non-zero) iff decoded name N0 should appear before N1
+   in a listing of choices during disambiguation (see sort_choices, below).
+   The idea is that overloadings of a subprogram name from the
+   same package should sort in their source order.  We settle for ordering
+   such symbols by their trailing number (__N  or $N).  */
 
-/* Same as evaluate_type (*EXP), but resolves ambiguous symbol
-   references (marked by OP_VAR_VALUE nodes in which the symbol has an
-   undefined namespace) and converts operators that are
-   user-defined into appropriate function calls.  If CONTEXT_TYPE is
-   non-null, it provides a preferred result type [at the moment, only
-   type void has any effect---causing procedures to be preferred over
-   functions in calls].  A null CONTEXT_TYPE indicates that a non-void
-   return type is preferred.  May change (expand) *EXP.  */
-
-static void
-resolve (expression_up *expp, int void_context_p, int parse_completion,
-        innermost_block_tracker *tracker)
+static int
+encoded_ordered_before (const char *N0, const char *N1)
 {
-  struct type *context_type = NULL;
-  int pc = 0;
+  if (N1 == NULL)
+    return 0;
+  else if (N0 == NULL)
+    return 1;
+  else
+    {
+      int k0, k1;
 
-  if (void_context_p)
-    context_type = builtin_type ((*expp)->gdbarch)->builtin_void;
+      for (k0 = strlen (N0) - 1; k0 > 0 && isdigit (N0[k0]); k0 -= 1)
+        ;
+      for (k1 = strlen (N1) - 1; k1 > 0 && isdigit (N1[k1]); k1 -= 1)
+        ;
+      if ((N0[k0] == '_' || N0[k0] == '$') && N0[k0 + 1] != '\000'
+          && (N1[k1] == '_' || N1[k1] == '$') && N1[k1 + 1] != '\000')
+        {
+          int n0, n1;
 
-  resolve_subexp (expp, &pc, 1, context_type, parse_completion, tracker);
+          n0 = k0;
+          while (N0[n0] == '_' && n0 > 0 && N0[n0 - 1] == '_')
+            n0 -= 1;
+          n1 = k1;
+          while (N1[n1] == '_' && n1 > 0 && N1[n1 - 1] == '_')
+            n1 -= 1;
+          if (n0 == n1 && strncmp (N0, N1, n0) == 0)
+            return (atoi (N0 + k0 + 1) < atoi (N1 + k1 + 1));
+        }
+      return (strcmp (N0, N1) < 0);
+    }
 }
 
-/* Resolve the operator of the subexpression beginning at
-   position *POS of *EXPP.  "Resolving" consists of replacing
-   the symbols that have undefined namespaces in OP_VAR_VALUE nodes
-   with their resolutions, replacing built-in operators with
-   function calls to user-defined operators, where appropriate, and,
-   when DEPROCEDURE_P is non-zero, converting function-valued variables
-   into parameterless calls.  May expand *EXPP.  The CONTEXT_TYPE functions
-   are as in ada_resolve, above.  */
+/* Sort SYMS[0..NSYMS-1] to put the choices in a canonical order by the
+   encoded names.  */
 
-static struct value *
-resolve_subexp (expression_up *expp, int *pos, int deprocedure_p,
-                struct type *context_type, int parse_completion,
-               innermost_block_tracker *tracker)
+static void
+sort_choices (struct block_symbol syms[], int nsyms)
 {
-  int pc = *pos;
   int i;
-  struct expression *exp;       /* Convenience: == *expp.  */
-  enum exp_opcode op = (*expp)->elts[pc].opcode;
-  struct value **argvec;        /* Vector of operand types (alloca'ed).  */
-  int nargs;                    /* Number of operands.  */
-  int oplen;
-
-  argvec = NULL;
-  nargs = 0;
-  exp = expp->get ();
 
-  /* Pass one: resolve operands, saving their types and updating *pos,
-     if needed.  */
-  switch (op)
+  for (i = 1; i < nsyms; i += 1)
     {
-    case OP_FUNCALL:
-      if (exp->elts[pc + 3].opcode == OP_VAR_VALUE
-          && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
-        *pos += 7;
-      else
+      struct block_symbol sym = syms[i];
+      int j;
+
+      for (j = i - 1; j >= 0; j -= 1)
         {
-          *pos += 3;
-          resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker);
+          if (encoded_ordered_before (syms[j].symbol->linkage_name (),
+                                      sym.symbol->linkage_name ()))
+            break;
+          syms[j + 1] = syms[j];
         }
-      nargs = longest_to_int (exp->elts[pc + 1].longconst);
-      break;
+      syms[j + 1] = sym;
+    }
+}
 
-    case UNOP_ADDR:
-      *pos += 1;
-      resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker);
-      break;
+/* Whether GDB should display formals and return types for functions in the
+   overloads selection menu.  */
+static bool print_signatures = true;
 
-    case UNOP_QUAL:
-      *pos += 3;
-      resolve_subexp (expp, pos, 1, check_typedef (exp->elts[pc + 1].type),
-                     parse_completion, tracker);
-      break;
+/* Print the signature for SYM on STREAM according to the FLAGS options.  For
+   all but functions, the signature is just the name of the symbol.  For
+   functions, this is the name of the function, the list of types for formals
+   and the return type (if any).  */
 
-    case OP_ATR_MODULUS:
-    case OP_ATR_SIZE:
-    case OP_ATR_TAG:
-    case OP_ATR_FIRST:
-    case OP_ATR_LAST:
-    case OP_ATR_LENGTH:
-    case OP_ATR_POS:
-    case OP_ATR_VAL:
-    case OP_ATR_MIN:
-    case OP_ATR_MAX:
-    case TERNOP_IN_RANGE:
-    case BINOP_IN_BOUNDS:
-    case UNOP_IN_RANGE:
-    case OP_AGGREGATE:
-    case OP_OTHERS:
-    case OP_CHOICES:
-    case OP_POSITIONAL:
-    case OP_DISCRETE_RANGE:
-    case OP_NAME:
-      ada_forward_operator_length (exp, pc, &oplen, &nargs);
-      *pos += oplen;
-      break;
+static void
+ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym,
+                           const struct type_print_options *flags)
+{
+  struct type *type = SYMBOL_TYPE (sym);
 
-    case BINOP_ASSIGN:
-      {
-        struct value *arg1;
+  fprintf_filtered (stream, "%s", sym->print_name ());
+  if (!print_signatures
+      || type == NULL
+      || TYPE_CODE (type) != TYPE_CODE_FUNC)
+    return;
 
-        *pos += 1;
-        arg1 = resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker);
-        if (arg1 == NULL)
-          resolve_subexp (expp, pos, 1, NULL, parse_completion, tracker);
-        else
-          resolve_subexp (expp, pos, 1, value_type (arg1), parse_completion,
-                         tracker);
-        break;
-      }
+  if (TYPE_NFIELDS (type) > 0)
+    {
+      int i;
 
-    case UNOP_CAST:
-      *pos += 3;
-      nargs = 1;
-      break;
+      fprintf_filtered (stream, " (");
+      for (i = 0; i < TYPE_NFIELDS (type); ++i)
+       {
+         if (i > 0)
+           fprintf_filtered (stream, "; ");
+         ada_print_type (TYPE_FIELD_TYPE (type, i), NULL, stream, -1, 0,
+                         flags);
+       }
+      fprintf_filtered (stream, ")");
+    }
+  if (TYPE_TARGET_TYPE (type) != NULL
+      && TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+    {
+      fprintf_filtered (stream, " return ");
+      ada_print_type (TYPE_TARGET_TYPE (type), NULL, stream, -1, 0, flags);
+    }
+}
 
-    case BINOP_ADD:
-    case BINOP_SUB:
-    case BINOP_MUL:
-    case BINOP_DIV:
-    case BINOP_REM:
-    case BINOP_MOD:
-    case BINOP_EXP:
-    case BINOP_CONCAT:
-    case BINOP_LOGICAL_AND:
-    case BINOP_LOGICAL_OR:
-    case BINOP_BITWISE_AND:
-    case BINOP_BITWISE_IOR:
-    case BINOP_BITWISE_XOR:
+/* Read and validate a set of numeric choices from the user in the
+   range 0 .. N_CHOICES-1.  Place the results in increasing
+   order in CHOICES[0 .. N-1], and return N.
 
-    case BINOP_EQUAL:
-    case BINOP_NOTEQUAL:
-    case BINOP_LESS:
-    case BINOP_GTR:
-    case BINOP_LEQ:
-    case BINOP_GEQ:
+   The user types choices as a sequence of numbers on one line
+   separated by blanks, encoding them as follows:
 
-    case BINOP_REPEAT:
-    case BINOP_SUBSCRIPT:
-    case BINOP_COMMA:
-      *pos += 1;
-      nargs = 2;
-      break;
+     + A choice of 0 means to cancel the selection, throwing an error.
+     + If IS_ALL_CHOICE, a choice of 1 selects the entire set 0 .. N_CHOICES-1.
+     + The user chooses k by typing k+IS_ALL_CHOICE+1.
 
-    case UNOP_NEG:
-    case UNOP_PLUS:
-    case UNOP_LOGICAL_NOT:
-    case UNOP_ABS:
-    case UNOP_IND:
-      *pos += 1;
-      nargs = 1;
-      break;
+   The user is not allowed to choose more than MAX_RESULTS values.
 
-    case OP_LONG:
-    case OP_FLOAT:
-    case OP_VAR_VALUE:
-    case OP_VAR_MSYM_VALUE:
-      *pos += 4;
-      break;
+   ANNOTATION_SUFFIX, if present, is used to annotate the input
+   prompts (for use with the -f switch).  */
 
-    case OP_TYPE:
-    case OP_BOOL:
-    case OP_LAST:
-    case OP_INTERNALVAR:
-      *pos += 3;
-      break;
+static int
+get_selections (int *choices, int n_choices, int max_results,
+                int is_all_choice, const char *annotation_suffix)
+{
+  const char *args;
+  const char *prompt;
+  int n_chosen;
+  int first_choice = is_all_choice ? 2 : 1;
 
-    case UNOP_MEMVAL:
-      *pos += 3;
-      nargs = 1;
-      break;
-
-    case OP_REGISTER:
-      *pos += 4 + BYTES_TO_EXP_ELEM (exp->elts[pc + 1].longconst + 1);
-      break;
-
-    case STRUCTOP_STRUCT:
-      *pos += 4 + BYTES_TO_EXP_ELEM (exp->elts[pc + 1].longconst + 1);
-      nargs = 1;
-      break;
-
-    case TERNOP_SLICE:
-      *pos += 1;
-      nargs = 3;
-      break;
+  prompt = getenv ("PS2");
+  if (prompt == NULL)
+    prompt = "> ";
 
-    case OP_STRING:
-      break;
+  args = command_line_input (prompt, annotation_suffix);
 
-    default:
-      error (_("Unexpected operator during name resolution"));
-    }
+  if (args == NULL)
+    error_no_arg (_("one or more choice numbers"));
 
-  argvec = XALLOCAVEC (struct value *, nargs + 1);
-  for (i = 0; i < nargs; i += 1)
-    argvec[i] = resolve_subexp (expp, pos, 1, NULL, parse_completion,
-                               tracker);
-  argvec[i] = NULL;
-  exp = expp->get ();
+  n_chosen = 0;
 
-  /* Pass two: perform any resolution on principal operator.  */
-  switch (op)
+  /* Set choices[0 .. n_chosen-1] to the users' choices in ascending
+     order, as given in args.  Choices are validated.  */
+  while (1)
     {
-    default:
-      break;
-
-    case OP_VAR_VALUE:
-      if (SYMBOL_DOMAIN (exp->elts[pc + 2].symbol) == UNDEF_DOMAIN)
-        {
-          std::vector<struct block_symbol> candidates;
-          int n_candidates;
+      char *args2;
+      int choice, j;
 
-          n_candidates =
-            ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME
-                                    (exp->elts[pc + 2].symbol),
-                                    exp->elts[pc + 1].block, VAR_DOMAIN,
-                                    &candidates);
+      args = skip_spaces (args);
+      if (*args == '\0' && n_chosen == 0)
+        error_no_arg (_("one or more choice numbers"));
+      else if (*args == '\0')
+        break;
 
-          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].symbol))
-                  {
-                  case LOC_REGISTER:
-                  case LOC_ARG:
-                  case LOC_REF_ARG:
-                  case LOC_REGPARM_ADDR:
-                  case LOC_LOCAL:
-                  case LOC_COMPUTED:
-                    goto FoundNonType;
-                  default:
-                    break;
-                  }
-            FoundNonType:
-              if (j < n_candidates)
-                {
-                  j = 0;
-                  while (j < n_candidates)
-                    {
-                      if (SYMBOL_CLASS (candidates[j].symbol) == LOC_TYPEDEF)
-                        {
-                          candidates[j] = candidates[n_candidates - 1];
-                          n_candidates -= 1;
-                        }
-                      else
-                        j += 1;
-                    }
-                }
-            }
+      choice = strtol (args, &args2, 10);
+      if (args == args2 || choice < 0
+          || choice > n_choices + first_choice - 1)
+        error (_("Argument must be choice number"));
+      args = args2;
 
-          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.data (), n_candidates))
-            {
-              i = ada_resolve_function
-                (candidates.data (), n_candidates, NULL, 0,
-                 SYMBOL_LINKAGE_NAME (exp->elts[pc + 2].symbol),
-                 context_type, parse_completion);
-              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.data (), n_candidates, 1);
-              i = 0;
-            }
+      if (choice == 0)
+        error (_("cancelled"));
 
-          exp->elts[pc + 1].block = candidates[i].block;
-          exp->elts[pc + 2].symbol = candidates[i].symbol;
-         tracker->update (candidates[i]);
+      if (choice < first_choice)
+        {
+          n_chosen = n_choices;
+          for (j = 0; j < n_choices; j += 1)
+            choices[j] = j;
+          break;
         }
+      choice -= first_choice;
 
-      if (deprocedure_p
-          && (TYPE_CODE (SYMBOL_TYPE (exp->elts[pc + 2].symbol))
-              == TYPE_CODE_FUNC))
+      for (j = n_chosen - 1; j >= 0 && choice < choices[j]; j -= 1)
         {
-          replace_operator_with_call (expp, pc, 0, 4,
-                                      exp->elts[pc + 2].symbol,
-                                      exp->elts[pc + 1].block);
-          exp = expp->get ();
         }
-      break;
-
-    case OP_FUNCALL:
-      {
-        if (exp->elts[pc + 3].opcode == OP_VAR_VALUE
-            && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
-          {
-           std::vector<struct block_symbol> 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);
-
-            if (n_candidates == 1)
-              i = 0;
-            else
-              {
-                i = ada_resolve_function
-                  (candidates.data (), n_candidates,
-                   argvec, nargs,
-                   SYMBOL_LINKAGE_NAME (exp->elts[pc + 5].symbol),
-                   context_type, parse_completion);
-                if (i < 0)
-                  error (_("Could not find a match for %s"),
-                         SYMBOL_PRINT_NAME (exp->elts[pc + 5].symbol));
-              }
 
-            exp->elts[pc + 4].block = candidates[i].block;
-            exp->elts[pc + 5].symbol = candidates[i].symbol;
-           tracker->update (candidates[i]);
-          }
-      }
-      break;
-    case BINOP_ADD:
-    case BINOP_SUB:
-    case BINOP_MUL:
-    case BINOP_DIV:
-    case BINOP_REM:
-    case BINOP_MOD:
-    case BINOP_CONCAT:
-    case BINOP_BITWISE_AND:
-    case BINOP_BITWISE_IOR:
-    case BINOP_BITWISE_XOR:
-    case BINOP_EQUAL:
-    case BINOP_NOTEQUAL:
-    case BINOP_LESS:
-    case BINOP_GTR:
-    case BINOP_LEQ:
-    case BINOP_GEQ:
-    case BINOP_EXP:
-    case UNOP_NEG:
-    case UNOP_PLUS:
-    case UNOP_LOGICAL_NOT:
-    case UNOP_ABS:
-      if (possible_user_operator_p (op, argvec))
+      if (j < 0 || choice != choices[j])
         {
-         std::vector<struct block_symbol> candidates;
-          int n_candidates;
-
-          n_candidates =
-            ada_lookup_symbol_list (ada_decoded_op_name (op),
-                                   NULL, VAR_DOMAIN,
-                                    &candidates);
-
-          i = ada_resolve_function (candidates.data (), n_candidates, argvec,
-                                   nargs, ada_decoded_op_name (op), NULL,
-                                   parse_completion);
-          if (i < 0)
-            break;
+          int k;
 
-         replace_operator_with_call (expp, pc, nargs, 1,
-                                     candidates[i].symbol,
-                                     candidates[i].block);
-          exp = expp->get ();
+          for (k = n_chosen - 1; k > j; k -= 1)
+            choices[k + 1] = choices[k];
+          choices[j + 1] = choice;
+          n_chosen += 1;
         }
-      break;
-
-    case OP_TYPE:
-    case OP_REGISTER:
-      return NULL;
     }
 
-  *pos = pc;
-  if (exp->elts[pc].opcode == OP_VAR_MSYM_VALUE)
-    return evaluate_var_msym_value (EVAL_AVOID_SIDE_EFFECTS,
-                                   exp->elts[pc + 1].objfile,
-                                   exp->elts[pc + 2].msymbol);
-  else
-    return evaluate_subexp_type (exp, pos);
+  if (n_chosen > max_results)
+    error (_("Select no more than %d of the above"), max_results);
+
+  return n_chosen;
 }
 
-/* Return non-zero if formal type FTYPE matches actual type ATYPE.  If
-   MAY_DEREF is non-zero, the formal may be a pointer and the actual
-   a non-pointer.  */
-/* The term "match" here is rather loose.  The match is heuristic and
-   liberal.  */
+/* Given a list of NSYMS symbols in SYMS, select up to MAX_RESULTS>0
+   by asking the user (if necessary), returning the number selected,
+   and setting the first elements of SYMS items.  Error if no symbols
+   selected.  */
+
+/* NOTE: Adapted from decode_line_2 in symtab.c, with which it ought
+   to be re-integrated one of these days.  */
 
 static int
-ada_type_match (struct type *ftype, struct type *atype, int may_deref)
+user_select_syms (struct block_symbol *syms, int nsyms, int max_results)
 {
-  ftype = ada_check_typedef (ftype);
-  atype = ada_check_typedef (atype);
-
-  if (TYPE_CODE (ftype) == TYPE_CODE_REF)
-    ftype = TYPE_TARGET_TYPE (ftype);
-  if (TYPE_CODE (atype) == TYPE_CODE_REF)
-    atype = TYPE_TARGET_TYPE (atype);
+  int i;
+  int *chosen = XALLOCAVEC (int , nsyms);
+  int n_chosen;
+  int first_choice = (max_results == 1) ? 1 : 2;
+  const char *select_mode = multiple_symbols_select_mode ();
 
-  switch (TYPE_CODE (ftype))
-    {
-    default:
-      return TYPE_CODE (ftype) == TYPE_CODE (atype);
-    case TYPE_CODE_PTR:
-      if (TYPE_CODE (atype) == TYPE_CODE_PTR)
-        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));
-    case TYPE_CODE_INT:
-    case TYPE_CODE_ENUM:
-    case TYPE_CODE_RANGE:
-      switch (TYPE_CODE (atype))
-        {
-        case TYPE_CODE_INT:
-        case TYPE_CODE_ENUM:
-        case TYPE_CODE_RANGE:
-          return 1;
-        default:
-          return 0;
-        }
-
-    case TYPE_CODE_ARRAY:
-      return (TYPE_CODE (atype) == TYPE_CODE_ARRAY
-              || ada_is_array_descriptor_type (atype));
+  if (max_results < 1)
+    error (_("Request to select 0 symbols!"));
+  if (nsyms <= 1)
+    return nsyms;
 
-    case TYPE_CODE_STRUCT:
-      if (ada_is_array_descriptor_type (ftype))
-        return (TYPE_CODE (atype) == TYPE_CODE_ARRAY
-                || ada_is_array_descriptor_type (atype));
-      else
-        return (TYPE_CODE (atype) == TYPE_CODE_STRUCT
-                && !ada_is_array_descriptor_type (atype));
+  if (select_mode == multiple_symbols_cancel)
+    error (_("\
+canceled because the command is ambiguous\n\
+See set/show multiple-symbol."));
 
-    case TYPE_CODE_UNION:
-    case TYPE_CODE_FLT:
-      return (TYPE_CODE (atype) == TYPE_CODE (ftype));
-    }
-}
+  /* If select_mode is "all", then return all possible symbols.
+     Only do that if more than one symbol can be selected, of course.
+     Otherwise, display the menu as usual.  */
+  if (select_mode == multiple_symbols_all && max_results > 1)
+    return nsyms;
 
-/* Return non-zero if the formals of FUNC "sufficiently match" the
-   vector of actual argument types ACTUALS of size N_ACTUALS.  FUNC
-   may also be an enumeral, in which case it is treated as a 0-
-   argument function.  */
+  printf_filtered (_("[0] cancel\n"));
+  if (max_results > 1)
+    printf_filtered (_("[1] all\n"));
 
-static int
-ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
-{
-  int i;
-  struct type *func_type = SYMBOL_TYPE (func);
+  sort_choices (syms, nsyms);
 
-  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;
+  for (i = 0; i < nsyms; i += 1)
+    {
+      if (syms[i].symbol == NULL)
+        continue;
 
-  if (TYPE_NFIELDS (func_type) != n_actuals)
-    return 0;
+      if (SYMBOL_CLASS (syms[i].symbol) == LOC_BLOCK)
+        {
+          struct symtab_and_line sal =
+            find_function_start_sal (syms[i].symbol, 1);
 
-  for (i = 0; i < n_actuals; i += 1)
-    {
-      if (actuals[i] == NULL)
-        return 0;
+         printf_filtered ("[%d] ", i + first_choice);
+         ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
+                                     &type_print_raw_options);
+         if (sal.symtab == NULL)
+           printf_filtered (_(" at %p[<no source file available>%p]:%d\n"),
+                            metadata_style.style ().ptr (), nullptr, sal.line);
+         else
+           printf_filtered
+             (_(" at %ps:%d\n"),
+              styled_string (file_name_style.style (),
+                             symtab_to_filename_for_display (sal.symtab)),
+              sal.line);
+          continue;
+        }
       else
         {
-          struct type *ftype = ada_check_typedef (TYPE_FIELD_TYPE (func_type,
-                                                                  i));
-          struct type *atype = ada_check_typedef (value_type (actuals[i]));
+          int is_enumeral =
+            (SYMBOL_CLASS (syms[i].symbol) == LOC_CONST
+             && SYMBOL_TYPE (syms[i].symbol) != NULL
+             && TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) == TYPE_CODE_ENUM);
+         struct symtab *symtab = NULL;
 
-          if (!ada_type_match (ftype, atype, 1))
-            return 0;
+         if (SYMBOL_OBJFILE_OWNED (syms[i].symbol))
+           symtab = symbol_symtab (syms[i].symbol);
+
+          if (SYMBOL_LINE (syms[i].symbol) != 0 && symtab != NULL)
+           {
+             printf_filtered ("[%d] ", i + first_choice);
+             ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
+                                         &type_print_raw_options);
+             printf_filtered (_(" at %s:%d\n"),
+                              symtab_to_filename_for_display (symtab),
+                              SYMBOL_LINE (syms[i].symbol));
+           }
+          else if (is_enumeral
+                   && TYPE_NAME (SYMBOL_TYPE (syms[i].symbol)) != NULL)
+            {
+              printf_filtered (("[%d] "), i + first_choice);
+              ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL,
+                              gdb_stdout, -1, 0, &type_print_raw_options);
+              printf_filtered (_("'(%s) (enumeral)\n"),
+                              syms[i].symbol->print_name ());
+            }
+         else
+           {
+             printf_filtered ("[%d] ", i + first_choice);
+             ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
+                                         &type_print_raw_options);
+
+             if (symtab != NULL)
+               printf_filtered (is_enumeral
+                                ? _(" in %s (enumeral)\n")
+                                : _(" at %s:?\n"),
+                                symtab_to_filename_for_display (symtab));
+             else
+               printf_filtered (is_enumeral
+                                ? _(" (enumeral)\n")
+                                : _(" at ?\n"));
+           }
         }
     }
-  return 1;
-}
-
-/* False iff function type FUNC_TYPE definitely does not produce a value
-   compatible with type CONTEXT_TYPE.  Conservatively returns 1 if
-   FUNC_TYPE is not a valid function type with a non-null return type
-   or an enumerated type.  A null CONTEXT_TYPE indicates any non-void type.  */
 
-static int
-return_match (struct type *func_type, struct type *context_type)
-{
-  struct type *return_type;
+  n_chosen = get_selections (chosen, nsyms, max_results, max_results > 1,
+                             "overload-choice");
 
-  if (func_type == NULL)
-    return 1;
+  for (i = 0; i < n_chosen; i += 1)
+    syms[i] = syms[chosen[i]];
 
-  if (TYPE_CODE (func_type) == TYPE_CODE_FUNC)
-    return_type = get_base_type (TYPE_TARGET_TYPE (func_type));
-  else
-    return_type = get_base_type (func_type);
-  if (return_type == NULL)
-    return 1;
+  return n_chosen;
+}
 
-  context_type = get_base_type (context_type);
+/* Same as evaluate_type (*EXP), but resolves ambiguous symbol
+   references (marked by OP_VAR_VALUE nodes in which the symbol has an
+   undefined namespace) and converts operators that are
+   user-defined into appropriate function calls.  If CONTEXT_TYPE is
+   non-null, it provides a preferred result type [at the moment, only
+   type void has any effect---causing procedures to be preferred over
+   functions in calls].  A null CONTEXT_TYPE indicates that a non-void
+   return type is preferred.  May change (expand) *EXP.  */
 
-  if (TYPE_CODE (return_type) == TYPE_CODE_ENUM)
-    return context_type == NULL || return_type == context_type;
-  else if (context_type == NULL)
-    return TYPE_CODE (return_type) != TYPE_CODE_VOID;
-  else
-    return TYPE_CODE (return_type) == TYPE_CODE (context_type);
-}
+static void
+resolve (expression_up *expp, int void_context_p, int parse_completion,
+        innermost_block_tracker *tracker)
+{
+  struct type *context_type = NULL;
+  int pc = 0;
 
+  if (void_context_p)
+    context_type = builtin_type ((*expp)->gdbarch)->builtin_void;
 
-/* Returns the index in SYMS[0..NSYMS-1] that contains  the symbol for the
-   function (if any) that matches the types of the NARGS arguments in
-   ARGS.  If CONTEXT_TYPE is non-null and there is at least one match
-   that returns that type, then eliminate matches that don't.  If
-   CONTEXT_TYPE is void and there is at least one match that does not
-   return void, eliminate all matches that do.
+  resolve_subexp (expp, &pc, 1, context_type, parse_completion, tracker);
+}
 
-   Asks the user if there is more than one match remaining.  Returns -1
-   if there is no such symbol or none is selected.  NAME is used
-   solely for messages.  May re-arrange and modify SYMS in
-   the process; the index returned is for the modified vector.  */
+/* Resolve the operator of the subexpression beginning at
+   position *POS of *EXPP.  "Resolving" consists of replacing
+   the symbols that have undefined namespaces in OP_VAR_VALUE nodes
+   with their resolutions, replacing built-in operators with
+   function calls to user-defined operators, where appropriate, and,
+   when DEPROCEDURE_P is non-zero, converting function-valued variables
+   into parameterless calls.  May expand *EXPP.  The CONTEXT_TYPE functions
+   are as in ada_resolve, above.  */
 
-static int
-ada_resolve_function (struct block_symbol syms[],
-                      int nsyms, struct value **args, int nargs,
-                      const char *name, struct type *context_type,
-                     int parse_completion)
+static struct value *
+resolve_subexp (expression_up *expp, int *pos, int deprocedure_p,
+                struct type *context_type, int parse_completion,
+               innermost_block_tracker *tracker)
 {
-  int fallback;
-  int k;
-  int m;                        /* Number of hits */
+  int pc = *pos;
+  int i;
+  struct expression *exp;       /* Convenience: == *expp.  */
+  enum exp_opcode op = (*expp)->elts[pc].opcode;
+  struct value **argvec;        /* Vector of operand types (alloca'ed).  */
+  int nargs;                    /* Number of operands.  */
+  int oplen;
 
-  m = 0;
-  /* In the first pass of the loop, we only accept functions matching
-     context_type.  If none are found, we add a second pass of the loop
-     where every function is accepted.  */
-  for (fallback = 0; m == 0 && fallback < 2; fallback++)
+  argvec = NULL;
+  nargs = 0;
+  exp = expp->get ();
+
+  /* Pass one: resolve operands, saving their types and updating *pos,
+     if needed.  */
+  switch (op)
     {
-      for (k = 0; k < nsyms; k += 1)
+    case OP_FUNCALL:
+      if (exp->elts[pc + 3].opcode == OP_VAR_VALUE
+          && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
+        *pos += 7;
+      else
         {
-          struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].symbol));
-
-          if (ada_args_match (syms[k].symbol, args, nargs)
-              && (fallback || return_match (type, context_type)))
-            {
-              syms[m] = syms[k];
-              m += 1;
-            }
+          *pos += 3;
+          resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker);
         }
-    }
+      nargs = longest_to_int (exp->elts[pc + 1].longconst);
+      break;
 
-  /* If we got multiple matches, ask the user which one to use.  Don't do this
-     interactive thing during completion, though, as the purpose of the
-     completion is providing a list of all possible matches.  Prompting the
-     user to filter it down would be completely unexpected in this case.  */
-  if (m == 0)
-    return -1;
-  else if (m > 1 && !parse_completion)
-    {
-      printf_filtered (_("Multiple matches for %s\n"), name);
-      user_select_syms (syms, m, 1);
-      return 0;
-    }
-  return 0;
-}
+    case UNOP_ADDR:
+      *pos += 1;
+      resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker);
+      break;
 
-/* Returns true (non-zero) iff decoded name N0 should appear before N1
-   in a listing of choices during disambiguation (see sort_choices, below).
-   The idea is that overloadings of a subprogram name from the
-   same package should sort in their source order.  We settle for ordering
-   such symbols by their trailing number (__N  or $N).  */
+    case UNOP_QUAL:
+      *pos += 3;
+      resolve_subexp (expp, pos, 1, check_typedef (exp->elts[pc + 1].type),
+                     parse_completion, tracker);
+      break;
 
-static int
-encoded_ordered_before (const char *N0, const char *N1)
-{
-  if (N1 == NULL)
-    return 0;
-  else if (N0 == NULL)
-    return 1;
-  else
-    {
-      int k0, k1;
+    case OP_ATR_MODULUS:
+    case OP_ATR_SIZE:
+    case OP_ATR_TAG:
+    case OP_ATR_FIRST:
+    case OP_ATR_LAST:
+    case OP_ATR_LENGTH:
+    case OP_ATR_POS:
+    case OP_ATR_VAL:
+    case OP_ATR_MIN:
+    case OP_ATR_MAX:
+    case TERNOP_IN_RANGE:
+    case BINOP_IN_BOUNDS:
+    case UNOP_IN_RANGE:
+    case OP_AGGREGATE:
+    case OP_OTHERS:
+    case OP_CHOICES:
+    case OP_POSITIONAL:
+    case OP_DISCRETE_RANGE:
+    case OP_NAME:
+      ada_forward_operator_length (exp, pc, &oplen, &nargs);
+      *pos += oplen;
+      break;
 
-      for (k0 = strlen (N0) - 1; k0 > 0 && isdigit (N0[k0]); k0 -= 1)
-        ;
-      for (k1 = strlen (N1) - 1; k1 > 0 && isdigit (N1[k1]); k1 -= 1)
-        ;
-      if ((N0[k0] == '_' || N0[k0] == '$') && N0[k0 + 1] != '\000'
-          && (N1[k1] == '_' || N1[k1] == '$') && N1[k1 + 1] != '\000')
-        {
-          int n0, n1;
+    case BINOP_ASSIGN:
+      {
+        struct value *arg1;
 
-          n0 = k0;
-          while (N0[n0] == '_' && n0 > 0 && N0[n0 - 1] == '_')
-            n0 -= 1;
-          n1 = k1;
-          while (N1[n1] == '_' && n1 > 0 && N1[n1 - 1] == '_')
-            n1 -= 1;
-          if (n0 == n1 && strncmp (N0, N1, n0) == 0)
-            return (atoi (N0 + k0 + 1) < atoi (N1 + k1 + 1));
-        }
-      return (strcmp (N0, N1) < 0);
-    }
-}
+        *pos += 1;
+        arg1 = resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker);
+        if (arg1 == NULL)
+          resolve_subexp (expp, pos, 1, NULL, parse_completion, tracker);
+        else
+          resolve_subexp (expp, pos, 1, value_type (arg1), parse_completion,
+                         tracker);
+        break;
+      }
 
-/* Sort SYMS[0..NSYMS-1] to put the choices in a canonical order by the
-   encoded names.  */
+    case UNOP_CAST:
+      *pos += 3;
+      nargs = 1;
+      break;
 
-static void
-sort_choices (struct block_symbol syms[], int nsyms)
-{
-  int i;
+    case BINOP_ADD:
+    case BINOP_SUB:
+    case BINOP_MUL:
+    case BINOP_DIV:
+    case BINOP_REM:
+    case BINOP_MOD:
+    case BINOP_EXP:
+    case BINOP_CONCAT:
+    case BINOP_LOGICAL_AND:
+    case BINOP_LOGICAL_OR:
+    case BINOP_BITWISE_AND:
+    case BINOP_BITWISE_IOR:
+    case BINOP_BITWISE_XOR:
 
-  for (i = 1; i < nsyms; i += 1)
-    {
-      struct block_symbol sym = syms[i];
-      int j;
+    case BINOP_EQUAL:
+    case BINOP_NOTEQUAL:
+    case BINOP_LESS:
+    case BINOP_GTR:
+    case BINOP_LEQ:
+    case BINOP_GEQ:
 
-      for (j = i - 1; j >= 0; j -= 1)
-        {
-          if (encoded_ordered_before (SYMBOL_LINKAGE_NAME (syms[j].symbol),
-                                      SYMBOL_LINKAGE_NAME (sym.symbol)))
-            break;
-          syms[j + 1] = syms[j];
-        }
-      syms[j + 1] = sym;
-    }
-}
+    case BINOP_REPEAT:
+    case BINOP_SUBSCRIPT:
+    case BINOP_COMMA:
+      *pos += 1;
+      nargs = 2;
+      break;
 
-/* Whether GDB should display formals and return types for functions in the
-   overloads selection menu.  */
-static bool print_signatures = true;
+    case UNOP_NEG:
+    case UNOP_PLUS:
+    case UNOP_LOGICAL_NOT:
+    case UNOP_ABS:
+    case UNOP_IND:
+      *pos += 1;
+      nargs = 1;
+      break;
 
-/* Print the signature for SYM on STREAM according to the FLAGS options.  For
-   all but functions, the signature is just the name of the symbol.  For
-   functions, this is the name of the function, the list of types for formals
-   and the return type (if any).  */
+    case OP_LONG:
+    case OP_FLOAT:
+    case OP_VAR_VALUE:
+    case OP_VAR_MSYM_VALUE:
+      *pos += 4;
+      break;
 
-static void
-ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym,
-                           const struct type_print_options *flags)
-{
-  struct type *type = SYMBOL_TYPE (sym);
+    case OP_TYPE:
+    case OP_BOOL:
+    case OP_LAST:
+    case OP_INTERNALVAR:
+      *pos += 3;
+      break;
 
-  fprintf_filtered (stream, "%s", SYMBOL_PRINT_NAME (sym));
-  if (!print_signatures
-      || type == NULL
-      || TYPE_CODE (type) != TYPE_CODE_FUNC)
-    return;
+    case UNOP_MEMVAL:
+      *pos += 3;
+      nargs = 1;
+      break;
 
-  if (TYPE_NFIELDS (type) > 0)
-    {
-      int i;
+    case OP_REGISTER:
+      *pos += 4 + BYTES_TO_EXP_ELEM (exp->elts[pc + 1].longconst + 1);
+      break;
 
-      fprintf_filtered (stream, " (");
-      for (i = 0; i < TYPE_NFIELDS (type); ++i)
-       {
-         if (i > 0)
-           fprintf_filtered (stream, "; ");
-         ada_print_type (TYPE_FIELD_TYPE (type, i), NULL, stream, -1, 0,
-                         flags);
-       }
-      fprintf_filtered (stream, ")");
-    }
-  if (TYPE_TARGET_TYPE (type) != NULL
-      && TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
-    {
-      fprintf_filtered (stream, " return ");
-      ada_print_type (TYPE_TARGET_TYPE (type), NULL, stream, -1, 0, flags);
-    }
-}
+    case STRUCTOP_STRUCT:
+      *pos += 4 + BYTES_TO_EXP_ELEM (exp->elts[pc + 1].longconst + 1);
+      nargs = 1;
+      break;
 
-/* Given a list of NSYMS symbols in SYMS, select up to MAX_RESULTS>0 
-   by asking the user (if necessary), returning the number selected, 
-   and setting the first elements of SYMS items.  Error if no symbols
-   selected.  */
+    case TERNOP_SLICE:
+      *pos += 1;
+      nargs = 3;
+      break;
 
-/* NOTE: Adapted from decode_line_2 in symtab.c, with which it ought
-   to be re-integrated one of these days.  */
+    case OP_STRING:
+      break;
 
-int
-user_select_syms (struct block_symbol *syms, int nsyms, int max_results)
-{
-  int i;
-  int *chosen = XALLOCAVEC (int , nsyms);
-  int n_chosen;
-  int first_choice = (max_results == 1) ? 1 : 2;
-  const char *select_mode = multiple_symbols_select_mode ();
+    default:
+      error (_("Unexpected operator during name resolution"));
+    }
 
-  if (max_results < 1)
-    error (_("Request to select 0 symbols!"));
-  if (nsyms <= 1)
-    return nsyms;
+  argvec = XALLOCAVEC (struct value *, nargs + 1);
+  for (i = 0; i < nargs; i += 1)
+    argvec[i] = resolve_subexp (expp, pos, 1, NULL, parse_completion,
+                               tracker);
+  argvec[i] = NULL;
+  exp = expp->get ();
 
-  if (select_mode == multiple_symbols_cancel)
-    error (_("\
-canceled because the command is ambiguous\n\
-See set/show multiple-symbol."));
+  /* Pass two: perform any resolution on principal operator.  */
+  switch (op)
+    {
+    default:
+      break;
 
-  /* If select_mode is "all", then return all possible symbols.
-     Only do that if more than one symbol can be selected, of course.
-     Otherwise, display the menu as usual.  */
-  if (select_mode == multiple_symbols_all && max_results > 1)
-    return nsyms;
+    case OP_VAR_VALUE:
+      if (SYMBOL_DOMAIN (exp->elts[pc + 2].symbol) == UNDEF_DOMAIN)
+        {
+          std::vector<struct block_symbol> candidates;
+          int n_candidates;
 
-  printf_filtered (_("[0] cancel\n"));
-  if (max_results > 1)
-    printf_filtered (_("[1] all\n"));
+          n_candidates =
+            ada_lookup_symbol_list (exp->elts[pc + 2].symbol->linkage_name (),
+                                    exp->elts[pc + 1].block, VAR_DOMAIN,
+                                    &candidates);
 
-  sort_choices (syms, nsyms);
+          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].symbol))
+                  {
+                  case LOC_REGISTER:
+                  case LOC_ARG:
+                  case LOC_REF_ARG:
+                  case LOC_REGPARM_ADDR:
+                  case LOC_LOCAL:
+                  case LOC_COMPUTED:
+                    goto FoundNonType;
+                  default:
+                    break;
+                  }
+            FoundNonType:
+              if (j < n_candidates)
+                {
+                  j = 0;
+                  while (j < n_candidates)
+                    {
+                      if (SYMBOL_CLASS (candidates[j].symbol) == LOC_TYPEDEF)
+                        {
+                          candidates[j] = candidates[n_candidates - 1];
+                          n_candidates -= 1;
+                        }
+                      else
+                        j += 1;
+                    }
+                }
+            }
 
-  for (i = 0; i < nsyms; i += 1)
-    {
-      if (syms[i].symbol == NULL)
-        continue;
+          if (n_candidates == 0)
+            error (_("No definition found for %s"),
+                   exp->elts[pc + 2].symbol->print_name ());
+          else if (n_candidates == 1)
+            i = 0;
+          else if (deprocedure_p
+                   && !is_nonfunction (candidates.data (), n_candidates))
+            {
+              i = ada_resolve_function
+                (candidates.data (), n_candidates, NULL, 0,
+                 exp->elts[pc + 2].symbol->linkage_name (),
+                 context_type, parse_completion);
+              if (i < 0)
+                error (_("Could not find a match for %s"),
+                       exp->elts[pc + 2].symbol->print_name ());
+            }
+          else
+            {
+              printf_filtered (_("Multiple matches for %s\n"),
+                               exp->elts[pc + 2].symbol->print_name ());
+              user_select_syms (candidates.data (), n_candidates, 1);
+              i = 0;
+            }
 
-      if (SYMBOL_CLASS (syms[i].symbol) == LOC_BLOCK)
-        {
-          struct symtab_and_line sal =
-            find_function_start_sal (syms[i].symbol, 1);
+          exp->elts[pc + 1].block = candidates[i].block;
+          exp->elts[pc + 2].symbol = candidates[i].symbol;
+         tracker->update (candidates[i]);
+        }
 
-         printf_filtered ("[%d] ", i + first_choice);
-         ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
-                                     &type_print_raw_options);
-         if (sal.symtab == NULL)
-           printf_filtered (_(" at <no source file available>:%d\n"),
-                            sal.line);
-         else
-           printf_filtered (_(" at %s:%d\n"),
-                            symtab_to_filename_for_display (sal.symtab),
-                            sal.line);
-          continue;
+      if (deprocedure_p
+          && (TYPE_CODE (SYMBOL_TYPE (exp->elts[pc + 2].symbol))
+              == TYPE_CODE_FUNC))
+        {
+          replace_operator_with_call (expp, pc, 0, 4,
+                                      exp->elts[pc + 2].symbol,
+                                      exp->elts[pc + 1].block);
+          exp = expp->get ();
         }
-      else
+      break;
+
+    case OP_FUNCALL:
+      {
+        if (exp->elts[pc + 3].opcode == OP_VAR_VALUE
+            && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
+          {
+           std::vector<struct block_symbol> candidates;
+            int n_candidates;
+
+            n_candidates =
+              ada_lookup_symbol_list (exp->elts[pc + 5].symbol->linkage_name (),
+                                      exp->elts[pc + 4].block, VAR_DOMAIN,
+                                      &candidates);
+
+            if (n_candidates == 1)
+              i = 0;
+            else
+              {
+                i = ada_resolve_function
+                  (candidates.data (), n_candidates,
+                   argvec, nargs,
+                   exp->elts[pc + 5].symbol->linkage_name (),
+                   context_type, parse_completion);
+                if (i < 0)
+                  error (_("Could not find a match for %s"),
+                         exp->elts[pc + 5].symbol->print_name ());
+              }
+
+            exp->elts[pc + 4].block = candidates[i].block;
+            exp->elts[pc + 5].symbol = candidates[i].symbol;
+           tracker->update (candidates[i]);
+          }
+      }
+      break;
+    case BINOP_ADD:
+    case BINOP_SUB:
+    case BINOP_MUL:
+    case BINOP_DIV:
+    case BINOP_REM:
+    case BINOP_MOD:
+    case BINOP_CONCAT:
+    case BINOP_BITWISE_AND:
+    case BINOP_BITWISE_IOR:
+    case BINOP_BITWISE_XOR:
+    case BINOP_EQUAL:
+    case BINOP_NOTEQUAL:
+    case BINOP_LESS:
+    case BINOP_GTR:
+    case BINOP_LEQ:
+    case BINOP_GEQ:
+    case BINOP_EXP:
+    case UNOP_NEG:
+    case UNOP_PLUS:
+    case UNOP_LOGICAL_NOT:
+    case UNOP_ABS:
+      if (possible_user_operator_p (op, argvec))
         {
-          int is_enumeral =
-            (SYMBOL_CLASS (syms[i].symbol) == LOC_CONST
-             && SYMBOL_TYPE (syms[i].symbol) != NULL
-             && TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) == TYPE_CODE_ENUM);
-         struct symtab *symtab = NULL;
+         std::vector<struct block_symbol> candidates;
+          int n_candidates;
 
-         if (SYMBOL_OBJFILE_OWNED (syms[i].symbol))
-           symtab = symbol_symtab (syms[i].symbol);
+          n_candidates =
+            ada_lookup_symbol_list (ada_decoded_op_name (op),
+                                   NULL, VAR_DOMAIN,
+                                    &candidates);
 
-          if (SYMBOL_LINE (syms[i].symbol) != 0 && symtab != NULL)
-           {
-             printf_filtered ("[%d] ", i + first_choice);
-             ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
-                                         &type_print_raw_options);
-             printf_filtered (_(" at %s:%d\n"),
-                              symtab_to_filename_for_display (symtab),
-                              SYMBOL_LINE (syms[i].symbol));
-           }
-          else if (is_enumeral
-                   && TYPE_NAME (SYMBOL_TYPE (syms[i].symbol)) != NULL)
-            {
-              printf_filtered (("[%d] "), i + first_choice);
-              ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL,
-                              gdb_stdout, -1, 0, &type_print_raw_options);
-              printf_filtered (_("'(%s) (enumeral)\n"),
-                              SYMBOL_PRINT_NAME (syms[i].symbol));
-            }
-         else
-           {
-             printf_filtered ("[%d] ", i + first_choice);
-             ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
-                                         &type_print_raw_options);
+          i = ada_resolve_function (candidates.data (), n_candidates, argvec,
+                                   nargs, ada_decoded_op_name (op), NULL,
+                                   parse_completion);
+          if (i < 0)
+            break;
 
-             if (symtab != NULL)
-               printf_filtered (is_enumeral
-                                ? _(" in %s (enumeral)\n")
-                                : _(" at %s:?\n"),
-                                symtab_to_filename_for_display (symtab));
-             else
-               printf_filtered (is_enumeral
-                                ? _(" (enumeral)\n")
-                                : _(" at ?\n"));
-           }
+         replace_operator_with_call (expp, pc, nargs, 1,
+                                     candidates[i].symbol,
+                                     candidates[i].block);
+          exp = expp->get ();
         }
+      break;
+
+    case OP_TYPE:
+    case OP_REGISTER:
+      return NULL;
     }
 
-  n_chosen = get_selections (chosen, nsyms, max_results, max_results > 1,
-                             "overload-choice");
+  *pos = pc;
+  if (exp->elts[pc].opcode == OP_VAR_MSYM_VALUE)
+    return evaluate_var_msym_value (EVAL_AVOID_SIDE_EFFECTS,
+                                   exp->elts[pc + 1].objfile,
+                                   exp->elts[pc + 2].msymbol);
+  else
+    return evaluate_subexp_type (exp, pos);
+}
 
-  for (i = 0; i < n_chosen; i += 1)
-    syms[i] = syms[chosen[i]];
+/* Return non-zero if formal type FTYPE matches actual type ATYPE.  If
+   MAY_DEREF is non-zero, the formal may be a pointer and the actual
+   a non-pointer.  */
+/* The term "match" here is rather loose.  The match is heuristic and
+   liberal.  */
+
+static int
+ada_type_match (struct type *ftype, struct type *atype, int may_deref)
+{
+  ftype = ada_check_typedef (ftype);
+  atype = ada_check_typedef (atype);
+
+  if (TYPE_CODE (ftype) == TYPE_CODE_REF)
+    ftype = TYPE_TARGET_TYPE (ftype);
+  if (TYPE_CODE (atype) == TYPE_CODE_REF)
+    atype = TYPE_TARGET_TYPE (atype);
+
+  switch (TYPE_CODE (ftype))
+    {
+    default:
+      return TYPE_CODE (ftype) == TYPE_CODE (atype);
+    case TYPE_CODE_PTR:
+      if (TYPE_CODE (atype) == TYPE_CODE_PTR)
+        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));
+    case TYPE_CODE_INT:
+    case TYPE_CODE_ENUM:
+    case TYPE_CODE_RANGE:
+      switch (TYPE_CODE (atype))
+        {
+        case TYPE_CODE_INT:
+        case TYPE_CODE_ENUM:
+        case TYPE_CODE_RANGE:
+          return 1;
+        default:
+          return 0;
+        }
+
+    case TYPE_CODE_ARRAY:
+      return (TYPE_CODE (atype) == TYPE_CODE_ARRAY
+              || ada_is_array_descriptor_type (atype));
+
+    case TYPE_CODE_STRUCT:
+      if (ada_is_array_descriptor_type (ftype))
+        return (TYPE_CODE (atype) == TYPE_CODE_ARRAY
+                || ada_is_array_descriptor_type (atype));
+      else
+        return (TYPE_CODE (atype) == TYPE_CODE_STRUCT
+                && !ada_is_array_descriptor_type (atype));
 
-  return n_chosen;
+    case TYPE_CODE_UNION:
+    case TYPE_CODE_FLT:
+      return (TYPE_CODE (atype) == TYPE_CODE (ftype));
+    }
 }
 
-/* Read and validate a set of numeric choices from the user in the
-   range 0 .. N_CHOICES-1.  Place the results in increasing
-   order in CHOICES[0 .. N-1], and return N.
+/* Return non-zero if the formals of FUNC "sufficiently match" the
+   vector of actual argument types ACTUALS of size N_ACTUALS.  FUNC
+   may also be an enumeral, in which case it is treated as a 0-
+   argument function.  */
 
-   The user types choices as a sequence of numbers on one line
-   separated by blanks, encoding them as follows:
+static int
+ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
+{
+  int i;
+  struct type *func_type = SYMBOL_TYPE (func);
 
-     + A choice of 0 means to cancel the selection, throwing an error.
-     + If IS_ALL_CHOICE, a choice of 1 selects the entire set 0 .. N_CHOICES-1.
-     + The user chooses k by typing k+IS_ALL_CHOICE+1.
+  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;
 
-   The user is not allowed to choose more than MAX_RESULTS values.
+  if (TYPE_NFIELDS (func_type) != n_actuals)
+    return 0;
 
-   ANNOTATION_SUFFIX, if present, is used to annotate the input
-   prompts (for use with the -f switch).  */
+  for (i = 0; i < n_actuals; i += 1)
+    {
+      if (actuals[i] == NULL)
+        return 0;
+      else
+        {
+          struct type *ftype = ada_check_typedef (TYPE_FIELD_TYPE (func_type,
+                                                                  i));
+          struct type *atype = ada_check_typedef (value_type (actuals[i]));
 
-int
-get_selections (int *choices, int n_choices, int max_results,
-                int is_all_choice, const char *annotation_suffix)
-{
-  char *args;
-  const char *prompt;
-  int n_chosen;
-  int first_choice = is_all_choice ? 2 : 1;
+          if (!ada_type_match (ftype, atype, 1))
+            return 0;
+        }
+    }
+  return 1;
+}
 
-  prompt = getenv ("PS2");
-  if (prompt == NULL)
-    prompt = "> ";
+/* False iff function type FUNC_TYPE definitely does not produce a value
+   compatible with type CONTEXT_TYPE.  Conservatively returns 1 if
+   FUNC_TYPE is not a valid function type with a non-null return type
+   or an enumerated type.  A null CONTEXT_TYPE indicates any non-void type.  */
 
-  args = command_line_input (prompt, annotation_suffix);
+static int
+return_match (struct type *func_type, struct type *context_type)
+{
+  struct type *return_type;
 
-  if (args == NULL)
-    error_no_arg (_("one or more choice numbers"));
+  if (func_type == NULL)
+    return 1;
 
-  n_chosen = 0;
+  if (TYPE_CODE (func_type) == TYPE_CODE_FUNC)
+    return_type = get_base_type (TYPE_TARGET_TYPE (func_type));
+  else
+    return_type = get_base_type (func_type);
+  if (return_type == NULL)
+    return 1;
 
-  /* Set choices[0 .. n_chosen-1] to the users' choices in ascending
-     order, as given in args.  Choices are validated.  */
-  while (1)
-    {
-      char *args2;
-      int choice, j;
+  context_type = get_base_type (context_type);
 
-      args = skip_spaces (args);
-      if (*args == '\0' && n_chosen == 0)
-        error_no_arg (_("one or more choice numbers"));
-      else if (*args == '\0')
-        break;
+  if (TYPE_CODE (return_type) == TYPE_CODE_ENUM)
+    return context_type == NULL || return_type == context_type;
+  else if (context_type == NULL)
+    return TYPE_CODE (return_type) != TYPE_CODE_VOID;
+  else
+    return TYPE_CODE (return_type) == TYPE_CODE (context_type);
+}
 
-      choice = strtol (args, &args2, 10);
-      if (args == args2 || choice < 0
-          || choice > n_choices + first_choice - 1)
-        error (_("Argument must be choice number"));
-      args = args2;
 
-      if (choice == 0)
-        error (_("cancelled"));
+/* Returns the index in SYMS[0..NSYMS-1] that contains  the symbol for the
+   function (if any) that matches the types of the NARGS arguments in
+   ARGS.  If CONTEXT_TYPE is non-null and there is at least one match
+   that returns that type, then eliminate matches that don't.  If
+   CONTEXT_TYPE is void and there is at least one match that does not
+   return void, eliminate all matches that do.
 
-      if (choice < first_choice)
-        {
-          n_chosen = n_choices;
-          for (j = 0; j < n_choices; j += 1)
-            choices[j] = j;
-          break;
-        }
-      choice -= first_choice;
+   Asks the user if there is more than one match remaining.  Returns -1
+   if there is no such symbol or none is selected.  NAME is used
+   solely for messages.  May re-arrange and modify SYMS in
+   the process; the index returned is for the modified vector.  */
 
-      for (j = n_chosen - 1; j >= 0 && choice < choices[j]; j -= 1)
-        {
-        }
+static int
+ada_resolve_function (struct block_symbol syms[],
+                      int nsyms, struct value **args, int nargs,
+                      const char *name, struct type *context_type,
+                     int parse_completion)
+{
+  int fallback;
+  int k;
+  int m;                        /* Number of hits */
 
-      if (j < 0 || choice != choices[j])
+  m = 0;
+  /* In the first pass of the loop, we only accept functions matching
+     context_type.  If none are found, we add a second pass of the loop
+     where every function is accepted.  */
+  for (fallback = 0; m == 0 && fallback < 2; fallback++)
+    {
+      for (k = 0; k < nsyms; k += 1)
         {
-          int k;
+          struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].symbol));
 
-          for (k = n_chosen - 1; k > j; k -= 1)
-            choices[k + 1] = choices[k];
-          choices[j + 1] = choice;
-          n_chosen += 1;
+          if (ada_args_match (syms[k].symbol, args, nargs)
+              && (fallback || return_match (type, context_type)))
+            {
+              syms[m] = syms[k];
+              m += 1;
+            }
         }
     }
 
-  if (n_chosen > max_results)
-    error (_("Select no more than %d of the above"), max_results);
-
-  return n_chosen;
+  /* If we got multiple matches, ask the user which one to use.  Don't do this
+     interactive thing during completion, though, as the purpose of the
+     completion is providing a list of all possible matches.  Prompting the
+     user to filter it down would be completely unexpected in this case.  */
+  if (m == 0)
+    return -1;
+  else if (m > 1 && !parse_completion)
+    {
+      printf_filtered (_("Multiple matches for %s\n"), name);
+      user_select_syms (syms, m, 1);
+      return 0;
+    }
+  return 0;
 }
 
 /* Replace the operator of length OPLEN at position PC in *EXPP with a call
@@ -4275,7 +4262,7 @@ ada_parse_renaming (struct symbol *sym,
     case LOC_STATIC:
     case LOC_COMPUTED:
     case LOC_OPTIMIZED_OUT:
-      info = strstr (SYMBOL_LINKAGE_NAME (sym), "___XR");
+      info = strstr (sym->linkage_name (), "___XR");
       if (info == NULL)
        return ADA_NOT_RENAMING;
       switch (info[5])
@@ -4301,57 +4288,182 @@ ada_parse_renaming (struct symbol *sym,
        }
     }
 
-  if (renamed_entity != NULL)
-    *renamed_entity = info;
-  suffix = strstr (info, "___XE");
-  if (suffix == NULL || suffix == info)
-    return ADA_NOT_RENAMING;
-  if (len != NULL)
-    *len = strlen (info) - strlen (suffix);
-  suffix += 5;
-  if (renaming_expr != NULL)
-    *renaming_expr = suffix;
-  return kind;
-}
+  if (renamed_entity != NULL)
+    *renamed_entity = info;
+  suffix = strstr (info, "___XE");
+  if (suffix == NULL || suffix == info)
+    return ADA_NOT_RENAMING;
+  if (len != NULL)
+    *len = strlen (info) - strlen (suffix);
+  suffix += 5;
+  if (renaming_expr != NULL)
+    *renaming_expr = suffix;
+  return kind;
+}
+
+/* Compute the value of the given RENAMING_SYM, which is expected to
+   be a symbol encoding a renaming expression.  BLOCK is the block
+   used to evaluate the renaming.  */
+
+static struct value *
+ada_read_renaming_var_value (struct symbol *renaming_sym,
+                            const struct block *block)
+{
+  const char *sym_name;
+
+  sym_name = renaming_sym->linkage_name ();
+  expression_up expr = parse_exp_1 (&sym_name, 0, block, 0);
+  return evaluate_expression (expr.get ());
+}
+\f
+
+                                /* Evaluation: Function Calls */
+
+/* Return an lvalue containing the value VAL.  This is the identity on
+   lvalues, and otherwise has the side-effect of allocating memory
+   in the inferior where a copy of the value contents is copied.  */
+
+static struct value *
+ensure_lval (struct value *val)
+{
+  if (VALUE_LVAL (val) == not_lval
+      || VALUE_LVAL (val) == lval_internalvar)
+    {
+      int len = TYPE_LENGTH (ada_check_typedef (value_type (val)));
+      const CORE_ADDR addr =
+        value_as_long (value_allocate_space_in_inferior (len));
+
+      VALUE_LVAL (val) = lval_memory;
+      set_value_address (val, addr);
+      write_memory (addr, value_contents (val), len);
+    }
+
+  return val;
+}
+
+/* Given ARG, a value of type (pointer or reference to a)*
+   structure/union, extract the component named NAME from the ultimate
+   target structure/union and return it as a value with its
+   appropriate type.
+
+   The routine searches for NAME among all members of the structure itself
+   and (recursively) among all members of any wrapper members
+   (e.g., '_parent').
+
+   If NO_ERR, then simply return NULL in case of error, rather than
+   calling error.  */
+
+static struct value *
+ada_value_struct_elt (struct value *arg, const char *name, int no_err)
+{
+  struct type *t, *t1;
+  struct value *v;
+  int check_tag;
+
+  v = NULL;
+  t1 = t = ada_check_typedef (value_type (arg));
+  if (TYPE_CODE (t) == TYPE_CODE_REF)
+    {
+      t1 = TYPE_TARGET_TYPE (t);
+      if (t1 == NULL)
+       goto BadValue;
+      t1 = ada_check_typedef (t1);
+      if (TYPE_CODE (t1) == TYPE_CODE_PTR)
+        {
+          arg = coerce_ref (arg);
+          t = t1;
+        }
+    }
+
+  while (TYPE_CODE (t) == TYPE_CODE_PTR)
+    {
+      t1 = TYPE_TARGET_TYPE (t);
+      if (t1 == NULL)
+       goto BadValue;
+      t1 = ada_check_typedef (t1);
+      if (TYPE_CODE (t1) == TYPE_CODE_PTR)
+        {
+          arg = value_ind (arg);
+          t = t1;
+        }
+      else
+        break;
+    }
 
-/* Compute the value of the given RENAMING_SYM, which is expected to
-   be a symbol encoding a renaming expression.  BLOCK is the block
-   used to evaluate the renaming.  */
+  if (TYPE_CODE (t1) != TYPE_CODE_STRUCT && TYPE_CODE (t1) != TYPE_CODE_UNION)
+    goto BadValue;
 
-static struct value *
-ada_read_renaming_var_value (struct symbol *renaming_sym,
-                            const struct block *block)
-{
-  const char *sym_name;
+  if (t1 == t)
+    v = ada_search_struct_field (name, arg, 0, t);
+  else
+    {
+      int bit_offset, bit_size, byte_offset;
+      struct type *field_type;
+      CORE_ADDR address;
 
-  sym_name = SYMBOL_LINKAGE_NAME (renaming_sym);
-  expression_up expr = parse_exp_1 (&sym_name, 0, block, 0);
-  return evaluate_expression (expr.get ());
-}
-\f
+      if (TYPE_CODE (t) == TYPE_CODE_PTR)
+       address = value_address (ada_value_ind (arg));
+      else
+       address = value_address (ada_coerce_ref (arg));
 
-                                /* Evaluation: Function Calls */
+      /* Check to see if this is a tagged type.  We also need to handle
+         the case where the type is a reference to a tagged type, but
+         we have to be careful to exclude pointers to tagged types.
+         The latter should be shown as usual (as a pointer), whereas
+         a reference should mostly be transparent to the user.  */
 
-/* Return an lvalue containing the value VAL.  This is the identity on
-   lvalues, and otherwise has the side-effect of allocating memory
-   in the inferior where a copy of the value contents is copied.  */
+      if (ada_is_tagged_type (t1, 0)
+          || (TYPE_CODE (t1) == TYPE_CODE_REF
+              && ada_is_tagged_type (TYPE_TARGET_TYPE (t1), 0)))
+        {
+          /* We first try to find the searched field in the current type.
+            If not found then let's look in the fixed type.  */
 
-static struct value *
-ensure_lval (struct value *val)
-{
-  if (VALUE_LVAL (val) == not_lval
-      || VALUE_LVAL (val) == lval_internalvar)
-    {
-      int len = TYPE_LENGTH (ada_check_typedef (value_type (val)));
-      const CORE_ADDR addr =
-        value_as_long (value_allocate_space_in_inferior (len));
+          if (!find_struct_field (name, t1, 0,
+                                  &field_type, &byte_offset, &bit_offset,
+                                  &bit_size, NULL))
+           check_tag = 1;
+         else
+           check_tag = 0;
+        }
+      else
+       check_tag = 0;
 
-      VALUE_LVAL (val) = lval_memory;
-      set_value_address (val, addr);
-      write_memory (addr, value_contents (val), len);
+      /* Convert to fixed type in all cases, so that we have proper
+        offsets to each field in unconstrained record types.  */
+      t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL,
+                             address, NULL, check_tag);
+
+      if (find_struct_field (name, t1, 0,
+                             &field_type, &byte_offset, &bit_offset,
+                             &bit_size, NULL))
+        {
+          if (bit_size != 0)
+            {
+              if (TYPE_CODE (t) == TYPE_CODE_REF)
+                arg = ada_coerce_ref (arg);
+              else
+                arg = ada_value_ind (arg);
+              v = ada_value_primitive_packed_val (arg, NULL, byte_offset,
+                                                  bit_offset, bit_size,
+                                                  field_type);
+            }
+          else
+            v = value_at_lazy (field_type, address + byte_offset);
+        }
     }
 
-  return val;
+  if (v != NULL || no_err)
+    return v;
+  else
+    error (_("There is no member named %s."), name);
+
+ BadValue:
+  if (no_err)
+    return NULL;
+  else
+    error (_("Attempt to extract a component of "
+            "a value that is not a record."));
 }
 
 /* Return the value ACTUAL, converted to be an appropriate value for a
@@ -4432,7 +4544,7 @@ value_pointer (struct value *value, struct type *type)
 
   addr = value_address (value);
   gdbarch_address_to_pointer (gdbarch, type, buf, addr);
-  addr = extract_unsigned_integer (buf, len, gdbarch_byte_order (gdbarch));
+  addr = extract_unsigned_integer (buf, len, type_byte_order (type));
   return addr;
 }
 
@@ -4720,8 +4832,8 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1)
       {
         struct type *type0 = SYMBOL_TYPE (sym0);
         struct type *type1 = SYMBOL_TYPE (sym1);
-        const char *name0 = SYMBOL_LINKAGE_NAME (sym0);
-        const char *name1 = SYMBOL_LINKAGE_NAME (sym1);
+        const char *name0 = sym0->linkage_name ();
+        const char *name1 = sym1->linkage_name ();
         int len0 = strlen (name0);
 
         return
@@ -4733,6 +4845,15 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1)
     case LOC_CONST:
       return SYMBOL_VALUE (sym0) == SYMBOL_VALUE (sym1)
         && equiv_types (SYMBOL_TYPE (sym0), SYMBOL_TYPE (sym1));
+
+    case LOC_STATIC:
+      {
+        const char *name0 = sym0->linkage_name ();
+        const char *name1 = sym1->linkage_name ();
+        return (strcmp (name0, name1) == 0
+                && SYMBOL_VALUE_ADDRESS (sym0) == SYMBOL_VALUE_ADDRESS (sym1));
+      }
+
     default:
       return 0;
     }
@@ -4823,7 +4944,7 @@ ada_lookup_simple_minsym (const char *name)
     {
       for (minimal_symbol *msymbol : objfile->msymbols ())
        {
-         if (match_name (MSYMBOL_LINKAGE_NAME (msymbol), lookup_name, NULL)
+         if (match_name (msymbol->linkage_name (), lookup_name, NULL)
              && MSYMBOL_TYPE (msymbol) != mst_solib_trampoline)
            {
              result.minsym = msymbol;
@@ -4836,36 +4957,6 @@ ada_lookup_simple_minsym (const char *name)
   return result;
 }
 
-/* Return all the bound minimal symbols matching NAME according to Ada
-   decoding rules.  Returns an empty vector if there is no such
-   minimal symbol.  Names prefixed with "standard__" are handled
-   specially: "standard__" is first stripped off, and only static and
-   global symbols are searched.  */
-
-static std::vector<struct bound_minimal_symbol>
-ada_lookup_simple_minsyms (const char *name)
-{
-  std::vector<struct bound_minimal_symbol> result;
-
-  symbol_name_match_type match_type = name_match_type_from_name (name);
-  lookup_name_info lookup_name (name, match_type);
-
-  symbol_name_matcher_ftype *match_name
-    = ada_get_symbol_name_matcher (lookup_name);
-
-  for (objfile *objfile : current_program_space->objfiles ())
-    {
-      for (minimal_symbol *msymbol : objfile->msymbols ())
-       {
-         if (match_name (MSYMBOL_LINKAGE_NAME (msymbol), lookup_name, NULL)
-             && MSYMBOL_TYPE (msymbol) != mst_solib_trampoline)
-           result.push_back ({msymbol, objfile});
-       }
-    }
-
-  return result;
-}
-
 /* For all subprograms that statically enclose the subprogram of the
    selected frame, add symbols matching identifier NAME in DOMAIN
    and their blocks to the list of data in OBSTACKP, as for
@@ -5019,15 +5110,15 @@ remove_extra_symbols (std::vector<struct block_symbol> *syms)
          the get rid of the stub.  */
 
       if (TYPE_STUB (SYMBOL_TYPE ((*syms)[i].symbol))
-          && SYMBOL_LINKAGE_NAME ((*syms)[i].symbol) != NULL)
+          && (*syms)[i].symbol->linkage_name () != NULL)
         {
           for (j = 0; j < syms->size (); j++)
             {
               if (j != i
                   && !TYPE_STUB (SYMBOL_TYPE ((*syms)[j].symbol))
-                  && SYMBOL_LINKAGE_NAME ((*syms)[j].symbol) != NULL
-                  && strcmp (SYMBOL_LINKAGE_NAME ((*syms)[i].symbol),
-                             SYMBOL_LINKAGE_NAME ((*syms)[j].symbol)) == 0)
+                  && (*syms)[j].symbol->linkage_name () != NULL
+                  && strcmp ((*syms)[i].symbol->linkage_name (),
+                             (*syms)[j].symbol->linkage_name ()) == 0)
                 remove_p = 1;
             }
         }
@@ -5035,16 +5126,16 @@ remove_extra_symbols (std::vector<struct block_symbol> *syms)
       /* Two symbols with the same name, same class and same address
          should be identical.  */
 
-      else if (SYMBOL_LINKAGE_NAME ((*syms)[i].symbol) != NULL
+      else if ((*syms)[i].symbol->linkage_name () != NULL
           && SYMBOL_CLASS ((*syms)[i].symbol) == LOC_STATIC
           && is_nondebugging_type (SYMBOL_TYPE ((*syms)[i].symbol)))
         {
           for (j = 0; j < syms->size (); j += 1)
             {
               if (i != j
-                  && SYMBOL_LINKAGE_NAME ((*syms)[j].symbol) != NULL
-                  && strcmp (SYMBOL_LINKAGE_NAME ((*syms)[i].symbol),
-                             SYMBOL_LINKAGE_NAME ((*syms)[j].symbol)) == 0
+                  && (*syms)[j].symbol->linkage_name () != NULL
+                  && strcmp ((*syms)[i].symbol->linkage_name (),
+                             (*syms)[j].symbol->linkage_name ()) == 0
                   && SYMBOL_CLASS ((*syms)[i].symbol)
                       == SYMBOL_CLASS ((*syms)[j].symbol)
                   && SYMBOL_VALUE_ADDRESS ((*syms)[i].symbol)
@@ -5221,7 +5312,7 @@ remove_irrelevant_renamings (std::vector<struct block_symbol> *syms,
 
       if (sym == NULL || SYMBOL_CLASS (sym) == LOC_TYPEDEF)
        continue;
-      name = SYMBOL_LINKAGE_NAME (sym);
+      name = sym->linkage_name ();
       suffix = strstr (name, "___XR");
 
       if (suffix != NULL)
@@ -5232,7 +5323,7 @@ remove_irrelevant_renamings (std::vector<struct block_symbol> *syms,
          is_new_style_renaming = 1;
          for (j = 0; j < syms->size (); j += 1)
            if (i != j && (*syms)[j].symbol != NULL
-               && strncmp (name, SYMBOL_LINKAGE_NAME ((*syms)[j].symbol),
+               && strncmp (name, (*syms)[j].symbol->linkage_name (),
                            name_len) == 0
                && block == (*syms)[j].block)
              (*syms)[j].symbol = NULL;
@@ -5261,7 +5352,7 @@ remove_irrelevant_renamings (std::vector<struct block_symbol> *syms,
   if (current_function == NULL)
     return syms->size ();
 
-  current_function_name = SYMBOL_LINKAGE_NAME (current_function);
+  current_function_name = current_function->linkage_name ();
   if (current_function_name == NULL)
     return syms->size ();
 
@@ -5993,7 +6084,7 @@ is_name_suffix (const char *str)
 static int
 is_valid_name_for_wild_match (const char *name0)
 {
-  const char *decoded_name = ada_decode (name0);
+  std::string decoded_name = ada_decode (name0);
   int i;
 
   /* If the decoded name starts with an angle bracket, it means that
@@ -6129,8 +6220,7 @@ ada_add_block_symbols (struct obstack *obstackp,
        sym != NULL;
        sym = block_iter_match_next (lookup_name, &iter))
     {
-      if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
-                                SYMBOL_DOMAIN (sym), domain))
+      if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain))
        {
          if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED)
            {
@@ -6169,22 +6259,22 @@ ada_add_block_symbols (struct obstack *obstackp,
 
       ALL_BLOCK_SYMBOLS (block, iter, sym)
       {
-        if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
+        if (symbol_matches_domain (sym->language (),
                                    SYMBOL_DOMAIN (sym), domain))
           {
             int cmp;
 
-            cmp = (int) '_' - (int) SYMBOL_LINKAGE_NAME (sym)[0];
+            cmp = (int) '_' - (int) sym->linkage_name ()[0];
             if (cmp == 0)
               {
-                cmp = !startswith (SYMBOL_LINKAGE_NAME (sym), "_ada_");
+                cmp = !startswith (sym->linkage_name (), "_ada_");
                 if (cmp == 0)
-                  cmp = strncmp (name, SYMBOL_LINKAGE_NAME (sym) + 5,
+                  cmp = strncmp (name, sym->linkage_name () + 5,
                                  name_len);
               }
 
             if (cmp == 0
-                && is_name_suffix (SYMBOL_LINKAGE_NAME (sym) + name_len + 5))
+                && is_name_suffix (sym->linkage_name () + name_len + 5))
               {
                if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED)
                  {
@@ -6233,19 +6323,16 @@ ada_lookup_name_info::matches
   if (strncmp (sym_name, text, text_len) == 0)
     match = true;
 
+  std::string decoded_name = ada_decode (sym_name);
   if (match && !m_encoded_p)
     {
       /* One needed check before declaring a positive match is to verify
          that iff we are doing a verbatim match, the decoded version
          of the symbol name starts with '<'.  Otherwise, this symbol name
          is not a suitable completion.  */
-      const char *sym_name_copy = sym_name;
-      bool has_angle_bracket;
 
-      sym_name = ada_decode (sym_name);
-      has_angle_bracket = (sym_name[0] == '<');
+      bool has_angle_bracket = (decoded_name[0] == '<');
       match = (has_angle_bracket == m_verbatim_p);
-      sym_name = sym_name_copy;
     }
 
   if (match && !m_verbatim_p)
@@ -6269,7 +6356,7 @@ ada_lookup_name_info::matches
       /* Since we are doing wild matching, this means that TEXT
          may represent an unqualified symbol name.  We therefore must
          also compare TEXT against the unqualified name of the symbol.  */
-      sym_name = ada_unqualified_name (ada_decode (sym_name));
+      sym_name = ada_unqualified_name (decoded_name.c_str ());
 
       if (strncmp (sym_name, text, text_len) == 0)
        match = true;
@@ -6340,7 +6427,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker,
          if (completion_skip_symbol (mode, msymbol))
            continue;
 
-         language symbol_language = MSYMBOL_LANGUAGE (msymbol);
+         language symbol_language = msymbol->language ();
 
          /* Ada minimal symbols won't have their language set to Ada.  If
             we let completion_list_add_name compare using the
@@ -6359,7 +6446,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker,
 
          completion_list_add_name (tracker,
                                    symbol_language,
-                                   MSYMBOL_LINKAGE_NAME (msymbol),
+                                   msymbol->linkage_name (),
                                    lookup_name, text, word);
        }
     }
@@ -6378,8 +6465,8 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker,
          continue;
 
        completion_list_add_name (tracker,
-                                 SYMBOL_LANGUAGE (sym),
-                                 SYMBOL_LINKAGE_NAME (sym),
+                                 sym->language (),
+                                 sym->linkage_name (),
                                  lookup_name, text, word);
       }
     }
@@ -6399,8 +6486,8 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker,
                continue;
 
              completion_list_add_name (tracker,
-                                       SYMBOL_LANGUAGE (sym),
-                                       SYMBOL_LINKAGE_NAME (sym),
+                                       sym->language (),
+                                       sym->linkage_name (),
                                        lookup_name, text, word);
            }
        }
@@ -6421,8 +6508,8 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker,
                continue;
 
              completion_list_add_name (tracker,
-                                       SYMBOL_LANGUAGE (sym),
-                                       SYMBOL_LINKAGE_NAME (sym),
+                                       sym->language (),
+                                       sym->linkage_name (),
                                        lookup_name, text, word);
            }
        }
@@ -6477,7 +6564,7 @@ ada_is_ignored_field (struct type *type, int field_num)
 
     /* Anonymous field names should not be printed.
        brobecker/2007-02-20: I don't think this can actually happen
-       but we don't want to print the value of annonymous fields anyway.  */
+       but we don't want to print the value of anonymous fields anyway.  */
     if (name == NULL)
       return 1;
 
@@ -6532,7 +6619,7 @@ ada_is_tag_type (struct type *type)
 
 /* The type of the tag on VAL.  */
 
-struct type *
+static struct type *
 ada_tag_type (struct value *val)
 {
   return ada_lookup_struct_elt_type (value_type (val), "_tag", 1, 0);
@@ -6549,7 +6636,7 @@ is_ada95_tag (struct value *tag)
 
 /* The value of the tag on VAL.  */
 
-struct value *
+static struct value *
 ada_value_tag (struct value *val)
 {
   return ada_value_struct_elt (val, "_tag", 0);
@@ -6901,7 +6988,7 @@ ada_variant_discrim_type (struct type *var_type, struct type *outer_type)
    valid field number within it, returns 1 iff field FIELD_NUM of TYPE
    represents a 'when others' clause; otherwise 0.  */
 
-int
+static int
 ada_is_others_clause (struct type *type, int field_num)
 {
   const char *name = TYPE_FIELD_NAME (type, field_num);
@@ -7009,7 +7096,7 @@ ada_scan_number (const char str[], int k, LONGEST * R, int *new_k)
    and FIELD_NUM is a valid field number within it, returns 1 iff VAL is
    in the range encoded by field FIELD_NUM of TYPE; otherwise 0.  */
 
-int
+static int
 ada_in_variant (LONGEST val, struct type *type, int field_num)
 {
   const char *name = TYPE_FIELD_NAME (type, field_num);
@@ -7358,181 +7445,56 @@ static struct value *ada_index_struct_field_1 (int *, struct value *,
 
 
 /* Return field #INDEX in ARG, where the index is that returned by
- * find_struct_field through its INDEX_P argument.  Adjust the address
- * of ARG by OFFSET bytes, and search in it assuming it has (class) type TYPE.
- * If found, return value, else return NULL.  */
-
-static struct value *
-ada_index_struct_field (int index, struct value *arg, int offset,
-                       struct type *type)
-{
-  return ada_index_struct_field_1 (&index, arg, offset, type);
-}
-
-
-/* Auxiliary function for ada_index_struct_field.  Like
- * ada_index_struct_field, but takes index from *INDEX_P and modifies
- * *INDEX_P.  */
-
-static struct value *
-ada_index_struct_field_1 (int *index_p, struct value *arg, int offset,
-                         struct type *type)
-{
-  int i;
-  type = ada_check_typedef (type);
-
-  for (i = 0; i < TYPE_NFIELDS (type); i += 1)
-    {
-      if (TYPE_FIELD_NAME (type, i) == NULL)
-        continue;
-      else if (ada_is_wrapper_field (type, i))
-        {
-          struct value *v =     /* Do not let indent join lines here.  */
-            ada_index_struct_field_1 (index_p, arg,
-                                     offset + TYPE_FIELD_BITPOS (type, i) / 8,
-                                     TYPE_FIELD_TYPE (type, i));
-
-          if (v != NULL)
-            return v;
-        }
-
-      else if (ada_is_variant_part (type, i))
-        {
-         /* PNH: Do we ever get here?  See ada_search_struct_field,
-            find_struct_field.  */
-         error (_("Cannot assign this kind of variant record"));
-        }
-      else if (*index_p == 0)
-        return ada_value_primitive_field (arg, offset, i, type);
-      else
-       *index_p -= 1;
-    }
-  return NULL;
-}
-
-/* Given ARG, a value of type (pointer or reference to a)*
-   structure/union, extract the component named NAME from the ultimate
-   target structure/union and return it as a value with its
-   appropriate type.
-
-   The routine searches for NAME among all members of the structure itself
-   and (recursively) among all members of any wrapper members
-   (e.g., '_parent').
-
-   If NO_ERR, then simply return NULL in case of error, rather than 
-   calling error.  */
-
-struct value *
-ada_value_struct_elt (struct value *arg, const char *name, int no_err)
-{
-  struct type *t, *t1;
-  struct value *v;
-  int check_tag;
-
-  v = NULL;
-  t1 = t = ada_check_typedef (value_type (arg));
-  if (TYPE_CODE (t) == TYPE_CODE_REF)
-    {
-      t1 = TYPE_TARGET_TYPE (t);
-      if (t1 == NULL)
-       goto BadValue;
-      t1 = ada_check_typedef (t1);
-      if (TYPE_CODE (t1) == TYPE_CODE_PTR)
-        {
-          arg = coerce_ref (arg);
-          t = t1;
-        }
-    }
-
-  while (TYPE_CODE (t) == TYPE_CODE_PTR)
-    {
-      t1 = TYPE_TARGET_TYPE (t);
-      if (t1 == NULL)
-       goto BadValue;
-      t1 = ada_check_typedef (t1);
-      if (TYPE_CODE (t1) == TYPE_CODE_PTR)
-        {
-          arg = value_ind (arg);
-          t = t1;
-        }
-      else
-        break;
-    }
+ * find_struct_field through its INDEX_P argument.  Adjust the address
+ * of ARG by OFFSET bytes, and search in it assuming it has (class) type TYPE.
+ * If found, return value, else return NULL.  */
 
-  if (TYPE_CODE (t1) != TYPE_CODE_STRUCT && TYPE_CODE (t1) != TYPE_CODE_UNION)
-    goto BadValue;
+static struct value *
+ada_index_struct_field (int index, struct value *arg, int offset,
+                       struct type *type)
+{
+  return ada_index_struct_field_1 (&index, arg, offset, type);
+}
 
-  if (t1 == t)
-    v = ada_search_struct_field (name, arg, 0, t);
-  else
-    {
-      int bit_offset, bit_size, byte_offset;
-      struct type *field_type;
-      CORE_ADDR address;
 
-      if (TYPE_CODE (t) == TYPE_CODE_PTR)
-       address = value_address (ada_value_ind (arg));
-      else
-       address = value_address (ada_coerce_ref (arg));
+/* Auxiliary function for ada_index_struct_field.  Like
+ * ada_index_struct_field, but takes index from *INDEX_P and modifies
+ * *INDEX_P.  */
 
-      /* Check to see if this is a tagged type.  We also need to handle
-         the case where the type is a reference to a tagged type, but
-         we have to be careful to exclude pointers to tagged types.
-         The latter should be shown as usual (as a pointer), whereas
-         a reference should mostly be transparent to the user.  */
+static struct value *
+ada_index_struct_field_1 (int *index_p, struct value *arg, int offset,
+                         struct type *type)
+{
+  int i;
+  type = ada_check_typedef (type);
 
-      if (ada_is_tagged_type (t1, 0)
-          || (TYPE_CODE (t1) == TYPE_CODE_REF
-              && ada_is_tagged_type (TYPE_TARGET_TYPE (t1), 0)))
+  for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+    {
+      if (TYPE_FIELD_NAME (type, i) == NULL)
+        continue;
+      else if (ada_is_wrapper_field (type, i))
         {
-          /* We first try to find the searched field in the current type.
-            If not found then let's look in the fixed type.  */
+          struct value *v =     /* Do not let indent join lines here.  */
+            ada_index_struct_field_1 (index_p, arg,
+                                     offset + TYPE_FIELD_BITPOS (type, i) / 8,
+                                     TYPE_FIELD_TYPE (type, i));
 
-          if (!find_struct_field (name, t1, 0,
-                                  &field_type, &byte_offset, &bit_offset,
-                                  &bit_size, NULL))
-           check_tag = 1;
-         else
-           check_tag = 0;
+          if (v != NULL)
+            return v;
         }
-      else
-       check_tag = 0;
-
-      /* Convert to fixed type in all cases, so that we have proper
-        offsets to each field in unconstrained record types.  */
-      t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL,
-                             address, NULL, check_tag);
 
-      if (find_struct_field (name, t1, 0,
-                             &field_type, &byte_offset, &bit_offset,
-                             &bit_size, NULL))
+      else if (ada_is_variant_part (type, i))
         {
-          if (bit_size != 0)
-            {
-              if (TYPE_CODE (t) == TYPE_CODE_REF)
-                arg = ada_coerce_ref (arg);
-              else
-                arg = ada_value_ind (arg);
-              v = ada_value_primitive_packed_val (arg, NULL, byte_offset,
-                                                  bit_offset, bit_size,
-                                                  field_type);
-            }
-          else
-            v = value_at_lazy (field_type, address + byte_offset);
+         /* PNH: Do we ever get here?  See ada_search_struct_field,
+            find_struct_field.  */
+         error (_("Cannot assign this kind of variant record"));
         }
+      else if (*index_p == 0)
+        return ada_value_primitive_field (arg, offset, i, type);
+      else
+       *index_p -= 1;
     }
-
-  if (v != NULL || no_err)
-    return v;
-  else
-    error (_("There is no member named %s."), name);
-
- BadValue:
-  if (no_err)
-    return NULL;
-  else
-    error (_("Attempt to extract a component of "
-            "a value that is not a record."));
+  return NULL;
 }
 
 /* Return a string representation of type TYPE.  */
@@ -7891,7 +7853,7 @@ ada_find_any_type (const char *name)
 static bool
 ada_is_renaming_symbol (struct symbol *name_sym)
 {
-  const char *name = SYMBOL_LINKAGE_NAME (name_sym);
+  const char *name = name_sym->linkage_name ();
   return strstr (name, "___XR") != NULL;
 }
 
@@ -9002,7 +8964,7 @@ ada_to_fixed_type (struct type *type, const gdb_byte *valaddr,
       brobecker/2010-11-19: It seems to me that the only case where it is
       useful to preserve the typedef layer is when dealing with fat pointers.
       Perhaps, we could add a check for that and preserve the typedef layer
-      only in that situation.  But this seems unecessary so far, probably
+      only in that situation.  But this seems unnecessary so far, probably
       because we call check_typedef/ada_check_typedef pretty much everywhere.
       */
   if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF
@@ -9186,7 +9148,7 @@ static const char *attribute_names[] = {
   0
 };
 
-const char *
+static const char *
 ada_attribute_name (enum exp_opcode n)
 {
   if (n >= OP_ATR_FIRST && n <= (int) OP_ATR_VAL)
@@ -9354,7 +9316,7 @@ ada_get_base_type (struct type *raw_type)
   if (TYPE_CODE (TYPE_FIELD_TYPE (real_type_namer, 0)) != TYPE_CODE_REF)
     {
       /* This is an older encoding form where the base type needs to be
-        looked up by name.  We prefer the newer enconding because it is
+        looked up by name.  We prefer the newer encoding because it is
         more efficient.  */
       raw_real_type = ada_find_any_type (TYPE_FIELD_NAME (real_type_namer, 0));
       if (raw_real_type == NULL)
@@ -9713,7 +9675,7 @@ 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)),
-                         gdbarch_byte_order (get_type_arch (type1)), v);
+                         type_byte_order (type1), v);
   return val;
 }
 
@@ -9980,7 +9942,7 @@ aggregate_assign_from_choices (struct value *container,
              name = &exp->elts[choice_pos + 2].string;
              break;
            case OP_VAR_VALUE:
-             name = SYMBOL_NATURAL_NAME (exp->elts[choice_pos + 2].symbol);
+             name = exp->elts[choice_pos + 2].symbol->natural_name ();
              break;
            default:
              error (_("Invalid record component association."));
@@ -10151,7 +10113,7 @@ ada_value_cast (struct type *type, struct value *arg2)
     information nor the associated type structure in GDB are able to
     express such dynamic types.  So what the debugger does is to create
     "fixed" versions of the type that applies to the specific object.
-    We also informally refer to this opperation as "fixing" an object,
+    We also informally refer to this operation as "fixing" an object,
     which means creating its associated fixed type.
 
     Example: when printing the value of variable "Yes" above, its fixed
@@ -10645,7 +10607,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
            context other than a function call, in which case, it is
            invalid.  */
         error (_("Unexpected unresolved symbol, %s, during evaluation"),
-               SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol));
+               exp->elts[pc + 2].symbol->print_name ());
 
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
         {
@@ -10735,7 +10697,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       if (exp->elts[*pos].opcode == OP_VAR_VALUE
           && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
         error (_("Unexpected unresolved symbol, %s, during evaluation"),
-               SYMBOL_PRINT_NAME (exp->elts[pc + 5].symbol));
+               exp->elts[pc + 5].symbol->print_name ());
       else
         {
           for (tem = 0; tem <= nargs; tem += 1)
@@ -11958,7 +11920,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
   if (SYMBOL_CLASS (sym) != LOC_BLOCK)
     {
       error (_("Symbol \"%s\" is not a function (class = %d)"),
-            SYMBOL_LINKAGE_NAME (sym), SYMBOL_CLASS (sym));
+            sym->linkage_name (), SYMBOL_CLASS (sym));
       return 0;
     }
 
@@ -11981,7 +11943,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
   if (SYMBOL_CLASS (sym) != LOC_BLOCK)
     {
       error (_("Symbol \"%s\" is not a function (class = %d)"),
-            SYMBOL_LINKAGE_NAME (sym), SYMBOL_CLASS (sym));
+            sym->linkage_name (), SYMBOL_CLASS (sym));
       return 0;
     }
 
@@ -12080,7 +12042,7 @@ is_known_support_routine (struct frame_info *frame)
   if (access (fullname, R_OK) != 0)
     return 1;
 
-  /* Check the unit filename againt the Ada runtime file naming.
+  /* Check the unit filename against the Ada runtime file naming.
      We also check the name of the objfile against the name of some
      known system libraries that sometimes come with debugging info
      too.  */
@@ -12347,8 +12309,16 @@ public:
 
 struct ada_catchpoint : public breakpoint
 {
+  explicit ada_catchpoint (enum ada_exception_catchpoint_kind kind)
+    : m_kind (kind)
+  {
+  }
+
   /* The name of the specific exception the user specified.  */
   std::string excep_string;
+
+  /* What kind of catchpoint this is.  */
+  enum ada_exception_catchpoint_kind m_kind;
 };
 
 /* Parse the exception condition string in the context of each of the
@@ -12358,6 +12328,8 @@ static void
 create_excep_cond_exprs (struct ada_catchpoint *c,
                          enum ada_exception_catchpoint_kind ex)
 {
+  struct bp_location *bl;
+
   /* Nothing to do if there's no specific exception to catch.  */
   if (c->excep_string.empty ())
     return;
@@ -12366,45 +12338,28 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
   if (c->loc == NULL)
     return;
 
-  /* We have to compute the expression once for each program space,
-     because the expression may hold the addresses of multiple symbols
-     in some cases.  */
-  std::multimap<program_space *, struct bp_location *> loc_map;
-  for (bp_location *bl = c->loc; bl != NULL; bl = bl->next)
-    loc_map.emplace (bl->pspace, bl);
+  /* Compute the condition expression in text form, from the specific
+     expection we want to catch.  */
+  std::string cond_string
+    = ada_exception_catchpoint_cond_string (c->excep_string.c_str (), ex);
 
-  scoped_restore_current_program_space save_pspace;
-
-  std::string cond_string;
-  program_space *last_ps = nullptr;
-  for (auto iter : loc_map)
+  /* Iterate over all the catchpoint's locations, and parse an
+     expression for each.  */
+  for (bl = c->loc; bl != NULL; bl = bl->next)
     {
       struct ada_catchpoint_location *ada_loc
-       = (struct ada_catchpoint_location *) iter.second;
-
-      if (ada_loc->pspace != last_ps)
-       {
-         last_ps = ada_loc->pspace;
-         set_current_program_space (last_ps);
-
-         /* Compute the condition expression in text form, from the
-            specific expection we want to catch.  */
-         cond_string
-           = ada_exception_catchpoint_cond_string (c->excep_string.c_str (),
-                                                   ex);
-       }
-
+       = (struct ada_catchpoint_location *) bl;
       expression_up exp;
 
-      if (!ada_loc->shlib_disabled)
+      if (!bl->shlib_disabled)
        {
          const char *s;
 
          s = cond_string.c_str ();
          try
            {
-             exp = parse_exp_1 (&s, ada_loc->address,
-                                block_for_pc (ada_loc->address),
+             exp = parse_exp_1 (&s, bl->address,
+                                block_for_pc (bl->address),
                                 0);
            }
          catch (const gdb_exception_error &e)
@@ -12423,8 +12378,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
    structure for all exception catchpoint kinds.  */
 
 static struct bp_location *
-allocate_location_exception (enum ada_exception_catchpoint_kind ex,
-                            struct breakpoint *self)
+allocate_location_exception (struct breakpoint *self)
 {
   return new ada_catchpoint_location (self);
 }
@@ -12433,7 +12387,7 @@ allocate_location_exception (enum ada_exception_catchpoint_kind ex,
    exception catchpoint kinds.  */
 
 static void
-re_set_exception (enum ada_exception_catchpoint_kind ex, struct breakpoint *b)
+re_set_exception (struct breakpoint *b)
 {
   struct ada_catchpoint *c = (struct ada_catchpoint *) b;
 
@@ -12443,7 +12397,7 @@ re_set_exception (enum ada_exception_catchpoint_kind ex, struct breakpoint *b)
 
   /* Reparse the exception conditional expressions.  One for each
      location.  */
-  create_excep_cond_exprs (c, ex);
+  create_excep_cond_exprs (c, c->m_kind);
 }
 
 /* Returns true if we should stop for this breakpoint hit.  If the
@@ -12458,6 +12412,30 @@ should_stop_exception (const struct bp_location *bl)
     = (const struct ada_catchpoint_location *) bl;
   int stop;
 
+  struct internalvar *var = lookup_internalvar ("_ada_exception");
+  if (c->m_kind == ada_catch_assert)
+    clear_internalvar (var);
+  else
+    {
+      try
+       {
+         const char *expr;
+
+         if (c->m_kind == ada_catch_handlers)
+           expr = ("GNAT_GCC_exception_Access(gcc_exception)"
+                   ".all.occurrence.id");
+         else
+           expr = "e";
+
+         struct value *exc = parse_and_eval (expr);
+         set_internalvar (var, exc);
+       }
+      catch (const gdb_exception_error &ex)
+       {
+         clear_internalvar (var);
+       }
+    }
+
   /* With no specific exception, should always stop.  */
   if (c->excep_string.empty ())
     return 1;
@@ -12491,7 +12469,7 @@ should_stop_exception (const struct bp_location *bl)
    for all exception catchpoint kinds.  */
 
 static void
-check_status_exception (enum ada_exception_catchpoint_kind ex, bpstat bs)
+check_status_exception (bpstat bs)
 {
   bs->stop = should_stop_exception (bs->bp_location_at);
 }
@@ -12500,7 +12478,7 @@ check_status_exception (enum ada_exception_catchpoint_kind ex, bpstat bs)
    for all exception catchpoint kinds.  */
 
 static enum print_stop_action
-print_it_exception (enum ada_exception_catchpoint_kind ex, bpstat bs)
+print_it_exception (bpstat bs)
 {
   struct ui_out *uiout = current_uiout;
   struct breakpoint *b = bs->breakpoint_at;
@@ -12526,13 +12504,14 @@ print_it_exception (enum ada_exception_catchpoint_kind ex, bpstat bs)
      ada_find_printable_frame).  */
   select_frame (get_current_frame ());
 
-  switch (ex)
+  struct ada_catchpoint *c = (struct ada_catchpoint *) b;
+  switch (c->m_kind)
     {
       case ada_catch_exception:
       case ada_catch_exception_unhandled:
       case ada_catch_handlers:
        {
-         const CORE_ADDR addr = ada_exception_name_addr (ex, b);
+         const CORE_ADDR addr = ada_exception_name_addr (c->m_kind, b);
          char exception_name[256];
 
          if (addr != 0)
@@ -12556,7 +12535,7 @@ print_it_exception (enum ada_exception_catchpoint_kind ex, bpstat bs)
             it clearer to the user which kind of catchpoint just got
             hit.  We used ui_out_text to make sure that this extra
             info does not pollute the exception name in the MI case.  */
-         if (ex == ada_catch_exception_unhandled)
+         if (c->m_kind == ada_catch_exception_unhandled)
            uiout->text ("unhandled ");
          uiout->field_string ("exception-name", exception_name);
        }
@@ -12589,8 +12568,7 @@ print_it_exception (enum ada_exception_catchpoint_kind ex, bpstat bs)
    for all exception catchpoint kinds.  */
 
 static void
-print_one_exception (enum ada_exception_catchpoint_kind ex,
-                     struct breakpoint *b, struct bp_location **last_loc)
+print_one_exception (struct breakpoint *b, struct bp_location **last_loc)
 { 
   struct ui_out *uiout = current_uiout;
   struct ada_catchpoint *c = (struct ada_catchpoint *) b;
@@ -12602,7 +12580,7 @@ print_one_exception (enum ada_exception_catchpoint_kind ex,
     uiout->field_skip ("addr");
 
   annotate_field (5);
-  switch (ex)
+  switch (c->m_kind)
     {
       case ada_catch_exception:
         if (!c->excep_string.empty ())
@@ -12646,8 +12624,7 @@ print_one_exception (enum ada_exception_catchpoint_kind ex,
    for all exception catchpoint kinds.  */
 
 static void
-print_mention_exception (enum ada_exception_catchpoint_kind ex,
-                         struct breakpoint *b)
+print_mention_exception (struct breakpoint *b)
 {
   struct ada_catchpoint *c = (struct ada_catchpoint *) b;
   struct ui_out *uiout = current_uiout;
@@ -12657,7 +12634,7 @@ print_mention_exception (enum ada_exception_catchpoint_kind ex,
   uiout->field_signed ("bkptno", b->number);
   uiout->text (": ");
 
-  switch (ex)
+  switch (c->m_kind)
     {
       case ada_catch_exception:
         if (!c->excep_string.empty ())
@@ -12700,12 +12677,11 @@ print_mention_exception (enum ada_exception_catchpoint_kind ex,
    for all exception catchpoint kinds.  */
 
 static void
-print_recreate_exception (enum ada_exception_catchpoint_kind ex,
-                         struct breakpoint *b, struct ui_file *fp)
+print_recreate_exception (struct breakpoint *b, struct ui_file *fp)
 {
   struct ada_catchpoint *c = (struct ada_catchpoint *) b;
 
-  switch (ex)
+  switch (c->m_kind)
     {
       case ada_catch_exception:
        fprintf_filtered (fp, "catch exception");
@@ -12731,192 +12707,10 @@ print_recreate_exception (enum ada_exception_catchpoint_kind ex,
   print_recreate_thread (b, fp);
 }
 
-/* Virtual table for "catch exception" breakpoints.  */
-
-static struct bp_location *
-allocate_location_catch_exception (struct breakpoint *self)
-{
-  return allocate_location_exception (ada_catch_exception, self);
-}
-
-static void
-re_set_catch_exception (struct breakpoint *b)
-{
-  re_set_exception (ada_catch_exception, b);
-}
-
-static void
-check_status_catch_exception (bpstat bs)
-{
-  check_status_exception (ada_catch_exception, bs);
-}
-
-static enum print_stop_action
-print_it_catch_exception (bpstat bs)
-{
-  return print_it_exception (ada_catch_exception, bs);
-}
-
-static void
-print_one_catch_exception (struct breakpoint *b, struct bp_location **last_loc)
-{
-  print_one_exception (ada_catch_exception, b, last_loc);
-}
-
-static void
-print_mention_catch_exception (struct breakpoint *b)
-{
-  print_mention_exception (ada_catch_exception, b);
-}
-
-static void
-print_recreate_catch_exception (struct breakpoint *b, struct ui_file *fp)
-{
-  print_recreate_exception (ada_catch_exception, b, fp);
-}
-
+/* Virtual tables for various breakpoint types.  */
 static struct breakpoint_ops catch_exception_breakpoint_ops;
-
-/* Virtual table for "catch exception unhandled" breakpoints.  */
-
-static struct bp_location *
-allocate_location_catch_exception_unhandled (struct breakpoint *self)
-{
-  return allocate_location_exception (ada_catch_exception_unhandled, self);
-}
-
-static void
-re_set_catch_exception_unhandled (struct breakpoint *b)
-{
-  re_set_exception (ada_catch_exception_unhandled, b);
-}
-
-static void
-check_status_catch_exception_unhandled (bpstat bs)
-{
-  check_status_exception (ada_catch_exception_unhandled, bs);
-}
-
-static enum print_stop_action
-print_it_catch_exception_unhandled (bpstat bs)
-{
-  return print_it_exception (ada_catch_exception_unhandled, bs);
-}
-
-static void
-print_one_catch_exception_unhandled (struct breakpoint *b,
-                                    struct bp_location **last_loc)
-{
-  print_one_exception (ada_catch_exception_unhandled, b, last_loc);
-}
-
-static void
-print_mention_catch_exception_unhandled (struct breakpoint *b)
-{
-  print_mention_exception (ada_catch_exception_unhandled, b);
-}
-
-static void
-print_recreate_catch_exception_unhandled (struct breakpoint *b,
-                                         struct ui_file *fp)
-{
-  print_recreate_exception (ada_catch_exception_unhandled, b, fp);
-}
-
 static struct breakpoint_ops catch_exception_unhandled_breakpoint_ops;
-
-/* Virtual table for "catch assert" breakpoints.  */
-
-static struct bp_location *
-allocate_location_catch_assert (struct breakpoint *self)
-{
-  return allocate_location_exception (ada_catch_assert, self);
-}
-
-static void
-re_set_catch_assert (struct breakpoint *b)
-{
-  re_set_exception (ada_catch_assert, b);
-}
-
-static void
-check_status_catch_assert (bpstat bs)
-{
-  check_status_exception (ada_catch_assert, bs);
-}
-
-static enum print_stop_action
-print_it_catch_assert (bpstat bs)
-{
-  return print_it_exception (ada_catch_assert, bs);
-}
-
-static void
-print_one_catch_assert (struct breakpoint *b, struct bp_location **last_loc)
-{
-  print_one_exception (ada_catch_assert, b, last_loc);
-}
-
-static void
-print_mention_catch_assert (struct breakpoint *b)
-{
-  print_mention_exception (ada_catch_assert, b);
-}
-
-static void
-print_recreate_catch_assert (struct breakpoint *b, struct ui_file *fp)
-{
-  print_recreate_exception (ada_catch_assert, b, fp);
-}
-
 static struct breakpoint_ops catch_assert_breakpoint_ops;
-
-/* Virtual table for "catch handlers" breakpoints.  */
-
-static struct bp_location *
-allocate_location_catch_handlers (struct breakpoint *self)
-{
-  return allocate_location_exception (ada_catch_handlers, self);
-}
-
-static void
-re_set_catch_handlers (struct breakpoint *b)
-{
-  re_set_exception (ada_catch_handlers, b);
-}
-
-static void
-check_status_catch_handlers (bpstat bs)
-{
-  check_status_exception (ada_catch_handlers, bs);
-}
-
-static enum print_stop_action
-print_it_catch_handlers (bpstat bs)
-{
-  return print_it_exception (ada_catch_handlers, bs);
-}
-
-static void
-print_one_catch_handlers (struct breakpoint *b,
-                         struct bp_location **last_loc)
-{
-  print_one_exception (ada_catch_handlers, b, last_loc);
-}
-
-static void
-print_mention_catch_handlers (struct breakpoint *b)
-{
-  print_mention_exception (ada_catch_handlers, b);
-}
-
-static void
-print_recreate_catch_handlers (struct breakpoint *b,
-                              struct ui_file *fp)
-{
-  print_recreate_exception (ada_catch_handlers, b, fp);
-}
-
 static struct breakpoint_ops catch_handlers_breakpoint_ops;
 
 /* See ada-lang.h.  */
@@ -13074,18 +12868,18 @@ ada_exception_catchpoint_cond_string (const char *excep_string,
                                       enum ada_exception_catchpoint_kind ex)
 {
   int i;
+  bool is_standard_exc = false;
   std::string result;
-  const char *name;
 
   if (ex == ada_catch_handlers)
     {
       /* For exception handlers catchpoints, the condition string does
          not use the same parameter as for the other exceptions.  */
-      name = ("long_integer (GNAT_GCC_exception_Access"
-             "(gcc_exception).all.occurrence.id)");
+      result = ("long_integer (GNAT_GCC_exception_Access"
+               "(gcc_exception).all.occurrence.id)");
     }
   else
-    name = "long_integer (e)";
+    result = "long_integer (e)";
 
   /* The standard exceptions are a special case.  They are defined in
      runtime units that have been compiled without debugging info; if
@@ -13101,38 +12895,26 @@ ada_exception_catchpoint_cond_string (const char *excep_string,
      exception constraint_error" is rewritten into "catch exception
      standard.constraint_error".
 
-     If an exception named contraint_error is defined in another package of
+     If an exception named constraint_error is defined in another package of
      the inferior program, then the only way to specify this exception as a
      breakpoint condition is to use its fully-qualified named:
-     e.g. my_package.constraint_error.
-
-     Furthermore, in some situations a standard exception's symbol may
-     be present in more than one objfile, because the compiler may
-     choose to emit copy relocations for them.  So, we have to compare
-     against all the possible addresses.  */
+     e.g. my_package.constraint_error.  */
 
-  /* Storage for a rewritten symbol name.  */
-  std::string std_name;
   for (i = 0; i < sizeof (standard_exc) / sizeof (char *); i++)
     {
       if (strcmp (standard_exc [i], excep_string) == 0)
        {
-         std_name = std::string ("standard.") + excep_string;
-         excep_string = std_name.c_str ();
+         is_standard_exc = true;
          break;
        }
     }
 
-  excep_string = ada_encode (excep_string);
-  std::vector<struct bound_minimal_symbol> symbols
-    = ada_lookup_simple_minsyms (excep_string);
-  for (const bound_minimal_symbol &msym : symbols)
-    {
-      if (!result.empty ())
-       result += " or ";
-      string_appendf (result, "%s = %s", name,
-                     pulongest (BMSYMBOL_VALUE_ADDRESS (msym)));
-    }
+  result += " = ";
+
+  if (is_standard_exc)
+    string_appendf (result, "long_integer (&standard.%s)", excep_string);
+  else
+    string_appendf (result, "long_integer (&%s)", excep_string);
 
   return result;
 }
@@ -13202,7 +12984,7 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch,
   const struct breakpoint_ops *ops = NULL;
   struct symtab_and_line sal = ada_exception_sal (ex_kind, &addr_string, &ops);
 
-  std::unique_ptr<ada_catchpoint> c (new ada_catchpoint ());
+  std::unique_ptr<ada_catchpoint> c (new ada_catchpoint (ex_kind));
   init_ada_exception_breakpoint (c.get (), gdbarch, sal, addr_string.c_str (),
                                 ops, tempflag, disabled, from_tty);
   c->excep_string = excep_string;
@@ -13356,13 +13138,13 @@ ada_is_non_standard_exception_sym (struct symbol *sym)
     return 0;
 
   for (i = 0; i < ARRAY_SIZE (standard_exc); i++)
-    if (strcmp (SYMBOL_LINKAGE_NAME (sym), standard_exc[i]) == 0)
+    if (strcmp (sym->linkage_name (), standard_exc[i]) == 0)
       return 0;  /* A standard exception.  */
 
   /* Numeric_Error is also a standard exception, so exclude it.
      See the STANDARD_EXC description for more details as to why
      this exception is not listed in that array.  */
-  if (strcmp (SYMBOL_LINKAGE_NAME (sym), "numeric_error") == 0)
+  if (strcmp (sym->linkage_name (), "numeric_error") == 0)
     return 0;
 
   return 1;
@@ -13475,7 +13257,7 @@ ada_add_exceptions_from_frame (compiled_regex *preg,
            default:
              if (ada_is_exception_sym (sym))
                {
-                 struct ada_exc_info info = {SYMBOL_PRINT_NAME (sym),
+                 struct ada_exc_info info = {sym->print_name (),
                                              SYMBOL_VALUE_ADDRESS (sym)};
 
                  exceptions->push_back (info);
@@ -13494,7 +13276,7 @@ static bool
 name_matches_regex (const char *name, compiled_regex *preg)
 {
   return (preg == NULL
-         || preg->exec (ada_decode (name), 0, NULL, 0) == 0);
+         || preg->exec (ada_decode (name).c_str (), 0, NULL, 0) == 0);
 }
 
 /* Add all exceptions defined globally whose name name match
@@ -13527,8 +13309,8 @@ ada_add_global_exceptions (compiled_regex *preg,
                           lookup_name_info::match_any (),
                           [&] (const char *search_name)
                           {
-                            const char *decoded = ada_decode (search_name);
-                            return name_matches_regex (decoded, preg);
+                            std::string decoded = ada_decode (search_name);
+                            return name_matches_regex (decoded.c_str (), preg);
                           },
                           NULL,
                           VARIABLES_DOMAIN);
@@ -13548,10 +13330,10 @@ ada_add_global_exceptions (compiled_regex *preg,
 
              ALL_BLOCK_SYMBOLS (b, iter, sym)
                if (ada_is_non_standard_exception_sym (sym)
-                   && name_matches_regex (SYMBOL_NATURAL_NAME (sym), preg))
+                   && name_matches_regex (sym->natural_name (), preg))
                  {
                    struct ada_exc_info info
-                     = {SYMBOL_PRINT_NAME (sym), SYMBOL_VALUE_ADDRESS (sym)};
+                     = {sym->print_name (), SYMBOL_VALUE_ADDRESS (sym)};
 
                    exceptions->push_back (info);
                  }
@@ -13879,7 +13661,7 @@ ada_print_subexp (struct expression *exp, int *pos,
       return;
 
     case OP_VAR_VALUE:
-      fputs_filtered (SYMBOL_NATURAL_NAME (exp->elts[pc + 2].symbol), stream);
+      fputs_filtered (exp->elts[pc + 2].symbol->natural_name (), stream);
       return;
 
     case BINOP_IN_BOUNDS:
@@ -14350,7 +14132,6 @@ extern const struct language_defn ada_language_defn = {
   ada_language_arch_info,
   ada_print_array_index,
   default_pass_by_reference,
-  c_get_string,
   ada_watch_location_expression,
   ada_get_symbol_name_matcher, /* la_get_symbol_name_matcher */
   ada_iterate_over_symbols,
@@ -14393,43 +14174,43 @@ initialize_ada_catchpoint_ops (void)
 
   ops = &catch_exception_breakpoint_ops;
   *ops = bkpt_breakpoint_ops;
-  ops->allocate_location = allocate_location_catch_exception;
-  ops->re_set = re_set_catch_exception;
-  ops->check_status = check_status_catch_exception;
-  ops->print_it = print_it_catch_exception;
-  ops->print_one = print_one_catch_exception;
-  ops->print_mention = print_mention_catch_exception;
-  ops->print_recreate = print_recreate_catch_exception;
+  ops->allocate_location = allocate_location_exception;
+  ops->re_set = re_set_exception;
+  ops->check_status = check_status_exception;
+  ops->print_it = print_it_exception;
+  ops->print_one = print_one_exception;
+  ops->print_mention = print_mention_exception;
+  ops->print_recreate = print_recreate_exception;
 
   ops = &catch_exception_unhandled_breakpoint_ops;
   *ops = bkpt_breakpoint_ops;
-  ops->allocate_location = allocate_location_catch_exception_unhandled;
-  ops->re_set = re_set_catch_exception_unhandled;
-  ops->check_status = check_status_catch_exception_unhandled;
-  ops->print_it = print_it_catch_exception_unhandled;
-  ops->print_one = print_one_catch_exception_unhandled;
-  ops->print_mention = print_mention_catch_exception_unhandled;
-  ops->print_recreate = print_recreate_catch_exception_unhandled;
+  ops->allocate_location = allocate_location_exception;
+  ops->re_set = re_set_exception;
+  ops->check_status = check_status_exception;
+  ops->print_it = print_it_exception;
+  ops->print_one = print_one_exception;
+  ops->print_mention = print_mention_exception;
+  ops->print_recreate = print_recreate_exception;
 
   ops = &catch_assert_breakpoint_ops;
   *ops = bkpt_breakpoint_ops;
-  ops->allocate_location = allocate_location_catch_assert;
-  ops->re_set = re_set_catch_assert;
-  ops->check_status = check_status_catch_assert;
-  ops->print_it = print_it_catch_assert;
-  ops->print_one = print_one_catch_assert;
-  ops->print_mention = print_mention_catch_assert;
-  ops->print_recreate = print_recreate_catch_assert;
+  ops->allocate_location = allocate_location_exception;
+  ops->re_set = re_set_exception;
+  ops->check_status = check_status_exception;
+  ops->print_it = print_it_exception;
+  ops->print_one = print_one_exception;
+  ops->print_mention = print_mention_exception;
+  ops->print_recreate = print_recreate_exception;
 
   ops = &catch_handlers_breakpoint_ops;
   *ops = bkpt_breakpoint_ops;
-  ops->allocate_location = allocate_location_catch_handlers;
-  ops->re_set = re_set_catch_handlers;
-  ops->check_status = check_status_catch_handlers;
-  ops->print_it = print_it_catch_handlers;
-  ops->print_one = print_one_catch_handlers;
-  ops->print_mention = print_mention_catch_handlers;
-  ops->print_recreate = print_recreate_catch_handlers;
+  ops->allocate_location = allocate_location_exception;
+  ops->re_set = re_set_exception;
+  ops->check_status = check_status_exception;
+  ops->print_it = print_it_exception;
+  ops->print_one = print_one_exception;
+  ops->print_mention = print_mention_exception;
+  ops->print_recreate = print_recreate_exception;
 }
 
 /* This module's 'new_objfile' observer.  */
This page took 0.066849 seconds and 4 git commands to generate.