From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 60C993858425 for ; Thu, 8 Sep 2022 13:30:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 60C993858425 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWHc8-00035a-HZ; Thu, 08 Sep 2022 09:30:40 -0400 Received: from [87.69.77.57] (port=3517 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWHbs-0006DR-Kv; Thu, 08 Sep 2022 09:30:36 -0400 Date: Thu, 08 Sep 2022 16:30:06 +0300 Message-Id: <834jxif0yp.fsf@gnu.org> From: Eli Zaretskii To: Gareth Rees Cc: gdb-patches@sourceware.org In-Reply-To: <20220908110248.1084-1-grees@undo.io> (message from Gareth Rees via Gdb-patches on Thu, 8 Sep 2022 12:02:48 +0100) Subject: Re: [PATCH v2] [gdb/mi] Don't treat references to compound values as "simple". References: <877d2ema8q.fsf@redhat.com> <20220908110248.1084-1-grees@undo.io> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2022 13:30:46 -0000 > Date: Thu, 8 Sep 2022 12:02:48 +0100 > From: Gareth Rees via Gdb-patches > > There are two ways we could fix this problem, depending on whether we > consider the current behaviour to be a bug. > > 1. If the current behaviour is a bug, then we can update the behaviour > of '--simple-values' so that it takes reference types into account: > that is, a value is simple if it is neither an array, struct, or > union, nor a reference to an array, struct or union. > > In this case we must add a feature to the '-list-features' command so > that IDEs can detect that it is safe to use the '--simple-values' > argument when refreshing the call stack. > > 2. If the current behaviour is not a bug, then we can add a new option > for the PRINT-VALUES argument, for example, '--simplest-values' (3), > that would be suitable for use by IDEs. > > In this case we must add a feature to the '-list-features' command so > that IDEs can detect that the '--simplest-values' argument is > available for use when refreshing the call stack. > > PATCH > > This patch implements solution (1) as I think the current behaviour of > not printing structures, but printing references to structures, is > contrary to reasonable expectation. Thanks. FWIW, I think we should implement 2, not 1. > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -114,6 +114,18 @@ maintenance info line-table > entry corresponds to an address where a breakpoint should be placed > to be at the first instruction past a function's prologue. > > +* MI changes > + > + ** The '--simple-values' argument to the '-stack-list-arguments', > + '-stack-list-locals', '-stack-list-variables', and > + '-var-list-children' commands takes reference types into account: > + that is, a value is now considered simple if it is neither an > + array, structure, or union, nor a reference to an array, structure, > + or union. Isn't it easier to say "only if the value is a scalar"? > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index 238a49b027d..5ccf6609709 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -37295,6 +37295,13 @@ option (@pxref{GDB/MI Program Execution}). > @item data-disassemble-a-option > Indicates that the @code{-data-disassemble} command supports the @option{-a} > option (@pxref{GDB/MI Data Manipulation}). > +@item simple-values-ref-types > +Indicates that the @code{--simple-values} argument to the > +@code{-stack-list-arguments}, @code{-stack-list-locals}, > +@code{-stack-list-variables}, and @code{-var-list-children} commands > +takes reference types into account: that is, a value is considered > +simple if it neither an array, structure, or union, nor a reference to > +an array, structure, or union. > @end ftable Same here. Other than that, the documentation parts are OK.