mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-06 15:38:45 +08:00
Trust PAD types instead of using PAD___XVS.
* ada-lang.c (trust_pad_over_xvs): New static variable. (ada_is_aligner_type): If !trust_pad_over_xvs and there is a parallel XVS type, follow the XVS type instead of the PAD type. (unwrap_value): Make sure that there is no parallel XVE type before returning the value as is. (set_ada_list, show_ada_list): New static variables. (set_ada_command, show_ada_command): New functions. (_initialize_ada_language): Add new "set/show ada" prefix commands. Add new "set/show ada trust-PAD-over-XVS" setting.
This commit is contained in:
@ -1,3 +1,16 @@
|
|||||||
|
2010-01-18 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
|
Trust PAD types instead of using PAD___XVS.
|
||||||
|
* ada-lang.c (trust_pad_over_xvs): New static variable.
|
||||||
|
(ada_is_aligner_type): If !trust_pad_over_xvs and there is a
|
||||||
|
parallel XVS type, follow the XVS type instead of the PAD type.
|
||||||
|
(unwrap_value): Make sure that there is no parallel XVE type
|
||||||
|
before returning the value as is.
|
||||||
|
(set_ada_list, show_ada_list): New static variables.
|
||||||
|
(set_ada_command, show_ada_command): New functions.
|
||||||
|
(_initialize_ada_language): Add new "set/show ada" prefix commands.
|
||||||
|
Add new "set/show ada trust-PAD-over-XVS" setting.
|
||||||
|
|
||||||
2010-01-18 Tom Tromey <tromey@redhat.com>
|
2010-01-18 Tom Tromey <tromey@redhat.com>
|
||||||
Thiago Jung Bauermann <bauerman@br.ibm.com>
|
Thiago Jung Bauermann <bauerman@br.ibm.com>
|
||||||
|
|
||||||
|
@ -7727,6 +7727,16 @@ ada_is_string_type (struct type *type)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The compiler sometimes provides a parallel XVS type for a given
|
||||||
|
PAD type. Normally, it is safe to follow the PAD type directly,
|
||||||
|
but older versions of the compiler have a bug that causes the offset
|
||||||
|
of its "F" field to be wrong. Following that field in that case
|
||||||
|
would lead to incorrect results, but this can be worked around
|
||||||
|
by ignoring the PAD type and using the associated XVS type instead.
|
||||||
|
|
||||||
|
Set to True if the debugger should trust the contents of PAD types.
|
||||||
|
Otherwise, ignore the PAD type if there is a parallel XVS type. */
|
||||||
|
static int trust_pad_over_xvs = 1;
|
||||||
|
|
||||||
/* True if TYPE is a struct type introduced by the compiler to force the
|
/* True if TYPE is a struct type introduced by the compiler to force the
|
||||||
alignment of a value. Such types have a single field with a
|
alignment of a value. Such types have a single field with a
|
||||||
@ -7737,10 +7747,7 @@ ada_is_aligner_type (struct type *type)
|
|||||||
{
|
{
|
||||||
type = ada_check_typedef (type);
|
type = ada_check_typedef (type);
|
||||||
|
|
||||||
/* If we can find a parallel XVS type, then the XVS type should
|
if (!trust_pad_over_xvs && ada_find_parallel_type (type, "___XVS") != NULL)
|
||||||
be used instead of this type. And hence, this is not an aligner
|
|
||||||
type. */
|
|
||||||
if (ada_find_parallel_type (type, "___XVS") != NULL)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (TYPE_CODE (type) == TYPE_CODE_STRUCT
|
return (TYPE_CODE (type) == TYPE_CODE_STRUCT
|
||||||
@ -7918,8 +7925,11 @@ unwrap_value (struct value *val)
|
|||||||
struct type *raw_real_type =
|
struct type *raw_real_type =
|
||||||
ada_check_typedef (ada_get_base_type (type));
|
ada_check_typedef (ada_get_base_type (type));
|
||||||
|
|
||||||
if (type == raw_real_type)
|
/* If there is no parallel XVS or XVE type, then the value is
|
||||||
return val;
|
already unwrapped. Return it without further modification. */
|
||||||
|
if ((type == raw_real_type)
|
||||||
|
&& ada_find_parallel_type (type, "___XVE") == NULL)
|
||||||
|
return val;
|
||||||
|
|
||||||
return
|
return
|
||||||
coerce_unspec_val_to_type
|
coerce_unspec_val_to_type
|
||||||
@ -11373,11 +11383,55 @@ const struct language_defn ada_language_defn = {
|
|||||||
/* Provide a prototype to silence -Wmissing-prototypes. */
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
||||||
extern initialize_file_ftype _initialize_ada_language;
|
extern initialize_file_ftype _initialize_ada_language;
|
||||||
|
|
||||||
|
/* Command-list for the "set/show ada" prefix command. */
|
||||||
|
static struct cmd_list_element *set_ada_list;
|
||||||
|
static struct cmd_list_element *show_ada_list;
|
||||||
|
|
||||||
|
/* Implement the "set ada" prefix command. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
set_ada_command (char *arg, int from_tty)
|
||||||
|
{
|
||||||
|
printf_unfiltered (_(\
|
||||||
|
"\"set ada\" must be followed by the name of a setting.\n"));
|
||||||
|
help_list (set_ada_list, "set ada ", -1, gdb_stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Implement the "show ada" prefix command. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
show_ada_command (char *args, int from_tty)
|
||||||
|
{
|
||||||
|
cmd_show_list (show_ada_list, from_tty, "");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_initialize_ada_language (void)
|
_initialize_ada_language (void)
|
||||||
{
|
{
|
||||||
add_language (&ada_language_defn);
|
add_language (&ada_language_defn);
|
||||||
|
|
||||||
|
add_prefix_cmd ("ada", no_class, set_ada_command,
|
||||||
|
_("Prefix command for changing Ada-specfic settings"),
|
||||||
|
&set_ada_list, "set ada ", 0, &setlist);
|
||||||
|
|
||||||
|
add_prefix_cmd ("ada", no_class, show_ada_command,
|
||||||
|
_("Generic command for showing Ada-specific settings."),
|
||||||
|
&show_ada_list, "show ada ", 0, &showlist);
|
||||||
|
|
||||||
|
add_setshow_boolean_cmd ("trust-PAD-over-XVS", class_obscure,
|
||||||
|
&trust_pad_over_xvs, _("\
|
||||||
|
Enable or disable an optimization trusting PAD types over XVS types"), _("\
|
||||||
|
Show whether an optimization trusting PAD types over XVS types is activated"),
|
||||||
|
_("\
|
||||||
|
This is related to the encoding used by the GNAT compiler. The debugger\n\
|
||||||
|
should normally trust the contents of PAD types, but certain older versions\n\
|
||||||
|
of GNAT have a bug that sometimes causes the information in the PAD type\n\
|
||||||
|
to be incorrect. Turning this setting \"off\" allows the debugger to\n\
|
||||||
|
work around this bug. It is always safe to turn this option \"off\", but\n\
|
||||||
|
this incurs a slight performance penalty, so it is recommended to NOT change\n\
|
||||||
|
this option to \"off\" unless necessary."),
|
||||||
|
NULL, NULL, &set_ada_list, &show_ada_list);
|
||||||
|
|
||||||
varsize_limit = 65536;
|
varsize_limit = 65536;
|
||||||
|
|
||||||
obstack_init (&symbol_list_obstack);
|
obstack_init (&symbol_list_obstack);
|
||||||
|
Reference in New Issue
Block a user