From: Richard Biener <richard.guenther@gmail.com>
To: "Jose E. Marchesi" <jose.marchesi@oracle.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH V7 2/7] dwarf: new dwarf_debuginfo_p predicate
Date: Thu, 29 Apr 2021 13:18:04 +0200 [thread overview]
Message-ID: <CAFiYyc1A9_dibRkGrq1TD_ORcDKU7U6YpNxyEdZC+WrBJTU7yw@mail.gmail.com> (raw)
In-Reply-To: <20210419164737.26566-3-jose.marchesi@oracle.com>
On Mon, Apr 19, 2021 at 7:32 PM Jose E. Marchesi via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> This patch introduces a dwarf_debuginfo_p predicate that abstracts and
> replaces complex checks on write_symbols.
I've heard you're considering more changes in this area but the patch would
be OK as-is with me as well.
Richard.
> 2021-04-14 Indu Bhagat <indu.bhagat@oracle.com>
>
> gcc/ChangeLog
>
> * flags.h (dwarf_debuginfo_p): New function declaration.
> * opts.c (dwarf_debuginfo_p): New function definition.
> * config/c6x/c6x.c (c6x_output_file_unwind): Likewise.
> * dwarf2cfi.c (cfi_label_required_p): Likewise.
> (dwarf2out_do_frame): Likewise.
> * final.c (dwarf2_debug_info_emitted_p): Likewise.
> (final_scan_insn_1): Likewise.
> * targhooks.c (default_debug_unwind_info): Likewise.
> * toplev.c (process_options): Likewise.
>
> gcc/c-family/ChangeLog
>
> * c-lex.c (init_c_lex): Use dwarf_debuginfo_p.
> ---
> gcc/c-family/c-lex.c | 4 ++--
> gcc/config/c6x/c6x.c | 3 +--
> gcc/dwarf2cfi.c | 9 ++++-----
> gcc/final.c | 15 ++++++---------
> gcc/flags.h | 3 +++
> gcc/opts.c | 8 ++++++++
> gcc/targhooks.c | 2 +-
> gcc/toplev.c | 6 ++----
> 8 files changed, 27 insertions(+), 23 deletions(-)
>
> diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c
> index 6374b72ed2d..5174b22c303 100644
> --- a/gcc/c-family/c-lex.c
> +++ b/gcc/c-family/c-lex.c
> @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
> #include "stor-layout.h"
> #include "c-pragma.h"
> #include "debug.h"
> +#include "flags.h"
> #include "file-prefix-map.h" /* remap_macro_filename() */
> #include "langhooks.h"
> #include "attribs.h"
> @@ -87,8 +88,7 @@ init_c_lex (void)
>
> /* Set the debug callbacks if we can use them. */
> if ((debug_info_level == DINFO_LEVEL_VERBOSE
> - && (write_symbols == DWARF2_DEBUG
> - || write_symbols == VMS_AND_DWARF2_DEBUG))
> + && dwarf_debuginfo_p ())
> || flag_dump_go_spec != NULL)
> {
> cb->define = cb_define;
> diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c
> index f9ad1e5f6c5..a10e2f8d662 100644
> --- a/gcc/config/c6x/c6x.c
> +++ b/gcc/config/c6x/c6x.c
> @@ -439,8 +439,7 @@ c6x_output_file_unwind (FILE * f)
> {
> if (flag_unwind_tables || flag_exceptions)
> {
> - if (write_symbols == DWARF2_DEBUG
> - || write_symbols == VMS_AND_DWARF2_DEBUG)
> + if (dwarf_debuginfo_p ())
> asm_fprintf (f, "\t.cfi_sections .debug_frame, .c6xabi.exidx\n");
> else
> asm_fprintf (f, "\t.cfi_sections .c6xabi.exidx\n");
> diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
> index 362ff3fdac2..c27ac1960b0 100644
> --- a/gcc/dwarf2cfi.c
> +++ b/gcc/dwarf2cfi.c
> @@ -39,7 +39,7 @@ along with GCC; see the file COPYING3. If not see
> #include "expr.h" /* init_return_column_size */
> #include "output.h" /* asm_out_file */
> #include "debug.h" /* dwarf2out_do_frame, dwarf2out_do_cfi_asm */
> -
> +#include "flags.h" /* dwarf_debuginfo_p */
>
> /* ??? Poison these here until it can be done generically. They've been
> totally replaced in this file; make sure it stays that way. */
> @@ -2289,8 +2289,7 @@ cfi_label_required_p (dw_cfi_ref cfi)
>
> if (dwarf_version == 2
> && debug_info_level > DINFO_LEVEL_TERSE
> - && (write_symbols == DWARF2_DEBUG
> - || write_symbols == VMS_AND_DWARF2_DEBUG))
> + && dwarf_debuginfo_p ())
> {
> switch (cfi->dw_cfi_opc)
> {
> @@ -3557,9 +3556,9 @@ bool
> dwarf2out_do_frame (void)
> {
> /* We want to emit correct CFA location expressions or lists, so we
> - have to return true if we're going to output debug info, even if
> + have to return true if we're going to generate debug info, even if
> we're not going to output frame or unwind info. */
> - if (write_symbols == DWARF2_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
> + if (dwarf_debuginfo_p ())
> return true;
>
> if (saved_do_cfi_asm > 0)
> diff --git a/gcc/final.c b/gcc/final.c
> index daae115fef5..cae692062b4 100644
> --- a/gcc/final.c
> +++ b/gcc/final.c
> @@ -1442,7 +1442,8 @@ asm_str_count (const char *templ)
> static bool
> dwarf2_debug_info_emitted_p (tree decl)
> {
> - if (write_symbols != DWARF2_DEBUG && write_symbols != VMS_AND_DWARF2_DEBUG)
> + /* When DWARF2 debug info is not generated internally. */
> + if (!dwarf_debuginfo_p ())
> return false;
>
> if (DECL_IGNORED_P (decl))
> @@ -2330,10 +2331,8 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
> break;
>
> case NOTE_INSN_BLOCK_BEG:
> - if (debug_info_level == DINFO_LEVEL_NORMAL
> - || debug_info_level == DINFO_LEVEL_VERBOSE
> - || write_symbols == DWARF2_DEBUG
> - || write_symbols == VMS_AND_DWARF2_DEBUG
> + if (debug_info_level >= DINFO_LEVEL_NORMAL
> + || dwarf_debuginfo_p ()
> || write_symbols == VMS_DEBUG)
> {
> int n = BLOCK_NUMBER (NOTE_BLOCK (insn));
> @@ -2368,10 +2367,8 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
> case NOTE_INSN_BLOCK_END:
> maybe_output_next_view (seen);
>
> - if (debug_info_level == DINFO_LEVEL_NORMAL
> - || debug_info_level == DINFO_LEVEL_VERBOSE
> - || write_symbols == DWARF2_DEBUG
> - || write_symbols == VMS_AND_DWARF2_DEBUG
> + if (debug_info_level >= DINFO_LEVEL_NORMAL
> + || dwarf_debuginfo_p ()
> || write_symbols == VMS_DEBUG)
> {
> int n = BLOCK_NUMBER (NOTE_BLOCK (insn));
> diff --git a/gcc/flags.h b/gcc/flags.h
> index 0c4409e7905..a52abdc0a68 100644
> --- a/gcc/flags.h
> +++ b/gcc/flags.h
> @@ -25,6 +25,9 @@ along with GCC; see the file COPYING3. If not see
> /* Names of debug_info_type, for error messages. */
> extern const char *const debug_type_names[];
>
> +/* Return true iff DWARF2 debug info is enabled. */
> +extern bool dwarf_debuginfo_p ();
> +
> extern void strip_off_ending (char *, int);
> extern int base_of_path (const char *path, const char **base_out);
>
> diff --git a/gcc/opts.c b/gcc/opts.c
> index 24bb64198c8..6c9083f28a8 100644
> --- a/gcc/opts.c
> +++ b/gcc/opts.c
> @@ -43,6 +43,14 @@ const char *const debug_type_names[] =
> "none", "stabs", "dwarf-2", "xcoff", "vms"
> };
>
> +/* Return TRUE if dwarf2 debug info is enabled. */
> +
> +bool dwarf_debuginfo_p ()
> +{
> + return (write_symbols == DWARF2_DEBUG
> + || write_symbols == VMS_AND_DWARF2_DEBUG);
> +}
> +
> /* Parse the -femit-struct-debug-detailed option value
> and set the flag variables. */
>
> diff --git a/gcc/targhooks.c b/gcc/targhooks.c
> index 952fad422eb..267ba47da8a 100644
> --- a/gcc/targhooks.c
> +++ b/gcc/targhooks.c
> @@ -1975,7 +1975,7 @@ default_debug_unwind_info (void)
>
> /* Otherwise, only turn it on if dwarf2 debugging is enabled. */
> #ifdef DWARF2_DEBUGGING_INFO
> - if (write_symbols == DWARF2_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
> + if (dwarf_debuginfo_p ())
> return UI_DWARF2;
> #endif
>
> diff --git a/gcc/toplev.c b/gcc/toplev.c
> index d8cc254adef..bcd44d59c6d 100644
> --- a/gcc/toplev.c
> +++ b/gcc/toplev.c
> @@ -1523,8 +1523,7 @@ process_options (void)
> debug_nonbind_markers_p
> = (optimize
> && debug_info_level >= DINFO_LEVEL_NORMAL
> - && (write_symbols == DWARF2_DEBUG
> - || write_symbols == VMS_AND_DWARF2_DEBUG)
> + && dwarf_debuginfo_p ()
> && !(flag_selective_scheduling || flag_selective_scheduling2));
>
> if (dwarf2out_as_loc_support == AUTODETECT_VALUE)
> @@ -1539,8 +1538,7 @@ process_options (void)
> debug_variable_location_views
> = (flag_var_tracking
> && debug_info_level >= DINFO_LEVEL_NORMAL
> - && (write_symbols == DWARF2_DEBUG
> - || write_symbols == VMS_AND_DWARF2_DEBUG)
> + && dwarf_debuginfo_p ()
> && !dwarf_strict
> && dwarf2out_as_loc_support
> && dwarf2out_as_locview_support);
> --
> 2.25.0.2.g232378479e
>
next prev parent reply other threads:[~2021-04-29 11:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 16:47 [PATCH V7 0/7] Support for the CTF and BTF debug formats Jose E. Marchesi
2021-04-19 16:47 ` [PATCH V7 1/7] dwarf: add a dwarf2int.h internal interface Jose E. Marchesi
2021-04-29 11:16 ` Richard Biener
2021-04-19 16:47 ` [PATCH V7 2/7] dwarf: new dwarf_debuginfo_p predicate Jose E. Marchesi
2021-04-29 11:18 ` Richard Biener [this message]
2021-04-19 16:47 ` [PATCH V7 3/7] dejagnu: modularize gcc-dg-debug-runtest a bit Jose E. Marchesi
2021-04-19 16:47 ` [PATCH V7 4/7] CTF/BTF debug formats Jose E. Marchesi
2021-04-19 16:47 ` [PATCH V7 5/7] CTF/BTF testsuites Jose E. Marchesi
2021-04-19 16:47 ` [PATCH V7 6/7] CTF/BTF documentation Jose E. Marchesi
2021-04-19 16:47 ` [PATCH V7 7/7] Enable BTF generation in the BPF backend Jose E. Marchesi
2021-04-29 11:12 ` [PATCH V7 0/7] Support for the CTF and BTF debug formats Richard Biener
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=CAFiYyc1A9_dibRkGrq1TD_ORcDKU7U6YpNxyEdZC+WrBJTU7yw@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jose.marchesi@oracle.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).