public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Mark Wielaard <mark@klomp.org>, Jason Merrill <jason@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 3/5] Add DWARF5 variants of assembly scan tests that use DW_FORM_implicit_const
Date: Mon, 24 Aug 2020 19:44:27 +0200	[thread overview]
Message-ID: <20200824174427.GO2363@tucnak> (raw)
In-Reply-To: <20200824125658.22526-4-mark@klomp.org>

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.
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)?

> ---
>  .../dwarf2/{inline-var-1.C => inline-var-1-dwarf5.C}      | 6 ++++--
>  gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C          | 2 +-
>  .../gcc.dg/debug/dwarf2/{inline2.c => inline2-dwarf5.c}   | 7 ++++---
>  gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c               | 4 +++-
>  .../debug/dwarf2/{pr41445-5.c => pr41445-5-dwarf5.c}      | 8 ++++----
>  gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c             | 2 +-
>  .../debug/dwarf2/{pr41445-6.c => pr41445-6-dwarf5.c}      | 8 ++++----
>  gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c             | 2 +-
>  8 files changed, 22 insertions(+), 17 deletions(-)
>  copy gcc/testsuite/g++.dg/debug/dwarf2/{inline-var-1.C => inline-var-1-dwarf5.C} (76%)
>  copy gcc/testsuite/gcc.dg/debug/dwarf2/{inline2.c => inline2-dwarf5.c} (88%)
>  copy gcc/testsuite/gcc.dg/debug/dwarf2/{pr41445-5.c => pr41445-5-dwarf5.c} (73%)
>  copy gcc/testsuite/gcc.dg/debug/dwarf2/{pr41445-6.c => pr41445-6-dwarf5.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-dwarf5.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-1-dwarf5.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-1-dwarf5.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/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/gcc.dg/debug/dwarf2/inline2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2-dwarf5.c
> similarity index 88%
> copy from gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
> copy to gcc/testsuite/gcc.dg/debug/dwarf2/inline2-dwarf5.c
> index 7e019a6c06a0..03013f11bca8 100644
> --- a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
> +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2-dwarf5.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/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/pr41445-5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5-dwarf5.c
> similarity index 73%
> copy from gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c
> copy to gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5-dwarf5.c
> index d646f5983b30..0e0de822d806 100644
> --- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c
> +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5-dwarf5.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-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-dwarf5.c
> similarity index 68%
> copy from gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c
> copy to gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6-dwarf5.c
> index 340cb3835307..3a6eeb530968 100644
> --- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c
> +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6-dwarf5.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)\\)" } } */
> 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"
>  
> -- 
> 2.18.4

	Jakub


  reply	other threads:[~2020-08-24 17:44 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 [this message]
2020-08-24 20:26     ` Mark Wielaard
2020-09-17 16:03       ` Mark Wielaard
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=20200824174427.GO2363@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=mark@klomp.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).