From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23985 invoked by alias); 28 Jan 2014 03:09:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23972 invoked by uid 89); 28 Jan 2014 03:09:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 28 Jan 2014 03:09:17 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 319681161C9; Mon, 27 Jan 2014 22:09:15 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 3XxpZm1HmC2H; Mon, 27 Jan 2014 22:09:15 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id ACAB311619A; Mon, 27 Jan 2014 22:09:14 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id E90A5E0C98; Tue, 28 Jan 2014 07:09:10 +0400 (RET) Date: Tue, 28 Jan 2014 03:09:00 -0000 From: Joel Brobecker To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [Ada/NEWS+doco] New Ada maintenance command to ignore descriptive types (DWARF). Message-ID: <20140128030910.GD4101@adacore.com> References: <1390797415-6071-1-git-send-email-brobecker@adacore.com> <83iot5a05d.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="RnlQjJ0d97Da+TV1" Content-Disposition: inline In-Reply-To: <83iot5a05d.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-01/txt/msg00989.txt.bz2 --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1444 Thanks for the review, Eli. > > +maint ada set ignore-descriptive-types (on|off) > > +maint ada show ignore-descriptive-types > > + Control whether the debugger should ignore descriptive types. > > I would say "... descriptive types in Ada programs", so that readers > who don't use Ada will not bother looking this up in the manual, even > if they missed the crucial hint in the name of the option. Indeed, that's a good suggestion. I also took your suggestion to change the wording on the default in gdb.texinfo to apply it here as well. > > +In particular, this convention makes use of @samp{descriptive types}, > > This should be in @dfn, not @samp, as you are introducing new > terminology. Also, a @cindex entry for that would be nice. OK. I keep writing notes of which @ command to use in which case, so hopefully I will be doing better as time goes by! Changes made. I added 2 @cindex, one for GNAT descriptive type, and one for GNAT encoding. > OK with those changes. However, I wonder if we really should document > this in such a detailed manner, if this is really a temporary measure. > Your call. I wasn't sure either. The volume of work to be done before we are completely done is massive - between GCC, GDB, and our busy schedules, I think we're talking years... Not being sure, I stayed with the current wording, but I am happy to make any change you may suggest. Attached is the patch I just checked in. -- Joel --RnlQjJ0d97Da+TV1 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-New-Ada-maintenance-command-to-ignore-descriptive-ty.patch" Content-length: 7514 >From 9ef398436c3e7bbc71b396d8a14375de8f83f0a4 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Thu, 16 Jan 2014 15:08:16 +0400 Subject: [PATCH] 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. --- gdb/NEWS | 9 +++++++++ gdb/ada-lang.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ gdb/doc/gdb.texinfo | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) diff --git a/gdb/NEWS b/gdb/NEWS index 6b1aacb..5062e02 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -3,6 +3,15 @@ *** Changes since GDB 7.7 +* New options + +maint ada set ignore-descriptive-types (on|off) +maint ada show ignore-descriptive-types + Control whether the debugger should ignore descriptive types in Ada + programs. The default is not to ignore the descriptive types. See + the user manual for more details on descriptive types and the intended + usage of this option. + * New features in the GDB remote stub, GDBserver ** New option --debug-format=option1[,option2,...] allows one to add 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 diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index a990d2a..02dbcba 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -15712,6 +15712,39 @@ recommended to leave this setting to @code{on} unless necessary. @end table +@cindex GNAT descriptive types +@cindex GNAT encoding +Internally, the debugger also relies on the compiler following a number +of conventions known as the @samp{GNAT Encoding}, all documented in +@file{gcc/ada/exp_dbug.ads} in the GCC sources. This encoding describes +how the debugging information should be generated for certain types. +In particular, this convention makes use of @dfn{descriptive types}, +which are artificial types generated purely to help the debugger. + +These encodings were defined at a time when the debugging information +format used was not powerful enough to describe some of the more complex +types available in Ada. Since DWARF allows us to express nearly all +Ada features, the long-term goal is to slowly replace these descriptive +types by their pure DWARF equivalent. To facilitate that transition, +a new maintenance option is available to force the debugger to ignore +those descriptive types. It allows the user to quickly evaluate how +well @value{GDBN} works without them. + +@table @code + +@kindex maint ada set ignore-descriptive-types +@item maintenance ada set ignore-descriptive-types [on|off] +Control whether the debugger should ignore descriptive types. +The default is not to ignore descriptives types (@code{off}). + +@kindex maint ada show ignore-descriptive-types +@item maintenance ada show ignore-descriptive-types +Show if descriptive types are ignored by @value{GDBN}. + +@end table + @node Unsupported Languages @section Unsupported Languages -- 1.8.3.2 --RnlQjJ0d97Da+TV1--