From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KKBMEiJThGoE1i4AWB0awg (envelope-from ) for ; Tue, 18 Aug 2026 08:42:10 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OH5CX2M6; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2C0671E166; Tue, 18 Aug 2026 08:42:10 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5B0A81E033 for ; Tue, 18 Aug 2026 08:42:09 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C6D794BA900D for ; Tue, 18 Aug 2026 12:42:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6D794BA900D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OH5CX2M6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id E449F4BA7992 for ; Tue, 18 Aug 2026 12:41:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E449F4BA7992 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E449F4BA7992 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787056878; cv=none; b=vC5sXLO+dM0e5ZVAjAkrpi4i5DUNQqE624eXuHgW27N6RwgodtQfNOovXx4oTbSNHM16JmjK8ED/1P5RbBoZtZYxFa++WRbwL33Ar3ZjGWqqUO3mFrIgwGYX+ckPutgzRPKnatUCzS56bCt6vd9gamVqRmMvzVqjMcOdtbax5oo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787056878; c=relaxed/simple; bh=Y15GTFHKCw3Gx2WV1jyMuIRm0K6PTeMGuaJSP9jOzFE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ef1JFbXKx5w1GMeDvB0QkLcLeJQ+9Zt+2msgQEvK2KVfXEMK0ENxCdDOLiHf2tk02rBe+fiGPVHuAPeFb/HgRvT0OqGWppg7n+GSLR+lQlYp9+uKx8xwfEEvx2/TAEI6wgsfUpsdFRaUx+6La2jcKtcJdNRIi44JqFVwQRD9c3o= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OH5CX2M6 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E449F4BA7992 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787056877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kqz1F/2K2qcICx5umzDMBQqRB/hHZS14j4qAxwql1r0=; b=OH5CX2M6LPNEciUW0v3WEMWG+vdwRo5yXAVXMcyZdbPxVOsnBm0WVL+uKESleNdqLKejEy /wdY2SarRh9KsfUBdqfv2jbrq4rBii/WDO4YEphv/BjkMXF8LlNPeig7e6ccQmNHyto1SS +8Qd+msIS/gngOj3f848VKi/TdIb1A4= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-244-zi2L7VPNPG-1RsPLsUxspA-1; Tue, 18 Aug 2026 08:41:16 -0400 X-MC-Unique: zi2L7VPNPG-1RsPLsUxspA-1 X-Mimecast-MFC-AGG-ID: zi2L7VPNPG-1RsPLsUxspA_1787056875 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-47f83999cceso4036881f8f.3 for ; Tue, 18 Aug 2026 05:41:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787056875; x=1787661675; h=content-type:mime-version:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=kqz1F/2K2qcICx5umzDMBQqRB/hHZS14j4qAxwql1r0=; b=RS6dYdYIKPUNjMGHZgBXubPK2lXpEgHOIHSJMuXSHGoEgE7TyUmqj7DjX9xGKG6a4a xst48vHTcdwebICuxvRESCuiR6j/UZ6ySFcu0nwrueXuUbpYoz0WdFpq02eTP+YYlkIc m69f+mEEnfBD8I+airFfVuvSxMLN85DwlDg0t/X1udsvtR9ZUdOFy71hqA1OBKLWoF0/ yVm7EZx8Tqtz4gW705qtNCbw5oPgWd3h1IR7sT61iXrsiQ6bB80FijZhdHnamA3mfSrm SJmHKM80bShxED8UHNnsRIvDPQM0dlvisPgurjpi4OH4GTpmLUOyXvPcYTziH4EvYwWu j9gg== X-Forwarded-Encrypted: i=1; AHgh+RqKOLelxIFWLvhzyzlTiEdEjtpqx4HvR+uPh8WzQF8I1ymScIbVyYKYz+1KEEWfwhxBOWRPh0IUiVeYpQ==@sourceware.org X-Gm-Message-State: AOJu0YwxvY+aOrL7+/E49b/UCj9gxp2NbZQo0G2bI+BxcM512aPvPyZZ dNCu/ZXsl34Nl2H8Avg0R30YIlr7J3EckAjpTKzRGqn8Fumnx/1yfQTnwV1G4UlGXgkP+bT8dRT 7qfEkRZoiCyEDF501CY9QB7T29/yNYvemVNcgyrqRKHag9+pqM46n37oIsPxNy3w= X-Gm-Gg: AR+sD13mie7M0hhmU6ZdSZsn83KNOS+R12X4EYXzBkjg4Oy9JJH5oY9FIuiLdVIGUSm 6AdRLaXd0ICkxLjlU9kvyKI7EBrOWys/w0Lj0Xz+sd538TsetdMYHh0rD1hUTlVAU+a1FTVkXwK H8wEzBAXoUR88L7G9KfTaJeSCxW92qhlmRXen6QFStU4V1/xFK71H8QtQnqb1h6qMDw5Z0k+ZJp clRghxEqW75Ql3+pzhZ1z95QDkmRlNGI8BQRzKJ2aZKtGUJBelS0PIvSQKUE6fGjPLnoQOYHZCl fYw/C98mZvmn9q6UQuq3ToPQ5lBcEBsNEdcfbVpT2ovWspewPfnIAZ2BnRXEzKVNm1/XURpLd+C 6gWwmIIZTv/nKR8Lt1qw= X-Received: by 2002:a05:6000:3109:b0:47f:e748:3ae3 with SMTP id ffacd0b85a97d-4816070bf1fmr50273953f8f.3.1787056874863; Tue, 18 Aug 2026 05:41:14 -0700 (PDT) X-Received: by 2002:a05:6000:3109:b0:47f:e748:3ae3 with SMTP id ffacd0b85a97d-4816070bf1fmr50273865f8f.3.1787056874365; Tue, 18 Aug 2026 05:41:14 -0700 (PDT) Received: from localhost (67.72.115.87.dyn.plus.net. [87.115.72.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482a5b7840esm10746998f8f.29.2026.08.18.05.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2026 05:41:13 -0700 (PDT) From: Andrew Burgess To: Tom Tromey , gdb-patches@sourceware.org Cc: Tom Tromey Subject: Re: [PATCH] Update gdb.ada/unchecked_union.exp for gnat-llvm In-Reply-To: <20260817195442.996856-1-tromey@adacore.com> References: <20260817195442.996856-1-tromey@adacore.com> Date: Tue, 18 Aug 2026 13:41:13 +0100 Message-ID: <87o6ez1tzq.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ETTiS9X-Ix5sJ1oyFB9nmBrGpHhGDzsmkBf8RSbQX50_1787056875 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Tom Tromey writes: > gnat-llvm emits a slightly different encoding for Ada unchecked > unions. In particular this will let gdb show the discrminant for some > branches of a union which currently cannot be seen in GCC's output. I found this text really hard to understand initially. I initially thought the "this" in the second sentence was talking about "this patch", the encoding change. I also assumed the talk about "GCC's output" was a typo for "GDB's output", but you really mean "GDB's output when compiling with GCC's GNAT". Could I suggest a rewording: gnat-llvm emits a slightly different encoding for Ada unchecked unions. This encoding lets GDB resolve the discriminant for some branches that appear as "?" when compiled with GCC's GNAT. I do wish the quotemeta system didn't do hungry white space matching by default, especially as it's use expands through the testsuite. But that's out of scope for this patch, which looks good. Approved-By: Andrew Burgess Thanks, Andrew > > This patch updates gdb.ada/unchecked_union.exp to allow this. > --- > gdb/testsuite/gdb.ada/unchecked_union.exp | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/gdb/testsuite/gdb.ada/unchecked_union.exp b/gdb/testsuite/gdb.ada/unchecked_union.exp > index 6a54e606712..ef9da787e65 100644 > --- a/gdb/testsuite/gdb.ada/unchecked_union.exp > +++ b/gdb/testsuite/gdb.ada/unchecked_union.exp > @@ -24,20 +24,23 @@ standard_ada_testfile unchecked_union > proc multi_line_string {str} { > set result {} > foreach line $str { > - lappend result [string_to_regexp $line] > + lappend result [quotemeta $line] > } > set res [multi_line {*}$result] > verbose -log "RES: '$res'" > return $res > } > > +# Note the quotemeta expression here. gnat-llvm emits slightly a > +# different encoding here, which lets gdb see the discriminant for a > +# branch. > set inner_string \ > [list \ > " case ? is" \ > " when 0 =>" \ > " small: range 0 .. 255;" \ > " second: range 0 .. 255;" \ > - " when ? =>" \ > + " when @/\[1?\]/ =>" \ > " bval: range 0 .. 255;" \ > " when others =>" \ > " large: range 255 .. 510;" \ > @@ -50,12 +53,15 @@ set inner_full \ > $inner_string \ > [list "end record"]] > > +# Note the quotemeta expression here. gnat-llvm emits slightly a > +# different encoding here, which lets gdb see the discriminant for a > +# branch. > set pair_string \ > [list \ > " case ? is" \ > - " when ? =>" \ > + " when @/\[0?\]/ =>" \ > " field_one: range 0 .. 255;" \ > - " when ? =>" \ > + " when @/(\\?|others)/ =>" \ > " field_two: range 255 .. 510;" \ > " end case;"] > > > base-commit: 0f9faaebc91bc1886a563bde6c178601b4be743b > -- > 2.55.0