public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jason Merrill <jason@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 3/5] Add DWARF5 variants of assembly scan tests that use DW_FORM_implicit_const
Date: Thu, 17 Sep 2020 18:03:28 +0200	[thread overview]
Message-ID: <ab122d5b7d2668aa6a0d469f04d00d32e6313b28.camel@klomp.org> (raw)
In-Reply-To: <20200824202607.GC3062@wildebeest.org>

[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]

On Mon, 2020-08-24 at 22:26 +0200, Mark Wielaard wrote:
> On Mon, Aug 24, 2020 at 07:44:27PM +0200, Jakub Jelinek wrote:
> > On Mon, Aug 24, 2020 at 02:56:56PM +0200, Mark Wielaard wrote:
> > > Some DWARF tests scan the assembly output looking for constant values.
> > > When using DWARF5 those constants might use DW_FORM_implicit_const,
> > > which are output (in the comments) after the attribute instead of
> > > before. To make sure these tests work introduce a -gdwarf-5 variant
> > > of these tests and explicitly use -gdwarf-2 for the original.
> > 
> > I just wonder if we want to use -gdwarf-2 rather than -gdwarf-4 in the
> > original, -gdwarf-5 has been the default for a couple of years and thus
> > that is what those testshave been compiled with.
> 
> I used -gdwarf-2 because I thought that was still the default for some
> arches/platforms. And they pass with -gdwarf-2.
> 
> > Also not sure about the -dwarf5 suffixes, couldn't we say just use
> > pr41445-{7,8}.c, inline-var-2.C or inline3.c (or whatever next number
> > with the same prefix is still unused)?
> 
> Sure, if that is a better naming scheme I'll rename them.

Here is the adjusted patch.

gcc/testsuite/ChangeLog:

        * gcc.dg/debug/dwarf2/inline2.c: Add -gdwarf-2.
        * g++.dg/debug/dwarf2/inline-var-1.C: Likewise.
        * gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c: Likewise.
        * gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c: Likewise.
        * gcc.dg/debug/dwarf2/inline6.c: New variant with -gdwarf-5.
        * g++.dg/debug/dwarf2/inline-var-3.C: Likewise.
        * gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-7.c: Likewise.
        * gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-8.c: Likewise.

OK to commit?


