mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-16 12:24:19 +08:00
[Ada] Make the exception_support_info data per inferior.
The ada-lang module was using a static global called "exception_info" for all inferiors. But each inferior might be different, and thus this patch makes this data per-inferior. gdb/ChangeLog: * ada-lang.c (struct ada_inferior_data) [exception_info]: New field. (exception_info): Delete. (ada_exception_support_info_sniffer): Get exception_support_info data from our per-inferior data. Adjust code accordingly. (ada_unhandled_exception_name_addr_from_raise): Likewise. (ada_exception_name_addr_1, ada_exception_sym_name): Ditto. (ada_executable_changed_observer): Delete. (_initialize_ada_language): Remove call to observer_attach_executable_changed.
This commit is contained in:
@ -1,3 +1,16 @@
|
|||||||
|
2011-12-11 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
|
* ada-lang.c (struct ada_inferior_data) [exception_info]:
|
||||||
|
New field.
|
||||||
|
(exception_info): Delete.
|
||||||
|
(ada_exception_support_info_sniffer): Get exception_support_info
|
||||||
|
data from our per-inferior data. Adjust code accordingly.
|
||||||
|
(ada_unhandled_exception_name_addr_from_raise): Likewise.
|
||||||
|
(ada_exception_name_addr_1, ada_exception_sym_name): Ditto.
|
||||||
|
(ada_executable_changed_observer): Delete.
|
||||||
|
(_initialize_ada_language): Remove call to
|
||||||
|
observer_attach_executable_changed.
|
||||||
|
|
||||||
2011-12-11 Joel Brobecker <brobecker@adacore.com>
|
2011-12-11 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
* ada-lang.c (ada_has_this_exception_support): Raise an error
|
* ada-lang.c (ada_has_this_exception_support): Raise an error
|
||||||
|
@ -317,6 +317,11 @@ struct ada_inferior_data
|
|||||||
accessible through a component ("tsd") in the object tag. But this
|
accessible through a component ("tsd") in the object tag. But this
|
||||||
is no longer the case, so we cache it for each inferior. */
|
is no longer the case, so we cache it for each inferior. */
|
||||||
struct type *tsd_type;
|
struct type *tsd_type;
|
||||||
|
|
||||||
|
/* The exception_support_info data. This data is used to determine
|
||||||
|
how to implement support for Ada exception catchpoints in a given
|
||||||
|
inferior. */
|
||||||
|
const struct exception_support_info *exception_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Our key to this module's inferior data. */
|
/* Our key to this module's inferior data. */
|
||||||
@ -10691,36 +10696,33 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For each executable, we sniff which exception info structure to use
|
|
||||||
and cache it in the following global variable. */
|
|
||||||
|
|
||||||
static const struct exception_support_info *exception_info = NULL;
|
|
||||||
|
|
||||||
/* Inspect the Ada runtime and determine which exception info structure
|
/* Inspect the Ada runtime and determine which exception info structure
|
||||||
should be used to provide support for exception catchpoints.
|
should be used to provide support for exception catchpoints.
|
||||||
|
|
||||||
This function will always set exception_info, or raise an error. */
|
This function will always set the per-inferior exception_info,
|
||||||
|
or raise an error. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ada_exception_support_info_sniffer (void)
|
ada_exception_support_info_sniffer (void)
|
||||||
{
|
{
|
||||||
|
struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
/* If the exception info is already known, then no need to recompute it. */
|
/* If the exception info is already known, then no need to recompute it. */
|
||||||
if (exception_info != NULL)
|
if (data->exception_info != NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Check the latest (default) exception support info. */
|
/* Check the latest (default) exception support info. */
|
||||||
if (ada_has_this_exception_support (&default_exception_support_info))
|
if (ada_has_this_exception_support (&default_exception_support_info))
|
||||||
{
|
{
|
||||||
exception_info = &default_exception_support_info;
|
data->exception_info = &default_exception_support_info;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try our fallback exception suport info. */
|
/* Try our fallback exception suport info. */
|
||||||
if (ada_has_this_exception_support (&exception_support_info_fallback))
|
if (ada_has_this_exception_support (&exception_support_info_fallback))
|
||||||
{
|
{
|
||||||
exception_info = &exception_support_info_fallback;
|
data->exception_info = &exception_support_info_fallback;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10751,19 +10753,6 @@ ada_exception_support_info_sniffer (void)
|
|||||||
error (_("Cannot insert catchpoints in this configuration."));
|
error (_("Cannot insert catchpoints in this configuration."));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* An observer of "executable_changed" events.
|
|
||||||
Its role is to clear certain cached values that need to be recomputed
|
|
||||||
each time a new executable is loaded by GDB. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
ada_executable_changed_observer (void)
|
|
||||||
{
|
|
||||||
/* If the executable changed, then it is possible that the Ada runtime
|
|
||||||
is different. So we need to invalidate the exception support info
|
|
||||||
cache. */
|
|
||||||
exception_info = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* True iff FRAME is very likely to be that of a function that is
|
/* True iff FRAME is very likely to be that of a function that is
|
||||||
part of the runtime system. This is all very heuristic, but is
|
part of the runtime system. This is all very heuristic, but is
|
||||||
intended to be used as advice as to what frames are uninteresting
|
intended to be used as advice as to what frames are uninteresting
|
||||||
@ -10863,6 +10852,7 @@ ada_unhandled_exception_name_addr_from_raise (void)
|
|||||||
{
|
{
|
||||||
int frame_level;
|
int frame_level;
|
||||||
struct frame_info *fi;
|
struct frame_info *fi;
|
||||||
|
struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
|
||||||
|
|
||||||
/* To determine the name of this exception, we need to select
|
/* To determine the name of this exception, we need to select
|
||||||
the frame corresponding to RAISE_SYM_NAME. This frame is
|
the frame corresponding to RAISE_SYM_NAME. This frame is
|
||||||
@ -10880,7 +10870,7 @@ ada_unhandled_exception_name_addr_from_raise (void)
|
|||||||
|
|
||||||
find_frame_funname (fi, &func_name, &func_lang, NULL);
|
find_frame_funname (fi, &func_name, &func_lang, NULL);
|
||||||
if (func_name != NULL
|
if (func_name != NULL
|
||||||
&& strcmp (func_name, exception_info->catch_exception_sym) == 0)
|
&& strcmp (func_name, data->exception_info->catch_exception_sym) == 0)
|
||||||
break; /* We found the frame we were looking for... */
|
break; /* We found the frame we were looking for... */
|
||||||
fi = get_prev_frame (fi);
|
fi = get_prev_frame (fi);
|
||||||
}
|
}
|
||||||
@ -10902,6 +10892,8 @@ static CORE_ADDR
|
|||||||
ada_exception_name_addr_1 (enum exception_catchpoint_kind ex,
|
ada_exception_name_addr_1 (enum exception_catchpoint_kind ex,
|
||||||
struct breakpoint *b)
|
struct breakpoint *b)
|
||||||
{
|
{
|
||||||
|
struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
|
||||||
|
|
||||||
switch (ex)
|
switch (ex)
|
||||||
{
|
{
|
||||||
case ex_catch_exception:
|
case ex_catch_exception:
|
||||||
@ -10909,7 +10901,7 @@ ada_exception_name_addr_1 (enum exception_catchpoint_kind ex,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ex_catch_exception_unhandled:
|
case ex_catch_exception_unhandled:
|
||||||
return exception_info->unhandled_exception_name_addr ();
|
return data->exception_info->unhandled_exception_name_addr ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ex_catch_assert:
|
case ex_catch_assert:
|
||||||
@ -11608,18 +11600,20 @@ catch_ada_exception_command_split (char *args,
|
|||||||
static const char *
|
static const char *
|
||||||
ada_exception_sym_name (enum exception_catchpoint_kind ex)
|
ada_exception_sym_name (enum exception_catchpoint_kind ex)
|
||||||
{
|
{
|
||||||
gdb_assert (exception_info != NULL);
|
struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
|
||||||
|
|
||||||
|
gdb_assert (data->exception_info != NULL);
|
||||||
|
|
||||||
switch (ex)
|
switch (ex)
|
||||||
{
|
{
|
||||||
case ex_catch_exception:
|
case ex_catch_exception:
|
||||||
return (exception_info->catch_exception_sym);
|
return (data->exception_info->catch_exception_sym);
|
||||||
break;
|
break;
|
||||||
case ex_catch_exception_unhandled:
|
case ex_catch_exception_unhandled:
|
||||||
return (exception_info->catch_exception_unhandled_sym);
|
return (data->exception_info->catch_exception_unhandled_sym);
|
||||||
break;
|
break;
|
||||||
case ex_catch_assert:
|
case ex_catch_assert:
|
||||||
return (exception_info->catch_assert_sym);
|
return (data->exception_info->catch_assert_sym);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
internal_error (__FILE__, __LINE__,
|
internal_error (__FILE__, __LINE__,
|
||||||
@ -12475,8 +12469,6 @@ With an argument, catch only exceptions with the given name."),
|
|||||||
(256, htab_hash_string, (int (*)(const void *, const void *)) streq,
|
(256, htab_hash_string, (int (*)(const void *, const void *)) streq,
|
||||||
NULL, xcalloc, xfree);
|
NULL, xcalloc, xfree);
|
||||||
|
|
||||||
observer_attach_executable_changed (ada_executable_changed_observer);
|
|
||||||
|
|
||||||
/* Setup per-inferior data. */
|
/* Setup per-inferior data. */
|
||||||
observer_attach_inferior_exit (ada_inferior_exit);
|
observer_attach_inferior_exit (ada_inferior_exit);
|
||||||
ada_inferior_data
|
ada_inferior_data
|
||||||
|
Reference in New Issue
Block a user