[PATCH,V3] gas: sframe: partially process DWARF unwind info in CFI_escape
Jens Remus
jremus@linux.ibm.com
Thu Feb 20 17:25:51 GMT 2025
On 13.02.2025 02:14, Indu Bhagat wrote:
> CFI_escape is most commonly used to include DWARF expressions in the
> unwind information. One may also use CFI_escape to add OS-specific CFI
> opcodes. Up until now, SFrame generation process would skip generating
> SFrame FDE at the mere sight of a CFI_escape opcode.
>
> Fine tune the handling of CFI_escape for SFrame generation by explicitly
> checking for few "harmless" (in context of SFrame generation)
> CFI_escape DWARF info:
> - 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
I successfully tested the DW_CFA_value_offset handling on s390x. A build
of Glibc with SFrame no longer skips FDEs because of .cfi_escape.
> Expose the current cfi_escape_data structure in dw2gencfi.c to the
> relevant header file to allow SFrame generation APIs to use it too.
>
> Valid unwind info may be split across multiple .cfi_escape directives.
> Conversely, it is also allowed to simply put multiple DWARF expressions
> and/or operations in a single .cfi_escape directive. Handling all of
> these cases correctly will need parsing/processing that is not deemed
> worth the effort in context of SFrame generation; We continue to skip
> generating SFrame FDE for these cases and warn the user.
Thank fou you for the clarification in the commit message!
> In future, SFrame stack trace may support non-SP/FP as base register
> (albeit in limited form). Add an explicit check in
> sframe_xlate_do_escape_expr (to test against the current CFA register)
> to ensure the functionality continues to work.
>
> Use differentiated warning text in sframe_xlate_do_val_offset to avoid
> confusion to the user as the same function is used for handling
> .cfi_val_offset and .cfi_escape DW_CFA_val_offset,...
Nice!
> Also, add a common test with DWARF reg 12 which is non SP / FP on x86_64
> and aarch64 (and s390x too).
Works on s390x.
> gas/
> * gas/dw2gencfi.c (struct cfi_escape_data): Move from ...
> * gas/dw2gencfi.h (struct cfi_escape_data): ... to.
> * gas/gen-sframe.c (sframe_xlate_do_val_offset): Include string
> for .cfi_escape conditionally.
> (sframe_xlate_do_escape_expr): New definition.
> (sframe_xlate_do_escape_val_offset): Likewise.
> (sframe_xlate_do_cfi_escape): Likewise.
> (sframe_do_cfi_insn): Handle CFI_escape explicitly.
>
> gas/testsuite/
> * gas/cfi-sframe/cfi-sframe.exp: Add new tests.
> * gas/cfi-sframe/cfi-sframe-common-9.d: New test.
> * gas/cfi-sframe/cfi-sframe-common-9.s: New test.
> * gas/cfi-sframe/cfi-sframe-x86_64-empty-1.d: New test.
> * gas/cfi-sframe/cfi-sframe-x86_64-empty-1.s: New test.
> * gas/cfi-sframe/cfi-sframe-x86_64-empty-2.d: New test.
> * gas/cfi-sframe/cfi-sframe-x86_64-empty-2.s: New test.
>
> ---
Jan had some good points concerning your patch introducing some cases
where SFrame FDE is silently skipped without a warning message. It
would be great if there would be a message.
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