aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2014-01-16 15:08:16 +0400
committerJoel Brobecker <brobecker@adacore.com>2014-01-28 07:01:48 +0400
commitc6044dd124bee08ce8ebd2909582f9aed53b5499 (patch)
tree4dd5d67541a49fd230c11b392ab3d3b664c0e7c4 /gdb/ada-lang.c
parenta83c8245aa76f176159431fdde8e488983877b51 (diff)
downloadgdb-c6044dd124bee08ce8ebd2909582f9aed53b5499.zip
gdb-c6044dd124bee08ce8ebd2909582f9aed53b5499.tar.gz
gdb-c6044dd124bee08ce8ebd2909582f9aed53b5499.tar.bz2
New Ada maintenance command to ignore descriptive types (DWARF).
Currently, Ada debugging requires the use of certain GNAT-specific encodings, which are generated by the compiler. These encodings were created a long time ago to work around the fairly limited capabilities of the stabs debugging format. With DWARF, the vast majority of the encodings could be abandoned in favor of a pure DWARF approach. In order to make it easier to evaluate the quality of the DWARF debugging information generated by the compiler, and how the debugger handles it, we are introducing a small Ada-specific maintenance setting which changes the debugger's behavior to ignore descriptive types. Descriptive types are artificial types generated by the compiler purely to give the debugger hints as to how to properly decode certain properties of a type. For instance, for array types, it generates a parallel type whose name is the name of the array suffixed with ___XA, whose contents tells us what the array's index type is, and possibly its bounds. See GCC's gcc/ada/exp_dbug.ads for the full description of all encodings. This is only a first step, as this setting does not deactivate all encodings; More settings dedicated to each type of encoding will likely be implemented in the future, as we make progress. gdb/ChangeLog: * ada-lang.c (maint_set_ada_cmdlist, maint_show_ada_cmdlist): New static globals. (maint_set_ada_cmd, maint_show_ada_cmd): New functions. (ada_ignore_descriptive_types_p): New static global. (find_parallel_type_by_descriptive_type): Return immediately if ada_ignore_descriptive_types_p is set. (_initialize_ada_language): Register new commands "maintenance set ada", "maintenance show ada", "maintenance set ada ignore-descriptive-types" and "maintenance show ada ignore-descriptive-types". * NEWS: Add entry for new "maint ada set/show ignore-descriptive-types" commands. gdb/doc/ChangeLog: * gdb.texinfo (Ada Glitches): Document the new "maint ada set/show ignore-descriptive-types". commands.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2630456..cad480f 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -308,6 +308,31 @@ static const char *known_auxiliary_function_name_patterns[] = {
/* Space for allocating results of ada_lookup_symbol_list. */
static struct obstack symbol_list_obstack;
+/* Maintenance-related settings for this module. */
+
+static struct cmd_list_element *maint_set_ada_cmdlist;
+static struct cmd_list_element *maint_show_ada_cmdlist;
+
+/* Implement the "maintenance set ada" (prefix) command. */
+
+static void
+maint_set_ada_cmd (char *args, int from_tty)
+{
+ help_list (maint_set_ada_cmdlist, "maintenance set ada ", -1, gdb_stdout);
+}
+
+/* Implement the "maintenance show ada" (prefix) command. */
+
+static void
+maint_show_ada_cmd (char *args, int from_tty)
+{
+ cmd_show_list (maint_show_ada_cmdlist, from_tty, "");
+}
+
+/* The "maintenance ada set/show ignore-descriptive-type" value. */
+
+static int ada_ignore_descriptive_types_p = 0;
+
/* Inferior-specific data. */
/* Per-inferior data for this module. */
@@ -7422,6 +7447,9 @@ find_parallel_type_by_descriptive_type (struct type *type, const char *name)
{
struct type *result;
+ if (ada_ignore_descriptive_types_p)
+ return NULL;
+
/* If there no descriptive-type info, then there is no parallel type
to be found. */
if (!HAVE_GNAT_AUX_INFO (type))
@@ -13321,6 +13349,26 @@ List all Ada exception names.\n\
If a regular expression is passed as an argument, only those matching\n\
the regular expression are listed."));
+ add_prefix_cmd ("ada", class_maintenance, maint_set_ada_cmd,
+ _("Set Ada maintenance-related variables."),
+ &maint_set_ada_cmdlist, "maintenance set ada ",
+ 0/*allow-unknown*/, &maintenance_set_cmdlist);
+
+ add_prefix_cmd ("ada", class_maintenance, maint_show_ada_cmd,
+ _("Show Ada maintenance-related variables"),
+ &maint_show_ada_cmdlist, "maintenance show ada ",
+ 0/*allow-unknown*/, &maintenance_show_cmdlist);
+
+ add_setshow_boolean_cmd
+ ("ignore-descriptive-types", class_maintenance,
+ &ada_ignore_descriptive_types_p,
+ _("Set whether descriptive types generated by GNAT should be ignored."),
+ _("Show whether descriptive types generated by GNAT should be ignored."),
+ _("\
+When enabled, the debugger will stop using the DW_AT_GNAT_descriptive_type\n\
+DWARF attribute."),
+ NULL, NULL, &maint_set_ada_cmdlist, &maint_show_ada_cmdlist);
+
obstack_init (&symbol_list_obstack);
decoded_names_store = htab_create_alloc