From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 6B7363858428 for ; Thu, 8 Sep 2022 13:58:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6B7363858428 Received: by mail-wr1-x42a.google.com with SMTP id e16so6976344wrx.7 for ; Thu, 08 Sep 2022 06:58:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=9fIL/dUkHKSds/n6rlB/dvxuWYUhnpJOdXOoc88gzZc=; b=3m16FA9BT5HaA4pylaFZUi5Yt4J7F20BLaWvCtaJgXv2/X3zEAN4TqAJbpKdnybXQ1 anO/mz51Frd8rgh+6ZS5IwKtsalh7PQFcVEdRo3r8Y+OaGpmIpc0t91JSH83wiI+WGQe /hLVf0yYn8DHF9tDO9nmFnYTMuiWu6Pq8AZ+lSO0EhjiIWre8thvuI8wQ7TL7vGinpxb 2fXBbmZS+aWnDm2zNhRHycm/pULvr6c39CFk/p9LSuKY0miS5KRpmy1o0cqiVvCPGH4k SdDku1C7LouljPV9YnYuatHIYVh9IJLNHNkeXT9GuToFyuqQjr6REoBMh3nYSYy/+4Gh 2tgw== X-Gm-Message-State: ACgBeo2h6BYLN0aoAm2F1o1zjWmvEQKiulzugv3KSnDU3nKnnle4RGRd RdmZfDAes3aIUpqV2EpsgVnLygm4umlAaEYPxZTHZv8DDFaW7g== X-Google-Smtp-Source: AA6agR6Ebwk0UEyLw9mLchmUHf3lI48LW+nQSzOFgHZ9bNeP0g4cTAyRetGMPGw2hg2RXzIVOcpmjVfdMMJGcZw+IqE= X-Received: by 2002:a5d:430d:0:b0:223:808f:19c6 with SMTP id h13-20020a5d430d000000b00223808f19c6mr5258649wrq.273.1662645513181; Thu, 08 Sep 2022 06:58:33 -0700 (PDT) MIME-Version: 1.0 References: <877d2ema8q.fsf@redhat.com> <20220908110248.1084-1-grees@undo.io> <834jxif0yp.fsf@gnu.org> In-Reply-To: <834jxif0yp.fsf@gnu.org> From: Gareth Rees Date: Thu, 8 Sep 2022 14:58:22 +0100 Message-ID: Subject: Re: [PATCH v2] [gdb/mi] Don't treat references to compound values as "simple". To: Eli Zaretskii Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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:58:36 -0000 Eli Zaretskii wrote: > > +* 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"? I deliberately echoed the wording used in the documentation for '-stack-list-arguments' and similar commands, which uses the formula "if it is 2 or --simple-values, print the name, type and value for simple data types, and the name and type for arrays, structures and unions." But you are right that this concept corresponds to the 'scalars' arguments to 'set print frame-arguments'. But then should I update the documentation for '-stack-list-arguments' to match? > Thanks. FWIW, I think we should implement 2, not 1. I note that 'set print frame-arguments scalars' already takes reference types into account: see the function 'val_print_scalar_type_p' in gdb/valprint.c, which is implemented like this: int val_print_scalar_type_p (struct type *type) { type = check_typedef (type); while (TYPE_IS_REFERENCE (type)) { type = TYPE_TARGET_TYPE (type); type = check_typedef (type); } switch (type->code ()) { case TYPE_CODE_ARRAY: case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: case TYPE_CODE_SET: case TYPE_CODE_STRING: return 0; default: return 1; } } Updating '--simple-values' to call 'val_print_scalar_type_p' is probably a step too far because of the exclusion of strings, so if we want the 'scalars' behaviour then we need solution (2) in which we would add a PRINT-VALUES option '--scalar-values' which behaves the same way as 'set print frame-arguments scalars'.