[PATCH,V2 2/2] gas: sframe: partially process DWARF expressions in CFI_escape

Jens Remus jremus@linux.ibm.com
Wed Feb 5 16:31:28 GMT 2025


On 05.02.2025 00:10, Indu Bhagat wrote:

>   - Restructure functionality to accommodate the fact that a valid
>     unwind info may be split across multiple .cfi_escape. If this is the
>     case, the current implementation bails out.  Handling this case does
>     not appear to be worth the effort.

Is that worth to be mentioned in the commit message?  How is multiple
unwind info within one .cfi_escape handled?

> Fine tune the handling of CFI_escape for SFrame generation by explicitly
> checking for some "harmless" (in context of SFrame generation)
> CFI_escape DWARF expressions:
>    - DW_CFA_expression affecting registers of no significance to SFrame
>      stack trace info
>    - DW_CFA_value_offset affecting registers of no significance to SFrame
>      stack trace info

Thank you for including DW_CFA_value_offset, which may be beneficial
for s390.  I will give it a try.

> Also, add a common test with DWARF reg 12 which is non SP / FP on both
> x86_64 and aarch64.

DWARF register 12 is also non-SP/FP on s390. :-)

> diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c

> @@ -1121,7 +1121,8 @@ sframe_xlate_do_offset (struct sframe_xlate_ctx *xlate_ctx,
>   
>   static int
>   sframe_xlate_do_val_offset (struct sframe_xlate_ctx *xlate_ctx ATTRIBUTE_UNUSED,
> -			    struct cfi_insn_data *cfi_insn)
> +			    struct cfi_insn_data *cfi_insn,
> +			    bool cfi_escape_p)
>   {
>     /* Previous value of register is CFA + offset.  However, if the specified
>        register is not interesting (SP, FP, or RA reg), the current
> @@ -1134,7 +1135,8 @@ sframe_xlate_do_val_offset (struct sframe_xlate_ctx *xlate_ctx ATTRIBUTE_UNUSED,
>         /* Ignore SP reg, if offset matches assumed default rule.  */
>         || (cfi_insn->u.ri.reg == SFRAME_CFA_SP_REG && cfi_insn->u.ri.offset != 0))
>       {
> -      as_warn (_("skipping SFrame FDE; DW_CFA_val_offset with %s register %u"),
> +      as_warn (_("skipping SFrame FDE; %sDW_CFA_val_offset with %s reg %u"),
> +	       cfi_escape_p ? ".cfi_escape " : "",
>   	       sframe_register_name (cfi_insn->u.ri.reg), cfi_insn->u.ri.reg);

Why not drop or adjust your preceding patch and use the following,
as you touch the warning message anyway:

	as_warn (_("skipping SFrame FDE; %s with %s register %u"),
		cfi_escape_p ? ".cfi_escape DW_CFA_val_offset" : ".cfi_val_offset",
		...

>         return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented.  */
>       }
> @@ -1310,6 +1312,173 @@ sframe_xlate_do_gnu_window_save (struct sframe_xlate_ctx *xlate_ctx,
>     return SFRAME_XLATE_ERR_NOTREPRESENTED;  /* Not represented.  */
>   }

Thanks and regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the Binutils mailing list