From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Update gdb.ada/unchecked_union.exp for gnat-llvm
Date: Mon, 17 Aug 2026 13:54:42 -0600 [thread overview]
Message-ID: <20260817195442.996856-1-tromey@adacore.com> (raw)
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.
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
next reply other threads:[~2026-08-17 19:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 19:54 Tom Tromey [this message]
2026-08-18 12:41 ` Andrew Burgess
2026-08-18 17:35 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260817195442.996856-1-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox