From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id /vM3C6Dvzl9LWwAAWB0awg (envelope-from ) for ; Mon, 07 Dec 2020 22:14:40 -0500 Received: by simark.ca (Postfix, from userid 112) id 20E0E1F071; Mon, 7 Dec 2020 22:14:40 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 87B981EF4B for ; Mon, 7 Dec 2020 22:14:39 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3E4AD3857039; Tue, 8 Dec 2020 03:14:39 +0000 (GMT) Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id BC3A23857C68 for ; Tue, 8 Dec 2020 03:14:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BC3A23857C68 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=brobecker@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 1509C116D99; Mon, 7 Dec 2020 22:14:37 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at gnat.com 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 r-z2xvsyR5Bj; Mon, 7 Dec 2020 22:14:37 -0500 (EST) Received: from float.home (localhost.localdomain [127.0.0.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id ABA52116D2A; Mon, 7 Dec 2020 22:14:36 -0500 (EST) Received: by float.home (Postfix, from userid 1000) id B46EFA1880; Tue, 8 Dec 2020 07:14:31 +0400 (+04) Date: Tue, 8 Dec 2020 07:14:31 +0400 From: Joel Brobecker To: Simon Marchi Subject: Re: [PATCH 4/4] gdb: fix value_subscript when array upper bound is not known Message-ID: <20201208031431.GG3202@adacore.com> References: <20201123162120.3778679-1-simon.marchi@efficios.com> <20201123162120.3778679-5-simon.marchi@efficios.com> <20201206075437.GC327270@adacore.com> <8a48f527-bd8f-5aa9-f232-7523359515fa@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8a48f527-bd8f-5aa9-f232-7523359515fa@polymtl.ca> 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: , Cc: Simon Marchi , Simon Marchi via Gdb-patches Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" [just for the sake of discussing generalities, rather than suggesting modifications to your patch] > > Now, the bigger question is: Why are we even getting to this point? > > Shouldn't the bounds simply be resolved before we do the subscripting? > > If the array is c-style, there's no concept of high bound, so I don't think > there's a point resolving the high bound then. I believe you sometimes do, for intance in... char something[5]; > Again, I've never really been a user of such a language. Intuitively, I'd > like the debugger to work as close to the source language as possible, so > I'd like it to validate the bounds in my expression. But it might be that > people who use these languages sometimes need to side-step the language's > protections. Speaking for myself, sometimes I indeed want to go beyond. Even in C, when we have structures looking like this (don't know if we have any of those in our code anymore): struct something { size_t n_elems; int buf[0]; }; You'd know that you need to go beyond the first element of the array to get to the rest of the data... -- Joel