[-- Attachment #2: 0001-Add-DWARF5-variants-of-assembly-scan-tests-that-use-.patch --]
[-- Type: text/x-patch, Size: 10635 bytes --]

From 99e4e5bca0d55971c515b98188ec6f206517267d Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Sun, 23 Aug 2020 16:21:08 +0200
Subject: [PATCH] Add DWARF5 variants of assembly scan tests that use
 DW_FORM_implicit_const

Some DWARF tests scan the assembly output looking for constant values.
When using DWARF5 those constants might use DW_FORM_implicit_const,
which are output (in the comments) after the attribute instead of
before. To make sure these tests work introduce a -gdwarf-5 variant
of these tests and explicitly use -gdwarf-2 for the original.

gcc/testsuite/ChangeLog:

	* gcc.dg/debug/dwarf2/inline2.c: Add -gdwarf-2.
	* g++.dg/debug/dwarf2/inline-var-1.C: Likewise.
	* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c: Likewise.
	* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c: Likewise.
	* gcc.dg/debug/dwarf2/inline6.c: New variant with -gdwarf-5.
	* g++.dg/debug/dwarf2/inline-var-3.C: Likewise.
	* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-7.c: Likewise.
	* gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-8.c: Likewise.
---
 gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C          | 2 +-
 .../debug/dwarf2/{inline-var-1.C => inline-var-3.C}       | 6 ++++--
 gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c               | 4 +++-
 .../gcc.dg/debug/dwarf2/{inline2.c => inline6.c}          | 7 ++++---
 gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c             | 2 +-
 gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c             | 2 +-
 .../gcc.dg/debug/dwarf2/{pr41445-5.c => pr41445-7.c}      | 8 ++++----
 .../gcc.dg/debug/dwarf2/{pr41445-6.c => pr41445-8.c}      | 8 ++++----
 8 files changed, 22 insertions(+), 17 deletions(-)
 copy gcc/testsuite/g++.dg/debug/dwarf2/{inline-var-1.C => inline-var-3.C} (76%)
 copy gcc/testsuite/gcc.dg/debug/dwarf2/{inline2.c => inline6.c} (88%)
 copy gcc/testsuite/gcc.dg/debug/dwarf2/{pr41445-5.c => pr41445-7.c} (73%)
 copy gcc/testsuite/gcc.dg/debug/dwarf2/{pr41445-6.c => pr41445-8.c} (68%)

diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
index 3b1c913edfca..9a88e28cbe0f 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
@@ -1,5 +1,5 @@
 // { dg-do compile { target c++17 } }
-// { dg-options "-O -g -dA -gno-strict-dwarf -fno-eliminate-unused-debug-symbols" }
+// { dg-options "-O -gdwarf-2 -dA -gno-strict-dwarf -fno-eliminate-unused-debug-symbols" }
 // { dg-require-weak "" }
 // { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 6 { xfail *-*-aix* } } }
 // { dg-final { scan-assembler-times "0x1\[^\n\r]* DW_AT_inline" 2 { xfail *-*-aix* } } }
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C
similarity index 76%
copy from gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
copy to gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C
index 3b1c913edfca..52ed5b6912fd 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C
@@ -1,7 +1,9 @@
+// DWARF5 variant of inline-var-1.C
 // { dg-do compile { target c++17 } }
-// { dg-options "-O -g -dA -gno-strict-dwarf -fno-eliminate-unused-debug-symbols" }
+// { dg-options "-O -gdwarf-5 -dA -gno-strict-dwarf -fno-eliminate-unused-debug-symbols" }
 // { dg-require-weak "" }
-// { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 6 { xfail *-*-aix* } } }
+// { dg-final { scan-assembler-times " DW_AT_inline \\(0x3\\)" 2 { xfail *-*-aix* } } }
+// { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 4 { xfail *-*-aix* } } }
 // { dg-final { scan-assembler-times "0x1\[^\n\r]* DW_AT_inline" 2 { xfail *-*-aix* } } }
 // { dg-final { scan-assembler-times " DW_AT_declaration" 6 { xfail *-*-aix* } } }
 // { dg-final { scan-assembler-times " DW_AT_specification" 6 { xfail *-*-aix* } } }
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
index 7e019a6c06a0..9c36450ae2de 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
@@ -14,7 +14,9 @@
   properly nested DW_TAG_inlined_subroutine DIEs for third, second and first.
 */
 
-/* { dg-options "-O -g3 -gdwarf -dA -fgnu89-inline" } */
+/* Explicitly use dwarf-2 because dwarf-5 might use DW_FORM_implicit_const
+   which is hard to scan for. */
+/* { dg-options "-O -g3 -gdwarf-2 -dA -fgnu89-inline" } */
 /* { dg-do compile } */
 
 /* There are 6 inlined subroutines:
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline6.c
similarity index 88%
copy from gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
copy to gcc/testsuite/gcc.dg/debug/dwarf2/inline6.c
index 7e019a6c06a0..03013f11bca8 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline6.c
@@ -1,4 +1,4 @@
-/* Contributed by Dodji Seketeli <dodji@redhat.com>
+/* DWARF5 variant of inline2.
    Origin: PR debug/37801
 
   Abstract instances (DW_TAG_subroutines having the DW_AT_inline attribute)
@@ -14,7 +14,8 @@
   properly nested DW_TAG_inlined_subroutine DIEs for third, second and first.
 */
 
-/* { dg-options "-O -g3 -gdwarf -dA -fgnu89-inline" } */
+/* Explicitly use dwarf-5 which uses DW_FORM_implicit_const.  */
+/* { dg-options "-O -g3 -gdwarf-5 -dA -fgnu89-inline" } */
 /* { dg-do compile } */
 
 /* There are 6 inlined subroutines:
@@ -32,7 +33,7 @@
 /* There are 3 DW_AT_inline attributes: one per abstract inline instance.
    The value of the attribute must be 0x3, meaning the function was
    actually inlined.  */
-/* { dg-final { scan-assembler-times  "(?:byte|data1)\[^\n\]*0x3\[^\n\]* DW_AT_inline" 3 } } */
+/* { dg-final { scan-assembler-times  " DW_AT_inline \\(0x3\\)" 3 } } */
 
 volatile int *a;
 
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c
index d646f5983b30..80300ec22e87 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c
@@ -2,7 +2,7 @@
 /* Test that token after multi-line function-like macro use
    gets correct locus even when preprocessing separately.  */
 /* { dg-do compile } */
-/* { dg-options "-save-temps -gdwarf -O0 -dA -fno-merge-debug-strings" } */
+/* { dg-options "-save-temps -gdwarf-2 -O0 -dA -fno-merge-debug-strings" } */
 
 #define A(x) vari x
 #define vari(x)
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c
index 340cb3835307..fbf033758b6b 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c
@@ -1,6 +1,6 @@
 /* PR preprocessor/41445 */
 /* { dg-do compile } */
-/* { dg-options "-gdwarf -O0 -dA -fno-merge-debug-strings" } */
+/* { dg-options "-gdwarf-2 -O0 -dA -fno-merge-debug-strings" } */
 
 #include "pr41445-5.c"
 
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-7.c
similarity index 73%
copy from gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c
copy to gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-7.c
index d646f5983b30..0e0de822d806 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-7.c
@@ -1,8 +1,8 @@
-/* PR preprocessor/41445 */
+/* PR preprocessor/41445 DWARF5 variant */
 /* Test that token after multi-line function-like macro use
    gets correct locus even when preprocessing separately.  */
 /* { dg-do compile } */
-/* { dg-options "-save-temps -gdwarf -O0 -dA -fno-merge-debug-strings" } */
+/* { dg-options "-save-temps -gdwarf-5 -O0 -dA -fno-merge-debug-strings" } */
 
 #define A(x) vari x
 #define vari(x)
@@ -12,5 +12,5 @@ int A(B) ;
 /*  We want to check that both vari and varj have the same line
     number.  */
 
-/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"vari\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xa|10)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */
-/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varj\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xa|10)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */
+/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"vari\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^\\r\\n\]*DW_AT_decl_line \\((0xa|10)\\)" } } */
+/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varj\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^\\r\\n\]*DW_AT_decl_line \\((0xa|10)\\)" } } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-8.c
similarity index 68%
copy from gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c
copy to gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-8.c
index 340cb3835307..3a6eeb530968 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-8.c
@@ -1,11 +1,11 @@
-/* PR preprocessor/41445 */
+/* PR preprocessor/41445 DWARF5 variant*/
 /* { dg-do compile } */
