]> Git Repo - binutils.git/blobdiff - gdb/ada-lang.c
Automatic date update in version.in
[binutils.git] / gdb / ada-lang.c
index d539c50602c395034804c8c7a97202bd705706a0..5054bdb2957210226630b9869e180d2fb03dc96a 100644 (file)
@@ -1146,12 +1146,14 @@ ada_fold_name (gdb::string_view name, bool throw_on_error = false)
   return fold_storage.c_str ();
 }
 
-/* The "encoded" form of DECODED, according to GNAT conventions.  */
+/* The "encoded" form of DECODED, according to GNAT conventions.  If
+   FOLD is true (the default), case-fold any ordinary symbol.  Symbols
+   with <...> quoting are not folded in any case.  */
 
 std::string
-ada_encode (const char *decoded)
+ada_encode (const char *decoded, bool fold)
 {
-  if (decoded[0] != '<')
+  if (fold && decoded[0] != '<')
     decoded = ada_fold_name (decoded);
   return ada_encode_1 (decoded, true);
 }
@@ -4149,7 +4151,9 @@ scalar_type_p (struct type *type)
     }
 }
 
-/* True iff TYPE is discrete (INT, RANGE, ENUM).  */
+/* True iff TYPE is discrete, as defined in the Ada Reference Manual.
+   This essentially means one of (INT, RANGE, ENUM) -- but note that
+   "enum" includes character and boolean as well.  */
 
 static int
 discrete_type_p (struct type *type)
@@ -4164,6 +4168,7 @@ discrete_type_p (struct type *type)
        case TYPE_CODE_RANGE:
        case TYPE_CODE_ENUM:
        case TYPE_CODE_BOOL:
+       case TYPE_CODE_CHAR:
          return 1;
        default:
          return 0;
@@ -4896,7 +4901,7 @@ add_defn_to_vec (std::vector<struct block_symbol> &result,
    global symbols are searched.  */
 
 struct bound_minimal_symbol
-ada_lookup_simple_minsym (const char *name)
+ada_lookup_simple_minsym (const char *name, struct objfile *objfile)
 {
   struct bound_minimal_symbol result;
 
@@ -4906,19 +4911,23 @@ ada_lookup_simple_minsym (const char *name)
   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 (), lookup_name, NULL)
-             && msymbol->type () != mst_solib_trampoline)
-           {
-             result.minsym = msymbol;
-             result.objfile = objfile;
-             break;
-           }
-       }
-    }
+  gdbarch_iterate_over_objfiles_in_search_order
+    (objfile != NULL ? objfile->arch () : target_gdbarch (),
+     [&result, lookup_name, match_name] (struct objfile *obj)
+       {
+        for (minimal_symbol *msymbol : obj->msymbols ())
+          {
+            if (match_name (msymbol->linkage_name (), lookup_name, nullptr)
+                && msymbol->type () != mst_solib_trampoline)
+              {
+                result.minsym = msymbol;
+                result.objfile = obj;
+                return 1;
+              }
+          }
+
+        return 0;
+       }, objfile);
 
   return result;
 }
@@ -7855,7 +7864,6 @@ ada_template_to_fixed_record_type_1 (struct type *type,
                                     CORE_ADDR address, struct value *dval0,
                                     int keep_dynamic_fields)
 {
-  struct value *mark = value_mark ();
   struct value *dval;
   struct type *rtype;
   int nfields, bit_len;
@@ -7864,6 +7872,8 @@ ada_template_to_fixed_record_type_1 (struct type *type,
   int fld_bit_len;
   int f;
 
+  scoped_value_mark mark;
+
   /* Compute the number of fields in this record type that are going
      to be processed: unless keep_dynamic_fields, this includes only
      fields whose position and length are static will be processed.  */
@@ -8065,7 +8075,6 @@ ada_template_to_fixed_record_type_1 (struct type *type,
   else
     rtype->set_length (align_up (rtype->length (), type->length ()));
 
-  value_free_to_mark (mark);
   return rtype;
 }
 
@@ -8166,7 +8175,6 @@ static struct type *
 to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
                                   CORE_ADDR address, struct value *dval0)
 {
-  struct value *mark = value_mark ();
   struct value *dval;
   struct type *rtype;
   struct type *branch_type;
@@ -8176,6 +8184,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
   if (variant_field == -1)
     return type;
 
+  scoped_value_mark mark;
   if (dval0 == NULL)
     {
       dval = value_from_contents_and_address (type, valaddr, address);
@@ -8225,7 +8234,6 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
   rtype->set_length (rtype->length ()
                     - type->field (variant_field).type ()->length ());
 
-  value_free_to_mark (mark);
   return rtype;
 }
 
@@ -11837,7 +11845,7 @@ ada_exception_support_info_sniffer (void)
    to most users.  */
 
 static int
-is_known_support_routine (struct frame_info *frame)
+is_known_support_routine (frame_info_ptr frame)
 {
   enum language func_lang;
   int i;
@@ -11896,7 +11904,7 @@ is_known_support_routine (struct frame_info *frame)
    part of the Ada run-time, starting from FI and moving upward.  */
 
 void
-ada_find_printable_frame (struct frame_info *fi)
+ada_find_printable_frame (frame_info_ptr fi)
 {
   for (; fi != NULL; fi = get_prev_frame (fi))
     {
@@ -11930,7 +11938,7 @@ static CORE_ADDR
 ada_unhandled_exception_name_addr_from_raise (void)
 {
   int frame_level;
-  struct frame_info *fi;
+  frame_info_ptr fi;
   struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
 
   /* To determine the name of this exception, we need to select
@@ -11997,7 +12005,7 @@ ada_exception_name_addr_1 (enum ada_exception_catchpoint_kind ex)
        break;
 
       default:
-       internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+       internal_error (_("unexpected catchpoint type"));
        break;
     }
 
@@ -12308,11 +12316,8 @@ should_stop_exception (const struct bp_location *bl)
   stop = true;
   try
     {
-      struct value *mark;
-
-      mark = value_mark ();
+      scoped_value_mark mark;
       stop = value_true (evaluate_expression (ada_loc->excep_cond_expr.get ()));
-      value_free_to_mark (mark);
     }
   catch (const gdb_exception &ex)
     {
@@ -12351,7 +12356,7 @@ ada_catchpoint::print_it (const bpstat *bs) const
 
   uiout->text (disposition == disp_del
               ? "\nTemporary catchpoint " : "\nCatchpoint ");
-  uiout->field_signed ("bkptno", number);
+  print_num_locno (bs, uiout);
   uiout->text (", ");
 
   /* ada_exception_name_addr relies on the selected frame being the
@@ -12470,7 +12475,7 @@ ada_catchpoint::print_one (bp_location **last_loc) const
        break;
 
       default:
-       internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+       internal_error (_("unexpected catchpoint type"));
        break;
     }
 
@@ -12524,7 +12529,7 @@ ada_catchpoint::print_mention () const
        break;
 
       default:
-       internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+       internal_error (_("unexpected catchpoint type"));
        break;
     }
 }
@@ -12556,7 +12561,7 @@ ada_catchpoint::print_recreate (struct ui_file *fp) const
        break;
 
       default:
-       internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+       internal_error (_("unexpected catchpoint type"));
     }
   print_recreate_thread (fp);
 }
@@ -12671,8 +12676,7 @@ ada_exception_sym_name (enum ada_exception_catchpoint_kind ex)
        return (data->exception_info->catch_handlers_sym);
        break;
       default:
-       internal_error (__FILE__, __LINE__,
-                       _("unexpected catchpoint kind (%d)"), ex);
+       internal_error (_("unexpected catchpoint kind (%d)"), ex);
     }
 }
 
@@ -13019,15 +13023,29 @@ ada_add_standard_exceptions (compiled_regex *preg,
     {
       if (preg == NULL || preg->exec (name, 0, NULL, 0) == 0)
        {
-         struct bound_minimal_symbol msymbol
-           = ada_lookup_simple_minsym (name);
+         symbol_name_match_type match_type = name_match_type_from_name (name);
+         lookup_name_info lookup_name (name, match_type);
 
-         if (msymbol.minsym != NULL)
-           {
-             struct ada_exc_info info
-               = {name, msymbol.value_address ()};
+         symbol_name_matcher_ftype *match_name
+           = ada_get_symbol_name_matcher (lookup_name);
 
-             exceptions->push_back (info);
+         /* Iterate over all objfiles irrespective of scope or linker
+            namespaces so we get all exceptions anywhere in the
+            progspace.  */
+         for (objfile *objfile : current_program_space->objfiles ())
+           {
+             for (minimal_symbol *msymbol : objfile->msymbols ())
+               {
+                 if (match_name (msymbol->linkage_name (), lookup_name,
+                                 nullptr)
+                     && msymbol->type () != mst_solib_trampoline)
+                   {
+                     ada_exc_info info
+                       = {name, msymbol->value_address (objfile)};
+
+                     exceptions->push_back (info);
+                   }
+               }
            }
        }
     }
@@ -13045,7 +13063,7 @@ ada_add_standard_exceptions (compiled_regex *preg,
 
 static void
 ada_add_exceptions_from_frame (compiled_regex *preg,
-                              struct frame_info *frame,
+                              frame_info_ptr frame,
                               std::vector<ada_exc_info> *exceptions)
 {
   const struct block *block = get_frame_block (frame, 0);
@@ -13125,6 +13143,8 @@ ada_add_global_exceptions (compiled_regex *preg,
                           SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
                           VARIABLES_DOMAIN);
 
+  /* Iterate over all objfiles irrespective of scope or linker namespaces
+     so we get all exceptions anywhere in the progspace.  */
   for (objfile *objfile : current_program_space->objfiles ())
     {
       for (compunit_symtab *s : objfile->compunits ())
@@ -13474,7 +13494,7 @@ public:
 
   struct value *read_var_value (struct symbol *var,
                                const struct block *var_block,
-                               struct frame_info *frame) const override
+                               frame_info_ptr frame) const override
   {
     /* The only case where default_read_var_value is not sufficient
        is when VAR is a renaming...  */
This page took 0.03968 seconds and 4 git commands to generate.