From: Indu Bhagat <indu.bhagat@oracle.com>
To: Jens Remus <jremus@linux.ibm.com>, binutils@sourceware.org
Cc: Andreas Krebbel <krebbel@linux.ibm.com>
Subject: Re: [PATCH v3 05/15] gas: Print DWARF call frame insn name in SFrame warning message
Date: Thu, 18 Apr 2024 00:40:22 -0700 [thread overview]
Message-ID: <d1f514ee-f4b1-4979-bff7-f5496ee92d41@oracle.com> (raw)
In-Reply-To: <20240412144718.4191286-6-jremus@linux.ibm.com>
On 4/12/24 07:47, Jens Remus wrote:
> SFrame generation prints the DWARF call frame instruction opcode in
> hexadecimal. Leverage get_DW_CFA_name to additionally print the
> DWARF call frame instruction name in human readable form, while also
> respecting fake CFI types. Use "(unknown)", if the DWARF call frame
> instruction name is not known.
>
> This changes the following assembler SFrame generation warning message
> as follows:
>
> Old:
> Warning: skipping SFrame FDE due to DWARF CFI op 0x<hexnum>
>
> New:
> Warning: skipping SFrame FDE due to DWARF CFI op <name> (0x<hexnum>)
>
> gas/
> * gen-sframe.c (sframe_get_cfi_name): New function to get the
> DWARF call frame instruction name for a DWARF call frame
> instruction opcode.
> (sframe_do_cfi_insn): Use sframe_get_cfi_name to print the
> DWARF call frame instruction name for the DWARF call frame
> instruction opcode in the warning message.
>
> gas/testsuite/
> * gas/cfi-sframe/common-empty-1.d: Update expected SFrame
> warning message text for DWARF call frame insn name.
> * gas/cfi-sframe/common-empty-2.d: Likewise.
>
> Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
> Reviewed-by: Indu Bhagat <indu.bhagat@oracle.com>
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
>
> Notes (jremus):
> Changes v2 -> v3:
> - Removed stale ChangeLog entries from commit message.
> - Corrected formatting of ChangeLog in commit message.
>
> gas/gen-sframe.c | 49 ++++++++++++++++++-
> gas/testsuite/gas/cfi-sframe/common-empty-1.d | 2 +-
> gas/testsuite/gas/cfi-sframe/common-empty-2.d | 2 +-
> 3 files changed, 50 insertions(+), 3 deletions(-)
>
> diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
> index 75781fc8ccbd..d35baaac54b2 100644
> --- a/gas/gen-sframe.c
> +++ b/gas/gen-sframe.c
> @@ -1197,6 +1197,46 @@ sframe_xlate_do_gnu_window_save (struct sframe_xlate_ctx *xlate_ctx,
> return SFRAME_XLATE_OK;
> }
>
> +/* Returns the DWARF call frame instruction name or fake CFI name for the
> + specified CFI opcode, or NULL if the value is not recognized. */
> +
> +static const char *
> +sframe_get_cfi_name (int cfi_opc)
> +{
> + const char *cfi_name;
> +
> + switch (cfi_opc)
> + {
> + /* Fake CFI type; outside the byte range of any real CFI insn. */
> + /* See gas/dw2gencfi.h. */
> + case CFI_adjust_cfa_offset:
> + cfi_name = "CFI_adjust_cfa_offset";
> + break;
> + case CFI_return_column:
> + cfi_name = "CFI_return_column";
> + break;
> + case CFI_rel_offset:
> + cfi_name = "CFI_rel_offset";
> + break;
> + case CFI_escape:
> + cfi_name = "CFI_escape";
> + break;
> + case CFI_signal_frame:
> + cfi_name = "CFI_signal_frame";
> + break;
> + case CFI_val_encoded_addr:
> + cfi_name = "CFI_val_encoded_addr";
> + break;
> + case CFI_label:
> + cfi_name = "CFI_label";
> + break;
> + default:
> + cfi_name = get_DW_CFA_name (cfi_opc);
> + }
> +
> + return cfi_name;
> +}
> +
> /* Process CFI_INSN and update the translation context with the FRE
> information.
>
> @@ -1272,7 +1312,14 @@ sframe_do_cfi_insn (struct sframe_xlate_ctx *xlate_ctx,
> /* An error here will cause no SFrame FDE later. Warn the user because this
> will affect the overall coverage and hence, asynchronicity. */
> if (err)
> - as_warn (_("skipping SFrame FDE due to DWARF CFI op %#x"), op);
> + {
> + const char *cfi_name = sframe_get_cfi_name (op);
> +
> + if (!cfi_name)
> + cfi_name = _("(unknown)");
> + as_warn (_("skipping SFrame FDE due to DWARF CFI op %s (%#x)"),
> + cfi_name, op);
Nit again: I realized when looking at this patch again that DWARF
standard uses the terminology of "instruction" for these DW_CFA_*. I
looked in the existing codebase and there is precedent to using "CFI
instruction" in error messages. How about we change this to "due to CFI
insn" ?
OK with that change.
Thanks for the patch.
> + }
>
> return err;
> }
> diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-1.d b/gas/testsuite/gas/cfi-sframe/common-empty-1.d
> index 125612ff841f..d7756302b559 100644
> --- a/gas/testsuite/gas/cfi-sframe/common-empty-1.d
> +++ b/gas/testsuite/gas/cfi-sframe/common-empty-1.d
> @@ -1,5 +1,5 @@
> #as: --gsframe
> -#warning: skipping SFrame FDE due to DWARF CFI op 0xa
> +#warning: skipping SFrame FDE due to DWARF CFI op DW_CFA_remember_state \(0xa\)
> #objdump: --sframe=.sframe
> #name: Uninteresting cfi directives generate an empty SFrame section
> #...
> diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-2.d b/gas/testsuite/gas/cfi-sframe/common-empty-2.d
> index 59328fc1033f..20282c7854e8 100644
> --- a/gas/testsuite/gas/cfi-sframe/common-empty-2.d
> +++ b/gas/testsuite/gas/cfi-sframe/common-empty-2.d
> @@ -1,5 +1,5 @@
> #as: --gsframe
> -#warning: skipping SFrame FDE due to DWARF CFI op 0xe
> +#warning: skipping SFrame FDE due to DWARF CFI op DW_CFA_def_cfa_offset \(0xe\)
> #objdump: --sframe=.sframe
> #name: SFrame supports only FP/SP based CFA
> #...
next prev parent reply other threads:[~2024-04-18 7:40 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-12 14:47 [PATCH v3 00/15] sframe: Enhancements to SFrame info generation Jens Remus
2024-04-12 14:47 ` [PATCH v3 01/15] x86: Remove unused SFrame CFI RA register variable Jens Remus
2024-04-12 14:47 ` [PATCH v3 02/15] gas: Enhance arch-specific SFrame configuration descriptions Jens Remus
2024-04-18 7:39 ` Indu Bhagat
2024-05-03 12:30 ` Jens Remus
2024-04-12 14:47 ` [PATCH v3 03/15] readelf/objdump: Dump SFrame CFA fixed FP and RA offsets Jens Remus
2024-04-18 7:39 ` Indu Bhagat
2024-04-12 14:47 ` [PATCH v3 04/15] readelf/objdump: Display SFrame fixed RA offset as 'f' in dump Jens Remus
2024-04-18 7:40 ` Indu Bhagat
2024-04-12 14:47 ` [PATCH v3 05/15] gas: Print DWARF call frame insn name in SFrame warning message Jens Remus
2024-04-18 7:40 ` Indu Bhagat [this message]
2024-04-12 14:47 ` [PATCH v3 06/15] gas: Skip SFrame FDE if CFI specifies non-FP/SP base register Jens Remus
2024-04-18 7:40 ` Indu Bhagat
2024-04-12 14:47 ` [PATCH v3 07/15] gas: Warn if SFrame FDE is skipped due to non-default return column Jens Remus
2024-04-18 7:40 ` Indu Bhagat
2024-04-12 14:47 ` [PATCH v3 08/15] gas: Refactor SFrame CFI opcode DW_CFA_register processing Jens Remus
2024-04-18 7:40 ` Indu Bhagat
2024-04-12 14:47 ` [PATCH v3 09/15] gas: User readable warnings if SFrame FDE is not generated Jens Remus
2024-04-18 20:33 ` Indu Bhagat
2024-05-03 12:30 ` Jens Remus
2024-05-03 23:41 ` Indu Bhagat
2024-04-12 14:47 ` [PATCH v3 10/15] gas: Skip SFrame FDE if FP without RA on stack Jens Remus
2024-04-16 13:14 ` Jens Remus
2024-04-17 23:56 ` Indu Bhagat
2024-04-18 10:27 ` Jens Remus
2024-04-18 20:35 ` Indu Bhagat
2024-04-12 14:47 ` [PATCH v3 11/15] gas: Skip SFrame FDE if .cfi_window_save Jens Remus
2024-04-18 20:36 ` Indu Bhagat
2024-04-12 14:47 ` [PATCH v3 12/15] gas: Don't skip SFrame FDE if .cfi_register specifies RA w/o tracking Jens Remus
2024-04-18 20:36 ` Indu Bhagat
2024-04-12 14:47 ` [PATCH v3 13/15] gas: Don't skip SFrame FDE if .cfi_register specifies SP register Jens Remus
2024-04-18 20:37 ` Indu Bhagat
2024-04-19 13:13 ` Jens Remus
2024-04-23 8:15 ` Indu Bhagat
2024-04-25 22:22 ` Indu Bhagat
2024-04-12 14:47 ` [PATCH v3 14/15] gas: Test predicate whether SFrame RA tracking is used Jens Remus
2024-04-18 20:37 ` Indu Bhagat
2024-04-12 14:47 ` [PATCH v3 15/15] gas: Validate SFrame RA tracking and fixed RA offset Jens Remus
2024-04-18 20:38 ` Indu Bhagat
2024-05-03 16:40 ` Jens Remus
2024-05-04 0:22 ` Indu Bhagat
2024-05-06 11:41 ` Jens Remus
2024-05-06 14:39 ` Jens Remus
2024-05-16 20:45 ` Indu Bhagat
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=d1f514ee-f4b1-4979-bff7-f5496ee92d41@oracle.com \
--to=indu.bhagat@oracle.com \
--cc=binutils@sourceware.org \
--cc=jremus@linux.ibm.com \
--cc=krebbel@linux.ibm.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).