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);
}
}
}
-/* 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)
case TYPE_CODE_RANGE:
case TYPE_CODE_ENUM:
case TYPE_CODE_BOOL:
+ case TYPE_CODE_CHAR:
return 1;
default:
return 0;
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;
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;
}
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;
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. */
else
rtype->set_length (align_up (rtype->length (), type->length ()));
- value_free_to_mark (mark);
return rtype;
}
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;
if (variant_field == -1)
return type;
+ scoped_value_mark mark;
if (dval0 == NULL)
{
dval = value_from_contents_and_address (type, valaddr, address);
rtype->set_length (rtype->length ()
- type->field (variant_field).type ()->length ());
- value_free_to_mark (mark);
return rtype;
}
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;
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))
{
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
break;
default:
- internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+ internal_error (_("unexpected catchpoint type"));
break;
}
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)
{
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
break;
default:
- internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+ internal_error (_("unexpected catchpoint type"));
break;
}
break;
default:
- internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+ internal_error (_("unexpected catchpoint type"));
break;
}
}
break;
default:
- internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+ internal_error (_("unexpected catchpoint type"));
}
print_recreate_thread (fp);
}
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);
}
}
{
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);
+ }
+ }
}
}
}
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);
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 ())
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... */