From 843f1ac16028a94cae33b390a0ed8da29e65ae12 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Tue, 25 Nov 2025 09:15:17 +0100 Subject: [PATCH] testsuite: Fix gcc.dg/debug/dwarf2/dwarf-btf-*-tag-*.c with Solaris/SPARC as A couple of gcc.dg/debug/dwarf2/dwarf-btf-*-tag-*.c tests FAIL on Solaris/SPARC when the native assembler is used: FAIL: gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c scan-assembler-times DW_AT_const_value: "my_foo" 1 FAIL: gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c scan-assembler-times DW_AT_name: "btf_decl_tag" 1 FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c scan-assembler-times DW_AT_const_value: "__user" 1 FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c scan-assembler-times DW_AT_name: "btf_type_tag" 1 FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c scan-assembler-times DW_AT_name: "btf_decl_tag" 1 FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c scan-assembler-times DW_AT_name: "btf_type_tag" 1 FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c scan-assembler-times DW_AT_const_value: "tag1" 1 FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c scan-assembler-times DW_AT_const_value: "tag2" 1 FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c scan-assembler-times DW_AT_name: "btf_type_tag" 1 FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c scan-assembler-times DW_AT_const_value: "tagged_arr" 1 FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c scan-assembler-times DW_AT_name: "btf_type_tag" 1 All of them FAIL in the same way: when gas is used, the tests contain something like .uaword .LLASF4 ! DW_AT_const_value: "my_foo" while for /bin/as .ascii "my_foo\0" ! DW_AT_const_value is emitted. While other dwarf2 tests support both forms, the tests above don't. This patch fixes this. To make the regex more readable, they are switched to using braces instead of double quotes, thus avoiding excessive escaping. At the same time, they now use newline-sensitive matching to avoid .* matching across lines. Tested on sparc-sun-solaris2.11 with as and gas, and x86_64-pc-linux-gnu. 2025-11-22 Rainer Orth * gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c (scan-assembler-times): Switch to brace quotes. Allow for alternative assembler syntax. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c: Likewise. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c: Likewise. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c: Likewise. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c: Likewise. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c: Likewise. --- .../gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c | 8 ++++---- .../gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c | 8 ++++---- .../gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c | 4 ++-- .../gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c | 10 +++++----- .../gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c | 6 +++--- .../gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c index a1c1676a7ba..38739e45976 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c @@ -5,7 +5,7 @@ int *foo __attribute__((btf_decl_tag ("my_foo"))); -/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_decl_tag\"" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_const_value: \"my_foo\"" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 1 } } */ +/* { dg-final { scan-assembler-times {(?n)DIE \(.*\) DW_TAG_GNU_annotation} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_decl_tag"|"btf_decl_tag..".*DW_AT_name)} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)( DW_AT_const_value: "my_foo"|"my_foo..".*DW_AT_const_value)} 1 } } */ +/* { dg-final { scan-assembler-times { DW_AT_GNU_annotation} 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c index 772aab09cfb..437b981b914 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c @@ -4,7 +4,7 @@ int * __attribute__((btf_type_tag("__user"))) ptr; -/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_type_tag\"" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_const_value: \"__user\"" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 1 } } */ +/* { dg-final { scan-assembler-times {(?n)DIE \(.*\) DW_TAG_GNU_annotation} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_type_tag"| "btf_type_tag..".*DW_AT_name)} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)( DW_AT_const_value: "__user"|"__user..".*DW_AT_const_value)} 1 } } */ +/* { dg-final { scan-assembler-times { DW_AT_GNU_annotation} 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c index 3ecd79f092f..7af1452776c 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c @@ -16,5 +16,5 @@ foo (int *x, int *y) /* Ideally, verify that AT_GNU_annotation in the subprogram DIE refers to the decl_tag annotation DIE, and the AT_GNU_annotation in the return type refers to the type_tag... */ -/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_type_tag\"" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_decl_tag\"" 1 } } */ +/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_type_tag"|"btf_type_tag..".*DW_AT_name)} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_decl_tag"|"btf_decl_tag..".*DW_AT_name)} 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c index 9c44e0ee0b9..467d759521a 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c @@ -20,12 +20,12 @@ struct S * __tag1 __tag2 my_S; /* Only 2 DW_TAG_GNU_annotation DIEs should be generated, one each for "tag1" and "tag2", and they should be reused. */ -/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 2 } } */ -/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_type_tag\"" 2 } } */ -/* { dg-final { scan-assembler-times " DW_AT_const_value: \"tag1\"" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_const_value: \"tag2\"" 1 } } */ +/* { dg-final { scan-assembler-times {(?n)DIE \(.*\) DW_TAG_GNU_annotation} 2 } } */ +/* { dg-final { scan-assembler-times { DW_AT_name: "btf_type_tag"} 2 } } */ +/* { dg-final { scan-assembler-times {(?n)( DW_AT_const_value: "tag1"|"tag1..".* DW_AT_const_value)} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)( DW_AT_const_value: "tag2"|"tag2..".*DW_AT_const_value)} 1 } } */ /* Each attribute-ed type shall refer via DW_AT_GNU_annotation to the appropriate annotation DIE, including the annotation DIE for "tag2" which is always chained to the DIE for "tag1" in this construction. */ -/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 5 } } */ +/* { dg-final { scan-assembler-times { DW_AT_GNU_annotation} 5 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c index 7205ef2c9a3..212cc4eca47 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c @@ -29,6 +29,6 @@ union U volatile union U volatile_u; /* One annotation DIE may be shared by all three annotated types. */ -/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_type_tag\"" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 3 } } */ +/* { dg-final { scan-assembler-times {(?n)DIE \(.*\) DW_TAG_GNU_annotation} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_type_tag"|"btf_type_tag..".* DW_AT_name)} 1 } } */ +/* { dg-final { scan-assembler-times { DW_AT_GNU_annotation} 3 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c index 1a6b29f99a1..ffb2ca8258e 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c @@ -4,7 +4,7 @@ int arr[8] __attribute__((btf_type_tag("tagged_arr"))); -/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_type_tag\"" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_const_value: \"tagged_arr\"" 1 } } */ -/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 1 } } */ +/* { dg-final { scan-assembler-times {(?n)DIE \(.*\) DW_TAG_GNU_annotation} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_type_tag"|"btf_type_tag..".*)} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)( DW_AT_const_value: "tagged_arr"|"tagged_arr..".*DW_AT_const_value)} 1 } } */ +/* { dg-final { scan-assembler-times { DW_AT_GNU_annotation} 1 } } */ -- 2.47.3