-/* { dg-options "-gdwarf -O0 -dA -fno-merge-debug-strings" } */
+/* { dg-options "-gdwarf-5 -O0 -dA -fno-merge-debug-strings" } */
 
 #include "pr41445-5.c"
 
 /*  We want to check that both vari and varj have the same line
     number.  */
 
-/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"vari\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xa|10)?\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */
-/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varj\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xa|10)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */
+/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"vari\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^\\r\\n\]*DW_AT_decl_line \\((0xa|10)\\)" } } */
+/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varj\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^\\r\\n\]*DW_AT_decl_line \\((0xa|10)\\)" } } */
-- 
2.18.4


  reply	other threads:[~2020-09-17 16:03 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24 12:56 BoF DWARF5 patches Mark Wielaard
2020-08-24 12:56 ` [PATCH 1/5] Don't enable -gvariable-location-views by default for DWARF5 Mark Wielaard
2020-08-24 17:38   ` Jakub Jelinek
2020-08-24 20:12     ` Mark Wielaard
2020-08-25  4:05     ` Alexandre Oliva
2020-08-25  7:27       ` Richard Biener
2020-08-25  9:24       ` Mark Wielaard
2020-08-26 12:22         ` Alexandre Oliva
2020-09-29 11:15     ` Mark Wielaard
2020-08-24 12:56 ` [PATCH 2/5] Make sure that static data member constexpr isn't optimized away in test Mark Wielaard
2020-08-24 17:40   ` Jakub Jelinek
2020-08-24 20:17     ` Mark Wielaard
2020-08-24 20:59       ` Tom Tromey
2020-08-24 21:38     ` Jason Merrill
2020-08-25  9:19       ` Mark Wielaard
2020-09-01 18:46         ` Jason Merrill
2021-02-09 19:40           ` Jason Merrill
2021-02-09 19:55             ` Jakub Jelinek
2021-02-09 23:15               ` Jakub Jelinek
2020-08-25 12:41       ` Jakub Jelinek
2020-08-24 12:56 ` [PATCH 3/5] Add DWARF5 variants of assembly scan tests that use DW_FORM_implicit_const Mark Wielaard
2020-08-24 17:44   ` Jakub Jelinek
2020-08-24 20:26     ` Mark Wielaard
2020-09-17 16:03       ` Mark Wielaard [this message]
2020-09-17 16:45         ` Jakub Jelinek
2020-08-24 12:56 ` [PATCH 4/5] Default to DWARF5 Mark Wielaard
2020-08-24 12:56 ` [PATCH 5/5] Add --gdwarf-5 to ASM_SPEC Mark Wielaard
2020-08-26 21:37   ` Duplicate .debug_lines (Was: [PATCH 5/5] Add --gdwarf-5 to ASM_SPEC) Mark Wielaard
2020-08-26 23:38     ` H.J. Lu
2020-08-29 12:23       ` Mark Wielaard
2020-08-29 14:34         ` H.J. Lu
2020-08-29 15:23           ` Mark Wielaard
2020-08-29 15:43             ` H.J. Lu
2020-08-29 16:32               ` Mark Wielaard
2020-08-29 16:44                 ` H.J. Lu
2020-08-29 17:32                   ` Mark Wielaard
2020-09-07 12:37     ` [PATCH] gas: Don't error when .debug_line already exists, unless .loc was used Mark Wielaard
2020-08-25  9:32 ` BoF DWARF5 patches Mark Wielaard
2020-09-09 19:57   ` BoF DWARF5 patches (25% .debug section size reduction) Mark Wielaard
2020-09-10 11:16     ` Jakub Jelinek
2020-09-10 11:45       ` Jakub Jelinek
2020-09-15 18:40         ` [PATCH] debug: Pass --gdwarf-N to assembler if fixed gas is detected during configure Jakub Jelinek
2020-09-16 12:33           ` Mark Wielaard
2020-09-16 13:31             ` Jakub Jelinek
2020-09-18 15:21           ` Mark Wielaard
2020-10-06 15:54             ` Mark Wielaard
2020-10-06 20:57               ` Jason Merrill
2020-10-07 11:29                 ` Mark Wielaard
2020-09-29 13:56       ` BoF DWARF5 patches (25% .debug section size reduction) Mark Wielaard
2020-11-15 22:41         ` Mark Wielaard
2021-01-15 16:16           ` Jakub Jelinek
2021-01-18 10:19             ` Sebastian Huber
2021-01-18 11:18             ` Mark Wielaard
2020-11-17  0:19         ` Jeff Law

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=ab122d5b7d2668aa6a0d469f04d00d32e6313b28.camel@klomp.org \
    --to=mark@klomp.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jason@redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).